Bläddra i källkod

Improved Job API

Stephen Ficklin 8 år sedan
förälder
incheckning
7573ad21c5
2 ändrade filer med 10 tillägg och 2 borttagningar
  1. 9 1
      tripal_core/api/tripal_core.jobs.api.inc
  2. 1 1
      tripal_core/includes/tripal_core.toc.inc

+ 9 - 1
tripal_core/api/tripal_core.jobs.api.inc

@@ -144,15 +144,23 @@ function tripal_add_job($job_name, $modulename, $callback, $arguments, $uid, $pr
  *   The unique identifier of the job
  *
  * @return
- *   An object describing the job
+ *   An object describing the job if a job is found or FALSE on failure.
  *
  * @ingroup tripal_jobs_api
  */
 function tripal_get_job($job_id) {
+  if (!$job_id or !is_numeric($job_id)) {
+    watchdog('tripal', "Must provide a numeric \$job_id to the tripal_cancel_job() function.");
+    return FALSE;
+  }
 
   $job = db_query('SELECT j.* FROM {tripal_jobs} j WHERE j.job_id=:job_id', array(':job_id' => $job_id))
     ->fetchObject();
 
+  $job->submit_date_string = format_date($job->submit_date);
+  $job->start_time_string = format_date($job->start_time);
+  $job->end_time_string = format_date($job->end_time);
+
   return $job;
 }
 

+ 1 - 1
tripal_core/includes/tripal_core.toc.inc

@@ -305,7 +305,6 @@ function tripal_core_node_view_build_toc(&$build) {
         continue;
       }
 
-
       // For backwards compatibility we will handle the content type fields
       // named 'field_resource_blocks', 'field_resource_titles', and
       // 'field_resource_links' these fields can be added on the Drupal content
@@ -484,6 +483,7 @@ function tripal_core_node_view_build_toc(&$build) {
       $toc_item_title = $overrides['title'] ? $overrides['title'] : $toc_item_title;
       $weight = $overrides['weight'] ? $overrides['weight'] : $weight;
       $hide = $overrides['hide'] ? $overrides['hide'] : $hide;
+      dpm($toc_item_title);
       $toc_item_link = "<div class=\"tripal_toc_list_item\"><a id=\"$toc_item_id\" class=\"tripal_toc_list_item_link\" href=\"?pane=$toc_item_id\">$toc_item_title</a></div>";