aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/functions.inc.php56
1 files changed, 56 insertions, 0 deletions
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]));
+ }
+}
?>