home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / CMCD0404.ISO / Software / Freeware / Programare / groupoffice-com-2.01 / modules / daogen / index.php < prev    next >
PHP Script  |  2004-03-08  |  3KB  |  151 lines

  1. <?php
  2. /*
  3. Copyright T & M Web Enterprises 2003
  4. Author: Mike Hostetler <mike@tm-web.com>
  5. Version: 1.0 Release date: 01 November 2003
  6.  
  7. This program is free software; you can redistribute it and/or modify it
  8. under the terms of the GNU General Public License as published by the
  9. Free Software Foundation; either version 2 of the License, or (at your
  10. option) any later version.
  11. */
  12.  
  13. /**
  14.  *
  15.  *@NAME:        index
  16.  *@PURPOSE:        To show the index page
  17.  *@REMARKS:     This serves as the default action for the entire module
  18.  *
  19.  */
  20.  
  21. echo '<div style="padding: 10px">';
  22.  
  23. $tabtable = new tabtable('gen_type', 'DAO Generator', '600', '400');
  24.  
  25. $tabtable->add_tab('new', 'New DAO');
  26. $tabtable->add_tab('sql', 'SQL Based');
  27. $tabtable->add_tab('base', 'Base Classes');
  28. //$tabtable->add_tab('xul', 'XUL Interface (experimental)');
  29.  
  30. $tabtable->print_head();
  31. switch($tabtable->get_active_tab_id())
  32. {
  33.         case 'new':
  34.                 newDaoForm();
  35.         break;
  36.         case 'sql':
  37.                 sqlDaoForm();
  38.         break;
  39.         case 'base':
  40.                 include('base.inc');
  41.         break;
  42.         /*
  43.         case 'xul':
  44.                 showXulLauncher();
  45.         break;
  46.         */
  47. }
  48. $tabtable->print_foot();
  49. echo '</div>';
  50.  
  51. function showXulLauncher() {
  52.     echo "XUL is an XML based language that is used by Mozilla to render it's user interface.  If you have a Mozilla browser, or a derivative of a mozilla browser, you will be able to view this experimental code";
  53. }
  54. function newDaoForm() {
  55. ?>
  56.  
  57. <div align="center">
  58. <br>
  59. <br>
  60.  
  61. <h1>Data Access Object Generator</h1>
  62.  
  63. <form action="fieldOptions.php" method="post">
  64.   <table>
  65.     <tr>
  66.       <td colspan="2" align="left">
  67.         <br>
  68.         <br>
  69.         <font face="Verdana" size="2"><b>1. Select Basic Generator Options</b></font>
  70.         <hr>
  71.       </td>
  72.     </tr>
  73.  
  74.     <tr>
  75.       <td><b>Database Table Name:</b></td>
  76.  
  77.       <td><input type="text" name="tablename" value="" size="20"> <em>(no spaces)</em></td>
  78.     </tr>
  79.  
  80.     <tr>
  81.       <td>Class Name (optional):</td>
  82.  
  83.       <td><input type="text" name="classname" value="" size="20"> <em>(no spaces)</em></td>
  84.     </tr>
  85.  
  86.     <tr>
  87.       <td><b>Total number of Columns</b>:</td>
  88.  
  89.       <td><input type="text" name="col_num" value="2" size="4"></td>
  90.     </tr>
  91.  
  92.     <tr>
  93.       <td><b>Primarykey Columns</b> :</td>
  94.  
  95.       <td><input type="text" name="pk_num" value="1" size="4"></td>
  96.     </tr>
  97.  
  98.     <tr>
  99.       <td colspan="2" align="center">
  100.         <hr>
  101.         <input type="submit" name="continue" value="Continue">
  102.       </td>
  103.     </tr>
  104.   </table>
  105. </form>
  106. </div><?php
  107. }
  108.  
  109. function sqlDaoForm() {
  110.     $db = new db();
  111.     $tables = $db->table_names();
  112.     //debug($tables);
  113.     $s = '<select name="tablename">';
  114.     foreach($tables as $v) {
  115.         $s .= '<option name="'.$v['table_name'].'">'.$v['table_name'].'</option>';
  116.     }
  117.     $s .= '</select>';
  118.     ?>
  119. <div align="center">
  120. <br>
  121. <br>
  122.  
  123. <h1>Data Access Object Generator</h1>
  124.  
  125. <form action="sqlGenerateCode.php" method="post">
  126.   <table>
  127.     <tr>
  128.       <td><b>Database Table:</b></td>
  129.  
  130.       <td><?php echo $s;?></td>
  131.     </tr>
  132.  
  133.     <tr>
  134.       <td>Class Name (optional):</td>
  135.  
  136.       <td><input type="text" name="classname" value="" size="20"> <em>(no spaces)</em></td>
  137.     </tr>
  138.  
  139.     <tr>
  140.       <td colspan="2" align="center">
  141.         <hr>
  142.         <input type="submit" name="continue" value="Continue">
  143.       </td>
  144.     </tr>
  145.   </table>
  146. </form>
  147. </div>
  148.     <?php
  149. }
  150. ?>
  151.