Changeset 681 for trunk/lib


Ignore:
Timestamp:
May 19, 2019 10:49:12 PM (5 years ago)
Author:
anonymous
Message:

Add printSortSelectMenu method

File:
1 edited

Legend:

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

    r635 r681  
    225225    }
    226226
     227    /*
     228    * Print a select menu of sort options.
     229    *
     230    * @access   public
     231    * @param    array   $cols   Array of column keys (printed in <option value="
">) and names (human-readable)
     232    * @return
     233    * @author   Quinn Comendant <quinn@strangecode.com>
     234    * @since    18 May 2019 15:27:21
     235    */
     236    public function printSortSelectMenu($cols)
     237    {
     238        $app =& App::getInstance();
     239
     240        ?><select name="sort" id="sort"><?php
     241        foreach ($cols as $col => $col_name) {
     242            if (!isset($this->_columns[$col])) {
     243                $app->logMsg(sprintf('Sort select option %s is not setup via setColumn', $col), LOG_NOTICE, __FILE__, __LINE__);
     244            }
     245            printf('<option value="%s"%s>%s</option>',
     246                $col,
     247                ($this->sort_by == $col ? ' selected="selected"' : ''),
     248                $col_name
     249            );
     250        }
     251        ?></select><?php
     252    }
     253
    227254}
    228255
Note: See TracChangeset for help on using the changeset viewer.