function tripal_jobs_report_form

2.x tripal_core.jobs.inc tripal_jobs_report_form($form, &$form_state = NULL)
3.x tripal.jobs.inc tripal_jobs_report_form($form, &$form_state = NULL)
1.x jobs.inc tripal_jobs_report_form($form, &$form_state = NULL)

NO LONGER USED: REPLACED BY VIEW

1 string reference to 'tripal_jobs_report_form'
tripal_jobs_report in tripal/includes/tripal.jobs.inc
Returns the Tripal Job Report

File

tripal/includes/tripal.jobs.inc, line 43
Contains functions related to the display of Tripal jobs in a Tripal website.

Code

function tripal_jobs_report_form($form, &$form_state = NULL) {
  $form = array();

  // set the default values
  $default_status = '';
  $default_job_name = '';
  if (array_key_exists('values', $form_state)) {
    $default_status = array_key_exists('job_status', $form_state['values']) ? $form_state['values']['job_status'] : '';
    $default_job_name = array_key_exists('job_name', $form_state['values']) ? $form_state['values']['job_name'] : '';
  }

  if (!$default_status and array_key_exists('tripal_job_filter', $_SESSION)) {
    $job_status = array_key_exists('job_status', $_SESSION['tripal_job_filter']) ? $_SESSION['tripal_job_filter']['job_status'] : '';
  }
  if (!$default_job_name and array_key_exists('tripal_job_filter', $_SESSION)) {
    $default_job_name = array_key_exists('job_name', $_SESSION['tripal_job_filter']) ? $_SESSION['tripal_job_filter']['job_name'] : '';
  }


  $form['job_status'] = array(
    '#type' => 'select',
    '#title' => t('Filter by Job Status'),
    '#default_value' => $default_status,
    '#options' => array(
      0 => 'All Jobs',
      'Running' => 'Running',
      'Waiting' => 'Waiting',
      'Completed' => 'Completed',
      'Cancelled' => 'Cancelled',
      'Error' => 'Error',
    ),
  );
  $form['job_name'] = array(
    '#type' => 'textfield',
    '#title' => t('Filter by Job Name'),
    '#description' => t('The jobs will be filtered if text provided is contained in the job name'),
    '#default_value' => $default_job_name,
  );

  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Filter'),
  );
  return $form;
}