SproutCMS

This is the code documentation for the SproutCMS project

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

  1. <?php
  2. use Sprout\Helpers\Csrf;
  3. use Sprout\Helpers\Enc;
  4. ?>
  5.  
  6. <div class="sqlresult">
  7. <table class="main-list main-list-no-js">
  8. <thead>
  9. <tr>
  10. <?php foreach ($columns as $column): ?>
  11. <th><?= Enc::html($column); ?></th>
  12. <?php endforeach; ?>
  13. </tr>
  14. </thead>
  15. <tbody>
  16. <?php foreach ($results as $row): ?>
  17. <tr>
  18. <?php foreach ($row as $val): ?>
  19. <td><?= $val === null ? '<i>null</i>' : Enc::html($val); ?></td>
  20. <?php endforeach; ?>
  21. </tr>
  22. <?php endforeach; ?>
  23. </tbody>
  24. </table>
  25. </div>
  26.  
  27. <?php if ($results->rowCount()): ?>
  28. <form action="SITE/dbtools/sqlcsv" method="post" target="_blank">
  29. <?= Csrf::token(); ?>
  30. <input type="hidden" name="sql" value="<?= Enc::html($results->queryString); ?>">
  31. <div class="action-bar">
  32. <button type="submit" class="button icon-after icon-save">Download CSV</button>
  33. </div>
  34. </form>
  35. <?php endif; ?>
  36.