summaryrefslogtreecommitdiff
path: root/app/Core
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-03-09 21:37:10 -0400
committerFrederic Guillot <fred@kanboard.net>2015-03-09 21:37:10 -0400
commitc870508923f62e90a81fe39d923d7776dd1e9634 (patch)
treef0c8966fe226b5c48730c29d3eaefb51a9010b8b /app/Core
parent732899564517c6efd9ef965f3f843309a222ce50 (diff)
Add user timetables
Diffstat (limited to 'app/Core')
-rw-r--r--app/Core/Helper.php49
1 files changed, 49 insertions, 0 deletions
diff --git a/app/Core/Helper.php b/app/Core/Helper.php
index 01ebb08f..78267feb 100644
--- a/app/Core/Helper.php
+++ b/app/Core/Helper.php
@@ -677,4 +677,53 @@ class Helper
array('task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id'], 'redirect' => $redirect)
);
}
+
+ /**
+ * Get all hours for day
+ *
+ * @access public
+ * @return array
+ */
+ public function getDayHours()
+ {
+ $values = array();
+
+ foreach (range(0, 23) as $hour) {
+ foreach (array(0, 30) as $minute) {
+ $time = sprintf('%02d:%02d', $hour, $minute);
+ $values[$time] = $time;
+ }
+ }
+
+ return $values;
+ }
+
+ /**
+ * Get all days of a week
+ *
+ * @access public
+ * @return array
+ */
+ public function getWeekDays()
+ {
+ $values = array();
+
+ foreach (range(1, 7) as $day) {
+ $values[$day] = $this->getWeekDay($day);
+ }
+
+ return $values;
+ }
+
+ /**
+ * Get the localized day name from the day number
+ *
+ * @access public
+ * @param integer $day Day number
+ * @return string
+ */
+ public function getWeekDay($day)
+ {
+ return dt('%A', strtotime('next Monday +'.($day - 1).' days'));
+ }
}