mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 02:14:26 +02:00
added paramters to html_select_time plugin
This commit is contained in:
3
NEWS
3
NEWS
@@ -1,3 +1,6 @@
|
||||
- added $all_extra, $hour_extra, $minute_extra,
|
||||
$second_extra and $meridian_extra parameters to
|
||||
html_select_time function (Rainer Collet, Monte)
|
||||
- update debug console to print objects (Simon Willison,
|
||||
Monte)
|
||||
- fix Config_File class to not error when there are no
|
||||
|
@@ -3480,6 +3480,46 @@ OUTPUT: (current year is 2000)
|
||||
<entry>n/a</entry>
|
||||
<entry>outputs values to array of this name</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>all_extra</entry>
|
||||
<entry>string</entry>
|
||||
<entry>No</entry>
|
||||
<entry>null</entry>
|
||||
<entry>adds extra attributes to select/input tags if
|
||||
given</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>hour_extra</entry>
|
||||
<entry>string</entry>
|
||||
<entry>No</entry>
|
||||
<entry>null</entry>
|
||||
<entry>adds extra attributes to select/input tags if
|
||||
given</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>minute_extra</entry>
|
||||
<entry>string</entry>
|
||||
<entry>No</entry>
|
||||
<entry>null</entry>
|
||||
<entry>adds extra attributes to select/input tags if
|
||||
given</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>second_extra</entry>
|
||||
<entry>string</entry>
|
||||
<entry>No</entry>
|
||||
<entry>null</entry>
|
||||
<entry>adds extra attributes to select/input tags if
|
||||
given</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>meridian_extra</entry>
|
||||
<entry>string</entry>
|
||||
<entry>No</entry>
|
||||
<entry>null</entry>
|
||||
<entry>adds extra attributes to select/input tags if
|
||||
given</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
|
@@ -27,6 +27,11 @@ function smarty_function_html_select_time($params, &$smarty)
|
||||
"birthday[Minute]", "birthday[Seconds]" & "birthday[Meridian]".
|
||||
Can be combined with prefix. */
|
||||
$field_array = null;
|
||||
$all_extra = null;
|
||||
$hour_extra = null;
|
||||
$minute_extra = null;
|
||||
$second_extra = null;
|
||||
$meridian_extra = null;
|
||||
|
||||
extract($params);
|
||||
|
||||
@@ -41,10 +46,17 @@ function smarty_function_html_select_time($params, &$smarty)
|
||||
$hours[$i] = sprintf('%02d', $hours[$i]);
|
||||
$html_result .= '<select name=';
|
||||
if (null !== $field_array) {
|
||||
$html_result .= '"' . $field_array . '[' . $prefix . 'Hour]">'."\n";
|
||||
$html_result .= '"' . $field_array . '[' . $prefix . 'Hour]"';
|
||||
} else {
|
||||
$html_result .= '"' . $prefix . 'Hour">'."\n";
|
||||
$html_result .= '"' . $prefix . 'Hour"';
|
||||
}
|
||||
if (null !== $hour_extra){
|
||||
$html_result .= ' ' . $hour_extra;
|
||||
}
|
||||
if (null !== $all_extra){
|
||||
$html_result .= ' ' . $all_extra;
|
||||
}
|
||||
$html_result .= '>'."\n";
|
||||
$html_result .= smarty_function_html_options(array('output' => $hours,
|
||||
'values' => $hours,
|
||||
'selected' => strftime($hour_fmt, $time),
|
||||
@@ -60,10 +72,18 @@ function smarty_function_html_select_time($params, &$smarty)
|
||||
$selected = intval(floor(strftime('%M', $time) / $minute_interval) * $minute_interval);
|
||||
$html_result .= '<select name=';
|
||||
if (null !== $field_array) {
|
||||
$html_result .= '"' . $field_array . '[' . $prefix . 'Minute]">'."\n";
|
||||
$html_result .= '"' . $field_array . '[' . $prefix . 'Minute]"';
|
||||
} else {
|
||||
$html_result .= '"' . $prefix . 'Minute">'."\n";
|
||||
$html_result .= '"' . $prefix . 'Minute"';
|
||||
}
|
||||
if (null !== $minute_extra){
|
||||
$html_result .= ' ' . $minute_extra;
|
||||
}
|
||||
if (null !== $all_extra){
|
||||
$html_result .= ' ' . $all_extra;
|
||||
}
|
||||
$html_result .= '>'."\n";
|
||||
|
||||
$html_result .= smarty_function_html_options(array('output' => $minutes,
|
||||
'values' => $minutes,
|
||||
'selected' => $selected,
|
||||
@@ -79,10 +99,19 @@ function smarty_function_html_select_time($params, &$smarty)
|
||||
$selected = intval(floor(strftime('%S', $time) / $second_interval) * $second_interval);
|
||||
$html_result .= '<select name=';
|
||||
if (null !== $field_array) {
|
||||
$html_result .= '"' . $field_array . '[' . $prefix . 'Second]">'."\n";
|
||||
$html_result .= '"' . $field_array . '[' . $prefix . 'Second]"';
|
||||
} else {
|
||||
$html_result .= '"' . $prefix . 'Second">'."\n";
|
||||
$html_result .= '"' . $prefix . 'Second"';
|
||||
}
|
||||
|
||||
if (null !== $second_extra){
|
||||
$html_result .= ' ' . $second_extra;
|
||||
}
|
||||
if (null !== $all_extra){
|
||||
$html_result .= ' ' . $all_extra;
|
||||
}
|
||||
$html_result .= '>'."\n";
|
||||
|
||||
$html_result .= smarty_function_html_options(array('output' => $seconds,
|
||||
'values' => $seconds,
|
||||
'selected' => $selected,
|
||||
@@ -94,10 +123,19 @@ function smarty_function_html_select_time($params, &$smarty)
|
||||
if ($display_meridian && !$use_24_hours) {
|
||||
$html_result .= '<select name=';
|
||||
if (null !== $field_array) {
|
||||
$html_result .= '"' . $field_array . '[' . $prefix . 'Meridian]">'."\n";
|
||||
$html_result .= '"' . $field_array . '[' . $prefix . 'Meridian]"';
|
||||
} else {
|
||||
$html_result .= '"' . $prefix . 'Meridian">'."\n";
|
||||
$html_result .= '"' . $prefix . 'Meridian"';
|
||||
}
|
||||
|
||||
if (null !== $meridian_extra){
|
||||
$html_result .= ' ' . $meridian_extra;
|
||||
}
|
||||
if (null !== $all_extra){
|
||||
$html_result .= ' ' . $all_extra;
|
||||
}
|
||||
$html_result .= '>'."\n";
|
||||
|
||||
$html_result .= smarty_function_html_options(array('output' => array('AM', 'PM'),
|
||||
'values' => array('am', 'pm'),
|
||||
'selected' => strtolower(strftime('%p', $time)),
|
||||
|
@@ -27,6 +27,11 @@ function smarty_function_html_select_time($params, &$smarty)
|
||||
"birthday[Minute]", "birthday[Seconds]" & "birthday[Meridian]".
|
||||
Can be combined with prefix. */
|
||||
$field_array = null;
|
||||
$all_extra = null;
|
||||
$hour_extra = null;
|
||||
$minute_extra = null;
|
||||
$second_extra = null;
|
||||
$meridian_extra = null;
|
||||
|
||||
extract($params);
|
||||
|
||||
@@ -41,10 +46,17 @@ function smarty_function_html_select_time($params, &$smarty)
|
||||
$hours[$i] = sprintf('%02d', $hours[$i]);
|
||||
$html_result .= '<select name=';
|
||||
if (null !== $field_array) {
|
||||
$html_result .= '"' . $field_array . '[' . $prefix . 'Hour]">'."\n";
|
||||
$html_result .= '"' . $field_array . '[' . $prefix . 'Hour]"';
|
||||
} else {
|
||||
$html_result .= '"' . $prefix . 'Hour">'."\n";
|
||||
$html_result .= '"' . $prefix . 'Hour"';
|
||||
}
|
||||
if (null !== $hour_extra){
|
||||
$html_result .= ' ' . $hour_extra;
|
||||
}
|
||||
if (null !== $all_extra){
|
||||
$html_result .= ' ' . $all_extra;
|
||||
}
|
||||
$html_result .= '>'."\n";
|
||||
$html_result .= smarty_function_html_options(array('output' => $hours,
|
||||
'values' => $hours,
|
||||
'selected' => strftime($hour_fmt, $time),
|
||||
@@ -60,10 +72,18 @@ function smarty_function_html_select_time($params, &$smarty)
|
||||
$selected = intval(floor(strftime('%M', $time) / $minute_interval) * $minute_interval);
|
||||
$html_result .= '<select name=';
|
||||
if (null !== $field_array) {
|
||||
$html_result .= '"' . $field_array . '[' . $prefix . 'Minute]">'."\n";
|
||||
$html_result .= '"' . $field_array . '[' . $prefix . 'Minute]"';
|
||||
} else {
|
||||
$html_result .= '"' . $prefix . 'Minute">'."\n";
|
||||
$html_result .= '"' . $prefix . 'Minute"';
|
||||
}
|
||||
if (null !== $minute_extra){
|
||||
$html_result .= ' ' . $minute_extra;
|
||||
}
|
||||
if (null !== $all_extra){
|
||||
$html_result .= ' ' . $all_extra;
|
||||
}
|
||||
$html_result .= '>'."\n";
|
||||
|
||||
$html_result .= smarty_function_html_options(array('output' => $minutes,
|
||||
'values' => $minutes,
|
||||
'selected' => $selected,
|
||||
@@ -79,10 +99,19 @@ function smarty_function_html_select_time($params, &$smarty)
|
||||
$selected = intval(floor(strftime('%S', $time) / $second_interval) * $second_interval);
|
||||
$html_result .= '<select name=';
|
||||
if (null !== $field_array) {
|
||||
$html_result .= '"' . $field_array . '[' . $prefix . 'Second]">'."\n";
|
||||
$html_result .= '"' . $field_array . '[' . $prefix . 'Second]"';
|
||||
} else {
|
||||
$html_result .= '"' . $prefix . 'Second">'."\n";
|
||||
$html_result .= '"' . $prefix . 'Second"';
|
||||
}
|
||||
|
||||
if (null !== $second_extra){
|
||||
$html_result .= ' ' . $second_extra;
|
||||
}
|
||||
if (null !== $all_extra){
|
||||
$html_result .= ' ' . $all_extra;
|
||||
}
|
||||
$html_result .= '>'."\n";
|
||||
|
||||
$html_result .= smarty_function_html_options(array('output' => $seconds,
|
||||
'values' => $seconds,
|
||||
'selected' => $selected,
|
||||
@@ -94,10 +123,19 @@ function smarty_function_html_select_time($params, &$smarty)
|
||||
if ($display_meridian && !$use_24_hours) {
|
||||
$html_result .= '<select name=';
|
||||
if (null !== $field_array) {
|
||||
$html_result .= '"' . $field_array . '[' . $prefix . 'Meridian]">'."\n";
|
||||
$html_result .= '"' . $field_array . '[' . $prefix . 'Meridian]"';
|
||||
} else {
|
||||
$html_result .= '"' . $prefix . 'Meridian">'."\n";
|
||||
$html_result .= '"' . $prefix . 'Meridian"';
|
||||
}
|
||||
|
||||
if (null !== $meridian_extra){
|
||||
$html_result .= ' ' . $meridian_extra;
|
||||
}
|
||||
if (null !== $all_extra){
|
||||
$html_result .= ' ' . $all_extra;
|
||||
}
|
||||
$html_result .= '>'."\n";
|
||||
|
||||
$html_result .= smarty_function_html_options(array('output' => array('AM', 'PM'),
|
||||
'values' => array('am', 'pm'),
|
||||
'selected' => strtolower(strftime('%p', $time)),
|
||||
|
Reference in New Issue
Block a user