home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / php / PEAR / HTML / Table / Matrix / Filler / LRBT.php < prev    next >
Encoding:
PHP Script  |  2008-07-02  |  1.3 KB  |  48 lines

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4: */
  3. require_once 'HTML/Table/Matrix/Filler.php';
  4.  
  5. /**
  6.  * Fill left-to-right, bottom-to-top.
  7.  *
  8.  * @author Arpad Ray <arpad@rajeczy.com>
  9.  * @package HTML_Table_Matrix
  10.  */
  11. class HTML_Table_Matrix_Filler_LRBT extends HTML_Table_Matrix_Filler {
  12.     /**
  13.      * Constructor
  14.      *
  15.      * @param Object $matrix Reference to the HTML_Table_Matrix instance we are
  16.      *                       filling data for.
  17.      * @param array $options Options for this Filler
  18.      * @return void
  19.      */
  20.     function HTML_Table_Matrix_Filler_LRBT(&$matrix, $options = false) {
  21.         $this->setOptions($options);
  22.         $this->matrix = &$matrix;
  23.     }
  24.  
  25.     /**
  26.      * Get the next cell.
  27.      *
  28.      * @param int $index Where we're at in the data-set
  29.      * @return array 1-dimensional array in the form of (row, col) containing the
  30.      *               coordinates to put the data for this loop iteration
  31.      */
  32.     function next($index) {
  33.         if ($index == 0) {
  34.             $this->row = $this->matrix->_rows - 1;
  35.             $this->col = $this->matrix->_fillStartCol;
  36.         } else {
  37.             $this->col++;
  38.             if ($this->col >= $this->matrix->_cols) {
  39.                 $this->col = $this->matrix->_fillStartCol;
  40.                 $this->row--;
  41.             }
  42.         }
  43.  
  44.         return array($this->row, $this->col);
  45.     }
  46. }
  47. ?>
  48.