Changeset 295 for trunk/lib/TemplateGlue.inc.php
- Timestamp:
- Dec 16, 2007 7:21:57 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/TemplateGlue.inc.php
r290 r295 62 62 * @param string $db_table database table to lookup 63 63 * @param string $db_col database column to lookup 64 * @param bool $sort Sort the output. 64 65 * @return array Array of the set/enum values on success, false on failure. 65 66 */ 66 function getSetEnumFieldValues($db_table, $db_col )67 function getSetEnumFieldValues($db_table, $db_col, $sort=false) 67 68 { 68 69 $app =& App::getInstance(); … … 73 74 $row = mysql_fetch_row($qid); 74 75 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 } 76 79 return $enum[1]; 77 80 } else { … … 87 90 * @param string $db_table database table to lookup 88 91 * @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 */ 94 function printSetSelectForm($db_table, $db_col, $preselected, $blank=false, $sort=false) 95 { 96 $values = getSetEnumFieldValues($db_table, $db_col, $sort); 93 97 if ($values === false) { 94 98 ?><option value=""> </option> … … 121 125 * @param string $db_table database table to lookup 122 126 * @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 */ 129 function printEnumRadios($name, $db_table, $db_col, $preselected, $blank=false, $sort=false) 130 { 131 $values = getSetEnumFieldValues($db_table, $db_col, $sort); 127 132 if ($values === false) { 128 133 return false; … … 145 150 * @param int $columns number of table columns to print 146 151 * @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 */ 154 function printSetCheckboxes($db_table, $db_col, $preselected, $columns=1, $flag=null, $sort) 149 155 { 150 156 ?> … … 166 172 167 173 // Retreive values of a Set or ENUM database column. 168 $values = getSetEnumFieldValues($db_table, $db_col );174 $values = getSetEnumFieldValues($db_table, $db_col, $sort); 169 175 170 176 // Initialize the HTML table generation vars. … … 222 228 * @param array $preselected array of preselected values (matching the values in $db_col) 223 229 * @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 */ 232 function printSetRadios($db_table, $db_col, $preselected, $columns=1, $sort=false) 227 233 { 228 234 ?> … … 244 250 245 251 // Retreive values of a Set or ENUM database column. 246 $values = getSetEnumFieldValues($db_table, $db_col );252 $values = getSetEnumFieldValues($db_table, $db_col, $sort); 247 253 248 254 // Initialize the HTML table generation vars.
Note: See TracChangeset
for help on using the changeset viewer.