You are here

function globallink_node_active_select_form in GlobalLink Connect for Drupal 7.5

Same name and namespace in other branches
  1. 7.6 globallink_active_submissions.inc \globallink_node_active_select_form()

Builds form to allow selection of specific GlobalLink submission by ID.

1 string reference to 'globallink_node_active_select_form'
globallink_dashboard_active_submissions_page in ./globallink_active_submissions.inc
Builds forms on GlobalLink active submissions dashboard.

File

./globallink_active_submissions.inc, line 27

Code

function globallink_node_active_select_form() {
  module_load_include('inc', 'globallink', 'globallink_node');
  $form = array();
  globallink_get_submission_status();
  $redirect_submission = isset($_GET['submission']) ? urldecode($_GET['submission']) : '';
  $selected_value = '';
  $options = globallink_get_distinct_active_submission_names();
  if (empty($redirect_submission) && !empty($_SESSION['globallink_selected_submission'])) {
    $selected_value = $_SESSION['globallink_selected_submission'];
  }
  elseif (!empty($redirect_submission)) {
    $selected_value = array_search($redirect_submission, $options);
  }
  $form['#attributes']['class'][] = 'globallink-node-select-submission-form';
  $form['select_submission'] = array(
    '#type' => 'container',
    '#attributes' => array(
      'class' => array(
        'container-inline',
      ),
    ),
  );
  $form['select_submission']['submission'] = array(
    '#type' => 'select',
    '#title' => t('Active Submission Name:'),
    '#options' => $options,
    '#default_value' => $selected_value,
    '#attributes' => array(
      'class' => array(
        'globallink-node-select-submission-edit',
      ),
    ),
    '#field_suffix' => '    ',
  );
  $form['select_submission']['go'] = array(
    '#type' => 'submit',
    '#value' => t('Go'),
    '#attributes' => array(
      'class' => array(
        'globallink-edit-submit-go',
      ),
    ),
  );
  if ($selected_value != '') {
    $form['select_submission']['submit_cancel_submission'] = array(
      '#type' => 'submit',
      '#value' => t('Cancel Submission'),
      '#attributes' => array(
        'class' => array(
          'globallink-edit-submit-cancel-submission',
        ),
      ),
    );
  }
  else {
    $form['select_submission']['br_markup'] = array(
      '#type' => 'markup',
      '#markup' => '<BR/><BR/>',
    );
  }
  return $form;
}