tripal_bulk_loader_base.tpl.php

  1. 2.x tripal_bulk_loader/theme/templates/tripal_bulk_loader_base.tpl.php
  2. 3.x tripal_bulk_loader/theme/templates/tripal_bulk_loader_base.tpl.php
1 theme call to tripal_bulk_loader_base.tpl.php
tripal_bulk_loader_node_view in tripal_bulk_loader/includes/tripal_bulk_loader.chado_node.inc
Implements hook_node_view(). Acts on all content types.

File

tripal_bulk_loader/theme/templates/tripal_bulk_loader_base.tpl.php
View source
  1. <?php
  2. $node = $variables['node']; ?>
  3. <div class="tripal_bulk_loader-data-block-desc tripal-data-block-desc"></div> <?php
  4. // the $headers array is an array of fields to use as the colum headers.
  5. // additional documentation can be found here
  6. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  7. // This table for the analysis has a vertical header (down the first column)
  8. // so we do not provide headers here, but specify them in the $rows array below.
  9. $headers = array();
  10. // the $rows array contains an array of rows where each row is an array
  11. // of values for each column of the table in that row. Additional documentation
  12. // can be found here:
  13. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  14. $rows = array();
  15. // Name row
  16. $rows[] = array(
  17. array(
  18. 'data' => 'Job Name',
  19. 'header' => TRUE,
  20. 'width' => '20%',
  21. ),
  22. $node->loader_name
  23. );
  24. // Submitted By
  25. $rows[] = array(
  26. array(
  27. 'data' => 'Submitted By',
  28. 'header' => TRUE
  29. ),
  30. $node->uid
  31. );
  32. // Job Creation Date
  33. $rows[] = array(
  34. array(
  35. 'data' => 'Job Creation Date',
  36. 'header' => TRUE
  37. ),
  38. format_date($node->created, 'custom', "F j, Y, g:i a")
  39. );
  40. // Last Updated
  41. $rows[] = array(
  42. array(
  43. 'data' => 'Last Updated',
  44. 'header' => TRUE
  45. ),
  46. format_date($node->changed, 'custom', "F j, Y, g:i a")
  47. );
  48. // Template Name
  49. $rows[] = array(
  50. array(
  51. 'data' => 'Template Name',
  52. 'header' => TRUE
  53. ),
  54. $node->template->name
  55. );
  56. // Data File
  57. $rows[] = array(
  58. array(
  59. 'data' => 'Data File',
  60. 'header' => TRUE
  61. ),
  62. $node->file
  63. );
  64. // Job Status
  65. $rows[] = array(
  66. array(
  67. 'data' => 'Job Status',
  68. 'header' => TRUE
  69. ),
  70. $node->job_status
  71. );
  72. //Job Progress
  73. if (isset($node->job)) {
  74. if (isset($node->job->progress)) {
  75. $rows[] = array(
  76. array(
  77. 'data' => 'Job Progress',
  78. 'header' => TRUE
  79. ),
  80. $node->job->progress . '% (' . l('view job', 'admin/tripal/tripal_jobs/view/' . $node->job_id) . ')'
  81. );
  82. }
  83. }
  84. // the $table array contains the headers and rows array as well as other
  85. // options for controlling the display of the table. Additional
  86. // documentation can be found here:
  87. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  88. $table = array(
  89. 'header' => $headers,
  90. 'rows' => $rows,
  91. 'attributes' => array(
  92. 'id' => 'tripal_bulk_loader-table-base',
  93. 'class' => 'tripal-data-table'
  94. ),
  95. 'sticky' => FALSE,
  96. 'caption' => '',
  97. 'colgroups' => array(),
  98. 'empty' => '',
  99. );
  100. // once we have our table array structure defined, we call Drupal's theme_table()
  101. // function to generate the table.
  102. print theme_table($table);
  103. // add the "submit" button for adding a loading job to the Tripal jobs management system
  104. $form = drupal_get_form('tripal_bulk_loader_add_loader_job_form', $node);
  105. print drupal_render($form);
  106. // if we have inserted records then load the summary:
  107. if (!empty($node->inserted_records)) {
  108. print '<h3>Loading Summary</h3>';
  109. // the $headers array is an array of fields to use as the colum headers.
  110. // additional documentation can be found here
  111. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  112. $headers = array('Chado Table', 'Number of Records Inserted');
  113. // the $rows array contains an array of rows where each row is an array
  114. // of values for each column of the table in that row. Additional documentation
  115. // can be found here:
  116. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  117. $rows = array();
  118. $total = 0;
  119. foreach ($node->inserted_records as $r) {
  120. $row = array();
  121. $row[] = $r->table_inserted_into;
  122. $row[] = $r->num_inserted;
  123. $rows[] = $row;
  124. $total = $total + $r->num_inserted;
  125. }
  126. $rows[] = array('<b>TOTAL</b>','<b>'.$total.'</b>');
  127. // the $table array contains the headers and rows array as well as other
  128. // options for controlling the display of the table. Additional
  129. // documentation can be found here:
  130. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  131. $table = array(
  132. 'header' => $headers,
  133. 'rows' => $rows,
  134. 'attributes' => array(),
  135. 'sticky' => FALSE,
  136. 'caption' => '',
  137. 'colgroups' => array(),
  138. 'empty' => '',
  139. );
  140. // once we have our table array structure defined, we call Drupal's theme_table()
  141. // function to generate the table.
  142. print theme_table($table);
  143. } ?>
  144. <br> <?php
  145. // add the form for setting any constants values
  146. $form = drupal_get_form('tripal_bulk_loader_set_constants_form', $node);
  147. print drupal_render($form);
  148. // add in the constant details
  149. print theme('tripal_bulk_loader_template', array('template_id' => $node->template->template_id));