SproutCMS

This is the code documentation for the SproutCMS project

source of /sprout/views/dbtools/db_struct.php

  1. <?php
  2. use Sprout\Helpers\Enc;
  3. use Sprout\Helpers\Form;
  4. use Sprout\Helpers\Html;
  5.  
  6. Form::setData($_GET);
  7. ?>
  8.  
  9. <form action="" method="get" class="field-group-wrap -clearfix">
  10.  
  11. <div class="field-group-item col col--one-half">
  12. <?php
  13. Form::nextFieldDetails('Search', true);
  14. echo Form::text('search');
  15. ?>
  16. </div>
  17.  
  18. <div class="field-group-item col col--one-half" style="margin-top: 2em;">
  19. <button class="button icon-before icon-search" type="submit">Search</button>
  20. </div>
  21.  
  22. </form>
  23.  
  24. <h3><?= empty($_GET['search']) ? 'All' : 'Matching' ; ?> tables</h3>
  25.  
  26. <table class="main-list main-list-no-js">
  27. <thead>
  28. <tr>
  29. <?php foreach ($headings as $heading): ?>
  30. <th><?= Enc::html($heading); ?></th>
  31. <?php endforeach; ?>
  32. </tr>
  33. </thead>
  34. <tbody>
  35. <?php foreach ($results as $row): ?>
  36. <tr>
  37. <?php foreach ($row as $name => $val): ?>
  38. <td>
  39. <?php
  40. if ($name == 'Name'):
  41. $val = empty($val) ? '&nbsp;' : $val;
  42. $suf = !empty($_GET['search']) ? '&search=' . $_GET['search'] : '';
  43. echo Html::anchor('dbtools/struct/'.$val.$suf, $val);
  44. else:
  45. echo Enc::html($val);
  46. endif;
  47. ?>
  48. </td>
  49. <?php endforeach; ?>
  50. </tr>
  51. <?php endforeach; ?>
  52. </tbody>
  53. </table>
  54.