Ignore:
Timestamp:
Dec 18, 2005 12:16:03 AM (18 years ago)
Author:
scdev
Message:

detabbed all files ;P

File:
1 edited

Legend:

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

    r41 r42  
    66
    77/**
    8  * Print URL to download file with BBEdit/Interarchy. "USER" must be a pre-set 
     8 * Print URL to download file with BBEdit/Interarchy. "USER" must be a pre-set
    99 * environment variable. Files must reside within and be relative to env "DOCUMENT_ROOT".
    1010 *
     
    1919
    2020/**
    21  * Returns an image tag for image specified in $src. 
     21 * Returns an image tag for image specified in $src.
    2222 *
    2323 * @param  string $src     File name of the image, including path and file extension.
     
    2828{
    2929    $filepath = preg_match('!://!', $src) ? $src : getenv('DOCUMENT_ROOT') . $src;
    30    
     30
    3131    if (true === ($gis = @getimagesize($filepath)) && !preg_match('/width|height/', $extra)) {
    3232        $image_size = $gis[3];
     
    3434        $image_size = '';
    3535    }
    36    
     36
    3737    return sprintf('<img src="%s" %s alt="%s" %s />',
    3838        $src,
     
    4444
    4545/**
    46  * Prints an image tag for image specified in $src. 
     46 * Prints an image tag for image specified in $src.
    4747 *
    4848 * @param  string $src     File name of the image, including path and file extension.
     
    5858 * Finds the values of an enumeration or set column of a MySQL database, returning them in an array.
    5959 * Use this to generate a pull-down menu of options or to validate the existance
    60  * of options. (Quinn 10 Feb 2001) 
     60 * of options. (Quinn 10 Feb 2001)
    6161 *
    6262 * @param  string $db_table   database table to lookup
     
    6767{
    6868    $qid = DB::query("SHOW COLUMNS FROM " . addslashes($db_table) . " LIKE '" . addslashes($db_col) . "'",false);
    69        
     69
    7070    $row = mysql_fetch_row($qid);
    7171    if (preg_match('/^enum|^set/i', $row[1]) && preg_match_all("/'([^']*)'/", $row[1], $enum)) {
     
    7979/**
    8080 * Prints option fields for a select form. Works only with enum or set
    81  * data types in table columns. 
     81 * data types in table columns.
    8282 *
    8383 * @param  string $db_table   database table to lookup
     
    134134/**
    135135 * Prints checkbox fields. Works only with enum or set
    136  * data types in table columns. 
     136 * data types in table columns.
    137137 *
    138138 * @param  string $db_table      database table to lookup
     
    143143 */
    144144function printSetCheckboxes($db_table, $db_col, $preselected, $columns=1, $flag=null)
    145 {   
     145{
    146146    ?>
    147147    <table>
     
    152152        $preselected = explode(',', $preselected);
    153153    }
    154    
     154
    155155    // Checkbox POST data has the primary data in the keys, and 'on' as the values.
    156156    // Here we assume in all the values of an array are 'on' that we can find the data
     
    160160        $preselected = array_keys($preselected);
    161161    }
    162    
    163     // Retreive values of a Set or ENUM database column. 
     162
     163    // Retreive values of a Set or ENUM database column.
    164164    $values = getSetEnumFieldValues($db_table, $db_col);
    165    
     165
    166166    // Initialize the HTML table generation vars.
    167167    $num_cells = sizeof($values) - 1;
     
    184184        $curr = $num_rows * $col_cnt + $lastrow_add + $row_cnt;
    185185        $col_cnt++;
    186        
     186
    187187        // Look for preselected value.
    188188        if (in_array($v, $preselected)) {
     
    212212/**
    213213 * Prints radio select fields. Works only with enum or set
    214  * data types in table columns. 
     214 * data types in table columns.
    215215 *
    216216 * @param  string $db_table      database table to lookup
     
    221221 */
    222222function printSetRadios($db_table, $db_col, $preselected, $columns=1, $flag=null)
    223 {   
     223{
    224224    ?>
    225225    <table>
     
    230230        $preselected = explode(',', $preselected);
    231231    }
    232    
     232
    233233    // Checkbox POST data has the primary data in the keys, and 'on' as the values.
    234234    // Here we assume in all the values of an array are 'on' that we can find the data
     
    238238        $preselected = array_keys($preselected);
    239239    }
    240    
    241     // Retreive values of a Set or ENUM database column. 
     240
     241    // Retreive values of a Set or ENUM database column.
    242242    $values = getSetEnumFieldValues($db_table, $db_col);
    243    
     243
    244244    // Initialize the HTML table generation vars.
    245245    $num_cells = sizeof($values) - 1;
     
    262262        $curr = $num_rows * $col_cnt + $lastrow_add + $row_cnt;
    263263        $col_cnt++;
    264        
     264
    265265        // Look for preselected value.
    266266        if (in_array($v, $preselected)) {
     
    283283
    284284/**
    285  * Prints a pulldown menu containing the specified values and keys of a table. 
     285 * Prints a pulldown menu containing the specified values and keys of a table.
    286286 *
    287287 * @param  string $db_table         database table to lookup
     
    305305        <?php
    306306    }
    307    
     307
    308308    // When the 'blank' value needs a specific key->val pair.
    309309    if (is_array($blank)) {
     
    323323/**
    324324 * Prints checkbox fields. Works only with enum or set
    325  * data types in table columns. 
     325 * data types in table columns.
    326326 *
    327327 * @param  string $db_table         database table to lookup
     
    339339        $preselected = explode(',', $preselected);
    340340    }
    341    
     341
    342342    // Checkbox POST data has the primary data in the keys, and 'on' as the values.
    343343    // Here we assume in all the values of an array are 'on' that we can find the data
     
    347347        $preselected = array_keys($preselected);
    348348    }
    349    
     349
    350350    $qid = DB::query("SELECT $key_column, $val_column FROM $db_table $extra_clause",false);
    351351    while ($row = mysql_fetch_assoc($qid)) {
    352352        $values[] = $row;
    353353    }
    354    
     354
    355355    // Rearrange array so sort is in vertical columns. FIXME: doesn't work.
    356356//  if ($vert_columns) {
     
    378378        return false;
    379379    }
    380    
     380
    381381    // Initialize the HTML table generation vars.
    382382    $num_cells = sizeof($values) - 1;
     
    396396            $row_cnt++;
    397397        }
    398        
     398
    399399        if ($col_cnt < $cols_lastrow) {
    400400            $lastrow_add = $col_cnt;
     
    402402            $lastrow_add = $cols_lastrow;
    403403        }
    404        
     404
    405405        $curr = $num_rows * $col_cnt + $lastrow_add + $row_cnt;
    406406        $col_cnt++;
    407        
     407
    408408        // Look for preselected value.
    409409        if (in_array($box[$val_column], $preselected)) {
     
    412412            $checked = '';
    413413        }
    414        
     414
    415415        // Print a cell with basic named checkboxes.
    416416        $html_name = $val_column . '[' . $box[$val_column] . ']';
     
    420420        <?php /// FIXME: class=normal?
    421421    }
    422    
     422
    423423    if ($col_cnt < $columns) {
    424424        // This last cell must expand to fill the last blank cells.
Note: See TracChangeset for help on using the changeset viewer.