diff options
author | msquare <msquare@notrademark.de> | 2016-09-28 11:46:40 +0200 |
---|---|---|
committer | msquare <msquare@notrademark.de> | 2016-09-28 11:46:40 +0200 |
commit | 50bf7feff0e0461e6afc7a6488dec1b898fa5abd (patch) | |
tree | 614f435b51a92649ec388a1554009017173bdd75 | |
parent | 6384eca1cefd9cc3aa1b38cbc037751c5f2fd5d8 (diff) |
show event info in footer text line
-rw-r--r-- | includes/view/EventConfig_view.php | 47 | ||||
-rw-r--r-- | public/index.php | 3 | ||||
-rw-r--r-- | templates/layout.html | 1 |
3 files changed, 44 insertions, 7 deletions
diff --git a/includes/view/EventConfig_view.php b/includes/view/EventConfig_view.php index aa43c28e..429b6a86 100644 --- a/includes/view/EventConfig_view.php +++ b/includes/view/EventConfig_view.php @@ -1,13 +1,48 @@ <?php /** + * Converts event name and start+end date into a line of text. + */ +function EventConfig_info() { + $event_config = EventConfig(); + if ($event_config === false) { + engelsystem_error("Unable to load event config."); + } + + // 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'])); + } + + // 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'])); + } + + // 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'])); + } + + // Only event name is set + if ($event_config['event_name'] != null) { + return sprintf($event_config['event_name']); + } + + return ""; +} + +/** * Render edit page for event config. - * @param string $event_name 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 string $event_name + * 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 */ 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(), [ diff --git a/public/index.php b/public/index.php index 31668687..e8cb1e2f 100644 --- a/public/index.php +++ b/public/index.php @@ -164,7 +164,8 @@ echo template_render('../templates/layout.html', array( 'header_toolbar' => header_toolbar(), 'faq_url' => $faq_url, 'contact_email' => $contact_email, - 'locale' => locale() + 'locale' => locale(), + 'event_info' => EventConfig_info() . '<br />' )); ?> diff --git a/templates/layout.html b/templates/layout.html index ee7fcd2d..a311be67 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -29,6 +29,7 @@ <div class="col-md-12"> <hr /> <div class="text-center footer" style="margin-bottom: 10px;"> + %event_info% <a href="%faq_url%">FAQ</a> · <a href="%contact_email%"><span class="glyphicon glyphicon-envelope"></span> Contact</a> · <a href="https://github.com/engelsystem/engelsystem/issues">Bugs / Features</a> · <a href="https://github.com/engelsystem/engelsystem/">Development Platform</a> · <a href="?p=credits">Credits</a> </div> |