Example #1
0
 public function indexAction()
 {
     $urls = $this->em->createQuery('SELECT su, s FROM Entity\\ShortUrl su LEFT JOIN su.station s ORDER BY su.station_id, su.short_url ASC')->getArrayResult();
     $global_custom_urls = array();
     $station_custom_urls = array();
     foreach ($urls as $url) {
         if ($url['station']) {
             $station_custom_urls[] = $url;
         } else {
             $global_custom_urls[] = $url;
         }
     }
     $this->view->station_custom_urls = $station_custom_urls;
     $this->view->global_custom_urls = $global_custom_urls;
     // Auto-Generated Station URLs.
     $station_details = Station::getShortNameLookup();
     $station_categories = Station::getCategories();
     $station_urls = array();
     foreach ($station_details as $short_name => $station) {
         $station['url'] = ShortUrl::getFullUrl($short_name);
         $station['icon'] = $station_categories[$station['category']]['icon'];
         $station_urls[$short_name] = $station;
     }
     $this->view->station_urls = $station_urls;
     // Auto-Generated Convention Archive URLs
     $convention_details = Convention::getShortNameLookup();
     $convention_urls = array();
     foreach ($convention_details as $short_name => $convention) {
         $convention['url'] = ShortUrl::getFullUrl($short_name);
         $convention_urls[$short_name] = $convention;
     }
     $this->view->convention_urls = $convention_urls;
 }
Example #2
0
 public function indexAction()
 {
     $urls = $this->em->createQuery('SELECT su FROM Entity\\ShortUrl su WHERE su.station_id = :station_id ORDER BY su.timestamp ASC')->setParameter('station_id', $this->station->id)->execute();
     $this->view->urls = $urls;
     // Auto-Generated Station URLs.
     $station_details = Station::getShortNameLookup();
     $station_categories = Station::getCategories();
     $station_urls = array();
     foreach ($station_details as $short_name => $station) {
         $station['url'] = ShortUrl::getFullUrl($short_name);
         $station['icon'] = $station_categories[$station['category']]['icon'];
         $station_urls[$short_name] = $station;
     }
     $this->view->station_urls = $station_urls;
     // Auto-Generated Convention Archive URLs
     $convention_details = Convention::getShortNameLookup();
     $convention_urls = array();
     foreach ($convention_details as $short_name => $convention) {
         $convention['url'] = ShortUrl::getFullUrl($short_name);
         $convention_urls[$short_name] = $convention;
     }
     $this->view->convention_urls = $convention_urls;
 }
Example #3
0
 protected function _initStations()
 {
     $this->view->station_id = $station_id = $this->getParam('id', NULL);
     $this->view->volume = $this->hasParam('volume') ? (int) $this->getParam('volume') : NULL;
     $this->categories = Station::getCategories();
     $stations_raw = Station::fetchArray();
     // Limit to a single station if requested.
     if ($station_id && $this->getParam('showonlystation', false) == 'true') {
         foreach ($stations_raw as $station) {
             if ($station['id'] == $station_id) {
                 $stations_raw = array($station);
                 break;
             }
         }
     }
     $this->stations = array();
     foreach ($stations_raw as $station) {
         // Build multi-stream directory.
         $streams = array();
         $current_stream_id = NULL;
         foreach ((array) $station['streams'] as $stream) {
             if (!$stream['hidden_from_player'] && $stream['is_active']) {
                 if ($stream['is_default']) {
                     $station['default_stream_id'] = $stream['id'];
                     $current_stream_id = $stream['id'];
                 }
                 $streams[$stream['id']] = $stream;
             }
         }
         // Pull from user preferences to potentially override defaults.
         $default_streams = (array) \PVL\Customization::get('stream_defaults');
         if (isset($default_streams[$station['id']])) {
             $stream_id = (int) $default_streams[$station['id']];
             if (isset($streams[$stream_id])) {
                 $current_stream_id = $stream_id;
             }
         }
         $station['current_stream_id'] = $current_stream_id;
         $station['streams'] = $streams;
         // Only show stations with at least one usable stream.
         if (count($streams) > 0) {
             $this->stations[$station['id']] = $station;
         }
     }
     foreach ($this->stations as $station) {
         if (isset($this->categories[$station['category']])) {
             $this->categories[$station['category']]['stations'][] = $station;
         }
     }
     $this->view->stations = $this->stations;
     $this->view->categories = $this->categories;
 }