2016-09-27 17:49:13 +02:00
|
|
|
<?php
|
|
|
|
|
2016-09-29 09:25:06 +02:00
|
|
|
/**
|
|
|
|
* Shows basic event infos and countdowns.
|
2017-01-02 15:43:36 +01:00
|
|
|
*
|
2017-01-03 03:22:48 +01:00
|
|
|
* @param array $event_config The event configuration
|
|
|
|
* @return string
|
2016-09-29 09:25:06 +02:00
|
|
|
*/
|
2017-01-02 03:57:23 +01:00
|
|
|
function EventConfig_countdown_page($event_config)
|
|
|
|
{
|
2018-01-14 17:47:26 +01:00
|
|
|
if (empty($event_config)) {
|
2017-01-02 03:57:23 +01:00
|
|
|
return div('col-md-12 text-center', [
|
2017-01-03 14:12:17 +01:00
|
|
|
heading(sprintf(_('Welcome to the %s!'), '<span class="icon-icon_angel"></span> ENGELSYSTEM'), 2)
|
2017-01-02 15:43:36 +01:00
|
|
|
]);
|
2017-01-02 03:57:23 +01:00
|
|
|
}
|
2017-01-02 15:43:36 +01:00
|
|
|
|
2017-01-02 03:57:23 +01:00
|
|
|
$elements = [];
|
2017-01-02 15:43:36 +01:00
|
|
|
|
2018-01-14 17:47:26 +01:00
|
|
|
if (!is_null($event_config['event_name'])) {
|
2017-01-02 03:57:23 +01:00
|
|
|
$elements[] = div('col-sm-12 text-center', [
|
2017-01-02 15:43:36 +01:00
|
|
|
heading(sprintf(
|
2017-01-03 14:12:17 +01:00
|
|
|
_('Welcome to the %s!'),
|
2017-01-02 15:43:36 +01:00
|
|
|
$event_config['event_name'] . ' <span class="icon-icon_angel"></span> ENGELSYSTEM'
|
|
|
|
), 2)
|
|
|
|
]);
|
2017-01-02 03:57:23 +01:00
|
|
|
}
|
2017-01-02 15:43:36 +01:00
|
|
|
|
2018-01-14 17:47:26 +01:00
|
|
|
if (!is_null($event_config['buildup_start_date']) && time() < $event_config['buildup_start_date']) {
|
2017-01-02 03:57:23 +01:00
|
|
|
$elements[] = div('col-sm-3 text-center hidden-xs', [
|
2017-01-03 14:12:17 +01:00
|
|
|
heading(_('Buildup starts'), 4),
|
2017-01-02 15:43:36 +01:00
|
|
|
'<span class="moment-countdown text-big" data-timestamp="' . $event_config['buildup_start_date'] . '">%c</span>',
|
2017-01-03 14:12:17 +01:00
|
|
|
'<small>' . date(_('Y-m-d'), $event_config['buildup_start_date']) . '</small>'
|
2017-01-02 15:43:36 +01:00
|
|
|
]);
|
2017-01-02 03:57:23 +01:00
|
|
|
}
|
2017-01-02 15:43:36 +01:00
|
|
|
|
2018-01-14 17:47:26 +01:00
|
|
|
if (!is_null($event_config['event_start_date']) && time() < $event_config['event_start_date']) {
|
2017-01-02 03:57:23 +01:00
|
|
|
$elements[] = div('col-sm-3 text-center hidden-xs', [
|
2017-01-03 14:12:17 +01:00
|
|
|
heading(_('Event starts'), 4),
|
2017-01-02 15:43:36 +01:00
|
|
|
'<span class="moment-countdown text-big" data-timestamp="' . $event_config['event_start_date'] . '">%c</span>',
|
2017-01-03 14:12:17 +01:00
|
|
|
'<small>' . date(_('Y-m-d'), $event_config['event_start_date']) . '</small>'
|
2017-01-02 15:43:36 +01:00
|
|
|
]);
|
2017-01-02 03:57:23 +01:00
|
|
|
}
|
2017-01-02 15:43:36 +01:00
|
|
|
|
2018-01-14 17:47:26 +01:00
|
|
|
if (!is_null($event_config['event_end_date']) && time() < $event_config['event_end_date']) {
|
2017-01-02 03:57:23 +01:00
|
|
|
$elements[] = div('col-sm-3 text-center hidden-xs', [
|
2017-01-03 14:12:17 +01:00
|
|
|
heading(_('Event ends'), 4),
|
2017-01-02 15:43:36 +01:00
|
|
|
'<span class="moment-countdown text-big" data-timestamp="' . $event_config['event_end_date'] . '">%c</span>',
|
2017-01-03 14:12:17 +01:00
|
|
|
'<small>' . date(_('Y-m-d'), $event_config['event_end_date']) . '</small>'
|
2017-01-02 15:43:36 +01:00
|
|
|
]);
|
2017-01-02 03:57:23 +01:00
|
|
|
}
|
2017-01-02 15:43:36 +01:00
|
|
|
|
2018-01-14 17:47:26 +01:00
|
|
|
if (!is_null($event_config['teardown_end_date']) && time() < $event_config['teardown_end_date']) {
|
2017-01-02 03:57:23 +01:00
|
|
|
$elements[] = div('col-sm-3 text-center hidden-xs', [
|
2017-01-03 14:12:17 +01:00
|
|
|
heading(_('Teardown ends'), 4),
|
2017-01-02 15:43:36 +01:00
|
|
|
'<span class="moment-countdown text-big" data-timestamp="' . $event_config['teardown_end_date'] . '">%c</span>',
|
2017-01-03 14:12:17 +01:00
|
|
|
'<small>' . date(_('Y-m-d'), $event_config['teardown_end_date']) . '</small>'
|
2017-01-02 15:43:36 +01:00
|
|
|
]);
|
2017-01-02 03:57:23 +01:00
|
|
|
}
|
2017-01-02 15:43:36 +01:00
|
|
|
|
2017-01-03 14:12:17 +01:00
|
|
|
return join('', $elements);
|
2016-09-29 09:25:06 +02:00
|
|
|
}
|
|
|
|
|
2016-09-28 11:46:40 +02:00
|
|
|
/**
|
|
|
|
* Converts event name and start+end date into a line of text.
|
2017-01-03 03:22:48 +01:00
|
|
|
*
|
|
|
|
* @param array $event_config
|
|
|
|
* @return string
|
2016-09-28 11:46:40 +02:00
|
|
|
*/
|
2017-01-02 03:57:23 +01:00
|
|
|
function EventConfig_info($event_config)
|
|
|
|
{
|
2018-01-14 17:47:26 +01:00
|
|
|
if (empty($event_config)) {
|
2017-01-03 14:12:17 +01:00
|
|
|
return '';
|
2017-01-02 03:57:23 +01:00
|
|
|
}
|
2017-01-02 15:43:36 +01:00
|
|
|
|
|
|
|
// Event name, start+end date are set
|
2017-12-25 23:12:52 +01:00
|
|
|
if (
|
2018-01-14 17:47:26 +01:00
|
|
|
!is_null($event_config['event_name'])
|
|
|
|
&& !is_null($event_config['event_start_date'])
|
|
|
|
&& !is_null($event_config['event_end_date'])
|
2017-12-25 23:12:52 +01:00
|
|
|
) {
|
2017-01-02 15:43:36 +01:00
|
|
|
return sprintf(
|
2017-01-03 14:12:17 +01:00
|
|
|
_('%s, from %s to %s'),
|
2017-01-02 15:43:36 +01:00
|
|
|
$event_config['event_name'],
|
2017-01-03 14:12:17 +01:00
|
|
|
date(_('Y-m-d'), $event_config['event_start_date']),
|
|
|
|
date(_('Y-m-d'), $event_config['event_end_date'])
|
2017-01-02 15:43:36 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Event name, start date are set
|
2018-01-14 17:47:26 +01:00
|
|
|
if (!is_null($event_config['event_name']) && !is_null($event_config['event_start_date'])) {
|
2017-01-02 15:43:36 +01:00
|
|
|
return sprintf(
|
2017-01-03 14:12:17 +01:00
|
|
|
_('%s, starting %s'), $event_config['event_name'],
|
|
|
|
date(_('Y-m-d'), $event_config['event_start_date'])
|
2017-01-02 15:43:36 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Event start+end date are set
|
2018-01-14 17:47:26 +01:00
|
|
|
if (!is_null($event_config['event_start_date']) && !is_null($event_config['event_end_date'])) {
|
2017-01-02 15:43:36 +01:00
|
|
|
return sprintf(
|
2017-01-03 14:12:17 +01:00
|
|
|
_('Event from %s to %s'),
|
|
|
|
date(_('Y-m-d'), $event_config['event_start_date']),
|
|
|
|
date(_('Y-m-d'), $event_config['event_end_date'])
|
2017-01-02 15:43:36 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Only event name is set
|
2018-01-14 17:47:26 +01:00
|
|
|
if (!is_null($event_config['event_name'])) {
|
2017-01-02 15:43:36 +01:00
|
|
|
return sprintf($event_config['event_name']);
|
|
|
|
}
|
|
|
|
|
2017-01-03 14:12:17 +01:00
|
|
|
return '';
|
2016-09-28 11:46:40 +02:00
|
|
|
}
|
|
|
|
|
2016-09-27 17:49:13 +02:00
|
|
|
/**
|
|
|
|
* Render edit page for event config.
|
2016-09-28 11:46:40 +02:00
|
|
|
*
|
2017-01-03 03:22:48 +01:00
|
|
|
* @param string $event_name The event name
|
|
|
|
* @param string $event_welcome_msg The welcome message
|
|
|
|
* @param int $buildup_start_date unix time stamp
|
|
|
|
* @param int $event_start_date unix time stamp
|
|
|
|
* @param int $event_end_date unix time stamp
|
|
|
|
* @param int $teardown_end_date unix time stamp
|
|
|
|
* @return string
|
2016-09-27 17:49:13 +02:00
|
|
|
*/
|
2017-01-02 15:43:36 +01:00
|
|
|
function EventConfig_edit_view(
|
|
|
|
$event_name,
|
|
|
|
$event_welcome_msg,
|
|
|
|
$buildup_start_date,
|
|
|
|
$event_start_date,
|
|
|
|
$event_end_date,
|
|
|
|
$teardown_end_date
|
|
|
|
) {
|
2017-01-02 03:57:23 +01:00
|
|
|
return page_with_title(event_config_title(), [
|
2017-01-02 15:43:36 +01:00
|
|
|
msg(),
|
|
|
|
form([
|
|
|
|
div('row', [
|
|
|
|
div('col-md-6', [
|
2017-01-03 14:12:17 +01:00
|
|
|
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),
|
2017-12-25 23:12:52 +01:00
|
|
|
form_info(
|
|
|
|
'',
|
|
|
|
_('Welcome message is shown after successful registration. You can use markdown.')
|
|
|
|
)
|
2017-01-02 15:43:36 +01:00
|
|
|
]),
|
|
|
|
div('col-md-3 col-xs-6', [
|
2017-01-03 14:12:17 +01:00
|
|
|
form_date('buildup_start_date', _('Buildup date'), $buildup_start_date),
|
|
|
|
form_date('event_start_date', _('Event start date'), $event_start_date)
|
2017-01-02 15:43:36 +01:00
|
|
|
]),
|
|
|
|
div('col-md-3 col-xs-6', [
|
2017-01-03 14:12:17 +01:00
|
|
|
form_date('teardown_end_date', _('Teardown end date'), $teardown_end_date),
|
|
|
|
form_date('event_end_date', _('Event end date'), $event_end_date)
|
2017-01-02 15:43:36 +01:00
|
|
|
])
|
|
|
|
]),
|
|
|
|
div('row', [
|
|
|
|
div('col-md-6', [
|
2017-01-03 14:12:17 +01:00
|
|
|
form_submit('submit', _('Save'))
|
2017-01-02 15:43:36 +01:00
|
|
|
])
|
|
|
|
])
|
|
|
|
])
|
|
|
|
]);
|
2016-09-27 17:49:13 +02:00
|
|
|
}
|