Show all upcoming Events in closed View

This commit is contained in:
MaZderMind 2015-04-06 15:03:38 +02:00
parent c7c528ba87
commit fd374f8b62
3 changed files with 26 additions and 15 deletions

View file

@ -2,14 +2,13 @@
class Upcoming
{
public function getNextEvent()
public function getNextEvents()
{
try {
$events = file_get_contents('https://c3voc.de/eventkalender/events.json?filter=upcoming');
$events = json_decode($events, true);
$names = array_keys($events['voc_events']);
return $events['voc_events'][$names[0]];
return array_values($events['voc_events']);
}
catch(ErrorException $e)
{

View file

@ -1,25 +1,35 @@
<div class="container about">
<h1><?=h($conference->getTitle())?> is over!</h1>
<? if($upcoming): ?>
<h2>See you soon at <?=h($upcoming['name'])?></h2>
<? if($next): ?>
<h2>See you soon at <?=h($next['name'])?></h2>
<? endif ?>
<p>
Lecture recording and streaming at <strong><?=h($conference->getTitle())?></strong> was organized and performed by the <a href="http://c3voc.de">Chaos Computer Club Video Operation Center</a>. The next Event we'll attend will be
Lecture recording and streaming at <strong><?=h($conference->getTitle())?></strong> was organized and performed by the <a href="http://c3voc.de">Chaos Computer Club Video Operation Center</a>. The next Events we'll attend will be
</p>
<br><br><br>
<div class="col-xs-10 col-xs-offset-1 col-md-6 col-md-offset-3">
<? foreach($events as $event): ?>
<div class="col-xs-10 col-xs-offset-1 col-md-6 col-md-offset-3">
<div class="panel panel-default">
<div class="panel-heading"><?=h($upcoming['name'])?></div>
<div class="panel-body">
<?=h($upcoming['location'])?><br />
<?=h($upcoming['start_date'])?> <?=h($upcoming['end_date'])?>
<div class="panel panel-default">
<div class="panel-heading">
<? if($event['description']): ?>
<a href="<?=h($event['description'])?>">
<?=h($event['name'])?>
</a>
<? else: ?>
<?=h($event['name'])?>
<? endif ?>
</div>
<div class="panel-body">
<?=h($event['location'])?><br />
<?=h($event['start_date'])?> <?=h($event['end_date'])?>
</div>
</div>
</div>
</div>
</div>
<? endforeach ?>
</div>

View file

@ -1,10 +1,12 @@
<?php
$upcoming = new Upcoming();
$events = $upcoming->getNextEvents();
echo $tpl->render(array(
'page' => 'closed',
'title' => 'See you soon … somewhere else!',
'upcoming' => $upcoming->getNextEvent(),
'next' => @$events[0],
'events' => $events,
));