Changeset 295 for trunk/lib


Ignore:
Timestamp:
Dec 16, 2007 7:21:57 AM (16 years ago)
Author:
quinn
Message:

Updated example config file. Added admin2.inc.css and minor corrections into HTML. Module maker fixes.

File:
1 edited

Legend:

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

    r290 r295  
    6262 * @param  string $db_table   database table to lookup
    6363 * @param  string $db_col     database column to lookup
     64 * @param  bool   $sort          Sort the output.
    6465 * @return array    Array of the set/enum values on success, false on failure.
    6566 */
    66 function getSetEnumFieldValues($db_table, $db_col)
     67function getSetEnumFieldValues($db_table, $db_col, $sort=false)
    6768{
    6869    $app =& App::getInstance();
     
    7374    $row = mysql_fetch_row($qid);
    7475    if (preg_match('/^enum|^set/i', $row[1]) && preg_match_all("/'([^']*)'/", $row[1], $enum)) {
    75         natsort($enum[1]);
     76        if ($sort) {
     77            natsort($enum[1]);           
     78        }
    7679        return $enum[1];
    7780    } else {
     
    8790 * @param  string $db_table   database table to lookup
    8891 * @param  string $db_col     database column to lookup
    89  */
    90 function printSetSelectForm($db_table, $db_col, $preselected, $blank=false)
    91 {
    92     $values = getSetEnumFieldValues($db_table, $db_col);
     92 * @param  bool   $sort          Sort the output.
     93 */
     94function printSetSelectForm($db_table, $db_col, $preselected, $blank=false, $sort=false)
     95{
     96    $values = getSetEnumFieldValues($db_table, $db_col, $sort);
    9397    if ($values === false) {
    9498        ?><option value="">&nbsp;</option>
     
    121125 * @param  string $db_table   database table to lookup
    122126 * @param  string $db_col     database column to lookup
    123  */
    124 function printEnumRadios($name, $db_table, $db_col, $preselected, $blank=false)
    125 {
    126     $values = getSetEnumFieldValues($db_table, $db_col);
     127 * @param  bool   $sort          Sort the output.
     128 */
     129function printEnumRadios($name, $db_table, $db_col, $preselected, $blank=false, $sort=false)
     130{
     131    $values = getSetEnumFieldValues($db_table, $db_col, $sort);
    127132    if ($values === false) {
    128133        return false;
     
    145150 * @param  int    $columns       number of table columns to print
    146151 * @param  int    $flag          set to 'allone' for name of input fields to all be the same of a multidimentional array.
    147  */
    148 function printSetCheckboxes($db_table, $db_col, $preselected, $columns=1, $flag=null)
     152 * @param  bool   $sort          Sort the output.
     153 */
     154function printSetCheckboxes($db_table, $db_col, $preselected, $columns=1, $flag=null, $sort)
    149155{
    150156    ?>
     
    166172
    167173    // Retreive values of a Set or ENUM database column.
    168     $values = getSetEnumFieldValues($db_table, $db_col);
     174    $values = getSetEnumFieldValues($db_table, $db_col, $sort);
    169175
    170176    // Initialize the HTML table generation vars.
     
    222228 * @param  array  $preselected   array of preselected values (matching the values in $db_col)
    223229 * @param  int    $columns       number of table columns to print
    224  * @param  int    $flag          set to 'allone' for name of input fields to all be the same of a multidimentional array.
    225  */
    226 function printSetRadios($db_table, $db_col, $preselected, $columns=1, $flag=null)
     230 * @param  bool   $sort          Sort the output.
     231 */
     232function printSetRadios($db_table, $db_col, $preselected, $columns=1, $sort=false)
    227233{
    228234    ?>
     
    244250
    245251    // Retreive values of a Set or ENUM database column.
    246     $values = getSetEnumFieldValues($db_table, $db_col);
     252    $values = getSetEnumFieldValues($db_table, $db_col, $sort);
    247253
    248254    // Initialize the HTML table generation vars.
Note: See TracChangeset for help on using the changeset viewer.