From 8549bee38a9c7d1ace16bc99c292e7a66c125eba Mon Sep 17 00:00:00 2001 From: plegall Date: Mon, 11 Apr 2005 20:31:50 +0000 Subject: - functions get_day_list and get_month_list moved from search.php to include/functions.inc.php : these functions are now also used in admin/element_set_global.php - elements batch management improved : ability to set the number of elements to display per line, ability to set {author, name, creation date} fields, ability to add and remove keywords, ability to take selected elements out of caddie git-svn-id: http://piwigo.org/svn/trunk@762 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/functions.inc.php | 56 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) (limited to 'include/functions.inc.php') diff --git a/include/functions.inc.php b/include/functions.inc.php index 282c196ac..d3fd3aee9 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -639,4 +639,60 @@ function array_from_query($query, $fieldname) return $array; } + +/** + * instantiate number list for days in a template block + * + * @param string blockname + * @param string selection + */ +function get_day_list($blockname, $selection) +{ + global $template; + + $template->assign_block_vars( + $blockname, array('SELECTED' => '', 'VALUE' => 0, 'OPTION' => '--')); + + for ($i = 1; $i <= 31; $i++) + { + $selected = ''; + if ($i == (int)$selection) + { + $selected = 'selected="selected"'; + } + $template->assign_block_vars( + $blockname, array('SELECTED' => $selected, + 'VALUE' => $i, + 'OPTION' => str_pad($i, 2, '0', STR_PAD_LEFT))); + } +} + +/** + * instantiate month list in a template block + * + * @param string blockname + * @param string selection + */ +function get_month_list($blockname, $selection) +{ + global $template, $lang; + + $template->assign_block_vars( + $blockname, array('SELECTED' => '', + 'VALUE' => 0, + 'OPTION' => '------------')); + + for ($i = 1; $i <= 12; $i++) + { + $selected = ''; + if ($i == (int)$selection) + { + $selected = 'selected="selected"'; + } + $template->assign_block_vars( + $blockname, array('SELECTED' => $selected, + 'VALUE' => $i, + 'OPTION' => $lang['month'][$i])); + } +} ?> -- cgit v1.2.3