summaryrefslogtreecommitdiff
path: root/includes/view
diff options
context:
space:
mode:
Diffstat (limited to 'includes/view')
-rw-r--r--includes/view/AngelTypes_view.php337
-rw-r--r--includes/view/EventConfig_view.php105
-rw-r--r--includes/view/Questions_view.php33
-rw-r--r--includes/view/Rooms_view.php20
-rw-r--r--includes/view/ShiftCalendarLane.php64
-rw-r--r--includes/view/ShiftCalendarRenderer.php277
-rw-r--r--includes/view/ShiftCalendarShiftRenderer.php162
-rw-r--r--includes/view/ShiftEntry_view.php23
-rw-r--r--includes/view/ShiftTypes_view.php85
-rw-r--r--includes/view/ShiftsFilterRenderer.php47
-rw-r--r--includes/view/Shifts_view.php187
-rw-r--r--includes/view/UserAngelTypes_view.php75
-rw-r--r--includes/view/UserDriverLicenses_view.php17
-rw-r--r--includes/view/UserHintsRenderer.php52
-rw-r--r--includes/view/User_view.php425
15 files changed, 987 insertions, 922 deletions
diff --git a/includes/view/AngelTypes_view.php b/includes/view/AngelTypes_view.php
index 7b20b7dd..bade3664 100644
--- a/includes/view/AngelTypes_view.php
+++ b/includes/view/AngelTypes_view.php
@@ -7,10 +7,11 @@
/**
* Renders the angeltypes name as link.
*
- * @param AngelType $angeltype
+ * @param AngelType $angeltype
*/
-function AngelType_name_render($angeltype) {
- return '<a href="' . angeltype_link($angeltype['id']) . '">' . ($angeltype['restricted'] ? glyph('lock') : '') . $angeltype['name'] . '</a>';
+function AngelType_name_render($angeltype)
+{
+ return '<a href="' . angeltype_link($angeltype['id']) . '">' . ($angeltype['restricted'] ? glyph('lock') : '') . $angeltype['name'] . '</a>';
}
/**
@@ -20,30 +21,32 @@ function AngelType_name_render($angeltype) {
* UserAngelType and AngelType
* @return string
*/
-function AngelType_render_membership($user_angeltype) {
- if ($user_angeltype['user_angeltype_id'] != null) {
- if ($user_angeltype['restricted']) {
- if ($user_angeltype['confirm_user_id'] == null) {
- return glyph('lock') . _("Unconfirmed");
- } elseif ($user_angeltype['supporter']) {
- return glyph_bool(true) . _("supporter");
- }
- return glyph_bool(true) . _("Member");
- } elseif ($user_angeltype['supporter']) {
- return glyph_bool(true) . _("supporter");
+function AngelType_render_membership($user_angeltype)
+{
+ if ($user_angeltype['user_angeltype_id'] != null) {
+ if ($user_angeltype['restricted']) {
+ if ($user_angeltype['confirm_user_id'] == null) {
+ return glyph('lock') . _("Unconfirmed");
+ } elseif ($user_angeltype['supporter']) {
+ return glyph_bool(true) . _("supporter");
+ }
+ return glyph_bool(true) . _("Member");
+ } elseif ($user_angeltype['supporter']) {
+ return glyph_bool(true) . _("supporter");
+ }
+ return glyph_bool(true) . _("Member");
}
- return glyph_bool(true) . _("Member");
- }
- return glyph_bool(false);
+ return glyph_bool(false);
}
-function AngelType_delete_view($angeltype) {
- return page_with_title(sprintf(_("Delete angeltype %s"), $angeltype['name']), [
+function AngelType_delete_view($angeltype)
+{
+ return page_with_title(sprintf(_("Delete angeltype %s"), $angeltype['name']), [
info(sprintf(_("Do you want to delete angeltype %s?"), $angeltype['name']), true),
buttons([
button(page_link_to('angeltypes'), _("cancel"), 'cancel'),
- button(page_link_to('angeltypes') . '&action=delete&angeltype_id=' . $angeltype['id'] . '&confirmed', _("delete"), 'ok')
- ])
+ button(page_link_to('angeltypes') . '&action=delete&angeltype_id=' . $angeltype['id'] . '&confirmed', _("delete"), 'ok')
+ ])
]);
}
@@ -55,11 +58,12 @@ function AngelType_delete_view($angeltype) {
* @param boolean $supporter_mode
* Is the user a supporter of this angeltype?
*/
-function AngelType_edit_view($angeltype, $supporter_mode) {
- $contact_info = AngelType_contact_info($angeltype);
- return page_with_title(sprintf(_("Edit %s"), $angeltype['name']), [
+function AngelType_edit_view($angeltype, $supporter_mode)
+{
+ $contact_info = AngelType_contact_info($angeltype);
+ return page_with_title(sprintf(_("Edit %s"), $angeltype['name']), [
buttons([
- button(page_link_to('angeltypes'), _("Angeltypes"), 'back')
+ button(page_link_to('angeltypes'), _("Angeltypes"), 'back')
]),
msg(),
form([
@@ -73,44 +77,45 @@ function AngelType_edit_view($angeltype, $supporter_mode) {
form_info("", _("Restricted angel types can only be used by an angel if enabled by a supporter (double opt-in).")),
form_textarea('description', _("Description"), $angeltype['description']),
form_info("", _("Please use markdown for the description.")),
- form_submit('submit', _("Save"))
- ])
+ form_submit('submit', _("Save"))
+ ])
]);
}
/**
* Renders the buttons for the angeltype view.
*/
-function AngelType_view_buttons($angeltype, $user_angeltype, $admin_angeltypes, $supporter, $user_driver_license, $user) {
- $buttons = [
- button(page_link_to('angeltypes'), _("Angeltypes"), 'back')
+function AngelType_view_buttons($angeltype, $user_angeltype, $admin_angeltypes, $supporter, $user_driver_license, $user)
+{
+ $buttons = [
+ button(page_link_to('angeltypes'), _("Angeltypes"), 'back')
];
- if ($angeltype['requires_driver_license']) {
- $buttons[] = button(user_driver_license_edit_link($user), glyph("road") . _("my driving license"));
- }
-
- if ($user_angeltype == null) {
- $buttons[] = button(page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'], _("join"), 'add');
- } else {
- if ($angeltype['requires_driver_license'] && $user_driver_license == null) {
- error(_("This angeltype requires a driver license. Please enter your driver license information!"));
+ if ($angeltype['requires_driver_license']) {
+ $buttons[] = button(user_driver_license_edit_link($user), glyph("road") . _("my driving license"));
}
+
+ if ($user_angeltype == null) {
+ $buttons[] = button(page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'], _("join"), 'add');
+ } else {
+ if ($angeltype['requires_driver_license'] && $user_driver_license == null) {
+ error(_("This angeltype requires a driver license. Please enter your driver license information!"));
+ }
- if ($angeltype['restricted'] && $user_angeltype['confirm_user_id'] == null) {
- error(sprintf(_("You are unconfirmed for this angeltype. Please go to the introduction for %s to get confirmed."), $angeltype['name']));
+ if ($angeltype['restricted'] && $user_angeltype['confirm_user_id'] == null) {
+ error(sprintf(_("You are unconfirmed for this angeltype. Please go to the introduction for %s to get confirmed."), $angeltype['name']));
+ }
+ $buttons[] = button(page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $user_angeltype['id'], _("leave"), 'cancel');
}
- $buttons[] = button(page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $user_angeltype['id'], _("leave"), 'cancel');
- }
- if ($admin_angeltypes || $supporter) {
- $buttons[] = button(page_link_to('angeltypes') . '&action=edit&angeltype_id=' . $angeltype['id'], _("edit"), 'edit');
- }
- if ($admin_angeltypes) {
- $buttons[] = button(page_link_to('angeltypes') . '&action=delete&angeltype_id=' . $angeltype['id'], _("delete"), 'delete');
- }
+ if ($admin_angeltypes || $supporter) {
+ $buttons[] = button(page_link_to('angeltypes') . '&action=edit&angeltype_id=' . $angeltype['id'], _("edit"), 'edit');
+ }
+ if ($admin_angeltypes) {
+ $buttons[] = button(page_link_to('angeltypes') . '&action=delete&angeltype_id=' . $angeltype['id'], _("delete"), 'delete');
+ }
- return buttons($buttons);
+ return buttons($buttons);
}
/**
@@ -118,62 +123,64 @@ function AngelType_view_buttons($angeltype, $user_angeltype, $admin_angeltypes,
*
* @return [supporters, members, unconfirmed members]
*/
-function AngelType_view_members($angeltype, $members, $admin_user_angeltypes, $admin_angeltypes) {
- $supporters = [];
- $members_confirmed = [];
- $members_unconfirmed = [];
- foreach ($members as $member) {
- $member['Nick'] = User_Nick_render($member);
+function AngelType_view_members($angeltype, $members, $admin_user_angeltypes, $admin_angeltypes)
+{
+ $supporters = [];
+ $members_confirmed = [];
+ $members_unconfirmed = [];
+ foreach ($members as $member) {
+ $member['Nick'] = User_Nick_render($member);
- if ($angeltype['requires_driver_license']) {
- $member['wants_to_drive'] = glyph_bool($member['user_id']);
- $member['has_car'] = glyph_bool($member['has_car']);
- $member['has_license_car'] = glyph_bool($member['has_license_car']);
- $member['has_license_3_5t_transporter'] = glyph_bool($member['has_license_3_5t_transporter']);
- $member['has_license_7_5t_truck'] = glyph_bool($member['has_license_7_5t_truck']);
- $member['has_license_12_5t_truck'] = glyph_bool($member['has_license_12_5t_truck']);
- $member['has_license_forklift'] = glyph_bool($member['has_license_forklift']);
- }
+ if ($angeltype['requires_driver_license']) {
+ $member['wants_to_drive'] = glyph_bool($member['user_id']);
+ $member['has_car'] = glyph_bool($member['has_car']);
+ $member['has_license_car'] = glyph_bool($member['has_license_car']);
+ $member['has_license_3_5t_transporter'] = glyph_bool($member['has_license_3_5t_transporter']);
+ $member['has_license_7_5t_truck'] = glyph_bool($member['has_license_7_5t_truck']);
+ $member['has_license_12_5t_truck'] = glyph_bool($member['has_license_12_5t_truck']);
+ $member['has_license_forklift'] = glyph_bool($member['has_license_forklift']);
+ }
- if ($angeltype['restricted'] && $member['confirm_user_id'] == null) {
- $member['actions'] = table_buttons([
+ if ($angeltype['restricted'] && $member['confirm_user_id'] == null) {
+ $member['actions'] = table_buttons([
button(page_link_to('user_angeltypes') . '&action=confirm&user_angeltype_id=' . $member['user_angeltype_id'], _("confirm"), 'btn-xs'),
- button(page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $member['user_angeltype_id'], _("deny"), 'btn-xs')
+ button(page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $member['user_angeltype_id'], _("deny"), 'btn-xs')
]);
- $members_unconfirmed[] = $member;
- } elseif ($member['supporter']) {
- if ($admin_angeltypes) {
- $member['actions'] = table_buttons([
- button(page_link_to('user_angeltypes') . '&action=update&user_angeltype_id=' . $member['user_angeltype_id'] . '&supporter=0', _("Remove supporter rights"), 'btn-xs')
+ $members_unconfirmed[] = $member;
+ } elseif ($member['supporter']) {
+ if ($admin_angeltypes) {
+ $member['actions'] = table_buttons([
+ button(page_link_to('user_angeltypes') . '&action=update&user_angeltype_id=' . $member['user_angeltype_id'] . '&supporter=0', _("Remove supporter rights"), 'btn-xs')
]);
- } else {
- $member['actions'] = '';
- }
- $supporters[] = $member;
- } else {
- if ($admin_user_angeltypes) {
- $member['actions'] = table_buttons([
+ } else {
+ $member['actions'] = '';
+ }
+ $supporters[] = $member;
+ } else {
+ if ($admin_user_angeltypes) {
+ $member['actions'] = table_buttons([
$admin_angeltypes ? button(page_link_to('user_angeltypes') . '&action=update&user_angeltype_id=' . $member['user_angeltype_id'] . '&supporter=1', _("Add supporter rights"), 'btn-xs') : '',
- button(page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $member['user_angeltype_id'], _("remove"), 'btn-xs')
+ button(page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $member['user_angeltype_id'], _("remove"), 'btn-xs')
]);
- }
- $members_confirmed[] = $member;
+ }
+ $members_confirmed[] = $member;
+ }
}
- }
- return [
+ return [
$supporters,
$members_confirmed,
- $members_unconfirmed
+ $members_unconfirmed
];
}
/**
* Creates the needed member table headers according to given rights and settings from the angeltype.
*/
-function AngelType_view_table_headers($angeltype, $supporter, $admin_angeltypes) {
- if ($angeltype['requires_driver_license'] && ($supporter || $admin_angeltypes)) {
- return [
+function AngelType_view_table_headers($angeltype, $supporter, $admin_angeltypes)
+{
+ if ($angeltype['requires_driver_license'] && ($supporter || $admin_angeltypes)) {
+ return [
'Nick' => _("Nick"),
'DECT' => _("DECT"),
'wants_to_drive' => _("Driver"),
@@ -183,147 +190,149 @@ function AngelType_view_table_headers($angeltype, $supporter, $admin_angeltypes)
'has_license_7_5t_truck' => _("7,5t Truck"),
'has_license_12_5t_truck' => _("12,5t Truck"),
'has_license_forklift' => _("Forklift"),
- 'actions' => ''
+ 'actions' => ''
];
- }
- return [
+ }
+ return [
'Nick' => _("Nick"),
'DECT' => _("DECT"),
- 'actions' => ''
+ 'actions' => ''
];
}
/**
* Render an angeltype page containing the member lists.
*/
-function AngelType_view($angeltype, $members, $user_angeltype, $admin_user_angeltypes, $admin_angeltypes, $supporter, $user_driver_license, $user) {
- $page = [
+function AngelType_view($angeltype, $members, $user_angeltype, $admin_user_angeltypes, $admin_angeltypes, $supporter, $user_driver_license, $user)
+{
+ $page = [
AngelType_view_buttons($angeltype, $user_angeltype, $admin_angeltypes, $supporter, $user_driver_license, $user),
- msg()
+ msg()
];
- $page[] = '<h3>' . _("Description") . '</h3>';
- $parsedown = new Parsedown();
- if ($angeltype['description'] != "") {
- $page[] = '<div class="well">' . $parsedown->parse($angeltype['description']) . '</div>';
- }
+ $page[] = '<h3>' . _("Description") . '</h3>';
+ $parsedown = new Parsedown();
+ if ($angeltype['description'] != "") {
+ $page[] = '<div class="well">' . $parsedown->parse($angeltype['description']) . '</div>';
+ }
- list($supporters, $members_confirmed, $members_unconfirmed) = AngelType_view_members($angeltype, $members, $admin_user_angeltypes, $admin_angeltypes);
- $table_headers = AngelType_view_table_headers($angeltype, $supporter, $admin_angeltypes);
+ list($supporters, $members_confirmed, $members_unconfirmed) = AngelType_view_members($angeltype, $members, $admin_user_angeltypes, $admin_angeltypes);
+ $table_headers = AngelType_view_table_headers($angeltype, $supporter, $admin_angeltypes);
- if (count($supporters) > 0) {
- $page[] = '<h3>' . _("supporters") . '</h3>';
- $page[] = table($table_headers, $supporters);
- }
+ if (count($supporters) > 0) {
+ $page[] = '<h3>' . _("supporters") . '</h3>';
+ $page[] = table($table_headers, $supporters);
+ }
- if (count($members_confirmed) > 0) {
- $members_confirmed[] = [
+ if (count($members_confirmed) > 0) {
+ $members_confirmed[] = [
'Nick' => _('Sum'),
'DECT' => count($members_confirmed),
- 'actions' => ''
+ 'actions' => ''
];
- }
+ }
- if (count($members_unconfirmed) > 0) {
- $members_unconfirmed[] = [
+ if (count($members_unconfirmed) > 0) {
+ $members_unconfirmed[] = [
'Nick' => _('Sum'),
'DECT' => count($members_unconfirmed),
- 'actions' => ''
+ 'actions' => ''
];
- }
+ }
- $page[] = '<h3>' . _("Members") . '</h3>';
- if ($admin_user_angeltypes) {
- $page[] = buttons([
- button(page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'], _("Add"), 'add')
+ $page[] = '<h3>' . _("Members") . '</h3>';
+ if ($admin_user_angeltypes) {
+ $page[] = buttons([
+ button(page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'], _("Add"), 'add')
]);
- }
- $page[] = table($table_headers, $members_confirmed);
+ }
+ $page[] = table($table_headers, $members_confirmed);
- if ($admin_user_angeltypes && $angeltype['restricted'] && count($members_unconfirmed) > 0) {
- $page[] = '<h3>' . _("Unconfirmed") . '</h3>';
- $page[] = buttons([
+ if ($admin_user_angeltypes && $angeltype['restricted'] && count($members_unconfirmed) > 0) {
+ $page[] = '<h3>' . _("Unconfirmed") . '</h3>';
+ $page[] = buttons([
button(page_link_to('user_angeltypes') . '&action=confirm_all&angeltype_id=' . $angeltype['id'], _("confirm all"), 'ok'),
- button(page_link_to('user_angeltypes') . '&action=delete_all&angeltype_id=' . $angeltype['id'], _("deny all"), 'cancel')
+ button(page_link_to('user_angeltypes') . '&action=delete_all&angeltype_id=' . $angeltype['id'], _("deny all"), 'cancel')
]);
- $page[] = table($table_headers, $members_unconfirmed);
- }
+ $page[] = table($table_headers, $members_unconfirmed);
+ }
- return page_with_title(sprintf(_("Team %s"), $angeltype['name']), $page);
+ return page_with_title(sprintf(_("Team %s"), $angeltype['name']), $page);
}
/**
* Display the list of angeltypes.
*
- * @param array $angeltypes
+ * @param array $angeltypes
*/
-function AngelTypes_list_view($angeltypes, $admin_angeltypes) {
- return page_with_title(angeltypes_title(), [
+function AngelTypes_list_view($angeltypes, $admin_angeltypes)
+{
+ return page_with_title(angeltypes_title(), [
msg(),
buttons([
$admin_angeltypes ? button(page_link_to('angeltypes') . '&action=edit', _("New angeltype"), 'add') : '',
- button(page_link_to('angeltypes') . '&action=about', _("Teams/Job description"))
+ button(page_link_to('angeltypes') . '&action=about', _("Teams/Job description"))
]),
table([
'name' => _("Name"),
'restricted' => glyph('lock') . _("Restricted"),
'no_self_signup' => glyph('share') . _("Self Sign Up Allowed"),
'membership' => _("Membership"),
- 'actions' => ""
- ], $angeltypes)
+ 'actions' => ""
+ ], $angeltypes)
]);
}
/**
* Renders the about info for an angeltype.
*/
-function AngelTypes_about_view_angeltype($angeltype) {
- $parsedown = new Parsedown();
+function AngelTypes_about_view_angeltype($angeltype)
+{
+ $parsedown = new Parsedown();
- $html = '<h2>' . $angeltype['name'] . '</h2>';
+ $html = '<h2>' . $angeltype['name'] . '</h2>';
- if (isset($angeltype['user_angeltype_id'])) {
- $buttons = [];
- if ($angeltype['user_angeltype_id'] != null) {
- $buttons[] = button(page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $angeltype['user_angeltype_id'], _("leave"), 'cancel');
- } else {
- $buttons[] = button(page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'], _("join"), 'add');
+ if (isset($angeltype['user_angeltype_id'])) {
+ $buttons = [];
+ if ($angeltype['user_angeltype_id'] != null) {
+ $buttons[] = button(page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $angeltype['user_angeltype_id'], _("leave"), 'cancel');
+ } else {
+ $buttons[] = button(page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'], _("join"), 'add');
+ }
+ $html .= buttons($buttons);
}
- $html .= buttons($buttons);
- }
- if ($angeltype['restricted']) {
- $html .= info(_("This angeltype is restricted by double-opt-in by a team supporter. Please show up at the according introduction meetings."), true);
- }
- if ($angeltype['description'] != "") {
- $html .= '<div class="well">' . $parsedown->parse($angeltype['description']) . '</div>';
- }
- $html .= '<hr />';
+ if ($angeltype['restricted']) {
+ $html .= info(_("This angeltype is restricted by double-opt-in by a team supporter. Please show up at the according introduction meetings."), true);
+ }
+ if ($angeltype['description'] != "") {
+ $html .= '<div class="well">' . $parsedown->parse($angeltype['description']) . '</div>';
+ }
+ $html .= '<hr />';
- return $html;
+ return $html;
}
/**
* Renders a site that contains every angeltype and its description, basically as an overview of the needed help types.
*/
-function AngelTypes_about_view($angeltypes, $user_logged_in) {
- global $faq_url;
+function AngelTypes_about_view($angeltypes, $user_logged_in)
+{
+ global $faq_url;
- $content = [
+ $content = [
buttons([
! $user_logged_in ? button(page_link_to('register'), register_title()) : '',
! $user_logged_in ? button(page_link_to('login'), login_title()) : '',
$user_logged_in ? button(page_link_to('angeltypes'), angeltypes_title(), 'back') : '',
- button($faq_url, _("FAQ"), "btn-primary")
+ button($faq_url, _("FAQ"), "btn-primary")
]),
'<p>' . _("Here is the list of teams and their tasks. If you have questions, read the FAQ.") . '</p>',
- '<hr />'
+ '<hr />'
];
- foreach ($angeltypes as $angeltype) {
- $content[] = AngelTypes_about_view_angeltype($angeltype);
- }
+ foreach ($angeltypes as $angeltype) {
+ $content[] = AngelTypes_about_view_angeltype($angeltype);
+ }
- return page_with_title(_("Teams/Job description"), $content);
+ return page_with_title(_("Teams/Job description"), $content);
}
-
-?>
diff --git a/includes/view/EventConfig_view.php b/includes/view/EventConfig_view.php
index 37a19839..87002399 100644
--- a/includes/view/EventConfig_view.php
+++ b/includes/view/EventConfig_view.php
@@ -4,85 +4,87 @@
* Shows basic event infos and countdowns.
* @param EventConfig $event_config The event configuration
*/
-function EventConfig_countdown_page($event_config) {
- if ($event_config == null) {
- return div('col-md-12 text-center', [
- heading(sprintf(_("Welcome to the %s!"), '<span class="icon-icon_angel"></span> ENGELSYSTEM'), 2)
+function EventConfig_countdown_page($event_config)
+{
+ if ($event_config == null) {
+ return div('col-md-12 text-center', [
+ heading(sprintf(_("Welcome to the %s!"), '<span class="icon-icon_angel"></span> ENGELSYSTEM'), 2)
]);
- }
+ }
- $elements = [];
+ $elements = [];
- if ($event_config['event_name'] != null) {
- $elements[] = div('col-sm-12 text-center', [
- heading(sprintf(_("Welcome to the %s!"), $event_config['event_name'] . ' <span class="icon-icon_angel"></span> ENGELSYSTEM'), 2)
+ if ($event_config['event_name'] != null) {
+ $elements[] = div('col-sm-12 text-center', [
+ heading(sprintf(_("Welcome to the %s!"), $event_config['event_name'] . ' <span class="icon-icon_angel"></span> ENGELSYSTEM'), 2)
]);
- }
+ }
- if ($event_config['buildup_start_date'] != null && time() < $event_config['buildup_start_date']) {
- $elements[] = div('col-sm-3 text-center hidden-xs', [
+ if ($event_config['buildup_start_date'] != null && time() < $event_config['buildup_start_date']) {
+ $elements[] = div('col-sm-3 text-center hidden-xs', [
heading(_("Buildup starts"), 4),
'<span class="moment-countdown text-big" data-timestamp="' . $event_config['buildup_start_date'] . '">%c</span>',
- '<small>' . date(_("Y-m-d"), $event_config['buildup_start_date']) . '</small>'
+ '<small>' . date(_("Y-m-d"), $event_config['buildup_start_date']) . '</small>'
]);
- }
+ }
- if ($event_config['event_start_date'] != null && time() < $event_config['event_start_date']) {
- $elements[] = div('col-sm-3 text-center hidden-xs', [
+ if ($event_config['event_start_date'] != null && time() < $event_config['event_start_date']) {
+ $elements[] = div('col-sm-3 text-center hidden-xs', [
heading(_("Event starts"), 4),
'<span class="moment-countdown text-big" data-timestamp="' . $event_config['event_start_date'] . '">%c</span>',
- '<small>' . date(_("Y-m-d"), $event_config['event_start_date']) . '</small>'
+ '<small>' . date(_("Y-m-d"), $event_config['event_start_date']) . '</small>'
]);
- }
+ }
- if ($event_config['event_end_date'] != null && time() < $event_config['event_end_date']) {
- $elements[] = div('col-sm-3 text-center hidden-xs', [
+ if ($event_config['event_end_date'] != null && time() < $event_config['event_end_date']) {
+ $elements[] = div('col-sm-3 text-center hidden-xs', [
heading(_("Event ends"), 4),
'<span class="moment-countdown text-big" data-timestamp="' . $event_config['event_end_date'] . '">%c</span>',
- '<small>' . date(_("Y-m-d"), $event_config['event_end_date']) . '</small>'
+ '<small>' . date(_("Y-m-d"), $event_config['event_end_date']) . '</small>'
]);
- }
+ }
- if ($event_config['teardown_end_date'] != null && time() < $event_config['teardown_end_date']) {
- $elements[] = div('col-sm-3 text-center hidden-xs', [
+ if ($event_config['teardown_end_date'] != null && time() < $event_config['teardown_end_date']) {
+ $elements[] = div('col-sm-3 text-center hidden-xs', [
heading(_("Teardown ends"), 4),
'<span class="moment-countdown text-big" data-timestamp="' . $event_config['teardown_end_date'] . '">%c</span>',
- '<small>' . date(_("Y-m-d"), $event_config['teardown_end_date']) . '</small>'
+ '<small>' . date(_("Y-m-d"), $event_config['teardown_end_date']) . '</small>'
]);
- }
+ }
- return join("", $elements);
+ return join("", $elements);
}
/**
* Converts event name and start+end date into a line of text.
*/
-function EventConfig_info($event_config) {
- if ($event_config == null) {
- return "";
- }
+function EventConfig_info($event_config)
+{
+ if ($event_config == null) {
+ return "";
+ }
// Event name, start+end date are set
if ($event_config['event_name'] != null && $event_config['event_start_date'] != null && $event_config['event_end_date'] != null) {
- return sprintf(_("%s, from %s to %s"), $event_config['event_name'], date(_("Y-m-d"), $event_config['event_start_date']), date(_("Y-m-d"), $event_config['event_end_date']));
+ return sprintf(_("%s, from %s to %s"), $event_config['event_name'], date(_("Y-m-d"), $event_config['event_start_date']), date(_("Y-m-d"), $event_config['event_end_date']));
}
// Event name, start date are set
if ($event_config['event_name'] != null && $event_config['event_start_date'] != null) {
- return sprintf(_("%s, starting %s"), $event_config['event_name'], date(_("Y-m-d"), $event_config['event_start_date']));
+ return sprintf(_("%s, starting %s"), $event_config['event_name'], date(_("Y-m-d"), $event_config['event_start_date']));
}
// Event start+end date are set
if ($event_config['event_start_date'] != null && $event_config['event_end_date'] != null) {
- return sprintf(_("Event from %s to %s"), date(_("Y-m-d"), $event_config['event_start_date']), date(_("Y-m-d"), $event_config['event_end_date']));
+ return sprintf(_("Event from %s to %s"), date(_("Y-m-d"), $event_config['event_start_date']), date(_("Y-m-d"), $event_config['event_end_date']));
}
// Only event name is set
if ($event_config['event_name'] != null) {
- return sprintf($event_config['event_name']);
+ return sprintf($event_config['event_name']);
}
- return "";
+ return "";
}
/**
@@ -92,13 +94,14 @@ function EventConfig_info($event_config) {
* The event name
* @param string $event_welcome_msg
* The welcome message
- * @param date $buildup_start_date
- * @param date $event_start_date
- * @param date $event_end_date
- * @param date $teardown_end_date
+ * @param date $buildup_start_date
+ * @param date $event_start_date
+ * @param date $event_end_date
+ * @param date $teardown_end_date
*/
-function EventConfig_edit_view($event_name, $event_welcome_msg, $buildup_start_date, $event_start_date, $event_end_date, $teardown_end_date) {
- return page_with_title(event_config_title(), [
+function EventConfig_edit_view($event_name, $event_welcome_msg, $buildup_start_date, $event_start_date, $event_end_date, $teardown_end_date)
+{
+ return page_with_title(event_config_title(), [
msg(),
form([
div('row', [
@@ -106,24 +109,22 @@ function EventConfig_edit_view($event_name, $event_welcome_msg, $buildup_start_d
form_text('event_name', _("Event Name"), $event_name),
form_info('', _("Event Name is shown on the start page.")),
form_textarea('event_welcome_msg', _("Event Welcome Message"), $event_welcome_msg),
- form_info('', _("Welcome message is shown after successful registration. You can use markdown."))
+ form_info('', _("Welcome message is shown after successful registration. You can use markdown."))
]),
div('col-md-3 col-xs-6', [
form_date('buildup_start_date', _("Buildup date"), $buildup_start_date),
- form_date('event_start_date', _("Event start date"), $event_start_date)
+ form_date('event_start_date', _("Event start date"), $event_start_date)
]),
div('col-md-3 col-xs-6', [
form_date('teardown_end_date', _("Teardown end date"), $teardown_end_date),
- form_date('event_end_date', _("Event end date"), $event_end_date)
- ])
+ form_date('event_end_date', _("Event end date"), $event_end_date)
+ ])
]),
div('row', [
div('col-md-6', [
- form_submit('submit', _("Save"))
- ])
- ])
- ])
+ form_submit('submit', _("Save"))
+ ])
+ ])
+ ])
]);
}
-
-?> \ No newline at end of file
diff --git a/includes/view/Questions_view.php b/includes/view/Questions_view.php
index a44a29d1..8446ad8b 100644
--- a/includes/view/Questions_view.php
+++ b/includes/view/Questions_view.php
@@ -1,37 +1,36 @@
<?php
-function Questions_view($open_questions, $answered_questions, $ask_action) {
- foreach ($open_questions as &$question) {
- $question['actions'] = '<a href="' . page_link_to("user_questions") . '&action=delete&id=' . $question['QID'] . '">' . _("delete") . '</a>';
- $question['Question'] = str_replace("\n", '<br />', $question['Question']);
- }
+function Questions_view($open_questions, $answered_questions, $ask_action)
+{
+ foreach ($open_questions as &$question) {
+ $question['actions'] = '<a href="' . page_link_to("user_questions") . '&action=delete&id=' . $question['QID'] . '">' . _("delete") . '</a>';
+ $question['Question'] = str_replace("\n", '<br />', $question['Question']);
+ }
- foreach ($answered_questions as &$question) {
- $question['Question'] = str_replace("\n", '<br />', $question['Question']);
- $question['Answer'] = str_replace("\n", '<br />', $question['Answer']);
- $question['actions'] = '<a href="' . page_link_to("user_questions") . '&action=delete&id=' . $question['QID'] . '">' . _("delete") . '</a>';
- }
+ foreach ($answered_questions as &$question) {
+ $question['Question'] = str_replace("\n", '<br />', $question['Question']);
+ $question['Answer'] = str_replace("\n", '<br />', $question['Answer']);
+ $question['actions'] = '<a href="' . page_link_to("user_questions") . '&action=delete&id=' . $question['QID'] . '">' . _("delete") . '</a>';
+ }
- return page_with_title(questions_title(), [
+ return page_with_title(questions_title(), [
msg(),
heading(_("Open questions"), 2),
table([
'Question' => _("Question"),
- 'actions' => ""
+ 'actions' => ""
], $open_questions),
heading(_("Answered questions"), 2),
table([
'Question' => _("Question"),
'answer_user' => _("Answered by"),
'Answer' => _("Answer"),
- 'actions' => ""
+ 'actions' => ""
], $answered_questions),
heading(_("Ask the Heaven"), 2),
form([
form_textarea('question', _("Your Question:"), ""),
- form_submit('submit', _("Save"))
- ], $ask_action)
+ form_submit('submit', _("Save"))
+ ], $ask_action)
]);
}
-
-?> \ No newline at end of file
diff --git a/includes/view/Rooms_view.php b/includes/view/Rooms_view.php
index 7afdc67b..892c5968 100644
--- a/includes/view/Rooms_view.php
+++ b/includes/view/Rooms_view.php
@@ -2,19 +2,19 @@
use Engelsystem\ShiftsFilterRenderer;
use Engelsystem\ShiftCalendarRenderer;
-function Room_view($room, ShiftsFilterRenderer $shiftsFilterRenderer, ShiftCalendarRenderer $shiftCalendarRenderer) {
- return page_with_title(glyph('map-marker') . $room['Name'], [
+function Room_view($room, ShiftsFilterRenderer $shiftsFilterRenderer, ShiftCalendarRenderer $shiftCalendarRenderer)
+{
+ return page_with_title(glyph('map-marker') . $room['Name'], [
$shiftsFilterRenderer->render(room_link($room)) ,
$shiftCalendarRenderer->render()
]);
}
-function Room_name_render($room) {
- global $privileges;
- if (in_array('view_rooms', $privileges)) {
- return '<a href="' . room_link($room) . '">' . glyph('map-marker') . $room['Name'] . '</a>';
- }
- return glyph('map-marker') . $room['Name'];
+function Room_name_render($room)
+{
+ global $privileges;
+ if (in_array('view_rooms', $privileges)) {
+ return '<a href="' . room_link($room) . '">' . glyph('map-marker') . $room['Name'] . '</a>';
+ }
+ return glyph('map-marker') . $room['Name'];
}
-
-?> \ No newline at end of file
diff --git a/includes/view/ShiftCalendarLane.php b/includes/view/ShiftCalendarLane.php
index 33fccec3..af674671 100644
--- a/includes/view/ShiftCalendarLane.php
+++ b/includes/view/ShiftCalendarLane.php
@@ -5,21 +5,22 @@ namespace Engelsystem;
/**
* Represents a single lane in a shifts calendar.
*/
-class ShiftCalendarLane {
+class ShiftCalendarLane
+{
+ private $firstBlockStartTime;
- private $firstBlockStartTime;
+ private $blockCount;
- private $blockCount;
+ private $header;
- private $header;
+ private $shifts = [];
- private $shifts = [];
-
- public function __construct($header, $firstBlockStartTime, $blockCount) {
- $this->header = $header;
- $this->firstBlockStartTime = $firstBlockStartTime;
- $this->blockCount = $blockCount;
- }
+ public function __construct($header, $firstBlockStartTime, $blockCount)
+ {
+ $this->header = $header;
+ $this->firstBlockStartTime = $firstBlockStartTime;
+ $this->blockCount = $blockCount;
+ }
/**
* Adds a shift to the lane, but only if it fits.
@@ -29,12 +30,13 @@ class ShiftCalendarLane {
* The shift to add
* @return boolean true on success
*/
- public function addShift($shift) {
- if ($this->shiftFits($shift)) {
- $this->shifts[] = $shift;
- return true;
- }
- return false;
+ public function addShift($shift)
+ {
+ if ($this->shiftFits($shift)) {
+ $this->shifts[] = $shift;
+ return true;
+ }
+ return false;
}
/**
@@ -43,21 +45,23 @@ class ShiftCalendarLane {
* @param Shift $shift
* The shift to fit into this lane
*/
- public function shiftFits($newShift) {
- foreach ($this->shifts as $laneShift) {
- if (! ($newShift['start'] >= $laneShift['end'] || $newShift['end'] <= $laneShift['start'])) {
- return false;
+ public function shiftFits($newShift)
+ {
+ foreach ($this->shifts as $laneShift) {
+ if (! ($newShift['start'] >= $laneShift['end'] || $newShift['end'] <= $laneShift['start'])) {
+ return false;
+ }
}
- }
- return true;
+ return true;
}
- public function getHeader() {
- return $this->header;
- }
+ public function getHeader()
+ {
+ return $this->header;
+ }
- public function getShifts() {
- return $this->shifts;
- }
+ public function getShifts()
+ {
+ return $this->shifts;
+ }
}
-?> \ No newline at end of file
diff --git a/includes/view/ShiftCalendarRenderer.php b/includes/view/ShiftCalendarRenderer.php
index 8c8e72a4..d40f63a1 100644
--- a/includes/view/ShiftCalendarRenderer.php
+++ b/includes/view/ShiftCalendarRenderer.php
@@ -2,7 +2,8 @@
namespace Engelsystem;
-class ShiftCalendarRenderer {
+class ShiftCalendarRenderer
+{
/**
* 15m * 60s/m = 900s
@@ -25,116 +26,123 @@ class ShiftCalendarRenderer {
*/
const TIME_MARGIN = 1800;
- private $lanes;
+ private $lanes;
- private $shiftsFilter;
+ private $shiftsFilter;
- private $firstBlockStartTime = null;
+ private $firstBlockStartTime = null;
- private $lastBlockEndTime = null;
+ private $lastBlockEndTime = null;
- private $blocksPerSlot = null;
+ private $blocksPerSlot = null;
- private $needed_angeltypes = null;
+ private $needed_angeltypes = null;
- private $shift_entries = null;
+ private $shift_entries = null;
- public function __construct($shifts, $needed_angeltypes, $shift_entries, ShiftsFilter $shiftsFilter) {
- $this->shiftsFilter = $shiftsFilter;
- $this->firstBlockStartTime = $this->calcFirstBlockStartTime($shifts);
- $this->lastBlockEndTime = $this->calcLastBlockEndTime($shifts);
- $this->lanes = $this->assignShiftsToLanes($shifts);
- $this->needed_angeltypes = $needed_angeltypes;
- $this->shift_entries = $shift_entries;
- }
+ public function __construct($shifts, $needed_angeltypes, $shift_entries, ShiftsFilter $shiftsFilter)
+ {
+ $this->shiftsFilter = $shiftsFilter;
+ $this->firstBlockStartTime = $this->calcFirstBlockStartTime($shifts);
+ $this->lastBlockEndTime = $this->calcLastBlockEndTime($shifts);
+ $this->lanes = $this->assignShiftsToLanes($shifts);
+ $this->needed_angeltypes = $needed_angeltypes;
+ $this->shift_entries = $shift_entries;
+ }
/**
* Assigns the shifts to different lanes per room if they collide
*
* @param Shift[] $shifts
* The shifts to assign
- *
+ *
* @return Returns an array that assigns a room_id to an array of ShiftCalendarLane containing the shifts
*/
- private function assignShiftsToLanes($shifts) {
- // array that assigns a room id to a list of lanes (per room)
+ private function assignShiftsToLanes($shifts)
+ {
+ // array that assigns a room id to a list of lanes (per room)
$lanes = [];
- foreach ($shifts as $shift) {
- $room_id = $shift['RID'];
- $header = Room_name_render([
+ foreach ($shifts as $shift) {
+ $room_id = $shift['RID'];
+ $header = Room_name_render([
'RID' => $room_id,
- 'Name' => $shift['room_name']
+ 'Name' => $shift['room_name']
]);
- if (! isset($lanes[$room_id])) {
- // initialize room with one lane
+ if (! isset($lanes[$room_id])) {
+ // initialize room with one lane
$lanes[$room_id] = [
- new ShiftCalendarLane($header, $this->getFirstBlockStartTime(), $this->getBlocksPerSlot())
+ new ShiftCalendarLane($header, $this->getFirstBlockStartTime(), $this->getBlocksPerSlot())
];
- }
+ }
// Try to add the shift to the existing lanes for this room
$shift_added = false;
- foreach ($lanes[$room_id] as $lane) {
- $shift_added = $lane->addShift($shift);
- if ($shift_added == true) {
- break;
- }
- }
+ foreach ($lanes[$room_id] as $lane) {
+ $shift_added = $lane->addShift($shift);
+ if ($shift_added == true) {
+ break;
+ }
+ }
// If all lanes for this room are busy, create a new lane and add shift to it
if ($shift_added == false) {
- $newLane = new ShiftCalendarLane($header, $this->getFirstBlockStartTime(), $this->getBlocksPerSlot());
- if (! $newLane->addShift($shift)) {
- engelsystem_error("Unable to add shift to new lane.");
- }
- $lanes[$room_id][] = $newLane;
+ $newLane = new ShiftCalendarLane($header, $this->getFirstBlockStartTime(), $this->getBlocksPerSlot());
+ if (! $newLane->addShift($shift)) {
+ engelsystem_error("Unable to add shift to new lane.");
+ }
+ $lanes[$room_id][] = $newLane;
+ }
}
- }
- return $lanes;
+ return $lanes;
}
- public function getFirstBlockStartTime() {
- return $this->firstBlockStartTime;
- }
+ public function getFirstBlockStartTime()
+ {
+ return $this->firstBlockStartTime;
+ }
- public function getLastBlockEndTime() {
- return $this->lastBlockEndTime;
- }
+ public function getLastBlockEndTime()
+ {
+ return $this->lastBlockEndTime;
+ }
- public function getBlocksPerSlot() {
- if ($this->blocksPerSlot == null) {
- $this->blocksPerSlot = $this->calcBlocksPerSlot();
+ public function getBlocksPerSlot()
+ {
+ if ($this->blocksPerSlot == null) {
+ $this->blocksPerSlot = $this->calcBlocksPerSlot();
+ }
+ return $this->blocksPerSlot;
}
- return $this->blocksPerSlot;
- }
/**
* Renders the whole calendar
*
* @return the generated html
*/
- public function render() {
- if (count($this->lanes) == 0) {
- return '';
- }
- return div('shift-calendar', [
+ public function render()
+ {
+ if (count($this->lanes) == 0) {
+ return '';
+ }
+ return div('shift-calendar', [
$this->renderTimeLane(),
- $this->renderShiftLanes()
+ $this->renderShiftLanes()
]) . $this->renderLegend();
}
/**
* Renders the lanes containing the shifts
*/
- private function renderShiftLanes() {
- $html = "";
- foreach ($this->lanes as $room_lanes) {
- foreach ($room_lanes as $lane) {
- $html .= $this->renderLane($lane);
+ private function renderShiftLanes()
+ {
+ $html = "";
+ foreach ($this->lanes as $room_lanes) {
+ foreach ($room_lanes as $lane) {
+ $html .= $this->renderLane($lane);
+ }
}
- }
- return $html;
+ return $html;
}
/**
@@ -143,32 +151,33 @@ class ShiftCalendarRenderer {
* @param ShiftCalendarLane $lane
* The lane to render
*/
- private function renderLane(ShiftCalendarLane $lane) {
- global $user;
+ private function renderLane(ShiftCalendarLane $lane)
+ {
+ global $user;
- $shift_renderer = new ShiftCalendarShiftRenderer();
- $html = "";
- $rendered_until = $this->getFirstBlockStartTime();
+ $shift_renderer = new ShiftCalendarShiftRenderer();
+ $html = "";
+ $rendered_until = $this->getFirstBlockStartTime();
- foreach ($lane->getShifts() as $shift) {
- while ($rendered_until + ShiftCalendarRenderer::SECONDS_PER_ROW <= $shift['start']) {
- $html .= $this->renderTick($rendered_until);
- $rendered_until += ShiftCalendarRenderer::SECONDS_PER_ROW;
- }
+ foreach ($lane->getShifts() as $shift) {
+ while ($rendered_until + ShiftCalendarRenderer::SECONDS_PER_ROW <= $shift['start']) {
+ $html .= $this->renderTick($rendered_until);
+ $rendered_until += ShiftCalendarRenderer::SECONDS_PER_ROW;
+ }
- list($shift_height, $shift_html) = $shift_renderer->render($shift, $this->needed_angeltypes[$shift['SID']], $this->shift_entries[$shift['SID']], $user);
- $html .= $shift_html;
- $rendered_until += $shift_height * ShiftCalendarRenderer::SECONDS_PER_ROW;
- }
+ list($shift_height, $shift_html) = $shift_renderer->render($shift, $this->needed_angeltypes[$shift['SID']], $this->shift_entries[$shift['SID']], $user);
+ $html .= $shift_html;
+ $rendered_until += $shift_height * ShiftCalendarRenderer::SECONDS_PER_ROW;
+ }
- while ($rendered_until < $this->getLastBlockEndTime()) {
- $html .= $this->renderTick($rendered_until);
- $rendered_until += ShiftCalendarRenderer::SECONDS_PER_ROW;
- }
+ while ($rendered_until < $this->getLastBlockEndTime()) {
+ $html .= $this->renderTick($rendered_until);
+ $rendered_until += ShiftCalendarRenderer::SECONDS_PER_ROW;
+ }
- return div('lane', [
+ return div('lane', [
div('header', $lane->getHeader()),
- $html
+ $html
]);
}
@@ -181,77 +190,81 @@ class ShiftCalendarRenderer {
* Should time labels be generated?
* @return rendered tick html
*/
- private function renderTick($time, $label = false) {
- if ($time % (24 * 60 * 60) == 23 * 60 * 60) {
- if (! $label) {
- return div('tick day');
- }
- return div('tick day', [
- date('m-d<b\r />H:i', $time)
+ private function renderTick($time, $label = false)
+ {
+ if ($time % (24 * 60 * 60) == 23 * 60 * 60) {
+ if (! $label) {
+ return div('tick day');
+ }
+ return div('tick day', [
+ date('m-d<b\r />H:i', $time)
]);
- } elseif ($time % (60 * 60) == 0) {
- if (! $label) {
- return div('tick hour');
- }
- return div('tick hour', [
- date('m-d<b\r />H:i', $time)
+ } elseif ($time % (60 * 60) == 0) {
+ if (! $label) {
+ return div('tick hour');
+ }
+ return div('tick hour', [
+ date('m-d<b\r />H:i', $time)
]);
- }
- return div('tick');
+ }
+ return div('tick');
}
/**
* Renders the left time lane including hour/day ticks
*/
- private function renderTimeLane() {
- $time_slot = [
+ private function renderTimeLane()
+ {
+ $time_slot = [
div('header', [
- _("Time")
- ])
+ _("Time")
+ ])
];
- for ($block = 0; $block < $this->getBlocksPerSlot(); $block ++) {
- $thistime = $this->getFirstBlockStartTime() + ($block * ShiftCalendarRenderer::SECONDS_PER_ROW);
- $time_slot[] = $this->renderTick($thistime, true);
- }
- return div('lane time', $time_slot);
+ for ($block = 0; $block < $this->getBlocksPerSlot(); $block ++) {
+ $thistime = $this->getFirstBlockStartTime() + ($block * ShiftCalendarRenderer::SECONDS_PER_ROW);
+ $time_slot[] = $this->renderTick($thistime, true);
+ }
+ return div('lane time', $time_slot);
}
- private function calcFirstBlockStartTime($shifts) {
- $start_time = $this->shiftsFilter->getEndTime();
- foreach ($shifts as $shift) {
- if ($shift['start'] < $start_time) {
- $start_time = $shift['start'];
- }
+ private function calcFirstBlockStartTime($shifts)
+ {
+ $start_time = $this->shiftsFilter->getEndTime();
+ foreach ($shifts as $shift) {
+ if ($shift['start'] < $start_time) {
+ $start_time = $shift['start'];
+ }
+ }
+ return ShiftCalendarRenderer::SECONDS_PER_ROW * floor(($start_time - ShiftCalendarRenderer::TIME_MARGIN) / ShiftCalendarRenderer::SECONDS_PER_ROW);
}
- return ShiftCalendarRenderer::SECONDS_PER_ROW * floor(($start_time - ShiftCalendarRenderer::TIME_MARGIN) / ShiftCalendarRenderer::SECONDS_PER_ROW);
- }
- private function calcLastBlockEndTime($shifts) {
- $end_time = $this->shiftsFilter->getStartTime();
- foreach ($shifts as $shift) {
- if ($shift['end'] > $end_time) {
- $end_time = $shift['end'];
- }
+ private function calcLastBlockEndTime($shifts)
+ {
+ $end_time = $this->shiftsFilter->getStartTime();
+ foreach ($shifts as $shift) {
+ if ($shift['end'] > $end_time) {
+ $end_time = $shift['end'];
+ }
+ }
+ return ShiftCalendarRenderer::SECONDS_PER_ROW * ceil(($end_time + ShiftCalendarRenderer::TIME_MARGIN) / ShiftCalendarRenderer::SECONDS_PER_ROW);
}
- return ShiftCalendarRenderer::SECONDS_PER_ROW * ceil(($end_time + ShiftCalendarRenderer::TIME_MARGIN) / ShiftCalendarRenderer::SECONDS_PER_ROW);
- }
- private function calcBlocksPerSlot() {
- return ceil(($this->getLastBlockEndTime() - $this->getFirstBlockStartTime()) / ShiftCalendarRenderer::SECONDS_PER_ROW);
- }
+ private function calcBlocksPerSlot()
+ {
+ return ceil(($this->getLastBlockEndTime() - $this->getFirstBlockStartTime()) / ShiftCalendarRenderer::SECONDS_PER_ROW);
+ }
/**
* Renders a legend explaining the shift coloring
*/
- private function renderLegend() {
- return div('legend', [
+ private function renderLegend()
+ {
+ return div('legend', [
label(_('Your shift'), 'primary'),
label(_('Help needed'), 'danger'),
label(_('Other angeltype needed / collides with my shifts'), 'warning'),
label(_('Shift is full'), 'success'),
- label(_('Shift running/ended'), 'default')
+ label(_('Shift running/ended'), 'default')
]);
}
}
-
-?> \ No newline at end of file
diff --git a/includes/view/ShiftCalendarShiftRenderer.php b/includes/view/ShiftCalendarShiftRenderer.php
index fdfefcc2..6d6523c5 100644
--- a/includes/view/ShiftCalendarShiftRenderer.php
+++ b/includes/view/ShiftCalendarShiftRenderer.php
@@ -5,7 +5,8 @@ namespace Engelsystem;
/**
* Renders a single shift for the shift calendar
*/
-class ShiftCalendarShiftRenderer {
+class ShiftCalendarShiftRenderer
+{
/**
* Renders a shift
@@ -15,18 +16,19 @@ class ShiftCalendarShiftRenderer {
* @param User $user
* The user who is viewing the shift calendar
*/
- public function render($shift, $needed_angeltypes, $shift_entries, $user) {
- $info_text = "";
- if ($shift['title'] != '') {
- $info_text = glyph('info-sign') . $shift['title'] . '<br>';
- }
- list($shift_signup_state, $shifts_row) = $this->renderShiftNeededAngeltypes($shift, $needed_angeltypes, $shift_entries, $user);
+ public function render($shift, $needed_angeltypes, $shift_entries, $user)
+ {
+ $info_text = "";
+ if ($shift['title'] != '') {
+ $info_text = glyph('info-sign') . $shift['title'] . '<br>';
+ }
+ list($shift_signup_state, $shifts_row) = $this->renderShiftNeededAngeltypes($shift, $needed_angeltypes, $shift_entries, $user);
- $class = $this->classForSignupState($shift_signup_state);
+ $class = $this->classForSignupState($shift_signup_state);
- $blocks = ceil(($shift["end"] - $shift["start"]) / ShiftCalendarRenderer::SECONDS_PER_ROW);
- $blocks = max(1, $blocks);
- return [
+ $blocks = ceil(($shift["end"] - $shift["start"]) / ShiftCalendarRenderer::SECONDS_PER_ROW);
+ $blocks = max(1, $blocks);
+ return [
$blocks,
div('shift panel panel-' . $class . '" style="height: ' . ($blocks * ShiftCalendarRenderer::BLOCK_HEIGHT - ShiftCalendarRenderer::MARGIN) . 'px"', [
$this->renderShiftHead($shift),
@@ -34,17 +36,18 @@ class ShiftCalendarShiftRenderer {
$info_text,
Room_name_render([
'RID' => $shift['RID'],
- 'Name' => $shift['room_name']
- ])
+ 'Name' => $shift['room_name']
+ ])
]),
$shifts_row,
- div('shift-spacer')
+ div('shift-spacer')
])
];
}
- private function classForSignupState(ShiftSignupState $shiftSignupState) {
- switch ($shiftSignupState->getState()) {
+ private function classForSignupState(ShiftSignupState $shiftSignupState)
+ {
+ switch ($shiftSignupState->getState()) {
case ShiftSignupState::ADMIN:
case ShiftSignupState::OCCUPIED:
return 'success';
@@ -62,50 +65,51 @@ class ShiftCalendarShiftRenderer {
case ShiftSignupState::FREE:
return 'danger';
}
- }
+ }
- private function renderShiftNeededAngeltypes($shift, $needed_angeltypes, $shift_entries, $user) {
- global $privileges;
+ private function renderShiftNeededAngeltypes($shift, $needed_angeltypes, $shift_entries, $user)
+ {
+ global $privileges;
- $shift_entries_filtered = [];
- foreach ($needed_angeltypes as $needed_angeltype) {
- $shift_entries_filtered[$needed_angeltype['id']] = [];
- }
- foreach ($shift_entries as $shift_entry) {
- $shift_entries_filtered[$shift_entry['TID']][] = $shift_entry;
- }
+ $shift_entries_filtered = [];
+ foreach ($needed_angeltypes as $needed_angeltype) {
+ $shift_entries_filtered[$needed_angeltype['id']] = [];
+ }
+ foreach ($shift_entries as $shift_entry) {
+ $shift_entries_filtered[$shift_entry['TID']][] = $shift_entry;
+ }
- $html = "";
- $shift_signup_state = null;
- foreach ($needed_angeltypes as $angeltype) {
- if ($angeltype['count'] > 0 || count($shift_entries_filtered[$angeltype['id']]) > 0) {
- list($angeltype_signup_state, $angeltype_html) = $this->renderShiftNeededAngeltype($shift, $shift_entries_filtered[$angeltype['id']], $angeltype, $user);
+ $html = "";
+ $shift_signup_state = null;
+ foreach ($needed_angeltypes as $angeltype) {
+ if ($angeltype['count'] > 0 || count($shift_entries_filtered[$angeltype['id']]) > 0) {
+ list($angeltype_signup_state, $angeltype_html) = $this->renderShiftNeededAngeltype($shift, $shift_entries_filtered[$angeltype['id']], $angeltype, $user);
+ if ($shift_signup_state == null) {
+ $shift_signup_state = $angeltype_signup_state;
+ } else {
+ $shift_signup_state->combineWith($angeltype_signup_state);
+ }
+ $html .= $angeltype_html;
+ }
+ }
if ($shift_signup_state == null) {
- $shift_signup_state = $angeltype_signup_state;
- } else {
- $shift_signup_state->combineWith($angeltype_signup_state);
+ $shift_signup_state = new ShiftSignupState(ShiftSignupState::SHIFT_ENDED, 0);
}
- $html .= $angeltype_html;
- }
- }
- if ($shift_signup_state == null) {
- $shift_signup_state = new ShiftSignupState(ShiftSignupState::SHIFT_ENDED, 0);
- }
- if (in_array('user_shifts_admin', $privileges)) {
- $html .= '<li class="list-group-item">' . button(page_link_to('user_shifts') . '&amp;shift_id=' . $shift['SID'], _("Add more angels"), 'btn-xs') . '</li>';
- }
- if ($html != '') {
- return [
+ if (in_array('user_shifts_admin', $privileges)) {
+ $html .= '<li class="list-group-item">' . button(page_link_to('user_shifts') . '&amp;shift_id=' . $shift['SID'], _("Add more angels"), 'btn-xs') . '</li>';
+ }
+ if ($html != '') {
+ return [
$shift_signup_state,
- '<ul class="list-group">' . $html . '</ul>'
+ '<ul class="list-group">' . $html . '</ul>'
];
- }
- return [
+ }
+ return [
$shift_signup_state,
- ""
+ ""
];
- }
+ }
/**
* Renders a list entry containing the needed angels for an angeltype
@@ -117,15 +121,16 @@ class ShiftCalendarShiftRenderer {
* @param User $user
* The user who is viewing the shift calendar
*/
- private function renderShiftNeededAngeltype($shift, $shift_entries, $angeltype, $user) {
- $entry_list = [];
- foreach ($shift_entries as $entry) {
- $style = $entry['freeloaded'] ? " text-decoration: line-through;" : '';
- $entry_list[] = "<span style=\"$style\">" . User_Nick_render($entry) . "</span>";
- }
- $shift_signup_state = Shift_signup_allowed($user, $shift, $angeltype, null, null, $angeltype, $shift_entries);
- $inner_text = sprintf(ngettext("%d helper needed", "%d helpers needed", $shift_signup_state->getFreeEntries()), $shift_signup_state->getFreeEntries());
- switch ($shift_signup_state->getState()) {
+ private function renderShiftNeededAngeltype($shift, $shift_entries, $angeltype, $user)
+ {
+ $entry_list = [];
+ foreach ($shift_entries as $entry) {
+ $style = $entry['freeloaded'] ? " text-decoration: line-through;" : '';
+ $entry_list[] = "<span style=\"$style\">" . User_Nick_render($entry) . "</span>";
+ }
+ $shift_signup_state = Shift_signup_allowed($user, $shift, $angeltype, null, null, $angeltype, $shift_entries);
+ $inner_text = sprintf(ngettext("%d helper needed", "%d helpers needed", $shift_signup_state->getFreeEntries()), $shift_signup_state->getFreeEntries());
+ switch ($shift_signup_state->getState()) {
case ShiftSignupState::ADMIN:
case ShiftSignupState::FREE:
// When admin or free display a link + button for sign up
@@ -139,10 +144,10 @@ class ShiftCalendarShiftRenderer {
case ShiftSignupState::ANGELTYPE:
if ($angeltype['restricted'] == 1) {
- // User has to be confirmed on the angeltype first
+ // User has to be confirmed on the angeltype first
$entry_list[] = $inner_text . glyph('lock');
} else {
- // Add link to join the angeltype first
+ // Add link to join the angeltype first
$entry_list[] = $inner_text . '<br />' . button(page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'], sprintf(_('Become %s'), $angeltype['name']), 'btn-xs');
}
break;
@@ -158,13 +163,13 @@ class ShiftCalendarShiftRenderer {
break;
}
- $shifts_row = '<li class="list-group-item">';
- $shifts_row .= '<strong>' . AngelType_name_render($angeltype) . ':</strong> ';
- $shifts_row .= join(", ", $entry_list);
- $shifts_row .= '</li>';
- return [
+ $shifts_row = '<li class="list-group-item">';
+ $shifts_row .= '<strong>' . AngelType_name_render($angeltype) . ':</strong> ';
+ $shifts_row .= join(", ", $entry_list);
+ $shifts_row .= '</li>';
+ return [
$shift_signup_state,
- $shifts_row
+ $shifts_row
];
}
@@ -174,22 +179,21 @@ class ShiftCalendarShiftRenderer {
* @param Shift $shift
* The shift
*/
- private function renderShiftHead($shift) {
- global $privileges;
+ private function renderShiftHead($shift)
+ {
+ global $privileges;
- $header_buttons = "";
- if (in_array('admin_shifts', $privileges)) {
- $header_buttons = '<div class="pull-right">' . table_buttons([
+ $header_buttons = "";
+ if (in_array('admin_shifts', $privileges)) {
+ $header_buttons = '<div class="pull-right">' . table_buttons([
button(page_link_to('user_shifts') . '&edit_shift=' . $shift['SID'], glyph('edit'), 'btn-xs'),
- button(page_link_to('user_shifts') . '&delete_shift=' . $shift['SID'], glyph('trash'), 'btn-xs')
+ button(page_link_to('user_shifts') . '&delete_shift=' . $shift['SID'], glyph('trash'), 'btn-xs')
]) . '</div>';
- }
- $shift_heading = date('H:i', $shift['start']) . ' &dash; ' . date('H:i', $shift['end']) . ' &mdash; ' . $shift['name'];
- return div('panel-heading', [
+ }
+ $shift_heading = date('H:i', $shift['start']) . ' &dash; ' . date('H:i', $shift['end']) . ' &mdash; ' . $shift['name'];
+ return div('panel-heading', [
'<a href="' . shift_link($shift) . '">' . $shift_heading . '</a>',
- $header_buttons
+ $header_buttons
]);
}
}
-
-?> \ No newline at end of file
diff --git a/includes/view/ShiftEntry_view.php b/includes/view/ShiftEntry_view.php
index 5bf10a91..2c31805c 100644
--- a/includes/view/ShiftEntry_view.php
+++ b/includes/view/ShiftEntry_view.php
@@ -8,18 +8,19 @@
* @param string $title
* @param string $type
* @param string $comment
- *
+ *
* @return string
*/
-function ShiftEntry_edit_view($angel, $date, $location, $title, $type, $comment, $freeloaded, $freeload_comment, $user_admin_shifts = false) {
- $freeload_form = [];
- if ($user_admin_shifts) {
- $freeload_form = [
+function ShiftEntry_edit_view($angel, $date, $location, $title, $type, $comment, $freeloaded, $freeload_comment, $user_admin_shifts = false)
+{
+ $freeload_form = [];
+ if ($user_admin_shifts) {
+ $freeload_form = [
form_checkbox('freeloaded', _("Freeloaded"), $freeloaded),
- form_textarea('freeload_comment', _("Freeload comment (Only for shift coordination):"), $freeload_comment)
+ form_textarea('freeload_comment', _("Freeload comment (Only for shift coordination):"), $freeload_comment)
];
- }
- return page_with_title(_("Edit shift entry"), [
+ }
+ return page_with_title(_("Edit shift entry"), [
msg(),
form([
form_info(_("Angel:"), $angel),
@@ -29,9 +30,7 @@ function ShiftEntry_edit_view($angel, $date, $location, $title, $type, $comment,
form_info(_("Type:"), $type),
form_textarea('comment', _("Comment (for your eyes only):"), $comment),
join("", $freeload_form),
- form_submit('submit', _("Save"))
- ])
+ form_submit('submit', _("Save"))
+ ])
]);
}
-
-?> \ No newline at end of file
diff --git a/includes/view/ShiftTypes_view.php b/includes/view/ShiftTypes_view.php
index 3e4cccc6..e2850ab0 100644
--- a/includes/view/ShiftTypes_view.php
+++ b/includes/view/ShiftTypes_view.php
@@ -1,84 +1,87 @@
<?php
-function ShiftType_name_render($shifttype) {
- global $privileges;
- if (in_array('shifttypes', $privileges)) {
- return '<a href="' . shifttype_link($shifttype) . '">' . $shifttype['name'] . '</a>';
- }
- return $shifttype['name'];
+function ShiftType_name_render($shifttype)
+{
+ global $privileges;
+ if (in_array('shifttypes', $privileges)) {
+ return '<a href="' . shifttype_link($shifttype) . '">' . $shifttype['name'] . '</a>';
+ }
+ return $shifttype['name'];
}
-function ShiftType_delete_view($shifttype) {
- return page_with_title(sprintf(_("Delete shifttype %s"), $shifttype['name']), [
+function ShiftType_delete_view($shifttype)
+{
+ return page_with_title(sprintf(_("Delete shifttype %s"), $shifttype['name']), [
info(sprintf(_("Do you want to delete shifttype %s?"), $shifttype['name']), true),
buttons([
button(page_link_to('shifttypes'), _("cancel"), 'cancel'),
- button(page_link_to('shifttypes') . '&action=delete&shifttype_id=' . $shifttype['id'] . '&confirmed', _("delete"), 'ok')
- ])
+ button(page_link_to('shifttypes') . '&action=delete&shifttype_id=' . $shifttype['id'] . '&confirmed', _("delete"), 'ok')
+ ])
]);
}
-function ShiftType_edit_view($name, $angeltype_id, $angeltypes, $description, $shifttype_id) {
- $angeltypes_select = [
- '' => _('All')
+function ShiftType_edit_view($name, $angeltype_id, $angeltypes, $description, $shifttype_id)
+{
+ $angeltypes_select = [
+ '' => _('All')
];
- foreach ($angeltypes as $angeltype) {
- $angeltypes_select[$angeltype['id']] = $angeltype['name'];
- }
+ foreach ($angeltypes as $angeltype) {
+ $angeltypes_select[$angeltype['id']] = $angeltype['name'];
+ }
- return page_with_title($shifttype_id ? _('Edit shifttype') : _('Create shifttype'), [
+ return page_with_title($shifttype_id ? _('Edit shifttype') : _('Create shifttype'), [
msg(),
buttons([
- button(page_link_to('shifttypes'), shifttypes_title(), 'back')
+ button(page_link_to('shifttypes'), shifttypes_title(), 'back')
]),
form([
form_text('name', _('Name'), $name),
form_select('angeltype_id', _('Angeltype'), $angeltypes_select, $angeltype_id),
form_textarea('description', _('Description'), $description),
form_info('', _('Please use markdown for the description.')),
- form_submit('submit', _('Save'))
- ])
+ form_submit('submit', _('Save'))
+ ])
]);
}
-function ShiftType_view($shifttype, $angeltype) {
- $parsedown = new Parsedown();
- $title = $shifttype['name'];
- if ($angeltype) {
- $title .= ' <small>' . sprintf(_('for team %s'), $angeltype['name']) . '</small>';
- }
- return page_with_title($title, [
+function ShiftType_view($shifttype, $angeltype)
+{
+ $parsedown = new Parsedown();
+ $title = $shifttype['name'];
+ if ($angeltype) {
+ $title .= ' <small>' . sprintf(_('for team %s'), $angeltype['name']) . '</small>';
+ }
+ return page_with_title($title, [
msg(),
buttons([
button(page_link_to('shifttypes'), shifttypes_title(), 'back'),
$angeltype ? button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], $angeltype['name']) : '',
button(page_link_to('shifttypes') . '&action=edit&shifttype_id=' . $shifttype['id'], _('edit'), 'edit'),
- button(page_link_to('shifttypes') . '&action=delete&shifttype_id=' . $shifttype['id'], _('delete'), 'delete')
+ button(page_link_to('shifttypes') . '&action=delete&shifttype_id=' . $shifttype['id'], _('delete'), 'delete')
]),
heading(_("Description"), 2),
- $parsedown->parse($shifttype['description'])
+ $parsedown->parse($shifttype['description'])
]);
}
-function ShiftTypes_list_view($shifttypes) {
- foreach ($shifttypes as &$shifttype) {
- $shifttype['name'] = '<a href="' . page_link_to('shifttypes') . '&action=view&shifttype_id=' . $shifttype['id'] . '">' . $shifttype['name'] . '</a>';
- $shifttype['actions'] = table_buttons([
+function ShiftTypes_list_view($shifttypes)
+{
+ foreach ($shifttypes as &$shifttype) {
+ $shifttype['name'] = '<a href="' . page_link_to('shifttypes') . '&action=view&shifttype_id=' . $shifttype['id'] . '">' . $shifttype['name'] . '</a>';
+ $shifttype['actions'] = table_buttons([
button(page_link_to('shifttypes') . '&action=edit&shifttype_id=' . $shifttype['id'], _('edit'), 'btn-xs'),
- button(page_link_to('shifttypes') . '&action=delete&shifttype_id=' . $shifttype['id'], _('delete'), 'btn-xs')
+ button(page_link_to('shifttypes') . '&action=delete&shifttype_id=' . $shifttype['id'], _('delete'), 'btn-xs')
]);
- }
+ }
- return page_with_title(shifttypes_title(), [
+ return page_with_title(shifttypes_title(), [
msg(),
buttons([
- button(page_link_to('shifttypes') . '&action=edit', _('New shifttype'), 'add')
+ button(page_link_to('shifttypes') . '&action=edit', _('New shifttype'), 'add')
]),
table([
'name' => _('Name'),
- 'actions' => ''
- ], $shifttypes)
+ 'actions' => ''
+ ], $shifttypes)
]);
}
-
-?> \ No newline at end of file
diff --git a/includes/view/ShiftsFilterRenderer.php b/includes/view/ShiftsFilterRenderer.php
index 301f31a2..9b7df7cd 100644
--- a/includes/view/ShiftsFilterRenderer.php
+++ b/includes/view/ShiftsFilterRenderer.php
@@ -2,7 +2,8 @@
namespace Engelsystem;
-class ShiftsFilterRenderer {
+class ShiftsFilterRenderer
+{
/**
* The shiftFilter to render.
@@ -26,44 +27,46 @@ class ShiftsFilterRenderer {
*/
private $days = [];
- public function __construct(ShiftsFilter $shiftsFilter) {
- $this->shiftsFilter = $shiftsFilter;
- }
+ public function __construct(ShiftsFilter $shiftsFilter)
+ {
+ $this->shiftsFilter = $shiftsFilter;
+ }
/**
* Renders the filter.
*
* @return Generated HTML
*/
- public function render($link_base) {
- $toolbar = [];
- if ($this->daySelectionEnabled && ! empty($this->days)) {
- $selected_day = date("Y-m-d", $this->shiftsFilter->getStartTime());
- $day_dropdown_items = [];
- foreach ($this->days as $day) {
- $day_dropdown_items[] = toolbar_item_link($link_base . '&shifts_filter_day=' . $day, '', $day);
+ public function render($link_base)
+ {
+ $toolbar = [];
+ if ($this->daySelectionEnabled && ! empty($this->days)) {
+ $selected_day = date("Y-m-d", $this->shiftsFilter->getStartTime());
+ $day_dropdown_items = [];
+ foreach ($this->days as $day) {
+ $day_dropdown_items[] = toolbar_item_link($link_base . '&shifts_filter_day=' . $day, '', $day);
+ }
+ $toolbar[] = toolbar_dropdown('', $selected_day, $day_dropdown_items, 'active');
}
- $toolbar[] = toolbar_dropdown('', $selected_day, $day_dropdown_items, 'active');
- }
- return div('form-group', [
- toolbar_pills($toolbar)
+ return div('form-group', [
+ toolbar_pills($toolbar)
]);
}
/**
* Should the filter display a day selection.
*/
- public function enableDaySelection($days) {
- $this->daySelectionEnabled = true;
- $this->days = $days;
+ public function enableDaySelection($days)
+ {
+ $this->daySelectionEnabled = true;
+ $this->days = $days;
}
/**
* Should the filter display a day selection.
*/
- public function isDaySelectionEnabled() {
- return $this->daySelectionEnabled;
+ public function isDaySelectionEnabled()
+ {
+ return $this->daySelectionEnabled;
}
}
-
-?> \ No newline at end of file
diff --git a/includes/view/Shifts_view.php b/includes/view/Shifts_view.php
index 765a6f3b..5b73c218 100644
--- a/includes/view/Shifts_view.php
+++ b/includes/view/Shifts_view.php
@@ -1,53 +1,56 @@
<?php
use Engelsystem\ShiftSignupState;
-function Shift_editor_info_render($shift) {
- $info = [];
- if ($shift['created_by_user_id'] != null) {
- $info[] = sprintf(glyph('plus') . _("created at %s by %s"), date('Y-m-d H:i', $shift['created_at_timestamp']), User_Nick_render(User($shift['created_by_user_id'])));
- }
- if ($shift['edited_by_user_id'] != null) {
- $info[] = sprintf(glyph('pencil') . _("edited at %s by %s"), date('Y-m-d H:i', $shift['edited_at_timestamp']), User_Nick_render(User($shift['edited_by_user_id'])));
- }
- return join('<br />', $info);
+function Shift_editor_info_render($shift)
+{
+ $info = [];
+ if ($shift['created_by_user_id'] != null) {
+ $info[] = sprintf(glyph('plus') . _("created at %s by %s"), date('Y-m-d H:i', $shift['created_at_timestamp']), User_Nick_render(User($shift['created_by_user_id'])));
+ }
+ if ($shift['edited_by_user_id'] != null) {
+ $info[] = sprintf(glyph('pencil') . _("edited at %s by %s"), date('Y-m-d H:i', $shift['edited_at_timestamp']), User_Nick_render(User($shift['edited_by_user_id'])));
+ }
+ return join('<br />', $info);
}
-function Shift_signup_button_render($shift, $angeltype, $user_angeltype = null) {
- global $user;
+function Shift_signup_button_render($shift, $angeltype, $user_angeltype = null)
+{
+ global $user;
- if ($user_angeltype == null) {
- $user_angeltype = UserAngelType_by_User_and_AngelType($user, $angeltype);
- }
+ if ($user_angeltype == null) {
+ $user_angeltype = UserAngelType_by_User_and_AngelType($user, $angeltype);
+ }
- if ($angeltype['shift_signup_state']->isSignupAllowed()) {
- return button(page_link_to('user_shifts') . '&shift_id=' . $shift['SID'] . '&type_id=' . $angeltype['id'], _('Sign up'));
- } elseif ($user_angeltype == null) {
- return button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], sprintf(_('Become %s'), $angeltype['name']));
- }
- return '';
+ if ($angeltype['shift_signup_state']->isSignupAllowed()) {
+ return button(page_link_to('user_shifts') . '&shift_id=' . $shift['SID'] . '&type_id=' . $angeltype['id'], _('Sign up'));
+ } elseif ($user_angeltype == null) {
+ return button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], sprintf(_('Become %s'), $angeltype['name']));
+ }
+ return '';
}
-function Shift_view($shift, $shifttype, $room, $angeltypes_source, ShiftSignupState $shift_signup_state) {
- global $privileges;
+function Shift_view($shift, $shifttype, $room, $angeltypes_source, ShiftSignupState $shift_signup_state)
+{
+ global $privileges;
- $shift_admin = in_array('admin_shifts', $privileges);
- $user_shift_admin = in_array('user_shifts_admin', $privileges);
- $admin_rooms = in_array('admin_rooms', $privileges);
- $admin_shifttypes = in_array('shifttypes', $privileges);
+ $shift_admin = in_array('admin_shifts', $privileges);
+ $user_shift_admin = in_array('user_shifts_admin', $privileges);
+ $admin_rooms = in_array('admin_rooms', $privileges);
+ $admin_shifttypes = in_array('shifttypes', $privileges);
- $parsedown = new Parsedown();
+ $parsedown = new Parsedown();
- $angeltypes = [];
- foreach ($angeltypes_source as $angeltype) {
- $angeltypes[$angeltype['id']] = $angeltype;
- }
+ $angeltypes = [];
+ foreach ($angeltypes_source as $angeltype) {
+ $angeltypes[$angeltype['id']] = $angeltype;
+ }
- $needed_angels = '';
- foreach ($shift['NeedAngels'] as $needed_angeltype) {
- $needed_angels .= Shift_view_render_needed_angeltype($needed_angeltype, $angeltypes, $shift, $user_shift_admin);
- }
+ $needed_angels = '';
+ foreach ($shift['NeedAngels'] as $needed_angeltype) {
+ $needed_angels .= Shift_view_render_needed_angeltype($needed_angeltype, $angeltypes, $shift, $user_shift_admin);
+ }
- return page_with_title($shift['name'] . ' <small class="moment-countdown" data-timestamp="' . $shift['start'] . '">%c</small>', [
+ return page_with_title($shift['name'] . ' <small class="moment-countdown" data-timestamp="' . $shift['start'] . '">%c</small>', [
msg(),
$shift_signup_state->getState() == ShiftSignupState::COLLIDES ? info(_('This shift collides with one of your shifts.'), true) : '',
$shift_signup_state->getState() == ShiftSignupState::SIGNED_UP ? info(_('You are signed up for this shift.'), true) : '',
@@ -55,12 +58,12 @@ function Shift_view($shift, $shifttype, $room, $angeltypes_source, ShiftSignupSt
$shift_admin ? button(shift_edit_link($shift), glyph('pencil') . _('edit')) : '',
$shift_admin ? button(shift_delete_link($shift), glyph('trash') . _('delete')) : '',
$admin_shifttypes ? button(shifttype_link($shifttype), $shifttype['name']) : '',
- $admin_rooms ? button(room_link($room), glyph('map-marker') . $room['Name']) : ''
+ $admin_rooms ? button(room_link($room), glyph('map-marker') . $room['Name']) : ''
]) : '',
div('row', [
div('col-sm-3 col-xs-6', [
'<h4>' . _('Title') . '</h4>',
- '<p class="lead">' . ($shift['URL'] != '' ? '<a href="' . $shift['URL'] . '">' . $shift['title'] . '</a>' : $shift['title']) . '</p>'
+ '<p class="lead">' . ($shift['URL'] != '' ? '<a href="' . $shift['URL'] . '">' . $shift['title'] . '</a>' : $shift['title']) . '</p>'
]),
div('col-sm-3 col-xs-6', [
'<h4>' . _('Start') . '</h4>',
@@ -68,7 +71,7 @@ function Shift_view($shift, $shifttype, $room, $angeltypes_source, ShiftSignupSt
glyph('calendar') . date(_('Y-m-d'), $shift['start']),
'<br />',
glyph('time') . date('H:i', $shift['start']),
- '</p>'
+ '</p>'
]),
div('col-sm-3 col-xs-6', [
'<h4>' . _('End') . '</h4>',
@@ -76,88 +79,90 @@ function Shift_view($shift, $shifttype, $room, $angeltypes_source, ShiftSignupSt
glyph('calendar') . date(_('Y-m-d'), $shift['end']),
'<br />',
glyph('time') . date('H:i', $shift['end']),
- '</p>'
+ '</p>'
]),
div('col-sm-3 col-xs-6', [
'<h4>' . _('Location') . '</h4>',
- '<p class="lead">' . Room_name_render($room) . '</p>'
- ])
+ '<p class="lead">' . Room_name_render($room) . '</p>'
+ ])
]),
div('row', [
div('col-sm-6', [
'<h2>' . _('Needed angels') . '</h2>',
- '<div class="list-group">' . $needed_angels . '</div>'
+ '<div class="list-group">' . $needed_angels . '</div>'
]),
div('col-sm-6', [
'<h2>' . _('Description') . '</h2>',
- $parsedown->parse($shifttype['description'])
- ])
+ $parsedown->parse($shifttype['description'])
+ ])
]),
- $shift_admin ? Shift_editor_info_render($shift) : ''
+ $shift_admin ? Shift_editor_info_render($shift) : ''
]);
}
-function Shift_view_render_needed_angeltype($needed_angeltype, $angeltypes, $shift, $user_shift_admin) {
- global $user;
+function Shift_view_render_needed_angeltype($needed_angeltype, $angeltypes, $shift, $user_shift_admin)
+{
+ global $user;
- $angeltype = $angeltypes[$needed_angeltype['TID']];
- $angeltype_supporter = User_is_AngelType_supporter($user, $angeltype);
+ $angeltype = $angeltypes[$needed_angeltype['TID']];
+ $angeltype_supporter = User_is_AngelType_supporter($user, $angeltype);
- $needed_angels = '';
+ $needed_angels = '';
- $class = 'progress-bar-warning';
- if ($needed_angeltype['taken'] == 0) {
- $class = 'progress-bar-danger';
- }
- if ($needed_angeltype['taken'] >= $needed_angeltype['count']) {
- $class = 'progress-bar-success';
- }
- $needed_angels .= '<div class="list-group-item">';
+ $class = 'progress-bar-warning';
+ if ($needed_angeltype['taken'] == 0) {
+ $class = 'progress-bar-danger';
+ }
+ if ($needed_angeltype['taken'] >= $needed_angeltype['count']) {
+ $class = 'progress-bar-success';
+ }
+ $needed_angels .= '<div class="list-group-item">';
- $needed_angels .= '<div class="pull-right">' . Shift_signup_button_render($shift, $angeltype) . '</div>';
+ $needed_angels .= '<div class="pull-right">' . Shift_signup_button_render($shift, $angeltype) . '</div>';
- $needed_angels .= '<h3>' . AngelType_name_render($angeltype) . '</h3>';
- $bar_max = max($needed_angeltype['count'] * 10, $needed_angeltype['taken'] * 10, 10);
- $bar_value = max(1, $needed_angeltype['taken'] * 10);
- $needed_angels .= progress_bar(0, $bar_max, $bar_value, $class, $needed_angeltype['taken'] . ' / ' . $needed_angeltype['count']);
+ $needed_angels .= '<h3>' . AngelType_name_render($angeltype) . '</h3>';
+ $bar_max = max($needed_angeltype['count'] * 10, $needed_angeltype['taken'] * 10, 10);
+ $bar_value = max(1, $needed_angeltype['taken'] * 10);
+ $needed_angels .= progress_bar(0, $bar_max, $bar_value, $class, $needed_angeltype['taken'] . ' / ' . $needed_angeltype['count']);
- $angels = [];
- foreach ($shift['ShiftEntry'] as $shift_entry) {
- if ($shift_entry['TID'] == $needed_angeltype['TID']) {
- $angels[] = Shift_view_render_shift_entry($shift_entry, $user_shift_admin, $angeltype_supporter);
+ $angels = [];
+ foreach ($shift['ShiftEntry'] as $shift_entry) {
+ if ($shift_entry['TID'] == $needed_angeltype['TID']) {
+ $angels[] = Shift_view_render_shift_entry($shift_entry, $user_shift_admin, $angeltype_supporter);
+ }
}
- }
- $needed_angels .= join(', ', $angels);
- $needed_angels .= '</div>';
+ $needed_angels .= join(', ', $angels);
+ $needed_angels .= '</div>';
- return $needed_angels;
+ return $needed_angels;
}
-function Shift_view_render_shift_entry($shift_entry, $user_shift_admin, $angeltype_supporter) {
- $entry = User_Nick_render(User($shift_entry['UID']));
- if ($shift_entry['freeloaded']) {
- $entry = '<strike>' . $entry . '</strike>';
- }
- if ($user_shift_admin || $angeltype_supporter) {
- $entry .= ' <div class="btn-group">';
- if ($user_shift_admin) {
- $entry .= button_glyph(page_link_to('user_myshifts') . '&edit=' . $shift_entry['id'] . '&id=' . $shift_entry['UID'], 'pencil', 'btn-xs');
+function Shift_view_render_shift_entry($shift_entry, $user_shift_admin, $angeltype_supporter)
+{
+ $entry = User_Nick_render(User($shift_entry['UID']));
+ if ($shift_entry['freeloaded']) {
+ $entry = '<strike>' . $entry . '</strike>';
+ }
+ if ($user_shift_admin || $angeltype_supporter) {
+ $entry .= ' <div class="btn-group">';
+ if ($user_shift_admin) {
+ $entry .= button_glyph(page_link_to('user_myshifts') . '&edit=' . $shift_entry['id'] . '&id=' . $shift_entry['UID'], 'pencil', 'btn-xs');
+ }
+ $entry .= button_glyph(page_link_to('user_shifts') . '&entry_id=' . $shift_entry['id'], 'trash', 'btn-xs');
+ $entry .= '</div>';
}
- $entry .= button_glyph(page_link_to('user_shifts') . '&entry_id=' . $shift_entry['id'], 'trash', 'btn-xs');
- $entry .= '</div>';
- }
- return $entry;
+ return $entry;
}
/**
* Calc shift length in format 12:23h.
*
- * @param Shift $shift
+ * @param Shift $shift
*/
-function shift_length($shift) {
- $length = floor(($shift['end'] - $shift['start']) / (60 * 60)) . ":";
- $length .= str_pad((($shift['end'] - $shift['start']) % (60 * 60)) / 60, 2, "0", STR_PAD_LEFT) . "h";
- return $length;
+function shift_length($shift)
+{
+ $length = floor(($shift['end'] - $shift['start']) / (60 * 60)) . ":";
+ $length .= str_pad((($shift['end'] - $shift['start']) % (60 * 60)) / 60, 2, "0", STR_PAD_LEFT) . "h";
+ return $length;
}
-?>
diff --git a/includes/view/UserAngelTypes_view.php b/includes/view/UserAngelTypes_view.php
index da4a2352..dcfff2b1 100644
--- a/includes/view/UserAngelTypes_view.php
+++ b/includes/view/UserAngelTypes_view.php
@@ -1,88 +1,93 @@
<?php
-function UserAngelType_update_view($user_angeltype, $user, $angeltype, $supporter) {
- return page_with_title($supporter ? _("Add supporter rights") : _("Remove supporter rights"), [
+function UserAngelType_update_view($user_angeltype, $user, $angeltype, $supporter)
+{
+ return page_with_title($supporter ? _("Add supporter rights") : _("Remove supporter rights"), [
msg(),
info(sprintf($supporter ? _("Do you really want to add supporter rights for %s to %s?") : _("Do you really want to remove supporter rights for %s from %s?"), $angeltype['name'], User_Nick_render($user)), true),
buttons([
button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], _("cancel"), 'cancel'),
- button(page_link_to('user_angeltypes') . '&action=update&user_angeltype_id=' . $user_angeltype['id'] . '&supporter=' . ($supporter ? '1' : '0') . '&confirmed', _("yes"), 'ok')
- ])
+ button(page_link_to('user_angeltypes') . '&action=update&user_angeltype_id=' . $user_angeltype['id'] . '&supporter=' . ($supporter ? '1' : '0') . '&confirmed', _("yes"), 'ok')
+ ])
]);
}
-function UserAngelTypes_delete_all_view($angeltype) {
- return page_with_title(_("Deny all users"), [
+function UserAngelTypes_delete_all_view($angeltype)
+{
+ return page_with_title(_("Deny all users"), [
msg(),
info(sprintf(_("Do you really want to deny all users for %s?"), $angeltype['name']), true),
buttons([
button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], _("cancel"), 'cancel'),
- button(page_link_to('user_angeltypes') . '&action=delete_all&angeltype_id=' . $angeltype['id'] . '&confirmed', _("yes"), 'ok')
- ])
+ button(page_link_to('user_angeltypes') . '&action=delete_all&angeltype_id=' . $angeltype['id'] . '&confirmed', _("yes"), 'ok')
+ ])
]);
}
-function UserAngelTypes_confirm_all_view($angeltype) {
- return page_with_title(_("Confirm all users"), [
+function UserAngelTypes_confirm_all_view($angeltype)
+{
+ return page_with_title(_("Confirm all users"), [
msg(),
info(sprintf(_("Do you really want to confirm all users for %s?"), $angeltype['name']), true),
buttons([
button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], _("cancel"), 'cancel'),
- button(page_link_to('user_angeltypes') . '&action=confirm_all&angeltype_id=' . $angeltype['id'] . '&confirmed', _("yes"), 'ok')
- ])
+ button(page_link_to('user_angeltypes') . '&action=confirm_all&angeltype_id=' . $angeltype['id'] . '&confirmed', _("yes"), 'ok')
+ ])
]);
}
-function UserAngelType_confirm_view($user_angeltype, $user, $angeltype) {
- return page_with_title(_("Confirm angeltype for user"), [
+function UserAngelType_confirm_view($user_angeltype, $user, $angeltype)
+{
+ return page_with_title(_("Confirm angeltype for user"), [
msg(),
info(sprintf(_("Do you really want to confirm %s for %s?"), User_Nick_render($user), $angeltype['name']), true),
buttons([
button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], _("cancel"), 'cancel'),
- button(page_link_to('user_angeltypes') . '&action=confirm&user_angeltype_id=' . $user_angeltype['id'] . '&confirmed', _("yes"), 'ok')
- ])
+ button(page_link_to('user_angeltypes') . '&action=confirm&user_angeltype_id=' . $user_angeltype['id'] . '&confirmed', _("yes"), 'ok')
+ ])
]);
}
-function UserAngelType_delete_view($user_angeltype, $user, $angeltype) {
- return page_with_title(_("Remove angeltype"), [
+function UserAngelType_delete_view($user_angeltype, $user, $angeltype)
+{
+ return page_with_title(_("Remove angeltype"), [
msg(),
info(sprintf(_("Do you really want to delete %s from %s?"), User_Nick_render($user), $angeltype['name']), true),
buttons([
button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], _("cancel"), 'cancel'),
- button(page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $user_angeltype['id'] . '&confirmed', _("yes"), 'ok')
- ])
+ button(page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $user_angeltype['id'] . '&confirmed', _("yes"), 'ok')
+ ])
]);
}
-function UserAngelType_add_view($angeltype, $users_source, $user_id) {
- $users = [];
- foreach ($users_source as $user_source) {
- $users[$user_source['UID']] = User_Nick_render($user_source);
- }
+function UserAngelType_add_view($angeltype, $users_source, $user_id)
+{
+ $users = [];
+ foreach ($users_source as $user_source) {
+ $users[$user_source['UID']] = User_Nick_render($user_source);
+ }
- return page_with_title(_("Add user to angeltype"), [
+ return page_with_title(_("Add user to angeltype"), [
msg(),
buttons([
- button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], _("back"), 'back')
+ button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], _("back"), 'back')
]),
form([
form_info(_("Angeltype"), $angeltype['name']),
form_select('user_id', _("User"), $users, $user_id),
- form_submit('submit', _("Add"))
- ])
+ form_submit('submit', _("Add"))
+ ])
]);
}
-function UserAngelType_join_view($user, $angeltype) {
- return page_with_title(sprintf(_("Become a %s"), $angeltype['name']), [
+function UserAngelType_join_view($user, $angeltype)
+{
+ return page_with_title(sprintf(_("Become a %s"), $angeltype['name']), [
msg(),
info(sprintf(_("Do you really want to add %s to %s?"), User_Nick_render($user), $angeltype['name']), true),
buttons([
button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], _("cancel"), 'cancel'),
- button(page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'] . '&user_id=' . $user['UID'] . '&confirmed', _("save"), 'ok')
- ])
+ button(page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'] . '&user_id=' . $user['UID'] . '&confirmed', _("save"), 'ok')
+ ])
]);
}
-
-?> \ No newline at end of file
diff --git a/includes/view/UserDriverLicenses_view.php b/includes/view/UserDriverLicenses_view.php
index 5a3effeb..bd3393cc 100644
--- a/includes/view/UserDriverLicenses_view.php
+++ b/includes/view/UserDriverLicenses_view.php
@@ -11,10 +11,11 @@
* The user driver license
* @return string
*/
-function UserDriverLicense_edit_view($user_source, $wants_to_drive, $user_driver_license) {
- return page_with_title(sprintf(_("Edit %s driving license information"), User_Nick_render($user_source)), [
+function UserDriverLicense_edit_view($user_source, $wants_to_drive, $user_driver_license)
+{
+ return page_with_title(sprintf(_("Edit %s driving license information"), User_Nick_render($user_source)), [
buttons([
- button(user_link($user_source), _("Back to profile"), 'back')
+ button(user_link($user_source), _("Back to profile"), 'back')
]),
msg(),
form([
@@ -28,10 +29,10 @@ function UserDriverLicense_edit_view($user_source, $wants_to_drive, $user_driver
form_checkbox('has_license_3_5t_transporter', _("Transporter 3,5t"), $user_driver_license['has_license_3_5t_transporter']),
form_checkbox('has_license_7_5t_truck', _("Truck 7,5t"), $user_driver_license['has_license_7_5t_truck']),
form_checkbox('has_license_12_5t_truck', _("Truck 12,5t"), $user_driver_license['has_license_12_5t_truck']),
- form_checkbox('has_license_forklift', _("Forklift"), $user_driver_license['has_license_forklift'])
- ])
+ form_checkbox('has_license_forklift', _("Forklift"), $user_driver_license['has_license_forklift'])
+ ])
], 'driving_license'),
- form_submit('submit', _("Save"))
+ form_submit('submit', _("Save"))
]),
'<script type="text/javascript">
$(function() {
@@ -49,8 +50,6 @@ function UserDriverLicense_edit_view($user_source, $wants_to_drive, $user_driver
}
);
});
- </script>'
+ </script>'
]);
}
-
-?> \ No newline at end of file
diff --git a/includes/view/UserHintsRenderer.php b/includes/view/UserHintsRenderer.php
index cf4b1414..30281ea0 100644
--- a/includes/view/UserHintsRenderer.php
+++ b/includes/view/UserHintsRenderer.php
@@ -2,24 +2,25 @@
namespace Engelsystem;
-class UserHintsRenderer {
+class UserHintsRenderer
+{
+ private $hints = [];
- private $hints = [];
-
- private $important = false;
+ private $important = false;
/**
* Render the added hints to a popover for the toolbar.
*/
- public function render() {
- if (count($this->hints) > 0) {
- $hint_class = $this->important ? 'danger' : 'info';
- $glyphicon = $this->important ? 'warning-sign' : 'info-sign';
+ public function render()
+ {
+ if (count($this->hints) > 0) {
+ $hint_class = $this->important ? 'danger' : 'info';
+ $glyphicon = $this->important ? 'warning-sign' : 'info-sign';
- return toolbar_popover($glyphicon . ' text-' . $hint_class, '', $this->hints, 'bg-' . $hint_class);
- }
+ return toolbar_popover($glyphicon . ' text-' . $hint_class, '', $this->hints, 'bg-' . $hint_class);
+ }
- return '';
+ return '';
}
/**
@@ -30,30 +31,31 @@ class UserHintsRenderer {
* @param boolean $important
* Is the hint important?
*/
- public function addHint($hint, $important = false) {
- if ($hint != null && $hint != '') {
- if ($important) {
- $this->important = true;
- $this->hints[] = error($hint, true);
- } else {
- $this->hints[] = info($hint, true);
+ public function addHint($hint, $important = false)
+ {
+ if ($hint != null && $hint != '') {
+ if ($important) {
+ $this->important = true;
+ $this->hints[] = error($hint, true);
+ } else {
+ $this->hints[] = info($hint, true);
+ }
}
- }
}
/**
* Get all hints.
*/
- public function getHints() {
- return $this->hints;
+ public function getHints()
+ {
+ return $this->hints;
}
/**
* Are there important hints? This leads to a more intensive icon.
*/
- public function isImportant() {
- return $this->important;
+ public function isImportant()
+ {
+ return $this->important;
}
}
-
-?> \ No newline at end of file
diff --git a/includes/view/User_view.php b/includes/view/User_view.php
index 65cb36b3..e28e2a36 100644
--- a/includes/view/User_view.php
+++ b/includes/view/User_view.php
@@ -16,7 +16,7 @@ $tshirt_sizes = [
'S-G' => "S Girl",
'M-G' => "M Girl",
'L-G' => "L Girl",
- 'XL-G' => "XL Girl"
+ 'XL-G' => "XL Girl"
];
/**
@@ -29,8 +29,9 @@ $tshirt_sizes = [
* @param array<String> $themes
* Available themes
*/
-function User_settings_view($user_source, $locales, $themes, $buildup_start_date, $teardown_end_date, $enable_tshirt_size, $tshirt_sizes) {
- return page_with_title(settings_title(), [
+function User_settings_view($user_source, $locales, $themes, $buildup_start_date, $teardown_end_date, $enable_tshirt_size, $tshirt_sizes)
+{
+ return page_with_title(settings_title(), [
msg(),
div('row', [
div('col-md-6', [
@@ -53,8 +54,8 @@ function User_settings_view($user_source, $locales, $themes, $buildup_start_date
form_text('hometown', _("Hometown"), $user_source['Hometown']),
$enable_tshirt_size ? form_select('tshirt_size', _("Shirt size"), $tshirt_sizes, $user_source['Size']) : '',
form_info('', _('Please visit the angeltypes page to manage your angeltypes.')),
- form_submit('submit', _("Save"))
- ])
+ form_submit('submit', _("Save"))
+ ])
]),
div('col-md-6', [
form([
@@ -62,34 +63,35 @@ function User_settings_view($user_source, $locales, $themes, $buildup_start_date
form_password('password', _("Old password:")),
form_password('new_password', _("New password:")),
form_password('new_password2', _("Password confirmation:")),
- form_submit('submit_password', _("Save"))
+ form_submit('submit_password', _("Save"))
]),
form([
form_info(_("Here you can choose your color settings:")),
form_select('theme', _("Color settings:"), $themes, $user_source['color']),
- form_submit('submit_theme', _("Save"))
+ form_submit('submit_theme', _("Save"))
]),
form([
form_info(_("Here you can choose your language:")),
form_select('language', _("Language:"), $locales, $user_source['Sprache']),
- form_submit('submit_language', _("Save"))
- ])
- ])
- ])
+ form_submit('submit_language', _("Save"))
+ ])
+ ])
+ ])
]);
}
/**
* Displays the welcome message to the user and shows a login form.
*/
-function User_registration_success_view($event_welcome_message) {
- $parsedown = new Parsedown();
- $event_welcome_message = $parsedown->text($event_welcome_message);
- return page_with_title(_("Registration successful"), [
+function User_registration_success_view($event_welcome_message)
+{
+ $parsedown = new Parsedown();
+ $event_welcome_message = $parsedown->text($event_welcome_message);
+ return page_with_title(_("Registration successful"), [
msg(),
div('row', [
div('col-md-4', [
- $event_welcome_message
+ $event_welcome_message
]),
div('col-md-4', [
'<h2>' . _("Login") . '</h2>',
@@ -98,70 +100,73 @@ function User_registration_success_view($event_welcome_message) {
form_password('password', _("Password")),
form_submit('submit', _("Login")),
buttons([
- button(page_link_to('user_password_recovery'), _("I forgot my password"))
+ button(page_link_to('user_password_recovery'), _("I forgot my password"))
]),
- info(_("Please note: You have to activate cookies!"), true)
- ], page_link_to('login'))
+ info(_("Please note: You have to activate cookies!"), true)
+ ], page_link_to('login'))
]),
div('col-md-4', [
'<h2>' . _("What can I do?") . '</h2>',
'<p>' . _("Please read about the jobs you can do to help us.") . '</p>',
buttons([
- button(page_link_to('angeltypes') . '&action=about', _("Teams/Job description") . ' &raquo;')
- ])
- ])
- ])
+ button(page_link_to('angeltypes') . '&action=about', _("Teams/Job description") . ' &raquo;')
+ ])
+ ])
+ ])
]);
}
/**
* Gui for deleting user with password field.
*/
-function User_delete_view($user) {
- return page_with_title(sprintf(_("Delete %s"), User_Nick_render($user)), [
+function User_delete_view($user)
+{
+ return page_with_title(sprintf(_("Delete %s"), User_Nick_render($user)), [
msg(),
buttons([
- button(user_edit_link($user), glyph('chevron-left') . _("back"))
+ button(user_edit_link($user), glyph('chevron-left') . _("back"))
]),
error(_("Do you really want to delete the user including all his shifts and every other piece of his data?"), true),
form([
form_password('password', _("Your password")),
- form_submit('submit', _("Delete"))
- ])
+ form_submit('submit', _("Delete"))
+ ])
]);
}
/**
* View for editing the number of given vouchers
*/
-function User_edit_vouchers_view($user) {
- return page_with_title(sprintf(_("%s's vouchers"), User_Nick_render($user)), [
+function User_edit_vouchers_view($user)
+{
+ return page_with_title(sprintf(_("%s's vouchers"), User_Nick_render($user)), [
msg(),
buttons([
- button(user_link($user), glyph('chevron-left') . _("back"))
+ button(user_link($user), glyph('chevron-left') . _("back"))
]),
info(sprintf(_("Angel should receive at least %d vouchers."), User_get_eligable_voucher_count($user)), true),
form([
form_spinner('vouchers', _("Number of vouchers given out"), $user['got_voucher']),
- form_submit('submit', _("Save"))
- ], page_link_to('users') . '&action=edit_vouchers&user_id=' . $user['UID'])
+ form_submit('submit', _("Save"))
+ ], page_link_to('users') . '&action=edit_vouchers&user_id=' . $user['UID'])
]);
}
-function Users_view($users, $order_by, $arrived_count, $active_count, $force_active_count, $freeloads_count, $tshirts_count, $voucher_count) {
- foreach ($users as &$user) {
- $user['Nick'] = User_Nick_render($user);
- $user['Gekommen'] = glyph_bool($user['Gekommen']);
- $user['got_voucher'] = $user['got_voucher'];
- $user['Aktiv'] = glyph_bool($user['Aktiv']);
- $user['force_active'] = glyph_bool($user['force_active']);
- $user['Tshirt'] = glyph_bool($user['Tshirt']);
- $user['lastLogIn'] = date(_('m/d/Y h:i a'), $user['lastLogIn']);
- $user['actions'] = table_buttons([
- button_glyph(page_link_to('admin_user') . '&id=' . $user['UID'], 'edit', 'btn-xs')
+function Users_view($users, $order_by, $arrived_count, $active_count, $force_active_count, $freeloads_count, $tshirts_count, $voucher_count)
+{
+ foreach ($users as &$user) {
+ $user['Nick'] = User_Nick_render($user);
+ $user['Gekommen'] = glyph_bool($user['Gekommen']);
+ $user['got_voucher'] = $user['got_voucher'];
+ $user['Aktiv'] = glyph_bool($user['Aktiv']);
+ $user['force_active'] = glyph_bool($user['force_active']);
+ $user['Tshirt'] = glyph_bool($user['Tshirt']);
+ $user['lastLogIn'] = date(_('m/d/Y h:i a'), $user['lastLogIn']);
+ $user['actions'] = table_buttons([
+ button_glyph(page_link_to('admin_user') . '&id=' . $user['UID'], 'edit', 'btn-xs')
]);
- }
- $users[] = [
+ }
+ $users[] = [
'Nick' => '<strong>' . _('Sum') . '</strong>',
'Gekommen' => $arrived_count,
'got_voucher' => $voucher_count,
@@ -169,13 +174,13 @@ function Users_view($users, $order_by, $arrived_count, $active_count, $force_act
'force_active' => $force_active_count,
'freeloads' => $freeloads_count,
'Tshirt' => $tshirts_count,
- 'actions' => '<strong>' . count($users) . '</strong>'
+ 'actions' => '<strong>' . count($users) . '</strong>'
];
- return page_with_title(_("All users"), [
+ return page_with_title(_("All users"), [
msg(),
buttons([
- button(page_link_to('register'), glyph('plus') . _("New user"))
+ button(page_link_to('register'), glyph('plus') . _("New user"))
]),
table([
'Nick' => Users_table_header_link('Nick', _("Nick"), $order_by),
@@ -190,137 +195,143 @@ function Users_view($users, $order_by, $arrived_count, $active_count, $force_act
'Tshirt' => Users_table_header_link('Tshirt', _("T-Shirt"), $order_by),
'Size' => Users_table_header_link('Size', _("Size"), $order_by),
'lastLogIn' => Users_table_header_link('lastLogIn', _("Last login"), $order_by),
- 'actions' => ''
- ], $users)
+ 'actions' => ''
+ ], $users)
]);
}
-function Users_table_header_link($column, $label, $order_by) {
- return '<a href="' . page_link_to('users') . '&OrderBy=' . $column . '">' . $label . ($order_by == $column ? ' <span class="caret"></span>' : '') . '</a>';
+function Users_table_header_link($column, $label, $order_by)
+{
+ return '<a href="' . page_link_to('users') . '&OrderBy=' . $column . '">' . $label . ($order_by == $column ? ' <span class="caret"></span>' : '') . '</a>';
}
-function User_shift_state_render($user) {
- $upcoming_shifts = ShiftEntries_upcoming_for_user($user);
- if ($upcoming_shifts === false) {
- return false;
- }
+function User_shift_state_render($user)
+{
+ $upcoming_shifts = ShiftEntries_upcoming_for_user($user);
+ if ($upcoming_shifts === false) {
+ return false;
+ }
- if (count($upcoming_shifts) == 0) {
- return '<span class="text-success">' . _("Free") . '</span>';
- }
+ if (count($upcoming_shifts) == 0) {
+ return '<span class="text-success">' . _("Free") . '</span>';
+ }
- if ($upcoming_shifts[0]['start'] > time()) {
- if ($upcoming_shifts[0]['start'] - time() > 3600) {
- return '<span class="text-success moment-countdown" data-timestamp="' . $upcoming_shifts[0]['start'] . '">' . _("Next shift %c") . '</span>';
+ if ($upcoming_shifts[0]['start'] > time()) {
+ if ($upcoming_shifts[0]['start'] - time() > 3600) {
+ return '<span class="text-success moment-countdown" data-timestamp="' . $upcoming_shifts[0]['start'] . '">' . _("Next shift %c") . '</span>';
+ }
+ return '<span class="text-warning moment-countdown" data-timestamp="' . $upcoming_shifts[0]['start'] . '">' . _("Next shift %c") . '</span>';
}
- return '<span class="text-warning moment-countdown" data-timestamp="' . $upcoming_shifts[0]['start'] . '">' . _("Next shift %c") . '</span>';
- }
- $halfway = ($upcoming_shifts[0]['start'] + $upcoming_shifts[0]['end']) / 2;
+ $halfway = ($upcoming_shifts[0]['start'] + $upcoming_shifts[0]['end']) / 2;
- if (time() < $halfway) {
- return '<span class="text-danger moment-countdown" data-timestamp="' . $upcoming_shifts[0]['start'] . '">' . _("Shift starts %c") . '</span>';
- }
- return '<span class="text-danger moment-countdown" data-timestamp="' . $upcoming_shifts[0]['end'] . '">' . _("Shift ends %c") . '</span>';
+ if (time() < $halfway) {
+ return '<span class="text-danger moment-countdown" data-timestamp="' . $upcoming_shifts[0]['start'] . '">' . _("Shift starts %c") . '</span>';
+ }
+ return '<span class="text-danger moment-countdown" data-timestamp="' . $upcoming_shifts[0]['end'] . '">' . _("Shift ends %c") . '</span>';
}
-function User_view_shiftentries($needed_angel_type) {
- $shift_info = '<br><b>' . $needed_angel_type['name'] . ':</b> ';
+function User_view_shiftentries($needed_angel_type)
+{
+ $shift_info = '<br><b>' . $needed_angel_type['name'] . ':</b> ';
- $shift_entries = [];
- foreach ($needed_angel_type['users'] as $user_shift) {
- $member = User_Nick_render($user_shift);
- if ($user_shift['freeloaded']) {
- $member = '<strike>' . $member . '</strike>';
- }
+ $shift_entries = [];
+ foreach ($needed_angel_type['users'] as $user_shift) {
+ $member = User_Nick_render($user_shift);
+ if ($user_shift['freeloaded']) {
+ $member = '<strike>' . $member . '</strike>';
+ }
- $shift_entries[] = $member;
- }
- $shift_info .= join(", ", $shift_entries);
+ $shift_entries[] = $member;
+ }
+ $shift_info .= join(", ", $shift_entries);
- return $shift_info;
+ return $shift_info;
}
/**
* Helper that renders a shift line for user view
*/
-function User_view_myshift($shift, $user_source, $its_me) {
- global $LETZTES_AUSTRAGEN, $privileges;
+function User_view_myshift($shift, $user_source, $its_me)
+{
+ global $LETZTES_AUSTRAGEN, $privileges;
- $shift_info = '<a href="' . shift_link($shift) . '">' . $shift['name'] . '</a>';
- if ($shift['title']) {
- $shift_info .= '<br /><a href="' . shift_link($shift) . '">' . $shift['title'] . '</a>';
- }
- foreach ($shift['needed_angeltypes'] as $needed_angel_type) {
- $shift_info .= User_view_shiftentries($needed_angel_type);
- }
+ $shift_info = '<a href="' . shift_link($shift) . '">' . $shift['name'] . '</a>';
+ if ($shift['title']) {
+ $shift_info .= '<br /><a href="' . shift_link($shift) . '">' . $shift['title'] . '</a>';
+ }
+ foreach ($shift['needed_angeltypes'] as $needed_angel_type) {
+ $shift_info .= User_view_shiftentries($needed_angel_type);
+ }
- $myshift = [
+ $myshift = [
'date' => date("Y-m-d", $shift['start']),
'time' => date("H:i", $shift['start']) . ' - ' . date("H:i", $shift['end']),
'room' => $shift['Name'],
'shift_info' => $shift_info,
- 'comment' => $shift['Comment']
+ 'comment' => $shift['Comment']
];
- if ($shift['freeloaded']) {
- if (in_array("user_shifts_admin", $privileges)) {
- $myshift['comment'] .= '<br /><p class="error">' . _("Freeloaded") . ': ' . $shift['freeload_comment'] . '</p>';
- } else {
- $myshift['comment'] .= '<br /><p class="error">' . _("Freeloaded") . '</p>';
+ if ($shift['freeloaded']) {
+ if (in_array("user_shifts_admin", $privileges)) {
+ $myshift['comment'] .= '<br /><p class="error">' . _("Freeloaded") . ': ' . $shift['freeload_comment'] . '</p>';
+ } else {
+ $myshift['comment'] .= '<br /><p class="error">' . _("Freeloaded") . '</p>';
+ }
}
- }
- $myshift['actions'] = [
- button(shift_link($shift), glyph('eye-open') . _('view'), 'btn-xs')
+ $myshift['actions'] = [
+ button(shift_link($shift), glyph('eye-open') . _('view'), 'btn-xs')
];
- if ($its_me || in_array('user_shifts_admin', $privileges)) {
- $myshift['actions'][] = button(page_link_to('user_myshifts') . '&edit=' . $shift['id'] . '&id=' . $user_source['UID'], glyph('edit') . _('edit'), 'btn-xs');
- }
- if (($shift['start'] > time() + $LETZTES_AUSTRAGEN * 3600) || in_array('user_shifts_admin', $privileges)) {
- $myshift['actions'][] = button(page_link_to('user_myshifts') . ((! $its_me) ? '&id=' . $user_source['UID'] : '') . '&cancel=' . $shift['id'], glyph('trash') . _('sign off'), 'btn-xs');
- }
- $myshift['actions'] = table_buttons($myshift['actions']);
+ if ($its_me || in_array('user_shifts_admin', $privileges)) {
+ $myshift['actions'][] = button(page_link_to('user_myshifts') . '&edit=' . $shift['id'] . '&id=' . $user_source['UID'], glyph('edit') . _('edit'), 'btn-xs');
+ }
+ if (($shift['start'] > time() + $LETZTES_AUSTRAGEN * 3600) || in_array('user_shifts_admin', $privileges)) {
+ $myshift['actions'][] = button(page_link_to('user_myshifts') . ((! $its_me) ? '&id=' . $user_source['UID'] : '') . '&cancel=' . $shift['id'], glyph('trash') . _('sign off'), 'btn-xs');
+ }
+ $myshift['actions'] = table_buttons($myshift['actions']);
- return $myshift;
+ return $myshift;
}
/**
* Helper that prepares the shift table for user view
*/
-function User_view_myshifts($shifts, $user_source, $its_me) {
- $myshifts_table = [];
- $timesum = 0;
- foreach ($shifts as $shift) {
- $myshifts_table[] = User_view_myshift($shift, $user_source, $its_me);
+function User_view_myshifts($shifts, $user_source, $its_me)
+{
+ $myshifts_table = [];
+ $timesum = 0;
+ foreach ($shifts as $shift) {
+ $myshifts_table[] = User_view_myshift($shift, $user_source, $its_me);
- if ($shift['freeloaded']) {
- $timesum += (- 2 * ($shift['end'] - $shift['start']));
- } else {
- $timesum += ($shift['end'] - $shift['start']);
+ if ($shift['freeloaded']) {
+ $timesum += (- 2 * ($shift['end'] - $shift['start']));
+ } else {
+ $timesum += ($shift['end'] - $shift['start']);
+ }
}
- }
- if (count($myshifts_table) > 0) {
- $myshifts_table[] = [
+ if (count($myshifts_table) > 0) {
+ $myshifts_table[] = [
'date' => '<b>' . _("Sum:") . '</b>',
'time' => "<b>" . round($timesum / 3600, 1) . " h</b>",
'room' => "",
'shift_info' => "",
'comment' => "",
- 'actions' => ""
+ 'actions' => ""
];
- }
- return $myshifts_table;
+ }
+ return $myshifts_table;
}
/**
* Renders view for a single user
*/
-function User_view($user_source, $admin_user_privilege, $freeloader, $user_angeltypes, $user_groups, $shifts, $its_me) {
- $user_name = htmlspecialchars($user_source['Vorname']) . " " . htmlspecialchars($user_source['Name']);
- $myshifts_table = User_view_myshifts($shifts, $user_source, $its_me);
+function User_view($user_source, $admin_user_privilege, $freeloader, $user_angeltypes, $user_groups, $shifts, $its_me)
+{
+ $user_name = htmlspecialchars($user_source['Vorname']) . " " . htmlspecialchars($user_source['Name']);
+ $myshifts_table = User_view_myshifts($shifts, $user_source, $its_me);
- return page_with_title('<span class="icon-icon_angel"></span> ' . htmlspecialchars($user_source['Nick']) . ' <small>' . $user_name . '</small>', [
+ return page_with_title('<span class="icon-icon_angel"></span> ' . htmlspecialchars($user_source['Nick']) . ' <small>' . $user_name . '</small>', [
msg(),
div('row space-top', [
div('col-md-12', [
@@ -332,16 +343,16 @@ function User_view($user_source, $admin_user_privilege, $freeloader, $user_angel
$its_me ? button(page_link_to('user_settings'), glyph('list-alt') . _("Settings")) : '',
$its_me ? button(page_link_to('ical') . '&key=' . $user_source['api_key'], glyph('calendar') . _("iCal Export")) : '',
$its_me ? button(page_link_to('shifts_json_export') . '&key=' . $user_source['api_key'], glyph('export') . _("JSON Export")) : '',
- $its_me ? button(page_link_to('user_myshifts') . '&reset', glyph('repeat') . _('Reset API key')) : ''
- ])
- ])
+ $its_me ? button(page_link_to('user_myshifts') . '&reset', glyph('repeat') . _('Reset API key')) : ''
+ ])
+ ])
]),
div('row', [
div('col-md-3', [
'<h1>',
'<span class="glyphicon glyphicon-phone"></span>',
$user_source['DECT'],
- '</h1>'
+ '</h1>'
]),
div('col-md-3', [
'<h4>' . _("User state") . '</h4>',
@@ -350,16 +361,16 @@ function User_view($user_source, $admin_user_privilege, $freeloader, $user_angel
$admin_user_privilege || $its_me ? ($user_source['Gekommen'] ? '<span class="text-success"><span class="glyphicon glyphicon-home"></span> ' . sprintf(_("Arrived at %s"), date('Y-m-d', $user_source['arrival_date'])) . '</span>' : '<span class="text-danger">' . sprintf(_("Not arrived (Planned: %s)"), date('Y-m-d', $user_source['planned_arrival_date'])) . '</span>') : ($user_source['Gekommen'] ? '<span class="text-success"><span class="glyphicon glyphicon-home"></span> ' . _("Arrived") . '</span>' : '<span class="text-danger">' . _("Not arrived") . '</span>'),
$admin_user_privilege ? ($user_source['got_voucher'] > 0 ? '<br /><span class="text-success">' . glyph('cutlery') . sprintf(ngettext("Got %s voucher", "Got %s vouchers", $user_source['got_voucher']), $user_source['got_voucher']) . '</span><br />' : '<br /><span class="text-danger">' . _("Got no vouchers") . '</span><br />') : '',
($user_source['Gekommen'] && $admin_user_privilege && $user_source['Aktiv']) ? ' <span class="text-success">' . _("Active") . '</span>' : '',
- ($user_source['Gekommen'] && $admin_user_privilege && $user_source['Tshirt']) ? ' <span class="text-success">' . _("T-Shirt") . '</span>' : ''
+ ($user_source['Gekommen'] && $admin_user_privilege && $user_source['Tshirt']) ? ' <span class="text-success">' . _("T-Shirt") . '</span>' : ''
]),
div('col-md-3', [
'<h4>' . _("Angeltypes") . '</h4>',
- User_angeltypes_render($user_angeltypes)
+ User_angeltypes_render($user_angeltypes)
]),
div('col-md-3', [
'<h4>' . _("Rights") . '</h4>',
- User_groups_render($user_groups)
- ])
+ User_groups_render($user_groups)
+ ])
]),
($its_me || $admin_user_privilege) ? '<h2>' . _("Shifts") . '</h2>' : '',
($its_me || $admin_user_privilege) ? table([
@@ -368,127 +379,135 @@ function User_view($user_source, $admin_user_privilege, $freeloader, $user_angel
'room' => _("Location"),
'shift_info' => _("Name &amp; workmates"),
'comment' => _("Comment"),
- 'actions' => _("Action")
+ 'actions' => _("Action")
], $myshifts_table) : '',
$its_me ? info(glyph('info-sign') . _("Your night shifts between 2 and 8 am count twice."), true) : '',
- $its_me && count($shifts) == 0 ? error(sprintf(_("Go to the <a href=\"%s\">shifts table</a> to sign yourself up for some shifts."), page_link_to('user_shifts')), true) : ''
+ $its_me && count($shifts) == 0 ? error(sprintf(_("Go to the <a href=\"%s\">shifts table</a> to sign yourself up for some shifts."), page_link_to('user_shifts')), true) : ''
]);
}
/**
* View for password recovery step 1: E-Mail
*/
-function User_password_recovery_view() {
- return page_with_title(user_password_recovery_title(), [
+function User_password_recovery_view()
+{
+ return page_with_title(user_password_recovery_title(), [
msg(),
_("We will send you an e-mail with a password recovery link. Please use the email address you used for registration."),
form([
form_text('email', _("E-Mail"), ""),
- form_submit('submit', _("Recover"))
- ])
+ form_submit('submit', _("Recover"))
+ ])
]);
}
/**
* View for password recovery step 2: New password
*/
-function User_password_set_view() {
- return page_with_title(user_password_recovery_title(), [
+function User_password_set_view()
+{
+ return page_with_title(user_password_recovery_title(), [
msg(),
_("Please enter a new password."),
form([
form_password('password', _("Password")),
form_password('password2', _("Confirm password")),
- form_submit('submit', _("Save"))
- ])
+ form_submit('submit', _("Save"))
+ ])
]);
}
-function User_angeltypes_render($user_angeltypes) {
- $output = [];
- foreach ($user_angeltypes as $angeltype) {
- $class = "";
- if ($angeltype['restricted'] == 1) {
- if ($angeltype['confirm_user_id'] != null) {
- $class = 'text-success';
- } else {
- $class = 'text-warning';
- }
- } else {
- $class = 'text-success';
+function User_angeltypes_render($user_angeltypes)
+{
+ $output = [];
+ foreach ($user_angeltypes as $angeltype) {
+ $class = "";
+ if ($angeltype['restricted'] == 1) {
+ if ($angeltype['confirm_user_id'] != null) {
+ $class = 'text-success';
+ } else {
+ $class = 'text-warning';
+ }
+ } else {
+ $class = 'text-success';
+ }
+ $output[] = '<a href="' . angeltype_link($angeltype['id']) . '" class="' . $class . '">' . ($angeltype['supporter'] ? glyph('education') : '') . $angeltype['name'] . '</a>';
}
- $output[] = '<a href="' . angeltype_link($angeltype['id']) . '" class="' . $class . '">' . ($angeltype['supporter'] ? glyph('education') : '') . $angeltype['name'] . '</a>';
- }
- return join('<br />', $output);
+ return join('<br />', $output);
}
-function User_groups_render($user_groups) {
- $output = [];
- foreach ($user_groups as $group) {
- $output[] = substr($group['Name'], 2);
- }
- return join('<br />', $output);
+function User_groups_render($user_groups)
+{
+ $output = [];
+ foreach ($user_groups as $group) {
+ $output[] = substr($group['Name'], 2);
+ }
+ return join('<br />', $output);
}
/**
* Render a user nickname.
*
- * @param User $user_source
+ * @param User $user_source
* @return string
*/
-function User_Nick_render($user_source) {
- return '<a class="' . ($user_source['Gekommen'] ? '' : 'text-muted') . '" href="' . page_link_to('users') . '&amp;action=view&amp;user_id=' . $user_source['UID'] . '"><span class="icon-icon_angel"></span> ' . htmlspecialchars($user_source['Nick']) . '</a>';
+function User_Nick_render($user_source)
+{
+ return '<a class="' . ($user_source['Gekommen'] ? '' : 'text-muted') . '" href="' . page_link_to('users') . '&amp;action=view&amp;user_id=' . $user_source['UID'] . '"><span class="icon-icon_angel"></span> ' . htmlspecialchars($user_source['Nick']) . '</a>';
}
-function render_user_departure_date_hint() {
- global $user;
+function render_user_departure_date_hint()
+{
+ global $user;
- if (! isset($user['planned_departure_date']) || $user['planned_departure_date'] == null) {
- return _("Please enter your planned date of departure on your settings page to give us a feeling for teardown capacities.");
- }
+ if (! isset($user['planned_departure_date']) || $user['planned_departure_date'] == null) {
+ return _("Please enter your planned date of departure on your settings page to give us a feeling for teardown capacities.");
+ }
- return null;
+ return null;
}
-function render_user_freeloader_hint() {
- global $user, $max_freeloadable_shifts;
+function render_user_freeloader_hint()
+{
+ global $user, $max_freeloadable_shifts;
- if (User_is_freeloader($user)) {
- return sprintf(_("You freeloaded at least %s shifts. Shift signup is locked. Please go to heavens desk to be unlocked again."), $max_freeloadable_shifts);
- }
+ if (User_is_freeloader($user)) {
+ return sprintf(_("You freeloaded at least %s shifts. Shift signup is locked. Please go to heavens desk to be unlocked again."), $max_freeloadable_shifts);
+ }
- return null;
+ return null;
}
// Hinweis für Engel, die noch nicht angekommen sind
-function render_user_arrived_hint() {
- global $user;
+function render_user_arrived_hint()
+{
+ global $user;
- if ($user['Gekommen'] == 0) {
- return _("You are not marked as arrived. Please go to heaven's desk, get your angel badge and/or tell them that you arrived already.");
- }
+ if ($user['Gekommen'] == 0) {
+ return _("You are not marked as arrived. Please go to heaven's desk, get your angel badge and/or tell them that you arrived already.");
+ }
- return null;
+ return null;
}
-function render_user_tshirt_hint() {
- global $enable_tshirt_size, $user;
+function render_user_tshirt_hint()
+{
+ global $enable_tshirt_size, $user;
- if ($enable_tshirt_size && $user['Size'] == "") {
- return _("You need to specify a tshirt size in your settings!");
- }
+ if ($enable_tshirt_size && $user['Size'] == "") {
+ return _("You need to specify a tshirt size in your settings!");
+ }
- return null;
+ return null;
}
-function render_user_dect_hint() {
- global $user;
+function render_user_dect_hint()
+{
+ global $user;
- if ($user['DECT'] == "") {
- return _("You need to specify a DECT phone number in your settings! If you don't have a DECT phone, just enter \"-\".");
- }
+ if ($user['DECT'] == "") {
+ return _("You need to specify a DECT phone number in your settings! If you don't have a DECT phone, just enter \"-\".");
+ }
- return null;
+ return null;
}
-
-?>