summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormsquare <msquare@notrademark.de>2017-12-20 23:05:46 +0100
committermsquare <msquare@notrademark.de>2017-12-20 23:05:46 +0100
commit2c04e35bed483dfe31eda465345602a117054f44 (patch)
treed9b0fd897ae91b4e3a11010e79715b28c0d8ee8c
parent7a3bdda483be2a32cc67bcf97b246edcb48c124e (diff)
introduce new shift signup state for not arrived angels
-rw-r--r--includes/controller/shift_entries_controller.php2
-rw-r--r--includes/model/ShiftSignupState.php8
-rw-r--r--includes/model/Shifts_model.php2
-rw-r--r--includes/view/ShiftCalendarShiftRenderer.php8
4 files changed, 17 insertions, 3 deletions
diff --git a/includes/controller/shift_entries_controller.php b/includes/controller/shift_entries_controller.php
index 96967b1e..9ea25a79 100644
--- a/includes/controller/shift_entries_controller.php
+++ b/includes/controller/shift_entries_controller.php
@@ -191,6 +191,8 @@ function shift_entry_error_message(ShiftSignupState $shift_signup_state) {
error(_('This shift is already occupied.'));
} elseif ($shift_signup_state->getState() == ShiftSignupState::SHIFT_ENDED) {
error(_('This shift ended already.'));
+ } elseif ($shift_signup_state->getState() == ShiftSignupState::NOT_ARRIVED) {
+ error(_('You are not marked as arrived.'));
} elseif ($shift_signup_state->getState() == ShiftSignupState::SIGNED_UP) {
error(_('You are signed up for this shift.'));
}
diff --git a/includes/model/ShiftSignupState.php b/includes/model/ShiftSignupState.php
index 9b3de496..1ab7c362 100644
--- a/includes/model/ShiftSignupState.php
+++ b/includes/model/ShiftSignupState.php
@@ -42,7 +42,12 @@ class ShiftSignupState
* User is already signed up
*/
const SIGNED_UP = 'SIGNED_UP';
-
+
+ /**
+ * User has to be arrived
+ */
+ const NOT_ARRIVED = 'NOT_ARRIVED';
+
/** @var string */
private $state;
@@ -83,6 +88,7 @@ class ShiftSignupState
private function valueForState($state)
{
switch ($state) {
+ case ShiftSignupState::NOT_ARRIVED:
case ShiftSignupState::SHIFT_ENDED:
return 100;
diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php
index f3bb042a..ad64e9b9 100644
--- a/includes/model/Shifts_model.php
+++ b/includes/model/Shifts_model.php
@@ -312,7 +312,7 @@ function Shift_signup_allowed_angel(
$free_entries = Shift_free_entries($needed_angeltype, $shift_entries);
if (config('signup_requires_arrival') && !$user['Gekommen']) {
- return new ShiftSignupState(ShiftSignupState::SHIFT_ENDED, $free_entries);
+ return new ShiftSignupState(ShiftSignupState::NOT_ARRIVED, $free_entries);
}
if ($user_shifts == null) {
diff --git a/includes/view/ShiftCalendarShiftRenderer.php b/includes/view/ShiftCalendarShiftRenderer.php
index 74b36bc3..61e3ecec 100644
--- a/includes/view/ShiftCalendarShiftRenderer.php
+++ b/includes/view/ShiftCalendarShiftRenderer.php
@@ -67,6 +67,7 @@ class ShiftCalendarShiftRenderer
case ShiftSignupState::SIGNED_UP:
return 'primary';
+ case ShiftSignupState::NOT_ARRIVED:
case ShiftSignupState::SHIFT_ENDED:
return 'default';
@@ -180,11 +181,16 @@ class ShiftCalendarShiftRenderer
_('Sign up'), 'btn-xs btn-primary'
);
break;
-
+
case ShiftSignupState::SHIFT_ENDED:
// No link and add a text hint, when the shift ended
$entry_list[] = $inner_text . ' (' . _('ended') . ')';
break;
+
+ case ShiftSignupState::NOT_ARRIVED:
+ // No link and add a text hint, when the shift ended
+ $entry_list[] = $inner_text . ' (' . _('not arrived') . ')';
+ break;
case ShiftSignupState::ANGELTYPE:
if ($angeltype['restricted'] == 1) {