2016-09-27 17:49:13 +02:00
|
|
|
<?php
|
|
|
|
|
2018-09-25 17:33:31 +02:00
|
|
|
use Carbon\Carbon;
|
|
|
|
|
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
|
|
|
* @return string
|
2016-09-29 09:25:06 +02:00
|
|
|
*/
|
2018-09-25 17:33:31 +02:00
|
|
|
function EventConfig_countdown_page()
|
2017-01-02 03:57:23 +01:00
|
|
|
{
|
2018-09-25 17:33:31 +02:00
|
|
|
$config = config();
|
|
|
|
$name = $config->get('name', '');
|
|
|
|
/** @var Carbon $buildup */
|
|
|
|
$buildup = $config->get('buildup_start');
|
|
|
|
/** @var Carbon $start */
|
|
|
|
$start = $config->get('event_start');
|
|
|
|
/** @var Carbon $end */
|
|
|
|
$end = $config->get('event_end');
|
|
|
|
/** @var Carbon $teardown */
|
|
|
|
$teardown = $config->get('teardown_end');
|
2017-01-02 03:57:23 +01:00
|
|
|
$elements = [];
|
2017-01-02 15:43:36 +01:00
|
|
|
|
2018-09-25 17:33:31 +02:00
|
|
|
$elements[] = div('col-sm-12 text-center', [
|
|
|
|
heading(sprintf(
|
|
|
|
__('Welcome to the %s!'),
|
|
|
|
$name . ' <span class="icon-icon_angel"></span> ENGELSYSTEM'
|
|
|
|
), 2)
|
|
|
|
]);
|
2017-01-02 15:43:36 +01:00
|
|
|
|
2018-09-25 17:33:31 +02:00
|
|
|
if (!empty($buildup) && $buildup->greaterThan(new Carbon())) {
|
2017-01-02 03:57:23 +01:00
|
|
|
$elements[] = div('col-sm-3 text-center hidden-xs', [
|
2018-08-29 21:55:32 +02:00
|
|
|
heading(__('Buildup starts'), 4),
|
2018-09-25 17:33:31 +02:00
|
|
|
'<span class="moment-countdown text-big" data-timestamp="' . $buildup->getTimestamp() . '">%c</span>',
|
|
|
|
'<small>' . $buildup->format(__('Y-m-d')) . '</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-09-25 17:33:31 +02:00
|
|
|
if (!empty($start) && $start->greaterThan(new Carbon())) {
|
2017-01-02 03:57:23 +01:00
|
|
|
$elements[] = div('col-sm-3 text-center hidden-xs', [
|
2018-08-29 21:55:32 +02:00
|
|
|
heading(__('Event starts'), 4),
|
2018-09-25 17:33:31 +02:00
|
|
|
'<span class="moment-countdown text-big" data-timestamp="' . $start->getTimestamp() . '">%c</span>',
|
|
|
|
'<small>' . $start->format(__('Y-m-d')) . '</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-09-25 17:33:31 +02:00
|
|
|
if (!empty($end) && $end->greaterThan(new Carbon())) {
|
2017-01-02 03:57:23 +01:00
|
|
|
$elements[] = div('col-sm-3 text-center hidden-xs', [
|
2018-08-29 21:55:32 +02:00
|
|
|
heading(__('Event ends'), 4),
|
2018-09-25 17:33:31 +02:00
|
|
|
'<span class="moment-countdown text-big" data-timestamp="' . $end->getTimestamp() . '">%c</span>',
|
|
|
|
'<small>' . $end->format(__('Y-m-d')) . '</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-09-25 17:33:31 +02:00
|
|
|
if (!empty($teardown) && $teardown->greaterThan(new Carbon())) {
|
2017-01-02 03:57:23 +01:00
|
|
|
$elements[] = div('col-sm-3 text-center hidden-xs', [
|
2018-08-29 21:55:32 +02:00
|
|
|
heading(__('Teardown ends'), 4),
|
2018-09-25 17:33:31 +02:00
|
|
|
'<span class="moment-countdown text-big" data-timestamp="' . $teardown->getTimestamp() . '">%c</span>',
|
|
|
|
'<small>' . $teardown->format(__('Y-m-d')) . '</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-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', [
|
2018-08-29 21:55:32 +02: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(
|
|
|
|
'',
|
2018-08-29 21:55:32 +02:00
|
|
|
__('Welcome message is shown after successful registration. You can use markdown.')
|
2017-12-25 23:12:52 +01:00
|
|
|
)
|
2017-01-02 15:43:36 +01:00
|
|
|
]),
|
|
|
|
div('col-md-3 col-xs-6', [
|
2018-08-29 21:55:32 +02: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', [
|
2018-08-29 21:55:32 +02: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', [
|
2018-08-29 21:55:32 +02:00
|
|
|
form_submit('submit', __('Save'))
|
2017-01-02 15:43:36 +01:00
|
|
|
])
|
|
|
|
])
|
|
|
|
])
|
|
|
|
]);
|
2016-09-27 17:49:13 +02:00
|
|
|
}
|