tripal_feature_analyses.tpl.php

  1. 2.x tripal_feature/theme/templates/tripal_feature_analyses.tpl.php
  2. 3.x legacy/tripal_feature/theme/templates/tripal_feature_analyses.tpl.php
1 theme call to tripal_feature_analyses.tpl.php
tripal_feature_node_view in legacy/tripal_feature/includes/tripal_feature.chado_node.inc
Implements hook_node_view(). Acts on all content types.

File

legacy/tripal_feature/theme/templates/tripal_feature_analyses.tpl.php
View source
  1. <?php
  2. $feature = $variables['node']->feature;
  3. $options = array('return_array' => 1);
  4. $feature = chado_expand_var($feature, 'table', 'analysisfeature', $options);
  5. $analyses = $feature->analysisfeature;
  6. // don't show this page if there are no analyses
  7. if (count($analyses) > 0) { ?>
  8. <div class="tripal_feature-data-block-desc tripal-data-block-desc">This <?php print $feature->type_id->name ?> is derived from or has results from the following analyses</div> <?php
  9. // the $headers array is an array of fields to use as the colum headers.
  10. // additional documentation can be found here
  11. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  12. $headers = array('Analysis Name' ,'Date Performed');
  13. // the $rows array contains an array of rows where each row is an array
  14. // of values for each column of the table in that row. Additional documentation
  15. // can be found here:
  16. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  17. $rows = array();
  18. foreach ($analyses as $analysis) {
  19. $analysis_name = $analysis->analysis_id->name;
  20. if (property_exists($analysis->analysis_id, 'nid')) {
  21. $analysis_name = l($analysis_name, "node/" . $analysis->analysis_id->nid);
  22. }
  23. $rows[] = array(
  24. $analysis_name,
  25. preg_replace('/\d\d:\d\d:\d\d/', '', $analysis->analysis_id->timeexecuted),
  26. );
  27. }
  28. // the $table array contains the headers and rows array as well as other
  29. // options for controlling the display of the table. Additional
  30. // documentation can be found here:
  31. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  32. $table = array(
  33. 'header' => $headers,
  34. 'rows' => $rows,
  35. 'attributes' => array(
  36. 'id' => 'tripal_feature-table-analyses',
  37. 'class' => 'tripal-data-table'
  38. ),
  39. 'sticky' => FALSE,
  40. 'caption' => '',
  41. 'colgroups' => array(),
  42. 'empty' => '',
  43. );
  44. // once we have our table array structure defined, we call Drupal's theme_table()
  45. // function to generate the table.
  46. print theme_table($table);
  47. }