diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-03-09 21:37:10 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-03-09 21:37:10 -0400 |
commit | c870508923f62e90a81fe39d923d7776dd1e9634 (patch) | |
tree | f0c8966fe226b5c48730c29d3eaefb51a9010b8b /app/Core/Helper.php | |
parent | 732899564517c6efd9ef965f3f843309a222ce50 (diff) |
Add user timetables
Diffstat (limited to 'app/Core/Helper.php')
-rw-r--r-- | app/Core/Helper.php | 49 |
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')); + } } |