b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (0.9.x) [ class tree: evocore ] [ index: evocore ] [ all elements ]

Source for file _class_dataobjectlist.php

Documentation is available at _class_dataobjectlist.php

  1. <?php
  2. /**
  3.  * Data Object List Base Class
  4.  * 
  5.  * "data objects by fplanque" :P
  6.  *
  7.  * b2evolution - {@link http://b2evolution.net/}
  8.  * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}
  9.  * @copyright (c)2003-2005 by Francois PLANQUE - {@link http://fplanque.net/}
  10.  *
  11.  * @package evocore
  12.  */
  13. if!defined('DB_USER') ) die'Please, do not access this page directly.' );
  14.  
  15. /**
  16.  * Data Object List Base Class
  17.  *
  18.  * This is typically an abstract class, useful only when derived.
  19.  *
  20.  * @package evocore
  21.  * @version beta
  22.  * @abstract
  23.  */
  24. {
  25.     /**#@+
  26.      * @access private
  27.      */
  28.     var    $dbtablename;
  29.     var $dbprefix;
  30.     var $dbIDname;
  31.     var $posts_per_page 15;            
  32.     /** 
  33.      * SQL query string
  34.      */
  35.     var $request;
  36.     /**
  37.      * DB Result set (array)
  38.      */
  39.     var $result;
  40.     /**
  41.      * Number of rows in result set. Typically equal to $posts_per_page, once loaded.
  42.      */
  43.     var $result_num_rows 0;
  44.     /**
  45.      * Object array
  46.      */
  47.     var $Obj array();
  48.     /**
  49.      * Current object idx in array:
  50.      */
  51.     var $current_idx 0;
  52.     /**#@-*/
  53.  
  54.     /** 
  55.      * Constructor
  56.      *
  57.      * {@internal DataObjectList::DataObjectList(-) }}
  58.      *
  59.      * @param string Name of table in database
  60.      * @param string Prefix of fields in the table
  61.      * @param string Name of the ID field (including prefix)
  62.      */
  63.     function DataObjectList$tablename$prefix ''$dbIDname 'ID' )
  64.     {
  65.         $this->dbtablename $tablename;
  66.         $this->dbprefix $prefix;
  67.         $this->dbIDname $dbIDname;
  68.     }    
  69.  
  70.     /**
  71.      * Get nummber of rows available for display
  72.      *
  73.      * {@internal DataObjectList::get_num_rows(-) }}
  74.      *
  75.      * @return integer 
  76.      */
  77.     function get_num_rows()
  78.     {
  79.         return $this->result_num_rows;
  80.     }
  81.  
  82.     /** 
  83.      * Get next comment in list
  84.      *
  85.      * {@internal CommentList::get_next(-) }}
  86.      */
  87.     function get_next()
  88.     {
  89.         if$this->current_idx >= $this->result_num_rows )
  90.         {    // No more comment in list
  91.             return false;
  92.         }
  93.         return  $this->Obj[$this->current_idx++];
  94.     }
  95.  
  96.     /**
  97.      * Rewind resultset
  98.      *
  99.      * {@internal DataObjectList::restart(-) }}
  100.      */
  101.     function restart()
  102.     {
  103.         $this->current_idx 0;
  104.     }
  105.     
  106.     
  107.     /**
  108.      * Template function: display message if list is empty
  109.      *
  110.      * {@internal DataObjectList::display_if_empty(-) }}
  111.      *
  112.      * @param string String to display if list is empty
  113.    * @return true if empty
  114.      */
  115.     function display_if_empty$message '' )
  116.     {
  117.         ifempty($message) ) 
  118.         {    // Default message:
  119.             $message T_('Sorry, there is nothing to display...');
  120.         }
  121.  
  122.         if$this->result_num_rows == )
  123.         {
  124.             echo $message;
  125.       return true;
  126.         }
  127.     return false;
  128.     }
  129.     
  130. }
  131. ?>

Documentation generated on Tue, 20 May 2008 01:52:53 +0200 by phpDocumentor 1.4.2