You are here

function globallink_node_active_select_form_submit in GlobalLink Connect for Drupal 7.6

Same name and namespace in other branches
  1. 7.5 globallink_active_submissions.inc \globallink_node_active_select_form_submit()

Handles submission of active select form.

File

./globallink_active_submissions.inc, line 99

Code

function globallink_node_active_select_form_submit($form, &$form_state) {
  if (isset($_GET['submission'])) {
    unset($_GET['submission']);
  }
  $op = isset($form_state['values']['op']) ? $form_state['values']['op'] : '';
  $pd4 = globallink_get_project_director_details();
  switch ($op) {
    case t('Cancel Submission'):
      try {
        $selected_submission = $form_state['values']['submission'];
        $_SESSION['globallink_selected_submission'] = '';
        globallink_cancel_submission($selected_submission, $pd4);
        $_SESSION['globallink_globalLink_arr'] = array();
        drupal_set_message(t('Submission has been cancelled successfully.'));
      } catch (SoapFault $se) {
        watchdog('GlobalLink', 'SOAP Exception - %function - Code[%faultcode], Message[%faultstring]', array(
          '%function' => __FUNCTION__,
          '%faultcode' => $se->faultcode,
          '%faultstring' => $se->faultstring,
        ), WATCHDOG_ERROR);
        form_set_error('', t('Web Services Error: @faultcode - @faultstring', array(
          '@faultcode' => $se->faultcode,
          '@faultstring' => $se->faultstring,
        )));
      } catch (Exception $e) {
        watchdog('GlobalLink', 'Exception - %function - File[%file], Line[%line], Code[%code], Message[%message]', array(
          '%function' => __FUNCTION__,
          '%file' => $e
            ->getFile(),
          '%line' => $e
            ->getLine(),
          '%code' => $e
            ->getCode(),
          '%message' => $e
            ->getMessage(),
        ), WATCHDOG_ERROR);
        form_set_error('', t('Error: @message', array(
          '@message' => $e
            ->getMessage(),
        )));
      }
      break;
    case t('Go'):
      $_SESSION['globallink_selected_submission'] = $form_state['values']['submission'];
      break;
  }
}