Changeset 321


Ignore:
Timestamp:
Apr 3, 2008 11:03:55 PM (16 years ago)
Author:
quinn
Message:

Update SortOrder? so it checks if setColumn has been run on a column before printing.

File:
1 edited

Legend:

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

    r316 r321  
    162162    /**
    163163     * Prints a link for a column header with URL sort determining logic.
     164     * Column must be defined first using setColumn().
    164165     *
    165166     * @param string $col            The database column to sort by.
     
    172173        $app =& App::getInstance();
    173174
    174         if ($this->sort_by == $col) {
    175             if (mb_strtolower($this->order) == 'desc') {
    176                 ?><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?sort=' . $col . '&order=ASC'); ?>" title="<?php echo _("Change to ascending sort order"); ?>"><?php echo $this->desc_widget; ?></a><?php echo $col_name; ?><?php
     175        if (isset($this->_columns[$col])) {
     176            if ($this->sort_by == $col) {
     177                if (mb_strtolower($this->order) == 'desc') {
     178                    ?><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?sort=' . $col . '&order=ASC'); ?>" title="<?php echo _("Change to ascending sort order"); ?>"><?php echo $this->desc_widget; ?></a><?php echo $col_name; ?><?php
     179                } else {
     180                    ?><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?sort=' . $col . '&order=DESC'); ?>" title="<?php echo _("Change to descending sort order"); ?>"><?php echo $this->asc_widget; ?></a><?php echo $col_name; ?><?php
     181                }
    177182            } else {
    178                 ?><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?sort=' . $col . '&order=DESC'); ?>" title="<?php echo _("Change to descending sort order"); ?>"><?php echo $this->asc_widget; ?></a><?php echo $col_name; ?><?php
    179             }
     183                ?><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
     184            }           
    180185        } else {
    181             ?><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
     186            echo $col_name;
    182187        }
    183188    }
Note: See TracChangeset for help on using the changeset viewer.