tripal_bulk_loader_template.tpl.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. $fields = array();
  3. $constants = array();
  4. foreach ($template->template_array as $priority => $table_array) {
  5. if (!is_array($table_array)) {
  6. continue;
  7. }
  8. $table = $table_array['table'];
  9. $record = $table_array['record_id'];
  10. foreach ($table_array['fields'] as $field) {
  11. if (preg_match('/table field/', $field['type'])) {
  12. $field['table'] = $table;
  13. $field['record'] = $record;
  14. $sheet = 0;//$field['spreadsheet sheet'];
  15. $column = $field['spreadsheet column'];
  16. $fields[$sheet.'-'.$column][] = $field;
  17. } elseif ($field['type'] == 'constant') {
  18. $field['table'] = $table;
  19. $field['record'] = $record;
  20. $constants[] = $field;
  21. }
  22. }
  23. }
  24. ?>
  25. <div id="tripal_bulk_loader-base-box" class="tripal_bulk_loader-info-box tripal-info-box">
  26. <div class="tripal_bulk_loader-info-box-title tripal-info-box-title">Template Description</div>
  27. <div class="tripal_bulk_loader-info-box-desc tripal-info-box-desc"></div>
  28. <?php if (sizeof($constants)) { ?>
  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 Data File</caption>
  31. <tr><th rowspan="2">Record Name</th><th rowspan="2">Field Name</th><th rowspan="2">Value</th><th colspan="2">Chado Database</th></tr>
  32. <tr><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['record'];?></td>
  37. <td><?php print $field['title'];?></td>
  38. <td><?php print $field['constant value']; ?></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. <?php } if (sizeof($fields)) { ?>
  46. <table id="tripal_bulk_loader-template_fields-table" class="tripal_bulk_loader-table tripal-table tripal-table-vert">
  47. <caption><b>Fields</b> -Below is a mapping between Data File columns and the Chado Database</caption>
  48. <tr><th rowspan="2">Record Name</th><th rowspan="2">Field Name</th><th rowspan="2">Data File Column</th><th colspan="2">Chado Datbase</th></tr>
  49. <tr><th>Table</th><th>Field</th></tr>
  50. <?php $row = 'even' ?>
  51. <?php foreach ($fields as $column) {?>
  52. <?php foreach ($column as $field) {?>
  53. <tr class="tripal_bulk_loader-table-<?php print $row; ?>-row tripal-table-<?php print $row; ?>-row">
  54. <td><?php print $field['record'];?></td>
  55. <td><?php print $field['title'];?></td>
  56. <td><?php print $field['spreadsheet column'];?></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. <?php } ?>
  64. </div>