aboutsummaryrefslogtreecommitdiff
path: root/model
diff options
context:
space:
mode:
Diffstat (limited to 'model')
-rw-r--r--model/Relive.php29
-rw-r--r--model/Schedule.php2
2 files changed, 30 insertions, 1 deletions
diff --git a/model/Relive.php b/model/Relive.php
index 71a2e91..aa081a6 100644
--- a/model/Relive.php
+++ b/model/Relive.php
@@ -21,6 +21,8 @@ class Relive extends ModelBase
$talks = file_get_contents($this->getJsonUrl());
$talks = (array)json_decode($talks, true);
+ $mapping = $this->getScheduleToRoomMapping();
+
usort($talks, function($a, $b) {
$sort = array('live', 'recorded', 'released');
return array_search($a['status'], $sort) > array_search($b['status'], $sort);
@@ -34,6 +36,13 @@ class Relive extends ModelBase
else
$talk['url'] = 'relive/'.rawurlencode($talk['id']).'/';
+ if(isset($mapping[$talk['room']]))
+ {
+ $room = $mapping[$talk['room']];
+ $talk['room'] = $room->getDisplay();
+ $talk['roomlink'] = $room->getLink();
+ }
+
$talks_by_id[$talk['id']] = $talk;
}
@@ -86,4 +95,24 @@ class Relive extends ModelBase
{
return 'RELIVE.'.$this->getJsonUrl();
}
+
+ private function getScheduleToRoomMapping()
+ {
+ $schedule = new Schedule();
+ $mapping = array();
+
+ foreach($schedule->getScheduleToRoomSlugMapping() as $schedule => $slug)
+ {
+ try {
+ $mapping[$schedule] = new Room($slug);
+ }
+ catch(NotFoundException $e)
+ {
+ //
+ }
+ }
+
+ return $mapping;
+ }
+
}
diff --git a/model/Schedule.php b/model/Schedule.php
index 42849d1..7ff66af 100644
--- a/model/Schedule.php
+++ b/model/Schedule.php
@@ -258,7 +258,7 @@ class Schedule extends ModelBase
return 'SCHEDULE.'.$this->getScheduleUrl();
}
- private function getScheduleToRoomSlugMapping()
+ public function getScheduleToRoomSlugMapping()
{
$mapping = array();
foreach($this->get('ROOMS') as $slug => $room)