tripal_bulk_loader_template.tpl.php 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. //dpm($template->template_array, 'Template Array (tpl)');
  3. $fields = array();
  4. $constants = array();
  5. foreach ($template->template_array as $table => $table_groups) {
  6. if (!is_array($table_groups)) {
  7. continue;
  8. }
  9. foreach ($table_groups as $group => $table_array) {
  10. foreach ($table_array['field'] as $field) {
  11. if (preg_match('/table field/', $field['type'])) {
  12. $field['table'] = $table;
  13. $field['group'] = $group;
  14. $sheet = $field['spreadsheet sheet'];
  15. $column = $field['spreadsheet column'];
  16. $fields[$sheet.'-'.$column][] = $field;
  17. } elseif ($field['type'] == 'constant') {
  18. $field['table'] = $table;
  19. $field['group'] = $group;
  20. $constants[] = $field;
  21. }
  22. }
  23. }
  24. }
  25. ?>
  26. <div id="tripal_bulk_loader-base-box" class="tripal_bulk_loader-info-box tripal-info-box">
  27. <div class="tripal_bulk_loader-info-box-title tripal-info-box-title">Template Description</div>
  28. <div class="tripal_bulk_loader-info-box-desc tripal-info-box-desc"></div>
  29. <table id="tripal_bulk_loader-template_constant-table" class="tripal_bulk_loader-table tripal-table tripal-table-vert">
  30. <caption><b>Constants</b> -These values are applied to all records in the Spreadsheet</caption>
  31. <tr><th rowspan="2">Field Name</th><th rowspan="2">Value</th><th colspan="3">Chado Database</th></tr>
  32. <tr><th>Group</th><th>Table</th><th>Field</th></tr>
  33. <?php $row = 'even' ?>
  34. <?php foreach ($constants as $field) {?>
  35. <tr class="tripal_bulk_loader-table-<?php print $row; ?>-row tripal-table-<?php print $row; ?>-row">
  36. <td><?php print $field['title'];?></td>
  37. <td><?php print $field['constant value']; ?></td>
  38. <td><?php print $field['group'];?></td>
  39. <td><?php print $field['table'];?></td>
  40. <td><?php print $field['field'];?></td>
  41. </tr>
  42. <?php $row = ($row == 'odd') ? 'even':'odd' ; ?>
  43. <?php } ?>
  44. </table>
  45. <table id="tripal_bulk_loader-template_fields-table" class="tripal_bulk_loader-table tripal-table tripal-table-vert">
  46. <caption><b>Fields</b> -Below is a mapping between Spreadsheet columns and the Chado Database</caption>
  47. <tr><th rowspan="2">Field Name</th><th colspan="2">Spreadsheet</th><th colspan="3">Chado Datbase</th></tr>
  48. <tr><th>Worksheet</th><th>Column</th><th>Group</th><th>Table</th><th>Field</th></tr>
  49. <?php $row = 'even' ?>
  50. <?php foreach ($fields as $column) {?>
  51. <?php foreach ($column as $field) {?>
  52. <tr class="tripal_bulk_loader-table-<?php print $row; ?>-row tripal-table-<?php print $row; ?>-row">
  53. <td><?php print $field['title'];?></td>
  54. <td><?php print $field['spreadsheet sheet']; ?></td>
  55. <td><?php print $field['spreadsheet column'];?></td>
  56. <td><?php print $field['group'];?></td>
  57. <td><?php print $field['table'];?></td>
  58. <td><?php print $field['field'];?></td>
  59. <tr>
  60. <?php $row = ($row == 'odd') ? 'even':'odd' ; ?>
  61. <?php }} ?>
  62. </table>
  63. </div>