summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
Diffstat (limited to 'includes')
-rw-r--r--includes/model/ShiftSignupState.php5
-rw-r--r--includes/model/Shifts_model.php4
-rw-r--r--includes/view/ShiftCalendarShiftRenderer.php5
-rw-r--r--includes/view/Shifts_view.php7
4 files changed, 21 insertions, 0 deletions
diff --git a/includes/model/ShiftSignupState.php b/includes/model/ShiftSignupState.php
index 8d588de3..a2618cf1 100644
--- a/includes/model/ShiftSignupState.php
+++ b/includes/model/ShiftSignupState.php
@@ -39,6 +39,11 @@ class ShiftSignupState
const SHIFT_ENDED = 'SHIFT_ENDED';
/**
+ * Shift is not available yet
+ */
+ const NOT_YET = 'NOT_YET';
+
+ /**
* User is already signed up
*/
const SIGNED_UP = 'SIGNED_UP';
diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php
index 6f422c32..6bb17cf2 100644
--- a/includes/model/Shifts_model.php
+++ b/includes/model/Shifts_model.php
@@ -325,6 +325,10 @@ function Shift_signup_allowed_angel(
return new ShiftSignupState(ShiftSignupState::NOT_ARRIVED, $free_entries);
}
+ if (config('signup_advance_hours') && $shift['start'] > time() + config('signup_advance_hours') * 3600) {
+ return new ShiftSignupState(ShiftSignupState::NOT_YET, $free_entries);
+ }
+
if (empty($user_shifts)) {
$user_shifts = Shifts_by_user($user->id);
}
diff --git a/includes/view/ShiftCalendarShiftRenderer.php b/includes/view/ShiftCalendarShiftRenderer.php
index 3f427ea0..ac206ad0 100644
--- a/includes/view/ShiftCalendarShiftRenderer.php
+++ b/includes/view/ShiftCalendarShiftRenderer.php
@@ -74,6 +74,7 @@ class ShiftCalendarShiftRenderer
return 'primary';
case ShiftSignupState::NOT_ARRIVED:
+ case ShiftSignupState::NOT_YET:
case ShiftSignupState::SHIFT_ENDED:
return 'default';
@@ -203,6 +204,10 @@ class ShiftCalendarShiftRenderer
$entry_list[] = $inner_text . ' (' . __('please arrive for signup') . ')';
break;
+ case ShiftSignupState::NOT_YET:
+ $entry_list[] = $inner_text . '(' . _('not yet') . ')';
+ break;
+
case ShiftSignupState::ANGELTYPE:
if ($angeltype['restricted'] == 1) {
// User has to be confirmed on the angeltype first
diff --git a/includes/view/Shifts_view.php b/includes/view/Shifts_view.php
index 2e7bfa4b..01dc1561 100644
--- a/includes/view/Shifts_view.php
+++ b/includes/view/Shifts_view.php
@@ -129,6 +129,13 @@ function Shift_view($shift, $shifttype, $room, $angeltypes_source, ShiftSignupSt
$content[] = info(__('You are signed up for this shift.'), true);
}
+ if (config('signup_advance_hours') && $shift['start'] > time() + config('signup_advance_hours') * 3600) {
+ $content[] = info(sprintf(
+ _('This shift is in the far future and becomes available for signup at %s.'),
+ date(_('Y-m-d') . ' H:i', $shift['start'] - config('signup_advance_hours') * 3600)
+ ), true);
+ }
+
$buttons = [];
if ($shift_admin || $admin_shifttypes || $admin_rooms) {
$buttons = [