Skip to content
This repository has been archived by the owner on Dec 2, 2022. It is now read-only.

Commit

Permalink
refine Event Route, add a suitabele description for a session
Browse files Browse the repository at this point in the history
  • Loading branch information
aklassen committed Dec 3, 2013
1 parent 33ae0e6 commit 07decf1
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions routes/events.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?
namespace RestIP;
use \CalendarExport, \CalendarWriterICalendar, \Calendar, \DbCalendarEventList,
\SingleCalendar, \SingleDate, \Seminar;
\SingleCalendar, \SingleDate, \Seminar, \Issue;

class EventsRoute implements \APIPlugin
{
Expand All @@ -20,6 +20,7 @@ public function routes(&$router)
require_once $GLOBALS['RELATIVE_PATH_CALENDAR'] . '/lib/sync/CalendarWriterICalendar.class.php';
require_once 'lib/classes/Seminar.class.php';
require_once 'lib/raumzeit/raumzeit_functions.inc.php';
require_once 'lib/raumzeit/Issue.class.php';

$router->get('/events', function () use ($router) {
$start = time();
Expand Down Expand Up @@ -70,18 +71,34 @@ public function routes(&$router)
$dates = getAllSortedSingleDates($seminar);

$events = array();

foreach ($dates as $date) {

//TODO: Use more of the SingleDate-functionalities

$issues = $date->getIssueIDs();
$issue_titles = array();
$description = '';
if(is_array($issues)) {
foreach($issues as $is) {
$issue = new Issue(array('issue_id' => $is));
$issue_titles[] = $issue->getTitle();
}
}

$description = implode(', ', $issue_titles);
$temp = getTemplateDataForSingleDate($date);
$events[] = array(
'event_id' => $date->getSingleDateID(),
'course_id' => $course_id,
'start' => $date->getStartTime(),
'end' => $date->getEndTime(),
'title' => $temp['date'],
'description' => '',
'description' => $description,
'categories' => $temp['art'] ?: '',
'room' => html_entity_decode(strip_tags($temp['room'] ?: '')),
);

}

header('Cache-Control: private');
Expand Down

0 comments on commit 07decf1

Please sign in to comment.