function tripal_bulk_loader_admin_jobs

1.x tripal_bulk_loader.admin.inc tripal_bulk_loader_admin_jobs()

Provides a listing of bulk loader jobs and links for administration

Related topics

1 string reference to 'tripal_bulk_loader_admin_jobs'
tripal_bulk_loader_menu in tripal_bulk_loader/tripal_bulk_loader.module
Implements hook_menu

File

tripal_bulk_loader/includes/tripal_bulk_loader.admin.inc, line 58
Bulk Loader Administration (Miscellaneous)

Code

function tripal_bulk_loader_admin_jobs() {
  $output = '';
  $num_jobs_per_page = 50;

  $output .= '<p>' . t('Jobs are not automatically submitted to the tripal jobs management
  system when they are first created. Any jobs listed below with a status of "Initialized"
  will not have a Job ID until you go to the bulk loader page and submit the job.') . '</p>';

  $header = array(
    array('data' => 'Job ID', 'field' => 'job_id', 'sort' => 'DESC'),
    array('data' => 'Name', 'field' => 'loader_name'),
    array('data' => 'Template', 'field' => 'template_name'),
    array('data' => 'Status', 'field' => 'job_status'),
    array('data' => 'Progress', 'field' => 'progress'),
    '');
  $rows = array();
  $resource = pager_query("SELECT n.*, t.name as template_name, j.progress
    FROM {tripal_bulk_loader} n
    LEFT JOIN {tripal_bulk_loader_template} t ON cast(n.template_id as integer) = t.template_id
    LEFT JOIN {tripal_jobs} j ON n.job_id = j.job_id"
    . tablesort_sql($header), 
  $num_jobs_per_page);
  while ($n = db_fetch_object($resource)) {
    $rows[] = array(
      l($n->job_id, 'admin/tripal/tripal_jobs/view/' . $n->job_id),
      l($n->loader_name, 'node/' . $n->nid),
      l($n->template_name, 'admin/tripal/tripal_bulk_loader_template/manage_templates/edit', array('query' => 'template_id=' . $n->template_id)),
      $n->job_status,
      ($n->progress) ? $n->progress . '%' : '',
      l('View', 'node/' . $n->nid) . ' | ' . l('Edit', 'node/' . $n->nid . '/edit')
    );
  }
  $output .= theme_table($header, $rows);

  $output .= theme('pager');

  return $output;
}