Ignore:
Timestamp:
Jun 7, 2006 8:41:19 PM (18 years ago)
Author:
scdev
Message:

Q - decided to use standard instantiation for Prefs and Cache instead of singleton methods.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/SortOrder.inc.php

    r152 r153  
    3939        $this->default_sort = $default_sort;
    4040        $this->default_order = $default_order;
     41       
     42        $this->prefs = new Prefs();
     43        $this->prefs->setParam(array('persistent' => false));
    4144    }
    4245
     
    6972    function setDefault($default_sort = '', $default_order = '')
    7073    {
    71         $prefs =& Prefs::getInstance($_SERVER['PHP_SELF']);
    72         $prefs->setParam(array('persistent' => false));
    73 
    7474        // Which column to sort by?
    7575        // (1) By GET or POST specification, if available.
     
    7979        if (!empty($new_sort_by)) {
    8080            $this->sort_by = $new_sort_by;
    81             $prefs->set('sort_by', $this->sort_by);
    82         } else if ($prefs->exists('sort_by')) {
    83             $this->sort_by = $prefs->get('sort_by');
     81            $this->prefs->set('sort_by', $this->sort_by);
     82        } else if ($this->prefs->exists('sort_by')) {
     83            $this->sort_by = $this->prefs->get('sort_by');
    8484        } else {
    8585            $this->sort_by = $default_sort;
     
    9393        if (!empty($new_order)) {
    9494            $this->order = $new_order;
    95             $prefs->set('sort_order', $this->order);
    96         } else if ($prefs->exists('sort_order')) {
    97             $this->order = $prefs->get('sort_order');
     95            $this->prefs->set('sort_order', $this->order);
     96        } else if ($this->prefs->exists('sort_order')) {
     97            $this->order = $this->prefs->get('sort_order');
    9898        } else {
    9999            $this->order = $default_order;
     
    112112    function set($sort = null, $order = null)
    113113    {
    114         $prefs =& Prefs::getInstance($_SERVER['PHP_SELF']);
    115         $prefs->setParam(array('persistent' => false));
    116 
    117114        // Set new sort value.
    118115        if (isset($sort)) {
    119116            $this->sort_by = $sort;
    120             $prefs->set('sort_by', $this->sort_by);
     117            $this->prefs->set('sort_by', $this->sort_by);
    121118        }
    122119
     
    124121        if (isset($order)) {
    125122            $this->order = $order;
    126             $prefs->set('sort_order', $this->order);
     123            $this->prefs->set('sort_order', $this->order);
    127124        }
    128125    }
Note: See TracChangeset for help on using the changeset viewer.