HTML_Table_Matrix
[ class tree: HTML_Table_Matrix ] [ index: HTML_Table_Matrix ] [ all elements ]

Source for file HTML_Table_Matrix_example.php

Documentation is available at HTML_Table_Matrix_example.php

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4: */
  3. // +----------------------------------------------------------------------+
  4. // | PHP version 4                                                        |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 1997-2002 The PHP Group                                |
  7. // +----------------------------------------------------------------------+
  8. // | This source file is subject to version 3.0 of the PHP license,       |
  9. // | that is bundled with this package in the file LICENSE, and is        |
  10. // | available at through the world-wide-web at                           |
  11. // | http://www.php.net/license/3_0.txt.                                  |
  12. // | If you did not receive a copy of the PHP license and are unable to   |
  13. // | obtain it through the world-wide-web, please send a note to          |
  14. // | license@php.net so we can mail you a copy immediately.               |
  15. // +----------------------------------------------------------------------+
  16. // | Authors: Ian Eure <ieure@php.net>                                    |
  17. // +----------------------------------------------------------------------+
  18. //
  19. // $Id: HTML_Table_Matrix_example.php 195730 2005-09-10 18:59:48Z ieure $
  20.  
  21. require_once 'PEAR.php';
  22. require_once 'HTML/QuickForm.php';
  23. require_once 'Numbers/Words.php';
  24. require_once 'HTML/Table/Matrix.php';
  25.  
  26. $m = new HTML_Table_Matrix(array('border' => 1));
  27. for($i = 5; $i <= 20; $i +=5{
  28.     $nSel[$i$i;
  29. }
  30. $nSel[100= 100;
  31.  
  32. for($i = 0; $i <= 20; $i ++{
  33.     $sel[$i$i;
  34. }
  35.  
  36. $fm = array(
  37.     'RLTB'  => 'Right to left, top to bottom',
  38.     'RLBT'  => 'Right to left, bottom to top',
  39.     'LRTB'  => 'Left to right, top to bottom',
  40.     'LRBT'  => 'Left to right, bottom to top',
  41.     'TBLR'  => 'Top to bottom, left to right',
  42.     'TBRL'  => 'Top to bottom, right to left',
  43.     'BTLR'  => 'Bottom to top, left to right',
  44.     'BTRL'  => 'Bottom to top, right to left',
  45.     'InC'   => 'Inwards, clockwise',
  46.     'InCC'  => 'Inwards, counter-clockwise',
  47.     'OutC'  => 'Outwards, clockwise',
  48.     'OutCC' => 'Outwards, counter-clockwise'
  49. );
  50.  
  51. $def['number'= 5;
  52. $def['cols'= 5;
  53.  
  54.  
  55. $form = new HTML_QuickForm('formMatrixExample');
  56. if($_POST{
  57.     $form->setDefaults($_POST);
  58. else {
  59.     $form->setDefaults($def);
  60. }
  61.  
  62.  
  63. $form->addElement('header'''"HTML_Table_Matrix Example");
  64. $form->addElement('select''number'"Number of items"$nSel);
  65. $form->addElement('select''cols'"Columns"$sel);
  66. $form->addElement('select''rows'"Rows"$sel);
  67. $form->addElement('select''startcol'"X Offset"$sel);
  68. $form->addElement('select''startrow'"Y Offset"$sel);
  69. $form->addElement('select''fillmode'"Fill"$fm);
  70. $form->addElement('submit'"Submit");
  71.  
  72. $form->display();
  73.  
  74. if($_POST{
  75.     echo "<br><hr>";
  76.     $nw = new Numbers_Words;
  77.     for($i = 1; $i <= $_POST['number']$i++{
  78.         $data[$nw->toWords($i);
  79.     }
  80.  
  81.     $m->setData($data);
  82.     $m->setTableSize($_POST['rows']$_POST['cols']);
  83.     $m->setFillStart($_POST['startrow']$_POST['startcol']);
  84.     $f HTML_Table_Matrix_Filler::factory($_POST['fillmode']$m);
  85.     $m->accept($f);
  86.     print $m->toHtml();
  87.  
  88. }
  89.  
  90. ?>

Documentation generated on Mon, 11 Mar 2019 15:32:39 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.