tripal_bulk_loader_template.tpl.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. //dpm($template->template_array, 'Template Array (tpl)');
  3. $fields = array();
  4. $constants = array();
  5. foreach ($template->template_array as $table => $table_array) {
  6. if (!is_array($table_array)) {
  7. continue;
  8. }
  9. foreach ($table_array['field'] as $field) {
  10. if (preg_match('/table field/', $field['type'])) {
  11. $field['table'] = $table;
  12. $sheet = $field['spreadsheet sheet'];
  13. $column = $field['spreadsheet column'];
  14. $fields[$sheet.'-'.$column][] = $field;
  15. } elseif ($field['type'] == 'constant') {
  16. $field['table'] = $table;
  17. $constants[] = $field;
  18. }
  19. }
  20. }
  21. ?>
  22. <table>
  23. <caption><b>Constants</b> -These values are applied to all records in the Spreadsheet</caption>
  24. <tr><th rowspan="2">Field Name</th><th rowspan="2">Value</th><th colspan="2">Chado Database</th></tr>
  25. <tr><th>Table</th><th>Field</th></tr>
  26. <?php foreach ($constants as $field) {?>
  27. <td><?php print $field['title'];?></td>
  28. <td><?php print $field['constant value']; ?></td>
  29. <td><?php print $field['table'];?></td>
  30. <td><?php print $field['field'];?></td>
  31. <?php } ?>
  32. </table>
  33. <table>
  34. <caption><b>Fields</b> -Below is a mapping between Spreadsheet columns and the Chado Database</caption>
  35. <tr><th rowspan="2">Field Name</th><th colspan="2">Spreadsheet</th><th colspan="2">Chado Datbase</th></tr>
  36. <tr><th>Worksheet</th><th>Column</th><th>Table</th><th>Field</th></tr>
  37. <?php foreach ($fields as $column) {?>
  38. <?php foreach ($column as $field) {?>
  39. <tr>
  40. <td><?php print $field['title'];?></td>
  41. <td><?php print $field['spreadsheet sheet']; ?></td>
  42. <td><?php print $field['spreadsheet column'];?></td>
  43. <td><?php print $field['table'];?></td>
  44. <td><?php print $field['field'];?></td>
  45. <tr>
  46. <?php }} ?>
  47. </table>