12 require_once(SMARTY_PLUGINS_DIR .
'shared.escape_special_chars.php');
16 require_once(SMARTY_PLUGINS_DIR .
'shared.make_timestamp.php');
57 static $_month_timestamps = null;
58 static $_current_year = null;
59 if ($_month_timestamps === null) {
60 $_current_year = date(
'Y');
61 $_month_timestamps = array();
62 for (
$i = 1;
$i <= 12;
$i++) {
63 $_month_timestamps[
$i] = mktime(0, 0, 0,
$i, 1, 2000);
72 $display_months =
true;
73 $display_years =
true;
76 $month_value_format =
"%m";
79 $day_value_format =
"%d";
80 $year_as_text =
false;
82 $reverse_years =
false;
101 $field_order =
'MDY';
103 $field_separator =
"\n";
104 $option_separator =
"\n";
116 foreach ($params as $_key => $_value) {
119 if (!is_array($_value) && $_value !== null) {
125 if (is_array($_value) && count($_value) == 12) {
128 trigger_error(
"html_select_date: month_names must be an array of 12 strings", E_USER_NOTICE);
137 case 'day_value_format':
139 case 'month_value_format':
148 case 'field_separator':
149 case 'option_separator':
158 $$_key = (string)$_value;
162 case 'display_months':
163 case 'display_years':
165 case 'reverse_years':
166 $$_key = (bool)$_value;
170 if (!is_array($_value)) {
171 $extra_attrs .=
' ' . $_key .
'="' . smarty_function_escape_special_chars($_value) .
'"';
173 trigger_error(
"html_select_date: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
181 if (isset($params[
'time']) && is_array($params[
'time'])) {
182 if (isset($params[
'time'][$prefix .
'Year'])) {
184 foreach (array(
'Y' =>
'Year',
'm' =>
'Month',
'd' =>
'Day') as $_elementKey => $_elementName) {
185 $_variableName =
'_' . strtolower($_elementName);
186 $$_variableName = isset($params[
'time'][$prefix . $_elementName])
187 ? $params[
'time'][$prefix . $_elementName]
188 : date($_elementKey);
190 $time = mktime(0, 0, 0, $_month, $_day, $_year);
191 }
elseif (isset($params[
'time'][$field_array][$prefix .
'Year'])) {
193 foreach (array(
'Y' =>
'Year',
'm' =>
'Month',
'd' =>
'Day') as $_elementKey => $_elementName) {
194 $_variableName =
'_' . strtolower($_elementName);
195 $$_variableName = isset($params[
'time'][$field_array][$prefix . $_elementName])
196 ? $params[
'time'][$field_array][$prefix . $_elementName]
197 : date($_elementKey);
199 $time = mktime(0, 0, 0, $_month, $_day, $_year);
202 list($_year, $_month, $_day) = $time = explode(
'-', date(
'Y-m-d'));
204 }
elseif ($time === null) {
205 if (array_key_exists(
'time', $params)) {
206 $_year = $_month = $_day = $time = null;
208 list($_year, $_month, $_day) = $time = explode(
'-', date(
'Y-m-d'));
211 list($_year, $_month, $_day) = $time = explode(
'-', date(
'Y-m-d', $time));
216 foreach (array(
'start',
'end') as $key) {
220 $$key = (int)$_current_year;
221 }
else if ($t[0] ==
'+') {
222 $$key = (int)($_current_year + trim(substr($t, 1)));
223 }
else if ($t[0] ==
'-') {
224 $$key = (int)($_current_year - trim(substr($t, 1)));
231 if (($start_year > $end_year && !$reverse_years) || ($start_year < $end_year && $reverse_years)) {
233 $end_year = $start_year;
238 if ($display_years) {
241 $_name = $field_array ? ($field_array .
'[' . $prefix .
'Year]') : ($prefix .
'Year');
243 $_extra .=
' ' . $all_extra;
246 $_extra .=
' ' . $year_extra;
250 $_html_years =
'<input type="text" name="' . $_name .
'" value="' . $_year .
'" size="4" maxlength="4"' . $_extra . $extra_attrs .
' />';
252 $_html_years =
'<select name="' . $_name .
'"';
253 if ($year_id !== null || $all_id !== null) {
254 $_html_years .=
' id="' . smarty_function_escape_special_chars(
255 $year_id !== null ? ( $year_id ? $year_id : $_name ) : ( $all_id ? ($all_id . $_name) : $_name )
259 $_html_years .=
' size="' . $year_size .
'"';
261 $_html_years .= $_extra . $extra_attrs .
'>' . $option_separator;
263 if (isset($year_empty) || isset($all_empty)) {
264 $_html_years .=
'<option value="">' . ( isset($year_empty) ? $year_empty : $all_empty ) .
'</option>' . $option_separator;
267 $op = $start_year > $end_year ? -1 : 1;
268 for (
$i=$start_year; $op > 0 ? $i <= $end_year : $i >= $end_year;
$i += $op) {
269 $_html_years .=
'<option value="' .
$i .
'"'
270 . ($_year ==
$i ?
' selected="selected"' :
'')
271 .
'>' .
$i .
'</option>' . $option_separator;
274 $_html_years .=
'</select>';
279 if ($display_months) {
282 $_name = $field_array ? ($field_array .
'[' . $prefix .
'Month]') : ($prefix .
'Month');
284 $_extra .=
' ' . $all_extra;
287 $_extra .=
' ' . $month_extra;
290 $_html_months =
'<select name="' . $_name .
'"';
291 if ($month_id !== null || $all_id !== null) {
292 $_html_months .=
' id="' . smarty_function_escape_special_chars(
293 $month_id !== null ? ( $month_id ? $month_id : $_name ) : ( $all_id ? ($all_id . $_name) : $_name )
297 $_html_months .=
' size="' . $month_size .
'"';
299 $_html_months .= $_extra . $extra_attrs .
'>' . $option_separator;
301 if (isset($month_empty) || isset($all_empty)) {
302 $_html_months .=
'<option value="">' . ( isset($month_empty) ? $month_empty : $all_empty ) .
'</option>' . $option_separator;
305 for (
$i = 1;
$i <= 12;
$i++) {
306 $_val = sprintf(
'%02d',
$i);
307 $_text = isset($month_names) ? smarty_function_escape_special_chars($month_names[
$i]) : ($month_format ==
"%m" ? $_val : strftime($month_format, $_month_timestamps[$i]));
308 $_value = $month_value_format ==
"%m" ? $_val : strftime($month_value_format, $_month_timestamps[$i]);
309 $_html_months .=
'<option value="' . $_value .
'"'
310 . ($_val == $_month ?
' selected="selected"' :
'')
311 .
'>' . $_text .
'</option>' . $option_separator;
314 $_html_months .=
'</select>';
321 $_name = $field_array ? ($field_array .
'[' . $prefix .
'Day]') : ($prefix .
'Day');
323 $_extra .=
' ' . $all_extra;
326 $_extra .=
' ' . $day_extra;
329 $_html_days =
'<select name="' . $_name .
'"';
330 if ($day_id !== null || $all_id !== null) {
331 $_html_days .=
' id="' . smarty_function_escape_special_chars(
332 $day_id !== null ? ( $day_id ? $day_id : $_name ) : ( $all_id ? ($all_id . $_name) : $_name )
336 $_html_days .=
' size="' . $day_size .
'"';
338 $_html_days .= $_extra . $extra_attrs .
'>' . $option_separator;
340 if (isset($day_empty) || isset($all_empty)) {
341 $_html_days .=
'<option value="">' . ( isset($day_empty) ? $day_empty : $all_empty ) .
'</option>' . $option_separator;
344 for (
$i = 1;
$i <= 31;
$i++) {
345 $_val = sprintf(
'%02d',
$i);
346 $_text = $day_format ==
'%02d' ? $_val : sprintf($day_format,
$i);
347 $_value = $day_value_format ==
'%02d' ? $_val : sprintf($day_value_format,
$i);
348 $_html_days .=
'<option value="' . $_value .
'"'
349 . ($_val == $_day ?
' selected="selected"' :
'')
350 .
'>' . $_text .
'</option>' . $option_separator;
353 $_html_days .=
'</select>';
358 for (
$i=0;
$i <= 2;
$i++) {
359 switch ($field_order[
$i]) {
362 if (isset($_html_years)) {
364 $_html .= $field_separator;
366 $_html .= $_html_years;
372 if (isset($_html_months)) {
374 $_html .= $field_separator;
376 $_html .= $_html_months;
382 if (isset($_html_days)) {
384 $_html .= $field_separator;
386 $_html .= $_html_days;
smarty_function_html_select_date($params, $template)
smarty_make_timestamp($string)
Function: smarty_make_timestamp Purpose: used by other smarty functions to make a timestamp from a s...
if(strlen($date2)== '10') if($type== 'users-by-age'&&a_priv('admin_users', true)) elseif($type== 'forums-count'&&a_priv('admin_content', true)) elseif($type== 'forums-categories'&&a_priv('admin_content', true)) elseif($type== 'users-count'&&a_priv('admin_users', true)) elseif($type== 'product-categories'&&a_priv('admin_products', true)) elseif($type== 'users-by-sex'&&a_priv('admin_users', true)) elseif($type== 'users-by-country'&&a_priv('admin_users', true)) elseif($type== 'sales'&&a_priv('admin_sales', true))