display event countdowns on start page
This commit is contained in:
parent
50bf7feff0
commit
6685beb397
|
@ -306,27 +306,38 @@ function guest_login() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return page_with_title(login_title(), [
|
$event_config = EventConfig();
|
||||||
msg(),
|
if ($event_config === false) {
|
||||||
div('row', [
|
engelsystem_error("Unable to load event config.");
|
||||||
div('col-md-6', [
|
}
|
||||||
form([
|
|
||||||
form_text('nick', _("Nick"), $nick),
|
return page([
|
||||||
form_password('password', _("Password")),
|
div('col-md-12', [
|
||||||
form_submit('submit', _("Login")),
|
msg(),
|
||||||
|
div('row', [
|
||||||
|
div('col-md-4', [
|
||||||
|
EventConfig_countdown_page($event_config)
|
||||||
|
]),
|
||||||
|
div('col-md-4', [
|
||||||
|
heading(login_title(), 2),
|
||||||
|
form([
|
||||||
|
form_text('nick', _("Nick"), $nick),
|
||||||
|
form_password('password', _("Password")),
|
||||||
|
form_submit('submit', _("Login")),
|
||||||
|
buttons([
|
||||||
|
button(page_link_to('user_password_recovery'), _("I forgot my password"))
|
||||||
|
]),
|
||||||
|
info(_("Please note: You have to activate cookies!"), true)
|
||||||
|
])
|
||||||
|
]),
|
||||||
|
div('col-md-4', [
|
||||||
|
heading(register_title(), 2),
|
||||||
|
get_register_hint(),
|
||||||
|
heading(_("What can I do?"), 2),
|
||||||
|
'<p>' . _("Please read about the jobs you can do to help us.") . '</p>',
|
||||||
buttons([
|
buttons([
|
||||||
button(page_link_to('user_password_recovery'), _("I forgot my password"))
|
button(page_link_to('angeltypes') . '&action=about', _("Teams/Job description") . ' »')
|
||||||
]),
|
])
|
||||||
info(_("Please note: You have to activate cookies!"), true)
|
|
||||||
])
|
|
||||||
]),
|
|
||||||
div('col-md-6', [
|
|
||||||
'<h2>' . register_title() . '</h2>',
|
|
||||||
get_register_hint(),
|
|
||||||
'<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") . ' »')
|
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
|
|
|
@ -1,12 +1,49 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows basic event infos and countdowns.
|
||||||
|
* @param EventConfig $event_config The event configuration
|
||||||
|
*/
|
||||||
|
function EventConfig_countdown_page($event_config) {
|
||||||
|
if ($event_config == null) {
|
||||||
|
return info(_("We got no information about the event right now."), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$elements = [];
|
||||||
|
|
||||||
|
if ($event_config['event_name'] != null) {
|
||||||
|
$elements[] = heading($event_config['event_name'], 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($event_config['event_start_date'] != null && $event_config['event_end_date'] != null) {
|
||||||
|
$elements[] = sprintf(_("from %s to %s"), date("Y-m-d", $event_config['event_start_date']), date("Y-m-d", $event_config['event_end_date']));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($event_config['buildup_start_date'] != null && time() < $event_config['buildup_start_date']) {
|
||||||
|
$elements[] = '<h2 class="moment-countdown" data-timestamp="' . $event_config['buildup_start_date'] . '">' . _("Buildup starts in %c") . '</h2>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($event_config['event_start_date'] != null && time() < $event_config['event_start_date']) {
|
||||||
|
$elements[] = '<h2 class="moment-countdown" data-timestamp="' . $event_config['event_start_date'] . '">' . _("Event starts in %c") . '</h2>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($event_config['event_end_date'] != null && time() < $event_config['event_end_date'] && ($event_config['event_start_date'] == null || time() > $event_config['event_start_date'])) {
|
||||||
|
$elements[] = '<h2 class="moment-countdown" data-timestamp="' . $event_config['event_end_date'] . '">' . _("Event ends in %c") . '</h2>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($event_config['teardown_end_date'] != null && time() < $event_config['teardown_end_date'] && ($event_config['event_start_date'] == null || time() > $event_config['event_start_date'])) {
|
||||||
|
$elements[] = '<h2 class="moment-countdown" data-timestamp="' . $event_config['teardown_end_date'] . '">' . _("Teardown ends in %c") . '</h2>';
|
||||||
|
}
|
||||||
|
|
||||||
|
return join("", $elements);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts event name and start+end date into a line of text.
|
* Converts event name and start+end date into a line of text.
|
||||||
*/
|
*/
|
||||||
function EventConfig_info() {
|
function EventConfig_info($event_config) {
|
||||||
$event_config = EventConfig();
|
if ($event_config == null) {
|
||||||
if ($event_config === false) {
|
return "";
|
||||||
engelsystem_error("Unable to load event config.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Event name, start+end date are set
|
// Event name, start+end date are set
|
||||||
|
|
|
@ -155,6 +155,11 @@ if (isset($_REQUEST['p']) && preg_match("/^[a-z0-9_]*$/i", $_REQUEST['p']) && (i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$event_config = EventConfig();
|
||||||
|
if ($event_config === false) {
|
||||||
|
engelsystem_error("Unable to load event config.");
|
||||||
|
}
|
||||||
|
|
||||||
echo template_render('../templates/layout.html', array(
|
echo template_render('../templates/layout.html', array(
|
||||||
'theme' => isset($user) ? $user['color'] : $default_theme,
|
'theme' => isset($user) ? $user['color'] : $default_theme,
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
|
@ -165,7 +170,7 @@ echo template_render('../templates/layout.html', array(
|
||||||
'faq_url' => $faq_url,
|
'faq_url' => $faq_url,
|
||||||
'contact_email' => $contact_email,
|
'contact_email' => $contact_email,
|
||||||
'locale' => locale(),
|
'locale' => locale(),
|
||||||
'event_info' => EventConfig_info() . '<br />'
|
'event_info' => EventConfig_info($event_config) . '<br />'
|
||||||
));
|
));
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue