[1] | 1 | <?php |
---|
| 2 | /** |
---|
| 3 | * TemplateGlue.inc.php |
---|
| 4 | * Code by Strangecode :: www.strangecode.com :: This document contains copyrighted information |
---|
| 5 | */ |
---|
| 6 | |
---|
| 7 | /** |
---|
[42] | 8 | * Print URL to download file with BBEdit/Interarchy. "USER" must be a pre-set |
---|
[1] | 9 | * environment variable. Files must reside within and be relative to env "DOCUMENT_ROOT". |
---|
| 10 | * |
---|
| 11 | * @access public |
---|
| 12 | * @param mixed $file File path relative to DOCUMENT_ROOT (i.e. '/_templates/index.ihtml'). |
---|
| 13 | * @return string <a> with file basename as text. |
---|
| 14 | */ |
---|
| 15 | function bbftp($file) |
---|
| 16 | { |
---|
[35] | 17 | return sprintf('<a href="bbftp://%s@%s:%s%s" title="%s" style="text-decoration: none; border-bottom: blue 1px dotted;">%s</a>', $_SERVER['USER'], $_SERVER['HTTP_HOST'], $_SERVER['DOCUMENT_ROOT'], $file, $file, basename($file)); |
---|
[1] | 18 | } |
---|
| 19 | |
---|
| 20 | /** |
---|
[42] | 21 | * Returns an image tag for image specified in $src. |
---|
[1] | 22 | * |
---|
| 23 | * @param string $src File name of the image, including path and file extension. |
---|
| 24 | * @param string $alt Alt tag text. |
---|
| 25 | * @param string $extra Additional attributes. |
---|
| 26 | */ |
---|
| 27 | function oImg($src, $alt='', $extra='') |
---|
| 28 | { |
---|
| 29 | $filepath = preg_match('!://!', $src) ? $src : getenv('DOCUMENT_ROOT') . $src; |
---|
[42] | 30 | |
---|
[35] | 31 | if (true === ($gis = @getimagesize($filepath)) && !preg_match('/width|height/', $extra)) { |
---|
| 32 | $image_size = $gis[3]; |
---|
| 33 | } else { |
---|
[1] | 34 | $image_size = ''; |
---|
| 35 | } |
---|
[42] | 36 | |
---|
[1] | 37 | return sprintf('<img src="%s" %s alt="%s" %s />', |
---|
| 38 | $src, |
---|
| 39 | $image_size, |
---|
| 40 | oTxt($alt), |
---|
| 41 | $extra |
---|
| 42 | ); |
---|
| 43 | } |
---|
| 44 | |
---|
| 45 | /** |
---|
[42] | 46 | * Prints an image tag for image specified in $src. |
---|
[1] | 47 | * |
---|
| 48 | * @param string $src File name of the image, including path and file extension. |
---|
| 49 | * @param string $alt Alt tag text. |
---|
| 50 | * @param string $extra Additional attributes. |
---|
| 51 | */ |
---|
| 52 | function printImg($src, $alt='', $extra='') |
---|
| 53 | { |
---|
| 54 | echo oImg($src, $alt, $extra); |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | /** |
---|
| 58 | * Finds the values of an enumeration or set column of a MySQL database, returning them in an array. |
---|
| 59 | * Use this to generate a pull-down menu of options or to validate the existance |
---|
[42] | 60 | * of options. (Quinn 10 Feb 2001) |
---|
[1] | 61 | * |
---|
| 62 | * @param string $db_table database table to lookup |
---|
| 63 | * @param string $db_col database column to lookup |
---|
| 64 | * @return array Array of the set/enum values on success, false on failure. |
---|
| 65 | */ |
---|
| 66 | function getSetEnumFieldValues($db_table, $db_col) |
---|
| 67 | { |
---|
[128] | 68 | $app =& App::getInstance(); |
---|
[130] | 69 | $db =& DB::getInstance(); |
---|
| 70 | |
---|
| 71 | $qid = $db->query("SHOW COLUMNS FROM " . $db->escapeString($db_table) . " LIKE '" . $db->escapeString($db_col) . "'",false); |
---|
[128] | 72 | |
---|
[1] | 73 | $row = mysql_fetch_row($qid); |
---|
| 74 | if (preg_match('/^enum|^set/i', $row[1]) && preg_match_all("/'([^']*)'/", $row[1], $enum)) { |
---|
| 75 | return $enum[1]; |
---|
| 76 | } else { |
---|
[128] | 77 | $app->logMsg(sprintf('No set or enum fields found.', null), LOG_ERR, __FILE__, __LINE__); |
---|
[1] | 78 | return false; |
---|
| 79 | } |
---|
| 80 | } |
---|
| 81 | |
---|
| 82 | /** |
---|
| 83 | * Prints option fields for a select form. Works only with enum or set |
---|
[42] | 84 | * data types in table columns. |
---|
[1] | 85 | * |
---|
| 86 | * @param string $db_table database table to lookup |
---|
| 87 | * @param string $db_col database column to lookup |
---|
| 88 | */ |
---|
| 89 | function printSetSelectForm($db_table, $db_col, $preselected, $blank=false) |
---|
| 90 | { |
---|
| 91 | $values = getSetEnumFieldValues($db_table, $db_col); |
---|
| 92 | if ($values === false) { |
---|
[21] | 93 | ?><option value=""> </option> |
---|
[1] | 94 | <?php |
---|
| 95 | return false; |
---|
| 96 | } |
---|
| 97 | if (true === $blank) { |
---|
| 98 | $selected = ($preselected == '') ? ' selected' : ''; |
---|
| 99 | ?><option value=""<?php echo $selected; ?>> </option> |
---|
| 100 | <?php |
---|
| 101 | } |
---|
| 102 | // When the 'blank' value needs a specific key->val pair. |
---|
| 103 | if (is_array($blank)) { |
---|
| 104 | foreach ($blank as $key=>$val) { |
---|
| 105 | $selected = ($preselected == $val) ? ' selected="selected"' : ''; |
---|
| 106 | ?><option value="<?php echo $key; ?>"<?php echo $selected; ?>><?php echo oTxt($val); ?></option> |
---|
| 107 | <?php |
---|
| 108 | } |
---|
| 109 | } |
---|
[32] | 110 | foreach ($values as $v) { |
---|
| 111 | $selected = ($v == $preselected) ? ' selected' : ''; |
---|
| 112 | ?><option value="<?php echo $v; ?>"<?php echo $selected; ?>><?php echo oTxt($v); ?></option> |
---|
[1] | 113 | <?php |
---|
| 114 | } |
---|
| 115 | } |
---|
| 116 | |
---|
| 117 | /** |
---|
[32] | 118 | * Prints radio buttons from a set/enum column. |
---|
| 119 | * |
---|
| 120 | * @param string $db_table database table to lookup |
---|
| 121 | * @param string $db_col database column to lookup |
---|
| 122 | */ |
---|
| 123 | function printEnumRadios($name, $db_table, $db_col, $preselected, $blank=false) |
---|
| 124 | { |
---|
| 125 | $values = getSetEnumFieldValues($db_table, $db_col); |
---|
| 126 | if ($values === false) { |
---|
| 127 | return false; |
---|
| 128 | } |
---|
| 129 | |
---|
| 130 | foreach ($values as $v) { |
---|
| 131 | $selected = ($v == $preselected) ? ' selected' : ''; |
---|
| 132 | ?><input type="radio" name="<?php echo $name ?>" id="<?php echo $v; ?>" value="<?php echo $v; ?>"<?php echo $selected; ?> /><label for="<?php echo $v; ?>"><?php echo oTxt($v); ?></label> |
---|
| 133 | <?php |
---|
| 134 | } |
---|
| 135 | } |
---|
| 136 | |
---|
| 137 | /** |
---|
[1] | 138 | * Prints checkbox fields. Works only with enum or set |
---|
[42] | 139 | * data types in table columns. |
---|
[1] | 140 | * |
---|
| 141 | * @param string $db_table database table to lookup |
---|
| 142 | * @param string $db_col database column to lookup |
---|
| 143 | * @param array $preselected array of preselected values (matching the values in $db_col) |
---|
| 144 | * @param int $columns number of table columns to print |
---|
| 145 | * @param int $flag set to 'allone' for name of input fields to all be the same of a multidimentional array. |
---|
| 146 | */ |
---|
| 147 | function printSetCheckboxes($db_table, $db_col, $preselected, $columns=1, $flag=null) |
---|
[42] | 148 | { |
---|
[1] | 149 | ?> |
---|
| 150 | <table> |
---|
| 151 | <tr> |
---|
| 152 | <?php |
---|
| 153 | // Sometimes preselected comes as a comma list. |
---|
| 154 | if (!is_array($preselected)) { |
---|
| 155 | $preselected = explode(',', $preselected); |
---|
| 156 | } |
---|
[42] | 157 | |
---|
[1] | 158 | // Checkbox POST data has the primary data in the keys, and 'on' as the values. |
---|
| 159 | // Here we assume in all the values of an array are 'on' that we can find the data |
---|
| 160 | // in the array keys. |
---|
| 161 | $ps_value_count = array_count_values($preselected); |
---|
[64] | 162 | if (isset($ps_value_count['on']) && $ps_value_count['on'] == sizeof($preselected)) { |
---|
[1] | 163 | $preselected = array_keys($preselected); |
---|
| 164 | } |
---|
[42] | 165 | |
---|
| 166 | // Retreive values of a Set or ENUM database column. |
---|
[1] | 167 | $values = getSetEnumFieldValues($db_table, $db_col); |
---|
[42] | 168 | |
---|
[1] | 169 | // Initialize the HTML table generation vars. |
---|
| 170 | $num_cells = sizeof($values) - 1; |
---|
| 171 | $num_rows = floor($num_cells / $columns); |
---|
| 172 | $cols_lastrow = $num_cells % $columns; |
---|
| 173 | $row_cnt = 0; |
---|
| 174 | $col_cnt = 0; |
---|
[32] | 175 | foreach ($values as $v) { |
---|
[1] | 176 | if ($col_cnt == $columns) { |
---|
| 177 | // Begin a new row. |
---|
| 178 | ?></tr><tr><?php |
---|
| 179 | $col_cnt = 0; |
---|
| 180 | $row_cnt++; |
---|
| 181 | } |
---|
| 182 | if ($col_cnt < $cols_lastrow) { |
---|
| 183 | $lastrow_add = $col_cnt; |
---|
| 184 | } else { |
---|
| 185 | $lastrow_add = $cols_lastrow; |
---|
| 186 | } |
---|
| 187 | $curr = $num_rows * $col_cnt + $lastrow_add + $row_cnt; |
---|
| 188 | $col_cnt++; |
---|
[42] | 189 | |
---|
[1] | 190 | // Look for preselected value. |
---|
[32] | 191 | if (in_array($v, $preselected)) { |
---|
[1] | 192 | $checked = ' checked="checked"'; |
---|
| 193 | } else { |
---|
| 194 | $checked = ''; |
---|
| 195 | } |
---|
| 196 | if ('allone' == $flag) { |
---|
| 197 | // Print a cell with multidimentioal array checkboxes. |
---|
[32] | 198 | $html_name = 'dbcol[' . $db_col . '][' . $v . ']'; |
---|
[28] | 199 | } else { |
---|
[1] | 200 | // Print a cell with basic named checkboxes. |
---|
[32] | 201 | $html_name = $db_col . '[' . $v . ']'; |
---|
[1] | 202 | } |
---|
[32] | 203 | ?><td><input type="checkbox" name="<?php echo $html_name ?>" id="<?php echo $html_name ?>"<?php echo $checked; ?> /><label for="<?php echo $html_name ?>"><?php echo oTxt($v); ?></label></td> |
---|
[28] | 204 | <?php |
---|
[1] | 205 | } |
---|
| 206 | if ($col_cnt < $columns) { |
---|
| 207 | // This last cell must expand to fill the last blank cells. |
---|
| 208 | ?><td colspan="<?php echo $columns - $col_cnt; ?>"> </td><?php |
---|
| 209 | } |
---|
| 210 | ?> |
---|
| 211 | </tr> |
---|
| 212 | </table><?php |
---|
| 213 | } |
---|
| 214 | |
---|
| 215 | /** |
---|
| 216 | * Prints radio select fields. Works only with enum or set |
---|
[42] | 217 | * data types in table columns. |
---|
[1] | 218 | * |
---|
| 219 | * @param string $db_table database table to lookup |
---|
| 220 | * @param string $db_col database column to lookup |
---|
| 221 | * @param array $preselected array of preselected values (matching the values in $db_col) |
---|
| 222 | * @param int $columns number of table columns to print |
---|
| 223 | * @param int $flag set to 'allone' for name of input fields to all be the same of a multidimentional array. |
---|
| 224 | */ |
---|
| 225 | function printSetRadios($db_table, $db_col, $preselected, $columns=1, $flag=null) |
---|
[42] | 226 | { |
---|
[1] | 227 | ?> |
---|
| 228 | <table> |
---|
| 229 | <tr> |
---|
| 230 | <?php |
---|
| 231 | // Sometimes preselected comes as a comma list. |
---|
| 232 | if (!is_array($preselected)) { |
---|
| 233 | $preselected = explode(',', $preselected); |
---|
| 234 | } |
---|
[42] | 235 | |
---|
[1] | 236 | // Checkbox POST data has the primary data in the keys, and 'on' as the values. |
---|
| 237 | // Here we assume in all the values of an array are 'on' that we can find the data |
---|
| 238 | // in the array keys. |
---|
| 239 | $ps_value_count = array_count_values($preselected); |
---|
[53] | 240 | if (isset($ps_value_count['on']) && $ps_value_count['on'] == sizeof($preselected)) { |
---|
[1] | 241 | $preselected = array_keys($preselected); |
---|
| 242 | } |
---|
[42] | 243 | |
---|
| 244 | // Retreive values of a Set or ENUM database column. |
---|
[1] | 245 | $values = getSetEnumFieldValues($db_table, $db_col); |
---|
[42] | 246 | |
---|
[1] | 247 | // Initialize the HTML table generation vars. |
---|
| 248 | $num_cells = sizeof($values) - 1; |
---|
| 249 | $num_rows = floor($num_cells / $columns); |
---|
| 250 | $cols_lastrow = $num_cells % $columns; |
---|
| 251 | $row_cnt = 0; |
---|
| 252 | $col_cnt = 0; |
---|
[32] | 253 | foreach ($values as $v) { |
---|
[1] | 254 | if ($col_cnt == $columns) { |
---|
| 255 | // Begin a new row. |
---|
| 256 | ?></tr><tr><?php |
---|
| 257 | $col_cnt = 0; |
---|
| 258 | $row_cnt++; |
---|
| 259 | } |
---|
| 260 | if ($col_cnt < $cols_lastrow) { |
---|
| 261 | $lastrow_add = $col_cnt; |
---|
| 262 | } else { |
---|
| 263 | $lastrow_add = $cols_lastrow; |
---|
| 264 | } |
---|
| 265 | $curr = $num_rows * $col_cnt + $lastrow_add + $row_cnt; |
---|
| 266 | $col_cnt++; |
---|
[42] | 267 | |
---|
[1] | 268 | // Look for preselected value. |
---|
[32] | 269 | if (in_array($v, $preselected)) { |
---|
[1] | 270 | $checked = ' checked="checked"'; |
---|
| 271 | } else { |
---|
| 272 | $checked = ''; |
---|
| 273 | } |
---|
| 274 | // Print a cell with basic named checkboxes. |
---|
[53] | 275 | ?><td><input type="radio" name="<?php echo $db_col; ?>" id="<?php echo $db_col . '-' . $v; ?>" value="<?php echo $v ?>"<?php echo $checked; ?> /><label class="sc-label-secondary" for="<?php echo $db_col . '-' . $v ?>"><?php echo oTxt($v); ?></label></td> |
---|
[1] | 276 | <?php |
---|
| 277 | } |
---|
| 278 | if ($col_cnt < $columns) { |
---|
| 279 | // This last cell must expand to fill the last blank cells. |
---|
| 280 | ?><td colspan="<?php echo $columns - $col_cnt; ?>"> </td><?php |
---|
| 281 | } |
---|
| 282 | ?> |
---|
| 283 | </tr> |
---|
| 284 | </table><?php |
---|
| 285 | } |
---|
| 286 | |
---|
| 287 | /** |
---|
[42] | 288 | * Prints a pulldown menu containing the specified values and keys of a table. |
---|
[1] | 289 | * |
---|
| 290 | * @param string $db_table database table to lookup |
---|
| 291 | * @param string $key_column column containing the human-readable titles for the select menu |
---|
| 292 | * @param string $val_column column containing the computer values for the select menu |
---|
| 293 | * @param string $preselected the currently selected value of the menu. compared to the $val_column |
---|
| 294 | * @param bool $blank leave one blank at the top? |
---|
| 295 | * @param string $extra_clause SQL exclude cluase. Something like "WHERE girls != 'buckteeth'" |
---|
| 296 | */ |
---|
| 297 | function printSelectForm($db_table, $key_column, $val_column, $preselected, $blank=false, $extra_clause='') |
---|
| 298 | { |
---|
[130] | 299 | $db =& DB::getInstance(); |
---|
| 300 | |
---|
[1] | 301 | // Sometimes preselected comes as a comma list. |
---|
| 302 | if (!is_array($preselected)) { |
---|
| 303 | $preselected = array($preselected); |
---|
| 304 | } |
---|
| 305 | |
---|
| 306 | // Print a blank first option. |
---|
| 307 | if (true === $blank) { |
---|
| 308 | $selected = in_array('', $preselected) ? ' selected="selected"' : ''; |
---|
| 309 | ?><option value=""<?php echo $selected; ?>> </option> |
---|
| 310 | <?php |
---|
| 311 | } |
---|
[42] | 312 | |
---|
[1] | 313 | // When the 'blank' value needs a specific key->val pair. |
---|
| 314 | if (is_array($blank)) { |
---|
| 315 | foreach ($blank as $key=>$val) { |
---|
| 316 | $selected = in_array($val, $preselected) ? ' selected="selected"' : ''; |
---|
| 317 | ?><option value="<?php echo $key; ?>"<?php echo $selected; ?>><?php echo oTxt($val); ?></option> |
---|
| 318 | <?php |
---|
| 319 | } |
---|
| 320 | } |
---|
[130] | 321 | $qid = $db->query("SELECT $key_column, $val_column FROM $db_table $extra_clause",false); |
---|
[1] | 322 | while ($row = mysql_fetch_assoc($qid)) { |
---|
| 323 | $selected = in_array($row[$val_column], $preselected) ? ' selected="selected"' : ''; |
---|
| 324 | ?><option value="<?php echo $row[$val_column]; ?>"<?php echo $selected; ?>><?php echo oTxt($row[$key_column]); ?></option><?php |
---|
| 325 | } |
---|
| 326 | } |
---|
| 327 | |
---|
| 328 | /** |
---|
| 329 | * Prints checkbox fields. Works only with enum or set |
---|
[42] | 330 | * data types in table columns. |
---|
[1] | 331 | * |
---|
| 332 | * @param string $db_table database table to lookup |
---|
| 333 | * @param string $key_column column containing the human-readable titles for the select menu |
---|
| 334 | * @param string $val_column column containing the computer values for the select menu |
---|
| 335 | * @param string $preselected the currently selected value of the menu. compared to the $val_column |
---|
| 336 | * @param int $columns number of table columns to print |
---|
| 337 | * @param int $extra_clause extra sql to send at end of select statement. |
---|
| 338 | * @param bool $vert_columns display checkboxes in vertical orientation first. |
---|
| 339 | */ |
---|
| 340 | function printDBCheckboxes($db_table, $key_column, $val_column, $preselected, $columns=1, $extra_clause='', $vert_columns=false) |
---|
| 341 | { |
---|
[130] | 342 | $db =& DB::getInstance(); |
---|
| 343 | |
---|
[1] | 344 | // Sometimes preselected comes as a comma list. |
---|
| 345 | if (!is_array($preselected)) { |
---|
| 346 | $preselected = explode(',', $preselected); |
---|
| 347 | } |
---|
[42] | 348 | |
---|
[1] | 349 | // Checkbox POST data has the primary data in the keys, and 'on' as the values. |
---|
| 350 | // Here we assume in all the values of an array are 'on' that we can find the data |
---|
| 351 | // in the array keys. |
---|
| 352 | $ps_value_count = array_count_values($preselected); |
---|
| 353 | if ($ps_value_count['on'] == sizeof($preselected)) { |
---|
| 354 | $preselected = array_keys($preselected); |
---|
| 355 | } |
---|
[42] | 356 | |
---|
[130] | 357 | $qid = $db->query("SELECT $key_column, $val_column FROM $db_table $extra_clause",false); |
---|
[1] | 358 | while ($row = mysql_fetch_assoc($qid)) { |
---|
| 359 | $values[] = $row; |
---|
| 360 | } |
---|
[42] | 361 | |
---|
[1] | 362 | // Rearrange array so sort is in vertical columns. FIXME: doesn't work. |
---|
| 363 | // if ($vert_columns) { |
---|
| 364 | // $per_col = ceil(sizeof($values) / $columns); |
---|
| 365 | // $columns = ceil(sizeof($values) / $per_col); |
---|
| 366 | // $curr_row = 0; |
---|
| 367 | // $curr_col = 0; |
---|
| 368 | // $pos = 0; |
---|
| 369 | // foreach ($values as $k=>$v) { |
---|
| 370 | // $pos = $curr_row * $columns + $curr_col; |
---|
| 371 | // if ($curr_row <= $per_col) { |
---|
| 372 | // $curr_row++; |
---|
| 373 | // } else { |
---|
| 374 | // $curr_row = 0; |
---|
| 375 | // $curr_col++; |
---|
| 376 | // } |
---|
| 377 | // // echo '<li>' . $pos . '-' . $v[$key_column]; |
---|
| 378 | // $new_values[$pos] = $v; |
---|
| 379 | // } |
---|
| 380 | // $values = $new_values; |
---|
| 381 | // ksort($values); |
---|
| 382 | // } |
---|
| 383 | |
---|
| 384 | if (empty($values)) { |
---|
| 385 | return false; |
---|
| 386 | } |
---|
[42] | 387 | |
---|
[1] | 388 | // Initialize the HTML table generation vars. |
---|
| 389 | $num_cells = sizeof($values) - 1; |
---|
| 390 | $num_rows = floor($num_cells / $columns); |
---|
| 391 | $cols_lastrow = $num_cells % $columns; |
---|
| 392 | $row_cnt = 0; |
---|
| 393 | $col_cnt = 0; |
---|
| 394 | ?> |
---|
[28] | 395 | <table border="0" cellspacing="0" cellpadding="0"> |
---|
[1] | 396 | <tr> |
---|
| 397 | <?php |
---|
| 398 | foreach ($values as $box) { |
---|
| 399 | if ($col_cnt == $columns) { |
---|
| 400 | // Begin a new row. |
---|
| 401 | ?></tr><tr><?php |
---|
| 402 | $col_cnt = 0; |
---|
| 403 | $row_cnt++; |
---|
| 404 | } |
---|
[42] | 405 | |
---|
[1] | 406 | if ($col_cnt < $cols_lastrow) { |
---|
| 407 | $lastrow_add = $col_cnt; |
---|
| 408 | } else { |
---|
| 409 | $lastrow_add = $cols_lastrow; |
---|
| 410 | } |
---|
[42] | 411 | |
---|
[1] | 412 | $curr = $num_rows * $col_cnt + $lastrow_add + $row_cnt; |
---|
| 413 | $col_cnt++; |
---|
[42] | 414 | |
---|
[1] | 415 | // Look for preselected value. |
---|
| 416 | if (in_array($box[$val_column], $preselected)) { |
---|
| 417 | $checked = ' checked="checked"'; |
---|
| 418 | } else { |
---|
| 419 | $checked = ''; |
---|
| 420 | } |
---|
[42] | 421 | |
---|
[1] | 422 | // Print a cell with basic named checkboxes. |
---|
[28] | 423 | $html_name = $val_column . '[' . $box[$val_column] . ']'; |
---|
| 424 | ?> |
---|
| 425 | <td><input type="checkbox" name="<?php echo $html_name ?>" id="<?php echo $html_name ?>"<?php echo $checked; ?> /></td> |
---|
| 426 | <td><label for="<?php echo $html_name ?>" class="normal"><?php echo oTxt($box[$key_column]); ?></label></td> |
---|
| 427 | <?php /// FIXME: class=normal? |
---|
[1] | 428 | } |
---|
[42] | 429 | |
---|
[1] | 430 | if ($col_cnt < $columns) { |
---|
| 431 | // This last cell must expand to fill the last blank cells. |
---|
| 432 | ?><td colspan="<?php echo $columns - $col_cnt; ?>"> </td><?php |
---|
| 433 | } |
---|
| 434 | ?> |
---|
| 435 | </tr> |
---|
| 436 | </table><?php |
---|
| 437 | } |
---|
| 438 | |
---|
| 439 | /** |
---|
| 440 | * Prints submit buttons based on given array of submit button names and titles. |
---|
| 441 | * |
---|
| 442 | * @access public |
---|
| 443 | * @param array $submit_buttons Array of buttons, the key being the button name, and value being the title of the button. |
---|
| 444 | * @return void |
---|
| 445 | * @author Quinn Comendant <quinn@strangecode.com> |
---|
| 446 | * @version 1.0 |
---|
| 447 | * @since 15 Jun 2005 13:42:21 |
---|
| 448 | */ |
---|
| 449 | function printSubmitButtons($submit_buttons) |
---|
| 450 | { |
---|
| 451 | if (is_array($submit_buttons) && !empty($submit_buttons)) { |
---|
| 452 | foreach ($submit_buttons as $button_name => $button_text) { |
---|
| 453 | ?><input type="submit" name="<?php echo $button_name ?>" value="<?php echo oTxt($button_text); ?>" /><?php |
---|
| 454 | } |
---|
| 455 | } |
---|
| 456 | } |
---|
| 457 | |
---|
| 458 | ?> |
---|