Ignore:
Timestamp:
Dec 25, 2013 12:47:12 AM (10 years ago)
Author:
anonymous
Message:

Merged changes to lib/SortOrder.inc.php from eli_branch; other minor changes

File:
1 edited

Legend:

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

    r396 r452  
    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/>.
     
    2424 * SortOrder.inc.php
    2525 *
    26  * SortOrder can determing how to sort results of a database query for display
     26 * SortOrder can determine how to sort results of a database query for display
    2727 * on a listing. It can print column headers that will be links to
    2828 * automatically change the sort and order.
     
    5656    {
    5757        $app =& App::getInstance();
    58        
     58
    5959        // Setup the HTML for printing ASC/DESC paths.
    6060        // This should be converted to CSS someday.
     
    6262        $this->asc_widget = sprintf('<img src="%s/sort_ascending.gif" alt="%s" width="11" height="7" border="0" />', $images_path, _("Ascending"));
    6363        $this->desc_widget = sprintf('<img src="%s/sort_descending.gif" alt="%s" width="11" height="7" border="0" />', $images_path, _("Ascending"));
    64        
     64
    6565        // Setup prefs object.
    6666        $this->prefs = new Prefs($_SERVER['PHP_SELF']);
     
    154154    }
    155155
     156    /**
     157     * Get the current sort and order values.
     158     *
     159     * @return array    Array with keys: sort and order. These can be fed back into the SortOrder::set() method or defaults.
     160     */
     161    function get()
     162    {
     163        return array(
     164            'sort' => $this->prefs->get('sort_by'),
     165            'order' => $this->prefs->get('sort_order'),
     166        );
     167    }
    156168
    157169    /**
     
    202214            } else {
    203215                ?><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?sort=' . $col . '&order=' . $default_order); ?>" title="<?php echo sprintf(_("Sort by %s"), $col_name); ?>"><?php echo $col_name; ?></a><?php
    204             }           
     216            }
    205217        } else {
    206218            echo $col_name;
Note: See TracChangeset for help on using the changeset viewer.