Pelzini

This is the code documentation for the Pelzini project

source of /viewer/controllers/tables_list.php

Displays a list of all of the tables used
  1. <?php
  2. /*
  3. Copyright 2008 Josh Heidenreich
  4.  
  5. This file is part of Pelzini.
  6.  
  7. Pelzini is free software: you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation, either version 3 of the License, or
  10. (at your option) any later version.
  11.  
  12. Pelzini is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with Pelzini. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20.  
  21. /**
  22.  * Displays a list of all of the tables used
  23.  *
  24.  * @package Viewer
  25.  * @author Josh Heidenreich
  26.  * @since 0.2
  27.  * @see viewer/table.php
  28.  * @tag i18n-done
  29.  **/
  30.  
  31. require_once 'functions.php';
  32.  
  33. $skin['page_name'] = str(STR_TABLE_LIST_TITLE);
  34. require_once 'head.php';
  35.  
  36.  
  37. echo '<h2>', str(STR_TABLE_LIST_TITLE), '</h2>';
  38.  
  39.  
  40. $q = "SELECT name
  41. FROM item_tables
  42. WHERE projectid = {$project['id']}
  43. GROUP BY name
  44. ORDER BY name";
  45. $res = db_query ($q);
  46.  
  47. if (db_num_rows ($res) > 0) {
  48. echo '<p>', str(STR_TABLE_LIST_INTRO), '</p>';
  49.  
  50. echo "<ul>";
  51. while ($row = db_fetch_assoc ($res)) {
  52. echo "<li><a href=\"table?name={$row['name']}\">{$row['name']}</a></li>";
  53. }
  54. echo "</ul>";
  55.  
  56.  
  57. } else {
  58. echo '<p>', str(STR_TABLE_LIST_NONE), '</p>';
  59. }
  60.  
  61.  
  62. require_once 'foot.php';
  63. ?>
  64.