summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/config.default.php27
-rw-r--r--includes/helper/message_helper.php11
-rw-r--r--includes/model/Shifts_model.php4
-rw-r--r--includes/pages/user_shifts.php6
-rw-r--r--includes/view/Rooms_view.php8
-rw-r--r--public/index.php3
-rw-r--r--templates/user_shifts.html17
7 files changed, 52 insertions, 24 deletions
diff --git a/config/config.default.php b/config/config.default.php
index a0303b15..419b02d1 100644
--- a/config/config.default.php
+++ b/config/config.default.php
@@ -4,7 +4,7 @@
return [
// MySQL-Connection Settings
- 'database' => [
+ 'database' => [
'host' => 'localhost',
'user' => 'root',
'pw' => '',
@@ -12,28 +12,28 @@ return [
],
// For accessing stats
- 'api_key' => '',
+ 'api_key' => '',
// Enable maintenance mode (show a static page)
- 'maintenance' => false,
+ 'maintenance' => false,
// Set to development to enable debugging messages
- 'environment' => 'production',
+ 'environment' => 'production',
// URL to the angel faq and job description
- 'faq_url' => 'https://events.ccc.de/congress/2013/wiki/Static:Volunteers',
+ 'faq_url' => 'https://events.ccc.de/congress/2013/wiki/Static:Volunteers',
// Contact email address, linked on every page
- 'contact_email' => 'mailto:ticket@c3heaven.de',
+ 'contact_email' => 'mailto:ticket@c3heaven.de',
// From address of all emails
- 'no_reply_email' => 'noreply@engelsystem.de',
+ 'no_reply_email' => 'noreply@engelsystem.de',
// Default theme, 1=style1.css
- 'theme' => 1,
+ 'theme' => 1,
// Available themes
- 'available_themes' => [
+ 'available_themes' => [
'4' => 'Engelsystem 33c3 (2016)',
'3' => 'Engelsystem 32c3 (2015)',
'2' => 'Engelsystem cccamp15',
@@ -42,10 +42,13 @@ return [
],
// Number of News shown on one site
- 'display_news' => 6,
+ 'display_news' => 6,
+
+ // Only arrived angels can sign up for shifts
+ 'signup_requires_arrival' => false,
// Anzahl Stunden bis zum Austragen eigener Schichten
- 'last_unsubscribe' => 3,
+ 'last_unsubscribe' => 3,
// Setzt den zu verwendenden Crypto-Algorithmus (entsprechend der Dokumentation von crypt()).
// Falls ein Benutzerpasswort in einem anderen Format gespeichert ist,
@@ -55,7 +58,7 @@ return [
// Blowfish '$2y$13'
// SHA-256 '$5$rounds=5000'
// SHA-512 '$6$rounds=5000'
- 'crypt_alg' => '$6$rounds=5000',
+ 'crypt_alg' => '$6$rounds=5000',
'min_password_length' => 8,
diff --git a/includes/helper/message_helper.php b/includes/helper/message_helper.php
index 7a42a7b7..4fa0efe3 100644
--- a/includes/helper/message_helper.php
+++ b/includes/helper/message_helper.php
@@ -57,16 +57,17 @@ function success($msg, $immediately = false)
* @param string $class
* @param string $msg
* @param bool $immediately
- * @return string|null
+ * @return string
*/
function alert($class, $msg, $immediately = false)
{
$session = session();
+ if (empty($msg)) {
+ return '';
+ }
+
if ($immediately) {
- if ($msg == '') {
- return '';
- }
return '<div class="alert alert-' . $class . '">' . $msg . '</div>';
}
@@ -74,5 +75,5 @@ function alert($class, $msg, $immediately = false)
$message .= alert($class, $msg, true);
$session->set('msg', $message);
- return null;
+ return '';
}
diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php
index 1589939d..03f8341f 100644
--- a/includes/model/Shifts_model.php
+++ b/includes/model/Shifts_model.php
@@ -245,6 +245,10 @@ function Shift_signup_allowed_angel(
) {
$free_entries = Shift_free_entries($needed_angeltype, $shift_entries);
+ if (config('signup_requires_arrival') && !$user['Gekommen']) {
+ return new ShiftSignupState(ShiftSignupState::SHIFT_ENDED, $free_entries);
+ }
+
if ($user_shifts == null) {
$user_shifts = Shifts_by_user($user);
}
diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php
index 30abbde6..2bd7688f 100644
--- a/includes/pages/user_shifts.php
+++ b/includes/pages/user_shifts.php
@@ -206,6 +206,11 @@ function view_user_shifts()
$end_day = date('Y-m-d', $shiftsFilter->getEndTime());
$end_time = date('H:i', $shiftsFilter->getEndTime());
+ $assignNotice = '';
+ if (config('signup_requires_arrival') && !$user['Gekommen']) {
+ $assignNotice = info(render_user_arrived_hint(), true);
+ }
+
return page([
div('col-md-12', [
msg(),
@@ -229,6 +234,7 @@ function view_user_shifts()
. ' <a href="' . page_link_to('angeltypes', ['action' => 'about']) . '">'
. _('Description of the jobs.')
. '</a>',
+ 'assign_notice' => $assignNotice,
'shifts_table' => msg() . $shiftCalendarRenderer->render(),
'ical_text' => '<h2>' . _('iCal export') . '</h2><p>' . sprintf(
_('Export of shown shifts. <a href="%s">iCal format</a> or <a href="%s">JSON format</a> available (please keep secret, otherwise <a href="%s">reset the api key</a>).'),
diff --git a/includes/view/Rooms_view.php b/includes/view/Rooms_view.php
index 3c0440a4..adb58a9a 100644
--- a/includes/view/Rooms_view.php
+++ b/includes/view/Rooms_view.php
@@ -11,8 +11,16 @@ use Engelsystem\ShiftsFilterRenderer;
*/
function Room_view($room, ShiftsFilterRenderer $shiftsFilterRenderer, ShiftCalendarRenderer $shiftCalendarRenderer)
{
+ global $user;
+
+ $assignNotice = '';
+ if (config('signup_requires_arrival') && !$user['Gekommen']) {
+ $assignNotice = info(render_user_arrived_hint(), true);
+ }
+
return page_with_title(glyph('map-marker') . $room['Name'], [
$shiftsFilterRenderer->render($room),
+ $assignNotice,
$shiftCalendarRenderer->render()
]);
}
diff --git a/public/index.php b/public/index.php
index a83ab5e8..b44e1491 100644
--- a/public/index.php
+++ b/public/index.php
@@ -19,7 +19,7 @@ $free_pages = [
'stats',
'users',
'user_driver_licenses',
- 'user_password_recovery'
+ 'user_password_recovery',
];
// Gewünschte Seite/Funktion
@@ -218,6 +218,7 @@ $parameters = [
if ($page == 'user_meetings') {
$parameters['meetings'] = 1;
}
+
echo view(__DIR__ . '/../templates/layout.html', [
'theme' => isset($user) ? $user['color'] : config('theme'),
'title' => $title,
diff --git a/templates/user_shifts.html b/templates/user_shifts.html
index 2b176ef9..c3fb7718 100644
--- a/templates/user_shifts.html
+++ b/templates/user_shifts.html
@@ -4,12 +4,14 @@
var days = document.getElementById(id + '_day').getElementsByTagName(
'option');
for (var i = 0; i < days.length; i++) {
- if (days[i].value == moment().format('YYYY-MM-DD'))
+ if (days[i].value === moment().format('YYYY-MM-DD')) {
days[i].selected = true;
+ }
}
}
</script>
-<form class="form-inline" action="" method="get">
+
+<form class="form-inline" action="">
<input type="hidden" name="p" value="user_shifts">
<div class="row">
<div class="col-md-6">
@@ -17,7 +19,7 @@
<div class="form-group">%start_select%</div>
<div class="form-group">
<div class="input-group">
- <input class="form-control" type="text" id="start_time" name="start_time" size="5"
+ <input class="form-control" id="start_time" name="start_time" size="5"
pattern="^\d{1,2}:\d{2}$" placeholder="HH:MM" maxlength="5" value="%start_time%">
<div class="input-group-btn">
<button class="btn btn-default" title="Now" type="button" onclick="set_to_now('start');">
@@ -30,7 +32,7 @@
<div class="form-group">%end_select%</div>
<div class="form-group">
<div class="input-group">
- <input class="form-control" type="text" id="end_time" name="end_time" size="5"
+ <input class="form-control" id="end_time" name="end_time" size="5"
pattern="^\d{1,2}:\d{2}$" placeholder="HH:MM" maxlength="5" value="%end_time%">
<div class="input-group-btn">
<button class="btn btn-default" title="Now" type="button" onclick="set_to_now('end');">
@@ -46,8 +48,11 @@
</div>
<div class="row">
<div class="col-md-6">
- <div>%task_notice%</div>
- <input class="btn btn-primary" type="submit" style="width: 75%; margin-bottom: 20px" value="%filter%">
+ <div>%assign_notice%</div>
+ </div>
+ <div class="col-md-6">
+ <div><p>%task_notice%</p></div>
+ <input class="btn btn-primary" type="submit" style="width:75%; margin-bottom: 20px" value="%filter%">
</div>
</div>
</form>