summaryrefslogtreecommitdiff
path: root/includes/view/ShiftEntry_view.php
diff options
context:
space:
mode:
authormsquare <msquare@notrademark.de>2017-12-19 20:58:01 +0100
committermsquare <msquare@notrademark.de>2017-12-19 20:58:01 +0100
commitfd85034e7f2277730f4ea4de49dade6d125832dd (patch)
tree54017bb754302b578838479d8f4d68f4a92010dd /includes/view/ShiftEntry_view.php
parent567ed9ebd2603a5deb9c171b4d969f7188414794 (diff)
redo shift signoff and icons for delete/confirm/acknowledgment questions
Diffstat (limited to 'includes/view/ShiftEntry_view.php')
-rw-r--r--includes/view/ShiftEntry_view.php71
1 files changed, 71 insertions, 0 deletions
diff --git a/includes/view/ShiftEntry_view.php b/includes/view/ShiftEntry_view.php
index 2e638df6..6dceac10 100644
--- a/includes/view/ShiftEntry_view.php
+++ b/includes/view/ShiftEntry_view.php
@@ -1,6 +1,77 @@
<?php
/**
+ * Sign off from an user from a shift with admin permissions, asking for ack.
+ *
+ * @param array $shiftEntry
+ * @param array $shift
+ * @param array $angeltype
+ * @param array $signoff_user
+ *
+ * @return string HTML
+ */
+function ShiftEntry_delete_view_admin($shiftEntry, $shift, $angeltype, $signoff_user) {
+ return page_with_title(ShiftEntry_delete_title(), [
+ info(sprintf(
+ _('Do you want to sign off %s from shift %s from %s to %s as %s?'),
+ User_Nick_render($signoff_user),
+ $shift['name'],
+ date('Y-m-d H:i', $shift['start']),
+ date('Y-m-d H:i', $shift['end']),
+ $angeltype['name']
+ ), true),
+ buttons([
+ button(user_link($signoff_user), glyph('remove') . _('cancel')),
+ button(ShiftEntry_delete_link($shiftEntry, ['continue' => 1]), glyph('ok') . _('delete'), 'btn-danger')
+ ])
+ ]);
+}
+
+/**
+ * Sign off from a shift, asking for ack.
+ *
+ * @param array $shiftEntry
+ * @param array $shift
+ * @param array $angeltype
+ * @param array $signoff_user
+ *
+ * @return string HTML
+ */
+function ShiftEntry_delete_view($shiftEntry, $shift, $angeltype, $signoff_user) {
+ return page_with_title(ShiftEntry_delete_title(), [
+ info(sprintf(
+ _('Do you want to sign off from your shift %s from %s to %s as %s?'),
+ $shift['name'],
+ date('Y-m-d H:i', $shift['start']),
+ date('Y-m-d H:i', $shift['end']),
+ $angeltype['name']
+ ), true),
+ buttons([
+ button(user_link($signoff_user), glyph('remove') . _('cancel')),
+ button(ShiftEntry_delete_link($shiftEntry, ['continue' => 1]), glyph('ok') . _('delete'), 'btn-danger')
+ ])
+ ]);
+}
+
+/**
+ * Link to delete a shift entry.
+ * @param array $shiftEntry
+ *
+ * @return string URL
+ */
+function ShiftEntry_delete_link($shiftEntry, $params = []) {
+ $params = array_merge(['entry_id' => $shiftEntry['id']], $params);
+ return page_link_to('user_shifts', $params);
+}
+
+/**
+ * Title for deleting a shift entry.
+ */
+function ShiftEntry_delete_title() {
+ return _('Shift sign off');
+}
+
+/**
* Display form for adding/editing a shift entry.
*
* @param string $angel