Ignore:
Timestamp:
Feb 20, 2014 3:03:59 AM (10 years ago)
Author:
anonymous
Message:

Completed integrating /branches/eli_branch into /trunk. Changes include:

  • Removed closing ?> from end of files
  • Upgrade old-style contructor methods to use construct() instead.
  • Class properties and methods defined as public, private, static or protected
  • Ensure code runs under E_ALL with only mysql_* deprecated warnings
  • Search for the '@' symbol anywhere it might be used to supress runtime errors, then replace with proper error recovery.
  • Run the php cli -l option to check files for syntax errors.
  • Bring tests up-to-date with latest version and methods of PHPUnit
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/lib/PageNumbers.inc.php

    r396 r468  
    44 * For details visit the project site: <http://trac.strangecode.com/codebase/>
    55 * Copyright 2001-2012 Strangecode, LLC
    6  * 
     6 *
    77 * This file is part of The Strangecode Codebase.
    88 *
     
    1111 * Free Software Foundation, either version 3 of the License, or (at your option)
    1212 * any later version.
    13  * 
     13 *
    1414 * The Strangecode Codebase is distributed in the hope that it will be useful, but
    1515 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1616 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    1717 * details.
    18  * 
     18 *
    1919 * You should have received a copy of the GNU General Public License along with
    2020 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
     
    3939class PageNumbers {
    4040
    41     var $total_items;       // Total quantity of items.
    42     var $total_pages;       // The total number of pages.
    43     var $current_page = 1;  // Current page number.
    44     var $first_item;        // The counter for the first item on this page (zero index).
    45     var $last_item;         // The counter for the last item on this page (zero index).
    46     var $max_num_links = 9; // The max number of links to show on page (odd numbers look best).
    47     var $_num_links;        // The number of links to show on page.
    48     var $_per_page = 25;    // Items per page.
     41    public $total_items;       // Total quantity of items.
     42    public $total_pages;       // The total number of pages.
     43    public $current_page = 1;  // Current page number.
     44    public $first_item;        // The counter for the first item on this page (zero index).
     45    public $last_item;         // The counter for the last item on this page (zero index).
     46    public $max_num_links = 9; // The max number of links to show on page (odd numbers look best).
     47    private $_num_links;        // The number of links to show on page.
     48    private $_per_page = 25;    // Items per page.
    4949
    5050    // Flags to ensure all necessary values have been set before calling calculate().
    51     var $set_per_page_initialized = false;
    52     var $set_page_number_initialized = false;
    53     var $set_total_items_initialized = false;
     51    public $set_per_page_initialized = false;
     52    public $set_page_number_initialized = false;
     53    public $set_total_items_initialized = false;
    5454
    5555    // These are initialized in the constructor.
    56     var $per_page_options;
    57     var $left_arrow;
    58     var $left_arrow_disabled;
    59     var $left_dbl_arrow;
    60     var $left_dbl_arrow_disabled;
    61     var $right_arrow;
    62     var $right_arrow_disabled;
    63     var $right_dbl_arrow;
    64     var $right_dbl_arrow_disabled;
     56    public $per_page_options;
     57    public $left_arrow;
     58    public $left_arrow_disabled;
     59    public $left_dbl_arrow;
     60    public $left_dbl_arrow_disabled;
     61    public $right_arrow;
     62    public $right_arrow_disabled;
     63    public $right_dbl_arrow;
     64    public $right_dbl_arrow_disabled;
    6565
    6666    /**
    6767     * PageNumbers constructor. All arguments are depreciated. Use set* functions instead.
    6868     */
    69     function PageNumbers()
     69    public function __construct()
    7070    {
    7171        // Default options for the quantity per page links.
     
    8585        // in special cases like using a /my/page/# scheme.
    8686        $this->url_base = $_SERVER['PHP_SELF'] . '?page_number=';
    87        
     87
    8888        $this->prefs = new Prefs($_SERVER['PHP_SELF']);
    8989        $this->prefs->setParam(array('persistent' => false));
     
    9393     * Set the number of items per page.
    9494     */
    95     function setPerPage($per_page, $default=25, $save_value=true)
     95    public function setPerPage($per_page, $default=25, $save_value=true)
    9696    {
    9797        // (1) By provided argument, if valid.
     
    115115     * Set the current page number.
    116116     */
    117     function setPageNumber($page_number, $save_value=true)
     117    public function setPageNumber($page_number, $save_value=true)
    118118    {
    119119        // (1) By provided argument, if valid.
     
    139139     * Set the total number of items.
    140140     */
    141     function setTotalItems($total_items)
     141    public function setTotalItems($total_items)
    142142    {
    143143        if (is_numeric($total_items) && $total_items > 0) {
     
    158158     * @access public
    159159     */
    160     function calculate()
     160    public function calculate()
    161161    {
    162162        $app =& App::getInstance();
     
    212212     * Returns the SQL code to limit query to items that are on current page.
    213213     */
    214     function getLimitSQL()
     214    public function getLimitSQL()
    215215    {
    216216        $app =& App::getInstance();
     
    230230     * @access public
    231231     */
    232     function printPerPageLinks($query_key='per_page')
     232    public function printPerPageLinks($query_key='per_page')
    233233    {
    234234        $app =& App::getInstance();
     
    260260     * @access public
    261261     */
    262     function getPageNumURL($page_number, $carry_args=null)
     262    public function getPageNumURL($page_number, $carry_args=null)
    263263    {
    264264        $app =& App::getInstance();
     
    266266        return $app->oHREF($this->url_base . $page_number, $carry_args);
    267267    }
    268     function printPageNumURL($page_number, $carry_args=null)
     268    public function printPageNumURL($page_number, $carry_args=null)
    269269    {
    270270        echo $this->getPageNumURL($page_number, $carry_args);
     
    276276     * @access public
    277277     */
    278     function getPageNumbersArray($carry_args=null)
     278    public function getPageNumbersArray($carry_args=null)
    279279    {
    280280        $page_numbers = array();
     
    296296     * @access public
    297297     */
    298     function getPageNumbers($carry_args=null)
     298    public function getPageNumbers($carry_args=null)
    299299    {
    300300        $page_numbers_string = '';
     
    361361    }
    362362
    363     function printPageNumbers($carry_args=null)
     363    public function printPageNumbers($carry_args=null)
    364364    {
    365365        echo $this->getPageNumbers($carry_args);
     
    368368}
    369369
    370 ?>
Note: See TracChangeset for help on using the changeset viewer.