Changeset 407 for trunk/lib/TemplateGlue.inc.php
- Timestamp:
- Aug 30, 2012 5:19:34 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/TemplateGlue.inc.php
r396 r407 108 108 * data types in table columns. 109 109 * 110 * @param string $db_table database table to lookup 111 * @param string $db_col database column to lookup 112 * @param bool $sort Sort the output. 113 */ 114 function printSetSelectForm($db_table, $db_col, $preselected, $blank=false, $sort=false) 110 * @param string $db_table Database table to lookup 111 * @param string $db_col Database column to lookup 112 * @param string $preselected The currently selected value of the menu. compared to the $val_column 113 * @param bool $first Optional first item; set true for a blank item, array for item with name and value. 114 * @param bool $sort Sort the output. 115 */ 116 function printSetSelectForm($db_table, $db_col, $preselected, $first=false, $sort=false) 115 117 { 116 118 $values = getSetEnumFieldValues($db_table, $db_col, $sort); … … 120 122 return false; 121 123 } 122 if (true === $ blank) {124 if (true === $first) { 123 125 $selected = ($preselected == '') ? ' selected' : ''; 124 126 ?><option value=""<?php echo $selected; ?>> </option> … … 126 128 } 127 129 // When the 'blank' value needs a specific key->val pair. 128 if (is_array($ blank)) {129 foreach ($ blankas $key=>$val) {130 if (is_array($first)) { 131 foreach ($first as $key=>$val) { 130 132 $selected = ($preselected == $val) ? ' selected="selected"' : ''; 131 133 ?><option value="<?php echo oTxt($key); ?>"<?php echo $selected; ?>><?php echo oTxt($val); ?></option> … … 143 145 * Prints radio buttons from a set/enum column. 144 146 * 145 * @param string $db_table database table to lookup 146 * @param string $db_col database column to lookup 147 * @param bool $sort Sort the output. 148 */ 149 function printEnumRadios($name, $db_table, $db_col, $preselected, $blank=false, $sort=false) 147 * @param string $db_table Database table to lookup 148 * @param string $db_col Database column to lookup 149 * @param string $preselected The currently selected value of the menu. compared to the $val_column 150 * @param bool $first Optional first item; set true for a blank item, array for item with name and value. 151 * @param bool $sort Sort the output. 152 */ 153 function printEnumRadios($name, $db_table, $db_col, $preselected, $first=false, $sort=false) 150 154 { 151 155 $values = getSetEnumFieldValues($db_table, $db_col, $sort); … … 319 323 * @param string $val_column column containing the computer values for the select menu 320 324 * @param string $preselected the currently selected value of the menu. compared to the $val_column 321 * @param bool $ blank leave one blank at the top?325 * @param bool $first Optional first item; set true for a blank item, array for item with name and value. 322 326 * @param string $extra_clause SQL exclude clause. Something like "WHERE girls != 'buckteeth'" 323 327 */ 324 function printSelectForm($db_table, $key_column, $val_column, $preselected, $ blank=false, $extra_clause='', $sql_format='SELECT %1$s, %2$s FROM %3$s %4$s')328 function printSelectForm($db_table, $key_column, $val_column, $preselected, $first=false, $extra_clause='', $sql_format='SELECT %1$s, %2$s FROM %3$s %4$s') 325 329 { 326 330 $db =& DB::getInstance(); … … 332 336 333 337 // Print a blank first option. 334 if (true === $ blank) {338 if (true === $first) { 335 339 $selected = in_array('', $preselected) ? ' selected="selected"' : ''; 336 340 ?><option value=""<?php echo $selected; ?>> </option> … … 339 343 340 344 // When the 'blank' value needs a specific key->val pair. 341 if (is_array($ blank)) {342 foreach ($ blankas $key=>$val) {345 if (is_array($first)) { 346 foreach ($first as $key=>$val) { 343 347 $selected = in_array($key, $preselected) ? ' selected="selected"' : ''; 344 348 ?><option value="<?php echo $key; ?>"<?php echo $selected; ?>><?php echo oTxt($val); ?></option>
Note: See TracChangeset
for help on using the changeset viewer.