phpDocumentor pond
[ class tree: pond ] [ index: pond ] [ all elements ]

Source for file _dataobjectlist.class.php

Documentation is available at _dataobjectlist.class.php

  1. <?php
  2. /**
  3.  * This file implements the abstract DataObjectList base class.
  4.  *
  5.  * This file is part of Quam Plures - {@link http://quamplures.net/}
  6.  * See also {@link https://launchpad.net/quam-plures}.
  7.  *
  8.  * @copyright (c) 2009 - 2011 by the Quam Plures developers - {@link http://quamplures.net/}
  9.  * @copyright (c)2003-2009 by Francois PLANQUE - {@link http://fplanque.net/}
  10.  *
  11.  *  {@internal License choice
  12.  *  - If you have received this file as part of a package, please find the license.txt file in
  13.  *    the same folder or the closest folder above for complete license terms.
  14.  *  - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/)
  15.  *    then you must choose one of the following licenses before using the file:
  16.  *    - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php
  17.  *    - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php
  18.  *  }}}
  19.  *
  20.  *  {@internal Open Source relicensing agreement:
  21.  *  }}}
  22.  *
  23.  *  {@internal Below is a list of authors who have contributed to design/coding of this file: }}
  24.  * @author fplanque: Francois PLANQUE
  25.  *
  26.  * @package pond
  27.  */
  28. if!defined('QP_MAIN_INIT') ) die'Please, do not access this page directly.' );
  29.  
  30. load_class('_core/ui/results/_results.class.php');
  31.  
  32. /**
  33.  * Data Object List Base Class
  34.  *
  35.  * This is typically an abstract class, useful only when derived.
  36.  * Holds DataObjects in an array and allows walking through...
  37.  *
  38.  * @version beta
  39.  * @abstract
  40.  *
  41.  * @package pond
  42.  */
  43. class DataObjectList extends Results
  44. {
  45.  
  46.     /**
  47.      * The following should probably be obsoleted by Results::Cache
  48.      */
  49.     var    $dbtablename;
  50.     var $dbprefix;
  51.     var $dbIDname;
  52.  
  53.     /**
  54.      * Class name of objects handled in this list
  55.      */
  56.     var $objType;
  57.  
  58.     /**
  59.      * Object array
  60.      */
  61.     var $Obj = array();
  62.  
  63.  
  64.     /**
  65.      * Constructor
  66.      *
  67.      * If provided, executes SQL query via parent Results object
  68.      *
  69.      * @param string Name of table in database
  70.      * @param string Prefix of fields in the table
  71.      * @param string Name of the ID field (including prefix)
  72.      * @param string Name of Class for objects within this list
  73.      * @param string SQL query
  74.      * @param integer number of lines displayed on one screen
  75.      * @param string prefix to differentiate page/order params when multiple Results appear one same page
  76.      * @param string default ordering of columns (special syntax)
  77.      */
  78.     function DataObjectList$tablename$prefix ''$dbIDname 'ID'$objType 'Item'$sql NULL,
  79.                                                         $limit 20$param_prefix ''$default_order NULL )
  80.     {
  81.         $this->dbtablename = $tablename;
  82.         $this->dbprefix = $prefix;
  83.         $this->dbIDname = $dbIDname;
  84.         $this->objType = $objType;
  85.  
  86.         if!is_null$sql ) )
  87.         {    // We have an SQL query to execute:
  88.             parent::Results$sql$param_prefix$default_order$limit );
  89.         }
  90.         else
  91.         {    // TODO: do we want to autogenerate a query here???
  92.             // Temporary...
  93.             parent::Results$sql$param_prefix$default_order$limit );
  94.         }
  95.     }
  96.  
  97.  
  98.     /**
  99.      * Get next object in list
  100.      *
  101.      * @return DataObject 
  102.      */
  103.     function get_next()
  104.     {
  105.         if$this->current_idx >= $this->result_num_rows )
  106.         {    // No more comment in list
  107.             $r false;
  108.             return $r;
  109.         }
  110.         return $this->Obj[$this->current_idx++];
  111.     }
  112.  
  113. }
  114.  
  115. ?>