You are here

function globallink_menu_dashboard_form_submit in GlobalLink Connect for Drupal 7.6

Same name and namespace in other branches
  1. 7.7 globallink_menu/globallink_menu_send.inc \globallink_menu_dashboard_form_submit()
  2. 7.5 globallink_menu/globallink_menu_send.inc \globallink_menu_dashboard_form_submit()

Handles menu form submission.

File

globallink_menu/globallink_menu_send.inc, line 677

Code

function globallink_menu_dashboard_form_submit($form, &$form_state) {
  $op = isset($form_state['values']['op']) ? $form_state['values']['op'] : '';
  $submission_details = array();
  if ($op != t('Send for Translation')) {
    return;
  }
  try {
    $pd4 = globallink_get_project_director_details();
    $mlids = array_filter($form_state['values']['table']);
    $submission_name = $form_state['values']['submission_name'];
    $source_locale = $form_state['values']['submission_source_locale'];
    $target_locale_arr = $form_state['values']['submission_target_locale'];
    $submission_details['instructions'] = $form_state['values']['submission_instructions'];
    $submission_details['submitter'] = $form_state['values']['submission_submitter'];
    $submission_priority = $form_state['values']['submission_pd_priority'];
    foreach ($target_locale_arr as $key => $target) {
      if ($target == FALSE) {
        unset($target_locale_arr[$key]);
      }
    }
    $due_date = globallink_convert_date_to_timestamp($form_state['values']['submission_due_date']);
    $project_code = $form_state['values']['submission_pd_project'];
    $updated_globalLink_arr = globallink_menu_send_for_translations($mlids, $pd4, $submission_name, $due_date, $project_code, $source_locale, $target_locale_arr, $submission_details, $submission_priority);
    if (count($updated_globalLink_arr) > 0) {
      globallink_menu_update_ticket_id($updated_globalLink_arr, $project_code);
      drupal_set_message(t('Content has been successfully sent for translations.'));
    }
  } catch (Exception $ex) {
    form_set_error('', t('Error: @message', array(
      '@message' => $ex
        ->getMessage(),
    )));
  }
}