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 / RLTB.php < prev    next >
Encoding:
PHP Script  |  2008-07-02  |  2.5 KB  |  66 lines

  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: RLTB.php,v 1.1.1.1 2004/04/19 23:47:14 ieure Exp $
  20.  
  21. require_once 'HTML/Table/Matrix/Filler.php';
  22.  
  23. /**
  24.  * Fill left-to-right, top-to-bottom.
  25.  *
  26.  * @author Ian Eure <ieure@php.net>
  27.  * @package HTML_Table_Matrix
  28.  * @since 1.0
  29.  */
  30. class HTML_Table_Matrix_Filler_RLTB extends HTML_Table_Matrix_Filler {
  31.     /**
  32.      * Constructor
  33.      *
  34.      * @param Object $matrix Reference to the HTML_Table_Matrix instance we are
  35.      *                       filling data for.
  36.      * @param array $options Options for this Filler
  37.      * @return void
  38.      */
  39.     function HTML_Table_Matrix_Filler_RLTB(&$matrix, $options = false) {
  40.         $this->setOptions($options);
  41.         $this->matrix = $matrix;
  42.     }
  43.  
  44.     /**
  45.      * Get the next cell.
  46.      *
  47.      * @param int $index Where we're at in the data-set
  48.      * @return array 1-dimensional array in the form of (row, col) containing the
  49.      *               coordinates to put the data for this loop iteration
  50.      */
  51.     function next($index) {
  52.         if ($index == 0) {
  53.             $this->row = $this->matrix->_fillStartRow;
  54.             $this->col = $this->matrix->_cols - 1;
  55.         } else {
  56.             $this->col--;
  57.             if ($this->col < $this->matrix->_fillStartCol) {
  58.                 $this->col = $this->matrix->_cols - 1;
  59.                 $this->row++;
  60.             }
  61.         }
  62.  
  63.         return array($this->row, $this->col);
  64.     }
  65. }
  66. ?>