Tripal Plant PopGen Submit
logs.php File Reference

Go to the source code of this file.

Functions

 tpps_admin_panel_logs (array $form, array &$form_state, $job_log_file=NULL)
 

Function Documentation

◆ tpps_admin_panel_logs()

tpps_admin_panel_logs ( array  $form,
array &  $form_state,
  $job_log_file = NULL 
)

Creates the administrative panel form.

If the administrator is looking at one specific TPPS submission, they are provided with options to reject the submission and leave a reason for the rejection, or to approve the submission and start loading the data into the database. If the submission includes CartograPlant layers with environmental parameters, the administrator will need to select the kind of parameter the user has selected - an attr_id, or a cvterm. This will be important when the submission is recording the environmental data of the plants.

Parameters
array$formThe form being created.
array$form_stateThe state of the form being created.
Returns
array The administrative panel logs form.

Definition at line 21 of file logs.php.

21  {
22  // if (empty($accession)) {
23  // tpps_admin_panel_top($form);
24  // }
25  // else {
26  // tpps_manage_submission_form($form, $form_state, $accession);
27  // }
28 
29  drupal_add_js(drupal_get_path('module', 'tpps') . TPPS_JS_PATH);
30  drupal_add_css(drupal_get_path('module', 'tpps') . TPPS_CSS_PATH);
31 
32  $job_log_file_parts = explode('_', $job_log_file);
33  $accession = $job_log_file_parts[0];
34  $job_id = $job_log_file_parts[1];
35  $job_log_file = $job_log_file . '.txt';
36 
37  $markup = "";
38  $markup .= "<a href='/tpps-admin-panel/$accession'>Return to TPPS Admin Panel - $accession</a><br />";
39  $markup .= "<a target='_blank' href='/admin/tripal/tripal_jobs/view/$job_id'>View Tripal Job ID: $job_id</a><br />";
40  $markup .= "This page refreshes every 10 seconds.<br />";
41  $markup .= "<iframe id='iframe_log' height='400px;' width='100%' src='/sites/default/files/tpps_job_logs/" . $job_log_file . "'></iframe>";
42  $markup .= '<script type="text/javascript">';
43  $markup .= "jQuery(document).ready(function() {";
44  $markup .= " setInterval(function() {";
45  $markup .= " var url='/sites/default/files/tpps_job_logs/$job_log_file';";
46  $markup .= " var nocache=Math.floor(Date.now() / 1000);";
47  $markup .= " jQuery('#iframe_log').attr('src', url + '?nocache=' + nocache);";
48  $markup .= " }, 10000);";
49  $markup .= " jQuery('#iframe_log').on('load', function() {";
50  // $markup .= " console.log('iframe reloaded'); console.log(jQuery('#iframe_log').height());";
51  $markup .= " jQuery('#iframe_log').contents().scrollTop(jQuery('#iframe_log').contents().height());";
52  $markup .= " });";
53  $markup .= "});";
54  $markup .= '</script>';
55 
56  $form['markup'] = array(
57  '#type' => 'markup',
58  '#markup' => $markup
59  );
60 
61  return $form;
62 }
const TPPS_CSS_PATH
Definition: tpps.module:11
const TPPS_JS_PATH
Definition: tpps.module:10