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

Source for file Random.php

Documentation is available at Random.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: Random.php 286818 2009-08-04 21:38:24Z cweiske $
  20.  
  21. /**
  22.  * Fill randomly
  23.  *
  24.  * @author Ian Eure <ieure@php.net>
  25.  * @package HTML_Table_Matrix
  26.  * @since 1.0
  27.  */
  28.     var $map = array();
  29.  
  30.     /**
  31.      * Constructor
  32.      *
  33.      * @param Object $matrix Reference to the HTML_Table_Matrix instance we are
  34.      *                        filling data for.
  35.      * @param array $options Options for this Filler
  36.      * @return void 
  37.      */
  38.     function HTML_Table_Matrix_Filler_Random(&$matrix$options = false{
  39.         $this->setOptions($options);
  40.         $this->matrix = &$matrix;
  41.     }
  42.     
  43.     function _initMap()
  44.     {
  45.         $this->matrix->_calculateSize();
  46.         for ($row = 0; $row $this->matrix->_rows; $row++{
  47.             for ($col = 0; $col $this->matrix->_cols; $col++{
  48.                 $this->map[$row][$col= 1;
  49.             }
  50.         }
  51.     }
  52.  
  53.     /**
  54.      * Get the next cell.
  55.      *
  56.      * @param int $index Where we're at in the data-set
  57.      * @return array 1-dimensional array in the form of (row, col) containing the
  58.      *                coordinates to put the data for this loop iteration
  59.      */
  60.     function next($index{
  61.         
  62.         $this->_initMap();
  63.         print "rows: ".$this->matrix->_rows."<br/>\n";
  64.         print "cols: ".$this->matrix->_cols."<br/>\n";
  65.         print "unf: ".count($this->map[0]);
  66.  
  67.  
  68.         return array($this->row$this->col);
  69.     }
  70. }
  71. ?>

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