Source for file 04.php

Documentation is available at 04.php

  1. <?php
  2. /*
  3. * This file is part of Sylar.
  4. *
  5. * Sylar is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU Lesser General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * Sylar is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public License
  16. * along with Sylar. If not, see <http://www.gnu.org/licenses/>.
  17. *
  18. * @copyright Copyright Sylar Development Team
  19. * @license http://www.gnu.org/licenses/ GNU Public License V2.0
  20. * @see https://launchpad.net/sylar/
  21. * @see http://www.giano-solutions.com
  22. */
  23.  
  24. /**
  25. * Example Sylar File
  26. * Some files that shows how sylar works
  27. *
  28. * @package Sylar
  29. * @version 1.0
  30. * @since 02-2008
  31. * @author Gianluca Giusti [brdp] <g.giusti@giano-solutions.com>
  32. * @copyright Sylar Development Team
  33. */
  34.  
  35. #
  36. # Include the bas Application settings
  37. #
  38.  
  39. require_once 'config/appConfig.php';
  40. ?>
  41.  
  42. <html>
  43. <head>
  44.  
  45. </head>
  46.  
  47. <body>
  48. <p>Test DataContainer</p>
  49. <a href='05.php'>TEST Db to SimpleTable &raquo;</a><br><br>
  50. <textarea style='width: 100%; height: 500px;'>
  51. <?php
  52.  
  53. import('sylar.common.system.SylarUtils');
  54. import('sylar.common.system.Logger');
  55. import('sylar.common.data.SimpleTable');
  56. import('sylar.common.data.SimpleTableRow');
  57.  
  58.  
  59. try{
  60.  
  61. $simpleTb = new Sylar_SimpleTable("pippo");
  62. // Create table Header Container
  63. $simpleTbHd = new Sylar_SimpleTableHeader(3);
  64. // Adding Column header descriptions
  65. $col = new Sylar_SimpleTableHeaderColumn("event_id");
  66. $col->setColumnName("EVENT ID");
  67. $col->setColumnType("int");
  68. $col->setColumnDesc("the unique id of the event");
  69. $simpleTbHd->addColumn($col);
  70. $col = new Sylar_SimpleTableHeaderColumn("name");
  71. $col->setColumnName("Name");
  72. $col->setColumnType("string");
  73. $col->setColumnDesc("the name of the user");
  74. $simpleTbHd->addColumn($col);
  75. $col = new Sylar_SimpleTableHeaderColumn("permissions");
  76. $col->setColumnName("Permissions");
  77. $col->setColumnType("string");
  78. $col->setColumnDesc("the user's permissions");
  79. $simpleTbHd->addColumn($col);
  80.  
  81. $simpleTb->setColumnsHeader($simpleTbHd);
  82. for($i= 0; $i<10; $i++){
  83. $riga = new Sylar_SimpleTableRow( array($i, 'pippo_'.$i, '1,23,'.$i), 3);
  84. $simpleTb->addSimpleTableRow($riga);
  85. $appoA = $riga->getData();
  86. }
  87. echo "\nNew Simple Table created, name: ".$simpleTb->getTableTitle()." and Table Id: ".$simpleTb->getTableId();
  88. echo "\nTable Rows: ".$simpleTb->getRows();
  89. echo "\nRow: 7 Column 1: ".$simpleTb->getRow(7)->getColumnValue(1);
  90. echo "\nRow n.6 is: ".$simpleTb->getRow(7)->getData();
  91. echo "\nArray of row number 6: \n";
  92. print_r($simpleTb->getRow(6)->getData());
  93.  
  94. }catch (ExceptionInSylar $ex){
  95. echo "\n".$ex->getMessage();
  96. }
  97. echo "\n\n\n-----------------------";
  98. echo "\nSylar included Files:\n";
  99. Sylar_SylarUtils::showIncludedFiles();
  100. echo "\n\nSylar Defined Costants:\n";
  101. Sylar_SylarUtils::showDefinedCostant();
  102. ?>
  103. </textarea>
  104. </body>
  105. </html>

Documentation generated on Thu, 24 Apr 2008 16:14:12 +0200 by phpDocumentor 1.3.0RC3