aboutsummaryrefslogtreecommitdiff
path: root/model/Relive.php
diff options
context:
space:
mode:
authorMaZderMind2015-04-04 13:31:01 +0200
committerMaZderMind2015-04-04 13:31:34 +0200
commit6913b01e5d9a062ac49553b02226f82c0171661c (patch)
tree1d2ae6c356e802a9e758acc923c05b962291832d /model/Relive.php
parentb8f51fa77f3ebb19ee7d54ef10e655176ae249c2 (diff)
Show Display-Names and Link Rooms in Relive-View
Diffstat (limited to '')
-rw-r--r--model/Relive.php29
1 files changed, 29 insertions, 0 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;
+ }
+
}