added paramters to html_select_time plugin

This commit is contained in:
mohrt
2002-07-29 14:21:54 +00:00
parent 9e1dd75228
commit df2a5888a8
4 changed files with 135 additions and 16 deletions

3
NEWS
View File

@@ -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, - update debug console to print objects (Simon Willison,
Monte) Monte)
- fix Config_File class to not error when there are no - fix Config_File class to not error when there are no

View File

@@ -3480,6 +3480,46 @@ OUTPUT: (current year is 2000)
<entry>n/a</entry> <entry>n/a</entry>
<entry>outputs values to array of this name</entry> <entry>outputs values to array of this name</entry>
</row> </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> </tbody>
</tgroup> </tgroup>
</informaltable> </informaltable>

View File

@@ -27,6 +27,11 @@ function smarty_function_html_select_time($params, &$smarty)
"birthday[Minute]", "birthday[Seconds]" & "birthday[Meridian]". "birthday[Minute]", "birthday[Seconds]" & "birthday[Meridian]".
Can be combined with prefix. */ Can be combined with prefix. */
$field_array = null; $field_array = null;
$all_extra = null;
$hour_extra = null;
$minute_extra = null;
$second_extra = null;
$meridian_extra = null;
extract($params); extract($params);
@@ -41,10 +46,17 @@ function smarty_function_html_select_time($params, &$smarty)
$hours[$i] = sprintf('%02d', $hours[$i]); $hours[$i] = sprintf('%02d', $hours[$i]);
$html_result .= '<select name='; $html_result .= '<select name=';
if (null !== $field_array) { if (null !== $field_array) {
$html_result .= '"' . $field_array . '[' . $prefix . 'Hour]">'."\n"; $html_result .= '"' . $field_array . '[' . $prefix . 'Hour]"';
} else { } 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, $html_result .= smarty_function_html_options(array('output' => $hours,
'values' => $hours, 'values' => $hours,
'selected' => strftime($hour_fmt, $time), '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); $selected = intval(floor(strftime('%M', $time) / $minute_interval) * $minute_interval);
$html_result .= '<select name='; $html_result .= '<select name=';
if (null !== $field_array) { if (null !== $field_array) {
$html_result .= '"' . $field_array . '[' . $prefix . 'Minute]">'."\n"; $html_result .= '"' . $field_array . '[' . $prefix . 'Minute]"';
} else { } 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, $html_result .= smarty_function_html_options(array('output' => $minutes,
'values' => $minutes, 'values' => $minutes,
'selected' => $selected, 'selected' => $selected,
@@ -79,10 +99,19 @@ function smarty_function_html_select_time($params, &$smarty)
$selected = intval(floor(strftime('%S', $time) / $second_interval) * $second_interval); $selected = intval(floor(strftime('%S', $time) / $second_interval) * $second_interval);
$html_result .= '<select name='; $html_result .= '<select name=';
if (null !== $field_array) { if (null !== $field_array) {
$html_result .= '"' . $field_array . '[' . $prefix . 'Second]">'."\n"; $html_result .= '"' . $field_array . '[' . $prefix . 'Second]"';
} else { } 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, $html_result .= smarty_function_html_options(array('output' => $seconds,
'values' => $seconds, 'values' => $seconds,
'selected' => $selected, 'selected' => $selected,
@@ -94,10 +123,19 @@ function smarty_function_html_select_time($params, &$smarty)
if ($display_meridian && !$use_24_hours) { if ($display_meridian && !$use_24_hours) {
$html_result .= '<select name='; $html_result .= '<select name=';
if (null !== $field_array) { if (null !== $field_array) {
$html_result .= '"' . $field_array . '[' . $prefix . 'Meridian]">'."\n"; $html_result .= '"' . $field_array . '[' . $prefix . 'Meridian]"';
} else { } 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'), $html_result .= smarty_function_html_options(array('output' => array('AM', 'PM'),
'values' => array('am', 'pm'), 'values' => array('am', 'pm'),
'selected' => strtolower(strftime('%p', $time)), 'selected' => strtolower(strftime('%p', $time)),

View File

@@ -27,6 +27,11 @@ function smarty_function_html_select_time($params, &$smarty)
"birthday[Minute]", "birthday[Seconds]" & "birthday[Meridian]". "birthday[Minute]", "birthday[Seconds]" & "birthday[Meridian]".
Can be combined with prefix. */ Can be combined with prefix. */
$field_array = null; $field_array = null;
$all_extra = null;
$hour_extra = null;
$minute_extra = null;
$second_extra = null;
$meridian_extra = null;
extract($params); extract($params);
@@ -41,10 +46,17 @@ function smarty_function_html_select_time($params, &$smarty)
$hours[$i] = sprintf('%02d', $hours[$i]); $hours[$i] = sprintf('%02d', $hours[$i]);
$html_result .= '<select name='; $html_result .= '<select name=';
if (null !== $field_array) { if (null !== $field_array) {
$html_result .= '"' . $field_array . '[' . $prefix . 'Hour]">'."\n"; $html_result .= '"' . $field_array . '[' . $prefix . 'Hour]"';
} else { } 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, $html_result .= smarty_function_html_options(array('output' => $hours,
'values' => $hours, 'values' => $hours,
'selected' => strftime($hour_fmt, $time), '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); $selected = intval(floor(strftime('%M', $time) / $minute_interval) * $minute_interval);
$html_result .= '<select name='; $html_result .= '<select name=';
if (null !== $field_array) { if (null !== $field_array) {
$html_result .= '"' . $field_array . '[' . $prefix . 'Minute]">'."\n"; $html_result .= '"' . $field_array . '[' . $prefix . 'Minute]"';
} else { } 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, $html_result .= smarty_function_html_options(array('output' => $minutes,
'values' => $minutes, 'values' => $minutes,
'selected' => $selected, 'selected' => $selected,
@@ -79,10 +99,19 @@ function smarty_function_html_select_time($params, &$smarty)
$selected = intval(floor(strftime('%S', $time) / $second_interval) * $second_interval); $selected = intval(floor(strftime('%S', $time) / $second_interval) * $second_interval);
$html_result .= '<select name='; $html_result .= '<select name=';
if (null !== $field_array) { if (null !== $field_array) {
$html_result .= '"' . $field_array . '[' . $prefix . 'Second]">'."\n"; $html_result .= '"' . $field_array . '[' . $prefix . 'Second]"';
} else { } 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, $html_result .= smarty_function_html_options(array('output' => $seconds,
'values' => $seconds, 'values' => $seconds,
'selected' => $selected, 'selected' => $selected,
@@ -94,10 +123,19 @@ function smarty_function_html_select_time($params, &$smarty)
if ($display_meridian && !$use_24_hours) { if ($display_meridian && !$use_24_hours) {
$html_result .= '<select name='; $html_result .= '<select name=';
if (null !== $field_array) { if (null !== $field_array) {
$html_result .= '"' . $field_array . '[' . $prefix . 'Meridian]">'."\n"; $html_result .= '"' . $field_array . '[' . $prefix . 'Meridian]"';
} else { } 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'), $html_result .= smarty_function_html_options(array('output' => array('AM', 'PM'),
'values' => array('am', 'pm'), 'values' => array('am', 'pm'),
'selected' => strtolower(strftime('%p', $time)), 'selected' => strtolower(strftime('%p', $time)),