| 1 |
<?php |
<?php |
| 2 |
|
/** |
|
/* |
|
| 3 |
* Smarty plugin |
* Smarty plugin |
| 4 |
* ------------------------------------------------------------- |
* @package Smarty |
| 5 |
* Type: function |
* @subpackage plugins |
| 6 |
* Name: html_select_time |
*/ |
| 7 |
|
|
| 8 |
|
|
| 9 |
|
/** |
| 10 |
|
* Smarty {html_select_time} function plugin |
| 11 |
|
* |
| 12 |
|
* Type: function<br> |
| 13 |
|
* Name: html_select_time<br> |
| 14 |
* Purpose: Prints the dropdowns for time selection |
* Purpose: Prints the dropdowns for time selection |
| 15 |
* ------------------------------------------------------------- |
* @link http://smarty.php.net/manual/en/language.function.html.select.time.php {html_select_time} |
| 16 |
|
* (Smarty online manual) |
| 17 |
|
* @param array |
| 18 |
|
* @param Smarty |
| 19 |
|
* @return string |
| 20 |
|
* @uses smarty_make_timestamp() |
| 21 |
*/ |
*/ |
|
require_once $this->_get_plugin_filepath('shared','make_timestamp'); |
|
|
require_once $this->_get_plugin_filepath('function','html_options'); |
|
| 22 |
function smarty_function_html_select_time($params, &$smarty) |
function smarty_function_html_select_time($params, &$smarty) |
| 23 |
{ |
{ |
| 24 |
|
require_once $smarty->_get_plugin_filepath('shared','make_timestamp'); |
| 25 |
|
require_once $smarty->_get_plugin_filepath('function','html_options'); |
| 26 |
/* Default values. */ |
/* Default values. */ |
| 27 |
$prefix = "Time_"; |
$prefix = "Time_"; |
| 28 |
$time = time(); |
$time = time(); |
| 44 |
$second_extra = null; |
$second_extra = null; |
| 45 |
$meridian_extra = null; |
$meridian_extra = null; |
| 46 |
|
|
| 47 |
extract($params); |
foreach ($params as $_key=>$_value) { |
| 48 |
|
switch ($_key) { |
| 49 |
|
case 'prefix': |
| 50 |
|
case 'time': |
| 51 |
|
case 'field_array': |
| 52 |
|
case 'all_extra': |
| 53 |
|
case 'hour_extra': |
| 54 |
|
case 'minute_extra': |
| 55 |
|
case 'second_extra': |
| 56 |
|
case 'meridian_extra': |
| 57 |
|
$$_key = (string)$_value; |
| 58 |
|
break; |
| 59 |
|
|
| 60 |
|
case 'display_hours': |
| 61 |
|
case 'display_minutes': |
| 62 |
|
case 'display_seconds': |
| 63 |
|
case 'display_meridian': |
| 64 |
|
case 'use_24_hours': |
| 65 |
|
$$_key = (bool)$_value; |
| 66 |
|
break; |
| 67 |
|
|
| 68 |
|
case 'minute_interval': |
| 69 |
|
case 'second_interval': |
| 70 |
|
$$_key = (int)$_value; |
| 71 |
|
break; |
| 72 |
|
|
| 73 |
|
default: |
| 74 |
|
$smarty->trigger_error("[html_select_time] unknown parameter $_key", E_USER_WARNING); |
| 75 |
|
} |
| 76 |
|
} |
| 77 |
|
|
| 78 |
$time = smarty_make_timestamp($time); |
$time = smarty_make_timestamp($time); |
| 79 |
|
|
| 184 |
$html_result .= "</select>\n"; |
$html_result .= "</select>\n"; |
| 185 |
} |
} |
| 186 |
|
|
| 187 |
print $html_result; |
return $html_result; |
| 188 |
} |
} |
| 189 |
|
|
| 190 |
/* vim: set expandtab: */ |
/* vim: set expandtab: */ |