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,v 1.1.1.1 2004/04/19 23:47:14 ieure Exp $
  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.         srand(microtime());
  42.     }
  43.     
  44.     function _initMap()
  45.     {
  46.         $this->matrix->_calculateSize();
  47.         for ($row = 0; $row $this->matrix->_rows; $row++{
  48.             for ($col = 0; $col $this->matrix->_cols; $col++{
  49.                 $this->map[$row][$col= 1;
  50.             }
  51.         }
  52.     }
  53.  
  54.     /**
  55.      * Get the next cell.
  56.      *
  57.      * @param int $index Where we're at in the data-set
  58.      * @return array 1-dimensional array in the form of (row, col) containing the
  59.      *                coordinates to put the data for this loop iteration
  60.      */
  61.     function next($index{
  62.         
  63.         $this->_initMap();
  64.         print "rows: ".$this->matrix->_rows."<br/>\n";
  65.         print "cols: ".$this->matrix->_cols."<br/>\n";
  66.         print "unf: ".count($this->map[0]);
  67.  
  68.  
  69.         return array($this->row$this->col);
  70.     }
  71. }
  72. ?>

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