summaryrefslogtreecommitdiff
path: root/includes/sys_page.php
diff options
context:
space:
mode:
authormsquare <msquare@notrademark.de>2016-10-03 18:32:25 +0200
committermsquare <msquare@notrademark.de>2016-10-03 18:32:25 +0200
commitf3a0ce865deb9603b77adc9c9237a55cd4d87eeb (patch)
tree2fb5cc4658fd8ff9b379c2bb6227e8bf8c9a7f37 /includes/sys_page.php
parent09c931dcf585da440879c52bb32b5eb9ef0fb9b4 (diff)
move sql queries from shifts controller to model
Diffstat (limited to 'includes/sys_page.php')
-rw-r--r--includes/sys_page.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/includes/sys_page.php b/includes/sys_page.php
index 27e3e8ba..e62909ab 100644
--- a/includes/sys_page.php
+++ b/includes/sys_page.php
@@ -19,6 +19,24 @@ function raw_output($output) {
}
/**
+ * Helper function for transforming list of entities into array for select boxes.
+ *
+ * @param array $data
+ * The data array
+ * @param string $key_name
+ * name of the column to use as id/key
+ * @param string $value_name
+ * name of the column to use as displayed value
+ */
+function select_array($data, $key_name, $value_name) {
+ $ret = [];
+ foreach ($data as $value) {
+ $ret[$value[$key_name]] = $value[$value_name];
+ }
+ return $ret;
+}
+
+/**
* Returns an int[] from given request param name.
*
* @param String $name