commit
3406967ab4
|
@ -29,9 +29,18 @@ return [
|
||||||
// From address of all emails
|
// From address of all emails
|
||||||
'no_reply_email' => 'noreply@engelsystem.de',
|
'no_reply_email' => 'noreply@engelsystem.de',
|
||||||
|
|
||||||
// Default theme of the start page, 1=style1.css
|
// Default theme, 1=style1.css
|
||||||
'theme' => 1,
|
'theme' => 1,
|
||||||
|
|
||||||
|
// Available themes
|
||||||
|
'available_themes' => [
|
||||||
|
'4' => 'Engelsystem 33c3 (2016)',
|
||||||
|
'3' => 'Engelsystem 32c3 (2015)',
|
||||||
|
'2' => 'Engelsystem cccamp15',
|
||||||
|
'0' => 'Engelsystem light',
|
||||||
|
'1' => 'Engelsystem dark'
|
||||||
|
],
|
||||||
|
|
||||||
// Number of News shown on one site
|
// Number of News shown on one site
|
||||||
'display_news' => 6,
|
'display_news' => 6,
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,8 @@ use Engelsystem\Config\Config;
|
||||||
use Engelsystem\Database\Db;
|
use Engelsystem\Database\Db;
|
||||||
use Engelsystem\Exceptions\Handler as ExceptionHandler;
|
use Engelsystem\Exceptions\Handler as ExceptionHandler;
|
||||||
use Engelsystem\Http\Request;
|
use Engelsystem\Http\Request;
|
||||||
|
use Engelsystem\Renderer\HtmlEngine;
|
||||||
|
use Engelsystem\Renderer\Renderer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This file includes all needed functions, connects to the db etc.
|
* This file includes all needed functions, connects to the db etc.
|
||||||
|
@ -43,11 +45,19 @@ $request::setInstance($request);
|
||||||
* Check for maintenance
|
* Check for maintenance
|
||||||
*/
|
*/
|
||||||
if ($config->get('maintenance')) {
|
if ($config->get('maintenance')) {
|
||||||
echo file_get_contents(__DIR__ . '/../public/maintenance.html');
|
echo file_get_contents(__DIR__ . '/../templates/maintenance.html');
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize renderer
|
||||||
|
*/
|
||||||
|
$renderer = new Renderer();
|
||||||
|
$renderer->addRenderer(new HtmlEngine());
|
||||||
|
Renderer::setInstance($renderer);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register error handler
|
* Register error handler
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -13,5 +13,5 @@ function credits_title()
|
||||||
*/
|
*/
|
||||||
function guest_credits()
|
function guest_credits()
|
||||||
{
|
{
|
||||||
return template_render(__DIR__ . '/../../templates/guest_credits.html', []);
|
return view(__DIR__ . '/../../templates/guest_credits.html');
|
||||||
}
|
}
|
||||||
|
|
|
@ -488,6 +488,5 @@ function get_register_hint()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//@TODO: FIXME: return error(_('Registration is disabled.'), true);
|
return error(_('Registration is disabled.'), true);
|
||||||
return error('Registration is <a href="https://engelsystem.de/33c3/overwhelmed.html">disabled</a>.', true);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,8 +198,9 @@ function user_settings_locale($user_source, $locales)
|
||||||
*/
|
*/
|
||||||
function user_settings()
|
function user_settings()
|
||||||
{
|
{
|
||||||
global $themes, $user;
|
global $user;
|
||||||
$request = request();
|
$request = request();
|
||||||
|
$themes = config('available_themes');
|
||||||
|
|
||||||
$enable_tshirt_size = config('enable_tshirt_size');
|
$enable_tshirt_size = config('enable_tshirt_size');
|
||||||
$tshirt_sizes = config('tshirt_sizes');
|
$tshirt_sizes = config('tshirt_sizes');
|
||||||
|
|
|
@ -206,7 +206,7 @@ function view_user_shifts()
|
||||||
return page([
|
return page([
|
||||||
div('col-md-12', [
|
div('col-md-12', [
|
||||||
msg(),
|
msg(),
|
||||||
template_render(__DIR__ . '/../../templates/user_shifts.html', [
|
view(__DIR__ . '/../../templates/user_shifts.html', [
|
||||||
'title' => shifts_title(),
|
'title' => shifts_title(),
|
||||||
'room_select' => make_select($rooms, $shiftsFilter->getRooms(), 'rooms', _('Rooms')),
|
'room_select' => make_select($rooms, $shiftsFilter->getRooms(), 'rooms', _('Rooms')),
|
||||||
'start_select' => html_select_key('start_day', 'start_day', array_combine($days, $days), $start_day),
|
'start_select' => html_select_key('start_day', 'start_day', array_combine($days, $days), $start_day),
|
||||||
|
|
|
@ -1,16 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
|
||||||
* Liste der verfügbaren Themes
|
|
||||||
*/
|
|
||||||
$themes = [
|
|
||||||
'4' => 'Engelsystem 33c3 (2016)',
|
|
||||||
'3' => 'Engelsystem 32c3 (2015)',
|
|
||||||
'2' => 'Engelsystem cccamp15',
|
|
||||||
'0' => 'Engelsystem light',
|
|
||||||
'1' => 'Engelsystem dark'
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display muted (grey) text.
|
* Display muted (grey) text.
|
||||||
*
|
*
|
||||||
|
@ -332,28 +321,6 @@ function table_buttons($buttons = [])
|
||||||
return '<div class="btn-group">' . join(' ', $buttons) . '</div>';
|
return '<div class="btn-group">' . join(' ', $buttons) . '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Load and render template
|
|
||||||
*
|
|
||||||
* @param string $file
|
|
||||||
* @param string[] $data
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
function template_render($file, $data = [])
|
|
||||||
{
|
|
||||||
if (file_exists($file)) {
|
|
||||||
$template = file_get_contents($file);
|
|
||||||
if (is_array($data)) {
|
|
||||||
foreach ($data as $name => $content) {
|
|
||||||
$template = str_replace('%' . $name . '%', $content, $template);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $template;
|
|
||||||
}
|
|
||||||
engelsystem_error('Cannot find template file «' . $file . '».');
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $str
|
* @param string $str
|
||||||
* @param int $length
|
* @param int $length
|
||||||
|
|
|
@ -166,7 +166,7 @@ if (
|
||||||
|
|
||||||
$event_config = EventConfig();
|
$event_config = EventConfig();
|
||||||
|
|
||||||
echo template_render(__DIR__ . '/../templates/layout.html', [
|
echo view(__DIR__ . '/../templates/layout.html', [
|
||||||
'theme' => isset($user) ? $user['color'] : config('theme'),
|
'theme' => isset($user) ? $user['color'] : config('theme'),
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
'atom_link' => ($page == 'news' || $page == 'user_meetings')
|
'atom_link' => ($page == 'news' || $page == 'user_meetings')
|
||||||
|
|
|
@ -1,77 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Engelsystem</title>
|
|
||||||
<meta charset="UTF-8"/>
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
<link rel="stylesheet" type="text/css" href="css/theme0.css"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="vendor/icomoon/style.css"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="vendor/bootstrap-datepicker-1.4.0/css/bootstrap-datepicker3.min.css"/>
|
|
||||||
<script type="text/javascript" src="vendor/jquery-2.1.1.min.js"></script>
|
|
||||||
<script type="text/javascript" src="vendor/jquery-ui.min.js"></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="navbar navbar-default navbar-fixed-top">
|
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="navbar-header">
|
|
||||||
<button type="button" class="navbar-toggle collapsed"
|
|
||||||
data-toggle="collapse" data-target="#navbar-collapse-1">
|
|
||||||
<span class="sr-only">Toggle navigation</span>
|
|
||||||
<span class="icon-bar"></span>
|
|
||||||
<span class="icon-bar"></span>
|
|
||||||
<span class="icon-bar"></span>
|
|
||||||
</button>
|
|
||||||
<a class="navbar-brand" href="https://engelsystem.de"><span class="icon-icon_angel"></span> <strong
|
|
||||||
class="visible-lg-inline">ENGELSYSTEM</strong></a>
|
|
||||||
</div>
|
|
||||||
<div class="collapse navbar-collapse" id="navbar-collapse-1">
|
|
||||||
<ul class="nav navbar-nav"></ul>
|
|
||||||
<ul class="nav navbar-nav navbar-right"></ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="row">
|
|
||||||
<div class="jumbotron">
|
|
||||||
<div class="container text-center">
|
|
||||||
<div class="col-md-6 col-md-offset-3">
|
|
||||||
<h2>Dear Angels,</h2>
|
|
||||||
<p>
|
|
||||||
The great interest in becoming an angel and participating at 33C3 is is something we are
|
|
||||||
grateful for every time. There is a record number of angels and helping volunteers this year.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
We did anticipate a great number but we are overwhelmed by this endless wave of support. We do
|
|
||||||
want to enable each and every one of you to be an angel at the congress, but sadly our resources
|
|
||||||
and capacities at Heaven are limited. The amount of angels at this point is beyond our
|
|
||||||
planing and to ensure we can support the angels already checked in. We did make a choice never
|
|
||||||
thought possible on a chaos event:
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
We closed the registration in the Engelsystem and at Heaven Desk at 19:00 27. Dec. 2016.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Everyone of us works for you to support you in being an angel, but the Heaven Desk and the
|
|
||||||
Kitchen among others are limited and so we decided to focus our effort to support those of you
|
|
||||||
already arrived to the best of our abilities.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
For the Heaven Team<br/>
|
|
||||||
Agnes, Jen, LLF and Knuth
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<div class="text-center footer">
|
|
||||||
<a href="https://github.com/engelsystem/engelsystem/issues">Bugs / Features</a>
|
|
||||||
· <a href="https://github.com/engelsystem/engelsystem/">Development Platform</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script type="text/javascript" src="vendor/bootstrap/js/bootstrap.min.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Engelsystem\Renderer;
|
||||||
|
|
||||||
|
interface EngineInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Render a template
|
||||||
|
*
|
||||||
|
* @param string $path
|
||||||
|
* @param mixed[] $data
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function get($path, $data = []);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $path
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function canRender($path);
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Engelsystem\Renderer;
|
||||||
|
|
||||||
|
class HtmlEngine implements EngineInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Render a template
|
||||||
|
*
|
||||||
|
* @param string $path
|
||||||
|
* @param mixed[] $data
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function get($path, $data = [])
|
||||||
|
{
|
||||||
|
$template = file_get_contents($path);
|
||||||
|
if (is_array($data)) {
|
||||||
|
foreach ($data as $name => $content) {
|
||||||
|
$template = str_replace('%' . $name . '%', $content, $template);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $template;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $path
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function canRender($path)
|
||||||
|
{
|
||||||
|
return strpos($path, '.html') && file_exists($path);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Engelsystem\Renderer;
|
||||||
|
|
||||||
|
use ErrorException;
|
||||||
|
|
||||||
|
class Renderer
|
||||||
|
{
|
||||||
|
/** @var self */
|
||||||
|
protected static $instance;
|
||||||
|
|
||||||
|
/** @var EngineInterface[] */
|
||||||
|
protected $renderer = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render a template
|
||||||
|
*
|
||||||
|
* @param string $template
|
||||||
|
* @param mixed[] $data
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function render($template, $data = [])
|
||||||
|
{
|
||||||
|
foreach ($this->renderer as $renderer) {
|
||||||
|
if (!$renderer->canRender($template)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $renderer->get($template, $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
engelsystem_error('Unable to find a renderer for template file «' . $template . '».');
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a new renderer engine
|
||||||
|
*
|
||||||
|
* @param EngineInterface $renderer
|
||||||
|
*/
|
||||||
|
public function addRenderer(EngineInterface $renderer)
|
||||||
|
{
|
||||||
|
$this->renderer[] = $renderer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return self
|
||||||
|
* @throws ErrorException
|
||||||
|
*/
|
||||||
|
public static function getInstance()
|
||||||
|
{
|
||||||
|
return self::$instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param self $instance
|
||||||
|
*/
|
||||||
|
public static function setInstance($instance)
|
||||||
|
{
|
||||||
|
self::$instance = $instance;
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
use Engelsystem\Config\Config;
|
use Engelsystem\Config\Config;
|
||||||
use Engelsystem\Http\Request;
|
use Engelsystem\Http\Request;
|
||||||
|
use Engelsystem\Renderer\Renderer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get or set config values
|
* Get or set config values
|
||||||
|
@ -39,3 +40,19 @@ function request($key = null, $default = null)
|
||||||
|
|
||||||
return $request->input($key, $default);
|
return $request->input($key, $default);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $template
|
||||||
|
* @param mixed[] $data
|
||||||
|
* @return Renderer|string
|
||||||
|
*/
|
||||||
|
function view($template = null, $data = null)
|
||||||
|
{
|
||||||
|
$renderer = Renderer::getInstance();
|
||||||
|
|
||||||
|
if (is_null($template)) {
|
||||||
|
return $renderer;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $renderer->render($template, $data);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue