b2evolution PHP Cross Reference Blogging Systems

Source: /inc/_core/model/dataobjects/_dataobjectlist.class.php - 115 lines - 3247 bytes - Summary - Text - Print

Description: This file implements the abstract DataObjectList base class. This file is part of the evoCore framework - {@link http://evocore.net/} See also {@link http://sourceforge.net/projects/evocms/}.

   1  <?php
   2  /**
   3   * This file implements the abstract DataObjectList base class.
   4   *
   5   * This file is part of the evoCore framework - {@link http://evocore.net/}
   6   * See also {@link http://sourceforge.net/projects/evocms/}.
   7   *
   8   * @copyright (c)2003-2014 by Francois Planque - {@link http://fplanque.com/}
   9   *
  10   * {@internal License choice
  11   * - If you have received this file as part of a package, please find the license.txt file in
  12   *   the same folder or the closest folder above for complete license terms.
  13   * - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/)
  14   *   then you must choose one of the following licenses before using the file:
  15   *   - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php
  16   *   - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php
  17   * }}
  18   *
  19   * {@internal Open Source relicensing agreement:
  20   * }}
  21   *
  22   * @package evocore
  23   *
  24   * {@internal Below is a list of authors who have contributed to design/coding of this file: }}
  25   * @author fplanque: Francois PLANQUE
  26   *
  27   * @version $Id: _dataobjectlist.class.php 6136 2014-03-08 07:59:48Z manuel $
  28   */
  29  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  30  
  31  load_class('_core/ui/results/_results.class.php', 'Results' );
  32  
  33  /**
  34   * Data Object List Base Class
  35   *
  36   * This is typically an abstract class, useful only when derived.
  37   * Holds DataObjects in an array and allows walking through...
  38   *
  39   * @package evocore
  40   * @version beta
  41   * @abstract
  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  ?>

title

Description

title

Description

title

Description

title

title

Body