2010-12-07 20:19:27 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class IndexController extends Zend_Controller_Action
|
|
|
|
{
|
2023-09-08 15:45:24 +02:00
|
|
|
public function init() {}
|
2010-12-07 20:19:27 +01:00
|
|
|
|
|
|
|
public function indexAction()
|
|
|
|
{
|
2015-04-21 17:26:48 +02:00
|
|
|
$CC_CONFIG = Config::getConfig();
|
2022-07-07 23:27:28 +02:00
|
|
|
$baseUrl = Config::getBasePath();
|
2024-02-02 19:04:12 +01:00
|
|
|
if (Application_Model_Preference::getRadioPageDisabled()) {
|
|
|
|
$this->_helper->redirector->gotoUrl($baseUrl . 'login');
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-10-14 21:20:49 +02:00
|
|
|
$this->view->headTitle(Application_Model_Preference::GetHeadTitle());
|
2022-09-19 11:58:31 +02:00
|
|
|
$this->view->headScript()->appendFile(Assets::url('js/libs/jquery-1.8.3.min.js'), 'text/javascript');
|
2015-11-04 18:45:30 +01:00
|
|
|
|
2022-09-19 11:58:31 +02:00
|
|
|
$this->view->headScript()->appendFile(Assets::url('js/i18n/jquery.i18n.js'), 'text/javascript');
|
|
|
|
$this->view->headScript()->appendFile($baseUrl . 'locale/general-translation-table', 'text/javascript');
|
2021-10-11 16:10:47 +02:00
|
|
|
$this->view->headScript()->appendScript('$.i18n.setDictionary(general_dict)');
|
|
|
|
$this->view->headScript()->appendScript("var baseUrl='{$baseUrl}'");
|
2015-11-04 18:45:30 +01:00
|
|
|
|
2022-03-14 11:15:04 +01:00
|
|
|
// jplayer
|
2022-09-19 11:58:31 +02:00
|
|
|
$this->view->headScript()->appendFile(Assets::url('js/jplayer/jquery.jplayer.min.js'), 'text/javascript');
|
|
|
|
$this->view->headScript()->appendFile(Assets::url('js/jplayer/jplayer.playlist.min.js'), 'text/javascript');
|
2015-10-14 21:15:25 +02:00
|
|
|
|
2022-09-19 11:58:31 +02:00
|
|
|
$this->view->headLink()->setStylesheet(Assets::url('css/radio-page/radio-page.css'));
|
|
|
|
$this->view->headLink()->appendStylesheet(Assets::url('css/embed/weekly-schedule-widget.css'));
|
|
|
|
$this->view->headLink()->appendStylesheet(Assets::url('css/radio-page/station-podcast.css'));
|
|
|
|
$this->view->headLink()->appendStylesheet(Assets::url('css/bootstrap.css'));
|
2015-11-04 18:45:30 +01:00
|
|
|
|
2022-03-14 11:15:04 +01:00
|
|
|
// jplayer control buttons
|
2022-09-19 11:58:31 +02:00
|
|
|
$this->view->headLink()->appendStylesheet(Assets::url('css/redmond/jquery-ui-1.8.8.custom.css'));
|
2015-05-27 19:50:25 +02:00
|
|
|
|
2015-05-15 15:01:20 +02:00
|
|
|
$this->_helper->layout->setLayout('radio-page');
|
2015-04-21 17:26:48 +02:00
|
|
|
|
2017-03-24 17:23:21 +01:00
|
|
|
// translate page to station default language
|
|
|
|
$locale = Application_Model_Preference::GetDefaultLocale();
|
|
|
|
if ($locale) {
|
|
|
|
Application_Model_Locale::configureLocalization($locale);
|
|
|
|
}
|
|
|
|
|
2015-04-21 17:26:48 +02:00
|
|
|
$this->view->stationLogo = Application_Model_Preference::GetStationLogo();
|
2015-05-15 15:01:20 +02:00
|
|
|
|
|
|
|
$stationName = Application_Model_Preference::GetStationName();
|
|
|
|
$this->view->stationName = $stationName;
|
|
|
|
|
|
|
|
$stationDescription = Application_Model_Preference::GetStationDescription();
|
|
|
|
$this->view->stationDescription = $stationDescription;
|
2015-05-27 19:50:25 +02:00
|
|
|
|
2022-07-07 23:32:43 +02:00
|
|
|
$this->view->stationUrl = Config::getPublicUrl();
|
2015-06-10 20:46:27 +02:00
|
|
|
|
2015-07-09 21:16:54 +02:00
|
|
|
$displayRadioPageLoginButtonValue = Application_Model_Preference::getRadioPageDisplayLoginButton();
|
2021-10-11 16:10:47 +02:00
|
|
|
if ($displayRadioPageLoginButtonValue == '') {
|
2015-07-09 21:16:54 +02:00
|
|
|
$displayRadioPageLoginButtonValue = true;
|
|
|
|
}
|
|
|
|
$this->view->displayLoginButton = $displayRadioPageLoginButtonValue;
|
2015-07-09 20:38:44 +02:00
|
|
|
|
2022-03-14 11:15:04 +01:00
|
|
|
// station feed episodes
|
2015-10-26 20:24:33 +01:00
|
|
|
$stationPodcastId = Application_Model_Preference::getStationPodcastId();
|
2015-11-03 22:23:17 +01:00
|
|
|
$podcastEpisodesService = new Application_Service_PodcastEpisodeService();
|
2021-10-11 16:10:47 +02:00
|
|
|
$episodes = $podcastEpisodesService->getPodcastEpisodes($stationPodcastId, 0, 0, PodcastEpisodesPeer::PUBLICATION_DATE, 'DESC');
|
2015-11-03 22:23:17 +01:00
|
|
|
foreach ($episodes as $e => $v) {
|
2021-10-11 16:10:47 +02:00
|
|
|
$episodes[$e]['CcFiles']['track_title'] = htmlspecialchars($v['CcFiles']['track_title'], ENT_QUOTES);
|
|
|
|
$episodes[$e]['CcFiles']['artist_name'] = htmlspecialchars($v['CcFiles']['artist_name'], ENT_QUOTES);
|
2015-11-09 14:42:46 +01:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$pubDate = explode(' ', $v['publication_date']);
|
|
|
|
$episodes[$e]['publication_date'] = $pubDate[0];
|
2015-11-09 14:42:46 +01:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$length = explode('.', $v['CcFiles']['length']);
|
|
|
|
$episodes[$e]['CcFiles']['length'] = $length[0];
|
2015-11-10 23:06:58 +01:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$episodes[$e]['mime'] = FileDataHelper::getAudioMimeTypeArray()[$v['CcFiles']['mime']];
|
2015-11-13 14:26:44 +01:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
if (is_null($v['CcFiles']['description'])) {
|
|
|
|
$episodes[$e]['CcFiles']['description'] = '';
|
2015-11-13 14:26:44 +01:00
|
|
|
}
|
2015-10-29 19:45:19 +01:00
|
|
|
}
|
2015-11-03 17:40:22 +01:00
|
|
|
|
2015-11-09 18:15:46 +01:00
|
|
|
$episodePages = array_chunk($episodes, 10);
|
|
|
|
|
|
|
|
$this->view->episodes = json_encode($episodePages, JSON_FORCE_OBJECT);
|
2015-10-28 15:58:22 +01:00
|
|
|
$this->view->displayRssTab = (!Application_Model_Preference::getStationPodcastPrivacy());
|
2015-11-06 02:46:33 +01:00
|
|
|
|
|
|
|
$stationPodcast = PodcastQuery::create()->findOneByDbId($stationPodcastId);
|
|
|
|
$url = $stationPodcast->getDbUrl();
|
|
|
|
$this->view->stationPodcastRssUrl = $url;
|
2015-11-09 18:15:46 +01:00
|
|
|
|
2015-11-16 18:35:50 +01:00
|
|
|
$stationName = Application_Model_Preference::GetStationName();
|
2021-10-11 16:10:47 +02:00
|
|
|
$this->view->podcastTitle = sprintf(_('%s Podcast'), !empty($stationName) ? $stationName : $CC_CONFIG['stationId']);
|
|
|
|
$this->view->emptyPodcastMessage = _('No tracks have been published yet.');
|
2010-12-07 20:19:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function mainAction()
|
2012-07-11 00:53:06 +02:00
|
|
|
{
|
2010-12-07 20:19:27 +01:00
|
|
|
$this->_helper->layout->setLayout('layout');
|
|
|
|
}
|
|
|
|
|
2014-04-24 22:19:55 +02:00
|
|
|
public function maintenanceAction()
|
|
|
|
{
|
|
|
|
$this->getResponse()->setHttpResponseCode(503);
|
|
|
|
}
|
2010-12-07 20:19:27 +01:00
|
|
|
}
|