summaryrefslogtreecommitdiff
path: root/includes/pages
diff options
context:
space:
mode:
authormsquare <msquare@notrademark.de>2016-11-15 22:00:17 +0100
committermsquare <msquare@notrademark.de>2016-11-15 22:00:17 +0100
commitac53559feac4948fc082b5384d3c0ca897f18cd0 (patch)
tree95add0bef42847a6320409e76e8118c8b8ca0b18 /includes/pages
parent54f3253c32d53bd9642132e45e1c7caab2eae233 (diff)
fix shift calendar headers
Diffstat (limited to 'includes/pages')
-rw-r--r--includes/pages/user_shifts.php30
1 files changed, 16 insertions, 14 deletions
diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php
index e5fd27ef..206a1586 100644
--- a/includes/pages/user_shifts.php
+++ b/includes/pages/user_shifts.php
@@ -37,8 +37,18 @@ function user_shifts() {
* The shiftfilter to update.
*/
function update_ShiftsFilter_timerange(ShiftsFilter $shiftsFilter, $days) {
- $shiftsFilter->setStartTime(check_request_datetime('start_day', 'start_time', $days, time()));
- $shiftsFilter->setEndTime(check_request_datetime('end_day', 'end_time', $days, time() + 24 * 60 * 60));
+ $start_time = $shiftsFilter->getStartTime();
+ if ($start_time == null) {
+ $start_time = time();
+ }
+
+ $end_time = $shiftsFilter->getEndTime();
+ if ($end_time == null) {
+ $end_time = $start_time + 24 * 60 * 60;
+ }
+
+ $shiftsFilter->setStartTime(check_request_datetime('start_day', 'start_time', $days, $start_time));
+ $shiftsFilter->setEndTime(check_request_datetime('end_day', 'end_time', $days, $end_time));
if ($shiftsFilter->getStartTime() > $shiftsFilter->getEndTime()) {
$shiftsFilter->setEndTime($shiftsFilter->getStartTime() + 24 * 60 * 60);
@@ -57,18 +67,10 @@ function update_ShiftsFilter_timerange(ShiftsFilter $shiftsFilter, $days) {
*/
function update_ShiftsFilter(ShiftsFilter $shiftsFilter, $user_shifts_admin, $days) {
$shiftsFilter->setUserShiftsAdmin($user_shifts_admin);
- if (isset($_REQUEST['filled'])) {
- $shiftsFilter->setFilled(check_request_int_array('filled'));
- }
- if (isset($_REQUEST['rooms'])) {
- $shiftsFilter->setRooms(check_request_int_array('rooms'));
- }
- if (isset($_REQUEST['types'])) {
- $shiftsFilter->setTypes(check_request_int_array('types'));
- }
- if ((isset($_REQUEST['start_time']) && isset($_REQUEST['start_day']) && isset($_REQUEST['end_time']) && isset($_REQUEST['end_day'])) || $shiftsFilter->getStartTime() == null || $shiftsFilter->getEndTime() == null) {
- update_ShiftsFilter_timerange($shiftsFilter, $days);
- }
+ $shiftsFilter->setFilled(check_request_int_array('filled', $shiftsFilter->getFilled()));
+ $shiftsFilter->setRooms(check_request_int_array('rooms', $shiftsFilter->getRooms()));
+ $shiftsFilter->setTypes(check_request_int_array('types', $shiftsFilter->getTypes()));
+ update_ShiftsFilter_timerange($shiftsFilter, $days);
}
function load_rooms() {