CC-4090: Make code style PSR compliant

-removed all trailing whitespace
This commit is contained in:
Martin Konecny 2012-07-10 18:53:06 -04:00
parent ee3447f903
commit d9cde230cd
17 changed files with 484 additions and 484 deletions

View File

@ -74,7 +74,7 @@ class ApiController extends Zend_Controller_Action
* This is only being used by schedule.js at the moment. * This is only being used by schedule.js at the moment.
*/ */
public function calendarInitAction(){ public function calendarInitAction(){
$this->view->layout()->disableLayout(); $this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true); $this->_helper->viewRenderer->setNoRender(true);
if(is_null(Zend_Auth::getInstance()->getStorage()->read())) { if(is_null(Zend_Auth::getInstance()->getStorage()->read())) {
@ -83,12 +83,12 @@ class ApiController extends Zend_Controller_Action
return; return;
} }
$this->view->calendarInit = array( $this->view->calendarInit = array(
"timestamp" => time(), "timestamp" => time(),
"timezoneOffset" => date("Z"), "timezoneOffset" => date("Z"),
"timeScale" => Application_Model_Preference::GetCalendarTimeScale(), "timeScale" => Application_Model_Preference::GetCalendarTimeScale(),
"timeInterval" => Application_Model_Preference::GetCalendarTimeInterval(), "timeInterval" => Application_Model_Preference::GetCalendarTimeInterval(),
"weekStartDay" => Application_Model_Preference::GetWeekStartDay() "weekStartDay" => Application_Model_Preference::GetWeekStartDay()
); );
} }
@ -116,24 +116,24 @@ class ApiController extends Zend_Controller_Action
Logging::log("401 Unauthorized"); Logging::log("401 Unauthorized");
return; return;
} }
$fileID = $this->_getParam("file"); $fileID = $this->_getParam("file");
$file_id = substr($fileID, 0, strpos($fileID, ".")); $file_id = substr($fileID, 0, strpos($fileID, "."));
if (ctype_alnum($file_id) && strlen($file_id) == 32) if (ctype_alnum($file_id) && strlen($file_id) == 32)
{ {
$media = Application_Model_StoredFile::RecallByGunid($file_id); $media = Application_Model_StoredFile::RecallByGunid($file_id);
if ( $media != null ) if ( $media != null )
{ {
$filepath = $media->getFilePath(); $filepath = $media->getFilePath();
if(is_file($filepath)){ if(is_file($filepath)){
$full_path = $media->getPropelOrm()->getDbFilepath(); $full_path = $media->getPropelOrm()->getDbFilepath();
$file_base_name = strrchr($full_path, '/'); $file_base_name = strrchr($full_path, '/');
/* If $full_path does not contain a '/', strrchr will return false, /* If $full_path does not contain a '/', strrchr will return false,
* in which case we can use $full_path as the base name. * in which case we can use $full_path as the base name.
*/ */
if (!$file_base_name) { if (!$file_base_name) {
$file_base_name = $full_path; $file_base_name = $full_path;
} else { } else {
@ -280,22 +280,22 @@ class ApiController extends Zend_Controller_Action
$result = array("env"=>APPLICATION_ENV, $result = array("env"=>APPLICATION_ENV,
"schedulerTime"=>gmdate("Y-m-d H:i:s"), "schedulerTime"=>gmdate("Y-m-d H:i:s"),
"nextShow"=>Application_Model_Show::getNextShows($utcTimeNow, 5, $utcTimeEnd)); "nextShow"=>Application_Model_Show::getNextShows($utcTimeNow, 5, $utcTimeEnd));
Application_Model_Show::convertToLocalTimeZone($result["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp")); Application_Model_Show::convertToLocalTimeZone($result["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
}else{ }else{
$limit = $request->getParam('limit'); $limit = $request->getParam('limit');
if($limit == "" || !is_numeric($limit)) { if($limit == "" || !is_numeric($limit)) {
$limit = "5"; $limit = "5";
} }
$result = Application_Model_Schedule::GetPlayOrderRange(); $result = Application_Model_Schedule::GetPlayOrderRange();
//Convert from UTC to localtime for user. //Convert from UTC to localtime for user.
Application_Model_Show::convertToLocalTimeZone($result["currentShow"], array("starts", "ends", "start_timestamp", "end_timestamp")); Application_Model_Show::convertToLocalTimeZone($result["currentShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
Application_Model_Show::convertToLocalTimeZone($result["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp")); Application_Model_Show::convertToLocalTimeZone($result["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
} }
$result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION; //used by caller to determine if the airtime they are running or widgets in use is out of date. $result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION; //used by caller to determine if the airtime they are running or widgets in use is out of date.
//echo json_encode($result); //echo json_encode($result);
@ -331,7 +331,7 @@ class ApiController extends Zend_Controller_Action
$result[$dow[$i]] = $shows; $result[$dow[$i]] = $shows;
} }
$result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION; //used by caller to determine if the airtime they are running or widgets in use is out of date. $result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION; //used by caller to determine if the airtime they are running or widgets in use is out of date.
header("Content-type: text/javascript"); header("Content-type: text/javascript");
echo $_GET['callback'].'('.json_encode($result).')'; echo $_GET['callback'].'('.json_encode($result).')';
} else { } else {
@ -466,8 +466,8 @@ class ApiController extends Zend_Controller_Action
$this->view->showinstanceid = $show_instance_id; $this->view->showinstanceid = $show_instance_id;
$showCanceled = false; $showCanceled = false;
$file = Application_Model_StoredFile::Recall($file_id); $file = Application_Model_StoredFile::Recall($file_id);
//$show_instance = $this->_getParam('show_instance'); //$show_instance = $this->_getParam('show_instance');
$show_name = null; $show_name = null;
@ -508,7 +508,7 @@ class ApiController extends Zend_Controller_Action
$tmpTitle = $file->getName(); $tmpTitle = $file->getName();
} }
//$file->setMetadataValue('MDATA_KEY_TITLE', $tmpTitle); //$file->setMetadataValue('MDATA_KEY_TITLE', $tmpTitle);
$file->setMetadataValue('MDATA_KEY_CREATOR', "Airtime Show Recorder"); $file->setMetadataValue('MDATA_KEY_CREATOR', "Airtime Show Recorder");
$file->setMetadataValue('MDATA_KEY_TRACKNUMBER', $show_instance_id); $file->setMetadataValue('MDATA_KEY_TRACKNUMBER', $show_instance_id);
@ -627,7 +627,7 @@ class ApiController extends Zend_Controller_Action
$filepath = $md['MDATA_KEY_FILEPATH']; $filepath = $md['MDATA_KEY_FILEPATH'];
//$filepath = str_replace("\\", "", $filepath); //$filepath = str_replace("\\", "", $filepath);
$file = Application_Model_StoredFile::RecallByFilepath($filepath); $file = Application_Model_StoredFile::RecallByFilepath($filepath);
if (is_null($file)) { if (is_null($file)) {
$this->view->error = "File doesn't exist in Airtime."; $this->view->error = "File doesn't exist in Airtime.";
return; return;
@ -770,7 +770,7 @@ class ApiController extends Zend_Controller_Action
$request = $this->getRequest(); $request = $this->getRequest();
$api_key = $request->getParam('api_key'); $api_key = $request->getParam('api_key');
$getDiskInfo = $request->getParam('diskinfo') == "true"; $getDiskInfo = $request->getParam('diskinfo') == "true";
if (!in_array($api_key, $CC_CONFIG["apiKey"]) && if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read())) is_null(Zend_Auth::getInstance()->getStorage()->read()))
{ {
@ -823,7 +823,7 @@ class ApiController extends Zend_Controller_Action
$msg = $request->getParam('msg'); $msg = $request->getParam('msg');
$sourcename = $request->getParam('sourcename'); $sourcename = $request->getParam('sourcename');
$status = $request->getParam('status'); $status = $request->getParam('status');
// on source disconnection sent msg to pypo to turn off the switch // on source disconnection sent msg to pypo to turn off the switch
// Added AutoTransition option // Added AutoTransition option
if($status == "false" && Application_Model_Preference::GetAutoTransition()){ if($status == "false" && Application_Model_Preference::GetAutoTransition()){
@ -977,7 +977,7 @@ class ApiController extends Zend_Controller_Action
$username = $request->getParam('username'); $username = $request->getParam('username');
$password = $request->getParam('password'); $password = $request->getParam('password');
$djtype = $request->getParam('djtype'); $djtype = $request->getParam('djtype');
if (!in_array($api_key, $CC_CONFIG["apiKey"]) && if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read())) is_null(Zend_Auth::getInstance()->getStorage()->read()))
{ {

View File

@ -20,14 +20,14 @@ class AudiopreviewController extends Zend_Controller_Action
public function audioPreviewAction() public function audioPreviewAction()
{ {
global $CC_CONFIG; global $CC_CONFIG;
$audioFileID = $this->_getParam('audioFileID'); $audioFileID = $this->_getParam('audioFileID');
$audioFileArtist = $this->_getParam('audioFileArtist'); $audioFileArtist = $this->_getParam('audioFileArtist');
$audioFileTitle = $this->_getParam('audioFileTitle'); $audioFileTitle = $this->_getParam('audioFileTitle');
$request = $this->getRequest(); $request = $this->getRequest();
$baseUrl = $request->getBaseUrl(); $baseUrl = $request->getBaseUrl();
$baseDir = dirname($_SERVER['SCRIPT_FILENAME']); $baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/audiopreview/preview_jplayer.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/audiopreview/preview_jplayer.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
@ -55,13 +55,13 @@ class AudiopreviewController extends Zend_Controller_Action
public function playlistPreviewAction() public function playlistPreviewAction()
{ {
global $CC_CONFIG; global $CC_CONFIG;
$playlistIndex = $this->_getParam('playlistIndex'); $playlistIndex = $this->_getParam('playlistIndex');
$playlistID = $this->_getParam('playlistID'); $playlistID = $this->_getParam('playlistID');
$request = $this->getRequest(); $request = $this->getRequest();
$baseUrl = $request->getBaseUrl(); $baseUrl = $request->getBaseUrl();
$baseDir = dirname($_SERVER['SCRIPT_FILENAME']); $baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/audiopreview/preview_jplayer.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/audiopreview/preview_jplayer.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
@ -88,18 +88,18 @@ class AudiopreviewController extends Zend_Controller_Action
// disable the view and the layout // disable the view and the layout
$this->view->layout()->disableLayout(); $this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true); $this->_helper->viewRenderer->setNoRender(true);
$playlistID = $this->_getParam('playlistID'); $playlistID = $this->_getParam('playlistID');
if (!isset($playlistID)){ if (!isset($playlistID)){
return; return;
} }
$pl = new Application_Model_Playlist($playlistID); $pl = new Application_Model_Playlist($playlistID);
$result = Array(); $result = Array();
foreach ( $pl->getContents(true) as $track ){ foreach ( $pl->getContents(true) as $track ){
$elementMap = array( 'element_title' => isset($track['CcFiles']['track_title'])?$track['CcFiles']['track_title']:"", $elementMap = array( 'element_title' => isset($track['CcFiles']['track_title'])?$track['CcFiles']['track_title']:"",
'element_artist' => isset($track['CcFiles']['artist_name'])?$track['CcFiles']['artist_name']:"", 'element_artist' => isset($track['CcFiles']['artist_name'])?$track['CcFiles']['artist_name']:"",
'element_id' => isset($track['id'])?$track['id']:"", 'element_id' => isset($track['id'])?$track['id']:"",
@ -115,7 +115,7 @@ class AudiopreviewController extends Zend_Controller_Action
} }
$result[] = $elementMap; $result[] = $elementMap;
} }
$this->_helper->json($result); $this->_helper->json($result);
} }
@ -126,13 +126,13 @@ class AudiopreviewController extends Zend_Controller_Action
public function showPreviewAction() public function showPreviewAction()
{ {
global $CC_CONFIG; global $CC_CONFIG;
$showID = $this->_getParam('showID'); $showID = $this->_getParam('showID');
$showIndex = $this->_getParam('showIndex'); $showIndex = $this->_getParam('showIndex');
$request = $this->getRequest(); $request = $this->getRequest();
$baseUrl = $request->getBaseUrl(); $baseUrl = $request->getBaseUrl();
$baseDir = dirname($_SERVER['SCRIPT_FILENAME']); $baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/audiopreview/preview_jplayer.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/audiopreview/preview_jplayer.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
@ -146,13 +146,13 @@ class AudiopreviewController extends Zend_Controller_Action
} else { } else {
$this->view->logo = "$baseUrl/css/images/airtime_logo_jp.png"; $this->view->logo = "$baseUrl/css/images/airtime_logo_jp.png";
} }
$this->view->showID = $showID; $this->view->showID = $showID;
$this->view->showIndex = $showIndex; $this->view->showIndex = $showIndex;
$this->_helper->viewRenderer->setRender('audio-preview'); $this->_helper->viewRenderer->setRender('audio-preview');
} }
/** /**
*Function will load and return the contents of the requested show. *Function will load and return the contents of the requested show.
*/ */
@ -161,25 +161,25 @@ class AudiopreviewController extends Zend_Controller_Action
// disable the view and the layout // disable the view and the layout
$this->view->layout()->disableLayout(); $this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true); $this->_helper->viewRenderer->setNoRender(true);
$showID = $this->_getParam('showID'); $showID = $this->_getParam('showID');
if (!isset($showID)){ if (!isset($showID)){
return; return;
} }
$showInstance = new Application_Model_ShowInstance($showID); $showInstance = new Application_Model_ShowInstance($showID);
$result = array(); $result = array();
$position = 0; $position = 0;
foreach ($showInstance->getShowListContent() as $track){ foreach ($showInstance->getShowListContent() as $track){
$elementMap = array( $elementMap = array(
'element_title' => isset($track['track_title']) ? $track['track_title'] : "", 'element_title' => isset($track['track_title']) ? $track['track_title'] : "",
'element_artist' => isset($track['artist_name']) ? $track['artist_name'] : "", 'element_artist' => isset($track['artist_name']) ? $track['artist_name'] : "",
'element_position' => $position, 'element_position' => $position,
'element_id' => ++$position, 'element_id' => ++$position,
); );
$fileExtension = pathinfo($track['filepath'], PATHINFO_EXTENSION); $fileExtension = pathinfo($track['filepath'], PATHINFO_EXTENSION);
if (strtolower($fileExtension) === 'mp3'){ if (strtolower($fileExtension) === 'mp3'){
$elementMap['element_mp3'] = $track['gunid'].'.'.$fileExtension; $elementMap['element_mp3'] = $track['gunid'].'.'.$fileExtension;

View File

@ -15,20 +15,20 @@ class DashboardController extends Zend_Controller_Action
{ {
// action body // action body
} }
public function disconnectSourceAction(){ public function disconnectSourceAction(){
$request = $this->getRequest(); $request = $this->getRequest();
$sourcename = $request->getParam('sourcename'); $sourcename = $request->getParam('sourcename');
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id); $user = new Application_Model_User($userInfo->id);
$show = Application_Model_Show::GetCurrentShow(); $show = Application_Model_Show::GetCurrentShow();
$show_id = isset($show['id'])?$show['id']:0; $show_id = isset($show['id'])?$show['id']:0;
$source_connected = Application_Model_Preference::GetSourceStatus($sourcename); $source_connected = Application_Model_Preference::GetSourceStatus($sourcename);
if($user->canSchedule($show_id) && $source_connected){ if($user->canSchedule($show_id) && $source_connected){
$data = array("sourcename"=>$sourcename); $data = array("sourcename"=>$sourcename);
Application_Model_RabbitMq::SendMessageToPypo("disconnect_source", $data); Application_Model_RabbitMq::SendMessageToPypo("disconnect_source", $data);
@ -40,40 +40,40 @@ class DashboardController extends Zend_Controller_Action
} }
} }
} }
public function switchSourceAction(){ public function switchSourceAction(){
$request = $this->getRequest(); $request = $this->getRequest();
$sourcename = $this->_getParam('sourcename'); $sourcename = $this->_getParam('sourcename');
$current_status = $this->_getParam('status'); $current_status = $this->_getParam('status');
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id); $user = new Application_Model_User($userInfo->id);
$show = Application_Model_Show::GetCurrentShow(); $show = Application_Model_Show::GetCurrentShow();
$show_id = isset($show[0]['id'])?$show[0]['id']:0; $show_id = isset($show[0]['id'])?$show[0]['id']:0;
$source_connected = Application_Model_Preference::GetSourceStatus($sourcename); $source_connected = Application_Model_Preference::GetSourceStatus($sourcename);
if($user->canSchedule($show_id) && ($source_connected || $sourcename == 'scheduled_play' || $current_status == "on")){ if($user->canSchedule($show_id) && ($source_connected || $sourcename == 'scheduled_play' || $current_status == "on")){
$change_status_to = "on"; $change_status_to = "on";
if(strtolower($current_status) == "on"){ if(strtolower($current_status) == "on"){
$change_status_to = "off"; $change_status_to = "off";
} }
$data = array("sourcename"=>$sourcename, "status"=>$change_status_to); $data = array("sourcename"=>$sourcename, "status"=>$change_status_to);
Application_Model_RabbitMq::SendMessageToPypo("switch_source", $data); Application_Model_RabbitMq::SendMessageToPypo("switch_source", $data);
if(strtolower($current_status) == "on"){ if(strtolower($current_status) == "on"){
Application_Model_Preference::SetSourceSwitchStatus($sourcename, "off"); Application_Model_Preference::SetSourceSwitchStatus($sourcename, "off");
$this->view->status = "OFF"; $this->view->status = "OFF";
//Log table updates //Log table updates
Application_Model_LiveLog::SetEndTime($sourcename == 'scheduled_play'?'S':'L', Application_Model_LiveLog::SetEndTime($sourcename == 'scheduled_play'?'S':'L',
new DateTime("now", new DateTimeZone('UTC'))); new DateTime("now", new DateTimeZone('UTC')));
}else{ }else{
Application_Model_Preference::SetSourceSwitchStatus($sourcename, "on"); Application_Model_Preference::SetSourceSwitchStatus($sourcename, "on");
$this->view->status = "ON"; $this->view->status = "ON";
//Log table updates //Log table updates
Application_Model_LiveLog::SetNewLogTime($sourcename == 'scheduled_play'?'S':'L', Application_Model_LiveLog::SetNewLogTime($sourcename == 'scheduled_play'?'S':'L',
new DateTime("now", new DateTimeZone('UTC'))); new DateTime("now", new DateTimeZone('UTC')));
@ -91,18 +91,18 @@ class DashboardController extends Zend_Controller_Action
} }
} }
} }
public function switchOffSource(){ public function switchOffSource(){
} }
public function streamPlayerAction() public function streamPlayerAction()
{ {
global $CC_CONFIG; global $CC_CONFIG;
$request = $this->getRequest(); $request = $this->getRequest();
$baseUrl = $request->getBaseUrl(); $baseUrl = $request->getBaseUrl();
$this->view->headLink()->appendStylesheet($baseUrl.'/js/jplayer/skin/jplayer.blue.monday.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'/js/jplayer/skin/jplayer.blue.monday.css?'.$CC_CONFIG['airtime_version']);
$this->_helper->layout->setLayout('bare'); $this->_helper->layout->setLayout('bare');

View File

@ -6,12 +6,12 @@ class ErrorController extends Zend_Controller_Action
public function errorAction() public function errorAction()
{ {
$errors = $this->_getParam('error_handler'); $errors = $this->_getParam('error_handler');
switch ($errors->type) { switch ($errors->type) {
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE: case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER: case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION: case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
// 404 error -- controller or action not found // 404 error -- controller or action not found
$this->getResponse()->setHttpResponseCode(404); $this->getResponse()->setHttpResponseCode(404);
$this->view->message = 'Page not found'; $this->view->message = 'Page not found';
@ -22,17 +22,17 @@ class ErrorController extends Zend_Controller_Action
$this->view->message = 'Application error'; $this->view->message = 'Application error';
break; break;
} }
// Log exception, if logger available // Log exception, if logger available
if ($log = $this->getLog()) { if ($log = $this->getLog()) {
$log->crit($this->view->message, $errors->exception); $log->crit($this->view->message, $errors->exception);
} }
// conditionally display exceptions // conditionally display exceptions
if ($this->getInvokeArg('displayExceptions') == true) { if ($this->getInvokeArg('displayExceptions') == true) {
$this->view->exception = $errors->exception; $this->view->exception = $errors->exception;
} }
$this->view->request = $errors->request; $this->view->request = $errors->request;
} }

View File

@ -5,7 +5,7 @@ class IndexController extends Zend_Controller_Action
public function init() public function init()
{ {
} }
public function indexAction() public function indexAction()
@ -14,7 +14,7 @@ class IndexController extends Zend_Controller_Action
} }
public function mainAction() public function mainAction()
{ {
$this->_helper->layout->setLayout('layout'); $this->_helper->layout->setLayout('layout');
} }

View File

@ -39,10 +39,10 @@ class LibraryController extends Zend_Controller_Action
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id); $user = new Application_Model_User($userInfo->id);
//Open a jPlayer window and play the audio clip. //Open a jPlayer window and play the audio clip.
$menu["play"] = array("name"=> "Preview", "icon" => "play"); $menu["play"] = array("name"=> "Preview", "icon" => "play");
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)); $isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
if ($type === "audioclip") { if ($type === "audioclip") {
@ -76,7 +76,7 @@ class LibraryController extends Zend_Controller_Action
} }
} }
//SOUNDCLOUD MENU OPTIONS //SOUNDCLOUD MENU OPTIONS
if ($type === "audioclip" && Application_Model_Preference::GetUploadToSoundcloudOption()) { if ($type === "audioclip" && Application_Model_Preference::GetUploadToSoundcloudOption()) {
@ -87,7 +87,7 @@ class LibraryController extends Zend_Controller_Action
$menu["soundcloud"] = array("name" => "Soundcloud", "icon" => "soundcloud", "items" => array()); $menu["soundcloud"] = array("name" => "Soundcloud", "icon" => "soundcloud", "items" => array());
$scid = $file->getSoundCloudId(); $scid = $file->getSoundCloudId();
if ($scid > 0){ if ($scid > 0){
$url = $file->getSoundCloudLinkToFile(); $url = $file->getSoundCloudLinkToFile();
$menu["soundcloud"]["items"]["view"] = array("name" => "View on Soundcloud", "icon" => "soundcloud", "url" => $url); $menu["soundcloud"]["items"]["view"] = array("name" => "View on Soundcloud", "icon" => "soundcloud", "url" => $url);
@ -102,7 +102,7 @@ class LibraryController extends Zend_Controller_Action
$menu["soundcloud"]["items"]["upload"] = array("name" => $text, "icon" => "soundcloud", "url" => "/library/upload-file-soundcloud/id/{$id}"); $menu["soundcloud"]["items"]["upload"] = array("name" => $text, "icon" => "soundcloud", "url" => "/library/upload-file-soundcloud/id/{$id}");
} }
$this->view->items = $menu; $this->view->items = $menu;
} }
@ -209,7 +209,7 @@ class LibraryController extends Zend_Controller_Action
if(!$isAdminOrPM){ if(!$isAdminOrPM){
return; return;
} }
$request = $this->getRequest(); $request = $this->getRequest();
$form = new Application_Form_EditAudioMD(); $form = new Application_Form_EditAudioMD();
@ -247,14 +247,14 @@ class LibraryController extends Zend_Controller_Action
$file = Application_Model_StoredFile::Recall($id); $file = Application_Model_StoredFile::Recall($id);
$this->view->type = $type; $this->view->type = $type;
$md = $file->getMetadata(); $md = $file->getMetadata();
foreach ($md as $key => $value) { foreach ($md as $key => $value) {
if ($key == 'MDATA_KEY_DIRECTORY') { if ($key == 'MDATA_KEY_DIRECTORY') {
$musicDir = Application_Model_MusicDir::getDirByPK($value); $musicDir = Application_Model_MusicDir::getDirByPK($value);
$md['MDATA_KEY_FILEPATH'] = Application_Common_OsPath::join($musicDir->getDirectory(), $md['MDATA_KEY_FILEPATH']); $md['MDATA_KEY_FILEPATH'] = Application_Common_OsPath::join($musicDir->getDirectory(), $md['MDATA_KEY_FILEPATH']);
} }
} }
$formatter = new SamplerateFormatter($md["MDATA_KEY_SAMPLERATE"]); $formatter = new SamplerateFormatter($md["MDATA_KEY_SAMPLERATE"]);
$md["MDATA_KEY_SAMPLERATE"] = $formatter->format(); $md["MDATA_KEY_SAMPLERATE"] = $formatter->format();

View File

@ -11,23 +11,23 @@ class LoginController extends Zend_Controller_Action
public function indexAction() public function indexAction()
{ {
global $CC_CONFIG; global $CC_CONFIG;
if (Zend_Auth::getInstance()->hasIdentity()) if (Zend_Auth::getInstance()->hasIdentity())
{ {
$this->_redirect('Showbuilder'); $this->_redirect('Showbuilder');
} }
//uses separate layout without a navigation. //uses separate layout without a navigation.
$this->_helper->layout->setLayout('login'); $this->_helper->layout->setLayout('login');
$error = false; $error = false;
$request = $this->getRequest(); $request = $this->getRequest();
$baseUrl = $request->getBaseUrl(); $baseUrl = $request->getBaseUrl();
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/login/login.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/login/login.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$form = new Application_Form_Login(); $form = new Application_Form_Login();
$message = "Please enter your user name and password"; $message = "Please enter your user name and password";
if($request->isPost()) if($request->isPost())
@ -50,24 +50,24 @@ class LoginController extends Zend_Controller_Action
//pass to the adapter the submitted username and password //pass to the adapter the submitted username and password
$authAdapter->setIdentity($username) $authAdapter->setIdentity($username)
->setCredential($password); ->setCredential($password);
$auth = Zend_Auth::getInstance(); $auth = Zend_Auth::getInstance();
$result = $auth->authenticate($authAdapter); $result = $auth->authenticate($authAdapter);
if($result->isValid()) if($result->isValid())
{ {
//all info about this user from the login table omit only the password //all info about this user from the login table omit only the password
$userInfo = $authAdapter->getResultRowObject(null, 'password'); $userInfo = $authAdapter->getResultRowObject(null, 'password');
//the default storage is a session with namespace Zend_Auth //the default storage is a session with namespace Zend_Auth
$authStorage = $auth->getStorage(); $authStorage = $auth->getStorage();
$authStorage->write($userInfo); $authStorage->write($userInfo);
Application_Model_LoginAttempts::resetAttempts($_SERVER['REMOTE_ADDR']); Application_Model_LoginAttempts::resetAttempts($_SERVER['REMOTE_ADDR']);
Application_Model_Subjects::resetLoginAttempts($username); Application_Model_Subjects::resetLoginAttempts($username);
$tempSess = new Zend_Session_Namespace("referrer"); $tempSess = new Zend_Session_Namespace("referrer");
$tempSess->referrer = 'login'; $tempSess->referrer = 'login';
$this->_redirect('Showbuilder'); $this->_redirect('Showbuilder');
} }
else else
@ -81,7 +81,7 @@ class LoginController extends Zend_Controller_Action
} }
} }
} }
$this->view->message = $message; $this->view->message = $message;
$this->view->error = $error; $this->view->error = $error;
$this->view->form = $form; $this->view->form = $form;
@ -97,15 +97,15 @@ class LoginController extends Zend_Controller_Action
Zend_Auth::getInstance()->clearIdentity(); Zend_Auth::getInstance()->clearIdentity();
$this->_redirect('showbuilder/index'); $this->_redirect('showbuilder/index');
} }
public function passwordRestoreAction() public function passwordRestoreAction()
{ {
global $CC_CONFIG; global $CC_CONFIG;
$request = $this->getRequest(); $request = $this->getRequest();
$baseUrl = $request->getBaseUrl(); $baseUrl = $request->getBaseUrl();
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/login/password-restore.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/login/password-restore.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
if (!Application_Model_Preference::GetEnableSystemEmail()) { if (!Application_Model_Preference::GetEnableSystemEmail()) {
$this->_redirect('login'); $this->_redirect('login');
} }

View File

@ -131,7 +131,7 @@ class PlaylistController extends Zend_Controller_Action
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']);
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/spl.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/spl.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headLink()->appendStylesheet($baseUrl.'/css/playlist_builder.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'/css/playlist_builder.css?'.$CC_CONFIG['airtime_version']);
@ -155,14 +155,14 @@ class PlaylistController extends Zend_Controller_Action
public function newAction() public function newAction()
{ {
$pl_sess = $this->pl_sess; $pl_sess = $this->pl_sess;
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$pl = new Application_Model_Playlist(); $pl = new Application_Model_Playlist();
$pl->setName("Untitled Playlist"); $pl->setName("Untitled Playlist");
$pl->setPLMetaData('dc:creator', $userInfo->id); $pl->setPLMetaData('dc:creator', $userInfo->id);
$this->changePlaylist($pl->getId()); $this->changePlaylist($pl->getId());
$this->createFullResponse($pl); $this->createFullResponse($pl);
} }
public function editAction() public function editAction()
@ -170,20 +170,20 @@ class PlaylistController extends Zend_Controller_Action
$id = $this->_getParam('id', null); $id = $this->_getParam('id', null);
Logging::log("editing playlist {$id}"); Logging::log("editing playlist {$id}");
if (!is_null($id)) { if (!is_null($id)) {
$this->changePlaylist($id); $this->changePlaylist($id);
} }
try { try {
$pl = new Application_Model_Playlist($id); $pl = new Application_Model_Playlist($id);
$this->createFullResponse($pl); $this->createFullResponse($pl);
} }
catch (PlaylistNotFoundException $e) { catch (PlaylistNotFoundException $e) {
$this->playlistNotFound(); $this->playlistNotFound();
} }
catch (Exception $e) { catch (Exception $e) {
$this->playlistUnknownError($e); $this->playlistUnknownError($e);
} }
} }
public function deleteAction() public function deleteAction()
@ -214,13 +214,13 @@ class PlaylistController extends Zend_Controller_Action
$this->playlistUnknownError($e); $this->playlistUnknownError($e);
} }
} }
public function addItemsAction() public function addItemsAction()
{ {
$ids = $this->_getParam('ids', array()); $ids = $this->_getParam('ids', array());
$ids = (!is_array($ids)) ? array($ids) : $ids; $ids = (!is_array($ids)) ? array($ids) : $ids;
$afterItem = $this->_getParam('afterItem', null); $afterItem = $this->_getParam('afterItem', null);
$addType = $this->_getParam('type', 'after'); $addType = $this->_getParam('type', 'after');
try { try {
$pl = $this->getPlaylist(); $pl = $this->getPlaylist();
@ -285,9 +285,9 @@ class PlaylistController extends Zend_Controller_Action
public function setCueAction() public function setCueAction()
{ {
$id = $this->_getParam('id'); $id = $this->_getParam('id');
$cueIn = $this->_getParam('cueIn', null); $cueIn = $this->_getParam('cueIn', null);
$cueOut = $this->_getParam('cueOut', null); $cueOut = $this->_getParam('cueOut', null);
try { try {
$pl = $this->getPlaylist(); $pl = $this->getPlaylist();
@ -314,9 +314,9 @@ class PlaylistController extends Zend_Controller_Action
public function setFadeAction() public function setFadeAction()
{ {
$id = $this->_getParam('id'); $id = $this->_getParam('id');
$fadeIn = $this->_getParam('fadeIn', null); $fadeIn = $this->_getParam('fadeIn', null);
$fadeOut = $this->_getParam('fadeOut', null); $fadeOut = $this->_getParam('fadeOut', null);
try { try {
$pl = $this->getPlaylist(); $pl = $this->getPlaylist();
@ -369,8 +369,8 @@ class PlaylistController extends Zend_Controller_Action
**/ **/
public function setPlaylistFadesAction() public function setPlaylistFadesAction()
{ {
$fadeIn = $this->_getParam('fadeIn', null); $fadeIn = $this->_getParam('fadeIn', null);
$fadeOut = $this->_getParam('fadeOut', null); $fadeOut = $this->_getParam('fadeOut', null);
try { try {
$pl = $this->getPlaylist(); $pl = $this->getPlaylist();

View File

@ -2,19 +2,19 @@
class PlayoutHistoryController extends Zend_Controller_Action class PlayoutHistoryController extends Zend_Controller_Action
{ {
public function init() public function init()
{ {
$ajaxContext = $this->_helper->getHelper('AjaxContext'); $ajaxContext = $this->_helper->getHelper('AjaxContext');
$ajaxContext $ajaxContext
->addActionContext('playout-history-feed', 'json') ->addActionContext('playout-history-feed', 'json')
->initContext(); ->initContext();
} }
public function indexAction() public function indexAction()
{ {
global $CC_CONFIG; global $CC_CONFIG;
$request = $this->getRequest(); $request = $this->getRequest();
$baseUrl = $request->getBaseUrl(); $baseUrl = $request->getBaseUrl();
//default time is the last 24 hours. //default time is the last 24 hours.
@ -36,49 +36,49 @@ class PlayoutHistoryController extends Zend_Controller_Action
)); ));
$this->view->date_form = $form; $this->view->date_form = $form;
$this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/TableTools/js/ZeroClipboard.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/TableTools/js/ZeroClipboard.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/TableTools/js/TableTools.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/TableTools/js/TableTools.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$offset = date("Z") * -1; $offset = date("Z") * -1;
$this->view->headScript()->appendScript("var serverTimezoneOffset = {$offset}; //in seconds"); $this->view->headScript()->appendScript("var serverTimezoneOffset = {$offset}; //in seconds");
$this->view->headScript()->appendFile($baseUrl.'/js/timepicker/jquery.ui.timepicker.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/timepicker/jquery.ui.timepicker.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/utilities/utilities.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/utilities/utilities.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/playouthistory/historytable.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/playouthistory/historytable.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headLink()->appendStylesheet($baseUrl.'/js/datatables/plugin/TableTools/css/TableTools.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'/js/datatables/plugin/TableTools/css/TableTools.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'/css/playouthistory.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'/css/playouthistory.css?'.$CC_CONFIG['airtime_version']);
} }
public function playoutHistoryFeedAction() public function playoutHistoryFeedAction()
{ {
$request = $this->getRequest(); $request = $this->getRequest();
$current_time = time(); $current_time = time();
$params = $request->getParams(); $params = $request->getParams();
$starts_epoch = $request->getParam("start", $current_time - (60*60*24)); $starts_epoch = $request->getParam("start", $current_time - (60*60*24));
$ends_epoch = $request->getParam("end", $current_time); $ends_epoch = $request->getParam("end", $current_time);
$startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC")); $startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC"));
$endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC")); $endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC"));
Logging::log("history starts {$startsDT->format("Y-m-d H:i:s")}"); Logging::log("history starts {$startsDT->format("Y-m-d H:i:s")}");
Logging::log("history ends {$endsDT->format("Y-m-d H:i:s")}"); Logging::log("history ends {$endsDT->format("Y-m-d H:i:s")}");
$history = new Application_Model_PlayoutHistory($startsDT, $endsDT, $params); $history = new Application_Model_PlayoutHistory($startsDT, $endsDT, $params);
$r = $history->getItems(); $r = $history->getItems();
$this->view->sEcho = $r["sEcho"]; $this->view->sEcho = $r["sEcho"];
$this->view->iTotalDisplayRecords = $r["iTotalDisplayRecords"]; $this->view->iTotalDisplayRecords = $r["iTotalDisplayRecords"];
$this->view->iTotalRecords = $r["iTotalRecords"]; $this->view->iTotalRecords = $r["iTotalRecords"];
$this->view->history = $r["history"]; $this->view->history = $r["history"];
} }
} }

View File

@ -14,7 +14,7 @@ class PluploadController extends Zend_Controller_Action
public function indexAction() public function indexAction()
{ {
global $CC_CONFIG; global $CC_CONFIG;
$request = $this->getRequest(); $request = $this->getRequest();
$baseUrl = $request->getBaseUrl(); $baseUrl = $request->getBaseUrl();
@ -33,7 +33,7 @@ class PluploadController extends Zend_Controller_Action
die('{"jsonrpc" : "2.0", "tempfilepath" : "'.$tempFileName.'" }'); die('{"jsonrpc" : "2.0", "tempfilepath" : "'.$tempFileName.'" }');
} }
public function copyfileAction(){ public function copyfileAction(){
$upload_dir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload"; $upload_dir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload";
$filename = $this->_getParam('name'); $filename = $this->_getParam('name');

View File

@ -21,9 +21,9 @@ class PreferenceController extends Zend_Controller_Action
public function indexAction() public function indexAction()
{ {
global $CC_CONFIG; global $CC_CONFIG;
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true; $isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
$request = $this->getRequest(); $request = $this->getRequest();
$baseUrl = $request->getBaseUrl(); $baseUrl = $request->getBaseUrl();
@ -41,7 +41,7 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::SetAllow3rdPartyApi($values["preferences_general"]["thirdPartyApi"]); Application_Model_Preference::SetAllow3rdPartyApi($values["preferences_general"]["thirdPartyApi"]);
Application_Model_Preference::SetTimezone($values["preferences_general"]["timezone"]); Application_Model_Preference::SetTimezone($values["preferences_general"]["timezone"]);
Application_Model_Preference::SetWeekStartDay($values["preferences_general"]["weekStartDay"]); Application_Model_Preference::SetWeekStartDay($values["preferences_general"]["weekStartDay"]);
if (!$isSaas) { if (!$isSaas) {
Application_Model_Preference::SetEnableSystemEmail($values["preferences_email_server"]["enableSystemEmail"]); Application_Model_Preference::SetEnableSystemEmail($values["preferences_email_server"]["enableSystemEmail"]);
Application_Model_Preference::SetSystemEmail($values["preferences_email_server"]["systemEmail"]); Application_Model_Preference::SetSystemEmail($values["preferences_email_server"]["systemEmail"]);
@ -153,7 +153,7 @@ class PreferenceController extends Zend_Controller_Action
$baseUrl = $request->getBaseUrl(); $baseUrl = $request->getBaseUrl();
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/streamsetting.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/streamsetting.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true; $isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
// get current settings // get current settings
@ -189,7 +189,7 @@ class PreferenceController extends Zend_Controller_Action
$form->setSetting($setting); $form->setSetting($setting);
$form->startFrom(); $form->startFrom();
$live_stream_subform = new Application_Form_LiveStreamingPreferences(); $live_stream_subform = new Application_Form_LiveStreamingPreferences();
$form->addSubForm($live_stream_subform, "live_stream_subform"); $form->addSubForm($live_stream_subform, "live_stream_subform");
@ -207,7 +207,7 @@ class PreferenceController extends Zend_Controller_Action
$error = false; $error = false;
$values = $post_data; $values = $post_data;
if($form->isValid($post_data)){ if($form->isValid($post_data)){
if (!$isSaas) { if (!$isSaas) {
$values['output_sound_device'] = $form->getValue('output_sound_device'); $values['output_sound_device'] = $form->getValue('output_sound_device');
@ -218,7 +218,7 @@ class PreferenceController extends Zend_Controller_Action
$values['streamFormat'] = $form->getValue('streamFormat'); $values['streamFormat'] = $form->getValue('streamFormat');
Application_Model_StreamSetting::setStreamSetting($values); Application_Model_StreamSetting::setStreamSetting($values);
// this goes into cc_pref table // this goes into cc_pref table
Application_Model_Preference::SetStreamLabelFormat($values['streamFormat']); Application_Model_Preference::SetStreamLabelFormat($values['streamFormat']);
Application_Model_Preference::SetLiveSteamMasterUsername($values["master_username"]); Application_Model_Preference::SetLiveSteamMasterUsername($values["master_username"]);
@ -226,7 +226,7 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::SetDefaultTransitionFade($values["transition_fade"]); Application_Model_Preference::SetDefaultTransitionFade($values["transition_fade"]);
Application_Model_Preference::SetAutoTransition($values["auto_transition"]); Application_Model_Preference::SetAutoTransition($values["auto_transition"]);
Application_Model_Preference::SetAutoSwitch($values["auto_switch"]); Application_Model_Preference::SetAutoSwitch($values["auto_switch"]);
if (!$isSaas) { if (!$isSaas) {
if (!Application_Model_Preference::GetMasterDjConnectionUrlOverride()) { if (!Application_Model_Preference::GetMasterDjConnectionUrlOverride()) {
$master_connection_url = "http://".$_SERVER['SERVER_NAME'].":".$values["master_harbor_input_port"]."/".$values["master_harbor_input_mount_point"]; $master_connection_url = "http://".$_SERVER['SERVER_NAME'].":".$values["master_harbor_input_port"]."/".$values["master_harbor_input_mount_point"];
@ -238,9 +238,9 @@ class PreferenceController extends Zend_Controller_Action
} }
} else { } else {
Application_Model_Preference::SetMasterDJSourceConnectionURL($values["master_dj_connection_url"]); Application_Model_Preference::SetMasterDJSourceConnectionURL($values["master_dj_connection_url"]);
} }
if (!Application_Model_Preference::GetLiveDjConnectionUrlOverride()) { if (!Application_Model_Preference::GetLiveDjConnectionUrlOverride()) {
$live_connection_url = "http://".$_SERVER['SERVER_NAME'].":".$values["dj_harbor_input_port"]."/".$values["dj_harbor_input_mount_point"]; $live_connection_url = "http://".$_SERVER['SERVER_NAME'].":".$values["dj_harbor_input_port"]."/".$values["dj_harbor_input_mount_point"];
if (empty($values["dj_harbor_input_port"]) || empty($values["dj_harbor_input_mount_point"])) { if (empty($values["dj_harbor_input_port"]) || empty($values["dj_harbor_input_mount_point"])) {
Application_Model_Preference::SetLiveDJSourceConnectionURL('N/A'); Application_Model_Preference::SetLiveDJSourceConnectionURL('N/A');
@ -252,32 +252,32 @@ class PreferenceController extends Zend_Controller_Action
else { else {
Application_Model_Preference::SetLiveDJSourceConnectionURL($values["live_dj_connection_url"]); Application_Model_Preference::SetLiveDJSourceConnectionURL($values["live_dj_connection_url"]);
} }
// extra info that goes into cc_stream_setting // extra info that goes into cc_stream_setting
Application_Model_StreamSetting::setMasterLiveStreamPort($values["master_harbor_input_port"]); Application_Model_StreamSetting::setMasterLiveStreamPort($values["master_harbor_input_port"]);
Application_Model_StreamSetting::setMasterLiveStreamMountPoint($values["master_harbor_input_mount_point"]); Application_Model_StreamSetting::setMasterLiveStreamMountPoint($values["master_harbor_input_mount_point"]);
Application_Model_StreamSetting::setDjLiveStreamPort($values["dj_harbor_input_port"]); Application_Model_StreamSetting::setDjLiveStreamPort($values["dj_harbor_input_port"]);
Application_Model_StreamSetting::setDjLiveStreamMountPoint($values["dj_harbor_input_mount_point"]); Application_Model_StreamSetting::setDjLiveStreamMountPoint($values["dj_harbor_input_mount_point"]);
} }
// store stream update timestamp // store stream update timestamp
Application_Model_Preference::SetStreamUpdateTimestamp(); Application_Model_Preference::SetStreamUpdateTimestamp();
$data = array(); $data = array();
$info = Application_Model_StreamSetting::getStreamSetting(); $info = Application_Model_StreamSetting::getStreamSetting();
$data['setting'] = $info; $data['setting'] = $info;
for($i=1;$i<=$num_of_stream;$i++){ for($i=1;$i<=$num_of_stream;$i++){
Application_Model_StreamSetting::setLiquidsoapError($i, "waiting"); Application_Model_StreamSetting::setLiquidsoapError($i, "waiting");
} }
Application_Model_RabbitMq::SendMessageToPypo("update_stream_setting", $data); Application_Model_RabbitMq::SendMessageToPypo("update_stream_setting", $data);
$this->view->statusMsg = "<div class='success'>Stream Setting Updated.</div>"; $this->view->statusMsg = "<div class='success'>Stream Setting Updated.</div>";
} }
} }
$live_stream_subform->updateVariables(); $live_stream_subform->updateVariables();
$this->view->confirm_pypo_restart_text = "If you change the username or password values for an enabled stream the playout engine will be rebooted and your listeners will hear silence for 5-10 seconds. Changing the following fields will NOT cause a reboot: Stream Label (Global Settings), and Switch Transition Fade(s), Master Username, and Master Password (Input Stream Settings). If Airtime is recording, and if the change causes a playout engine restart, the recording will be interrupted."; $this->view->confirm_pypo_restart_text = "If you change the username or password values for an enabled stream the playout engine will be rebooted and your listeners will hear silence for 5-10 seconds. Changing the following fields will NOT cause a reboot: Stream Label (Global Settings), and Switch Transition Fade(s), Master Username, and Master Password (Input Stream Settings). If Airtime is recording, and if the change causes a playout engine restart, the recording will be interrupted.";
$this->view->num_stream = $num_of_stream; $this->view->num_stream = $num_of_stream;
$this->view->enable_stream_conf = Application_Model_Preference::GetEnableStreamConf(); $this->view->enable_stream_conf = Application_Model_Preference::GetEnableStreamConf();
$this->view->form = $form; $this->view->form = $form;
@ -351,7 +351,7 @@ class PreferenceController extends Zend_Controller_Action
$this->view->subform = $watched_dirs_form->render(); $this->view->subform = $watched_dirs_form->render();
} }
public function rescanWatchDirectoryAction() public function rescanWatchDirectoryAction()
{ {
$dir = Application_Model_MusicDir::getDirByPath($this->getRequest()->getParam("dir")); $dir = Application_Model_MusicDir::getDirByPath($this->getRequest()->getParam("dir"));
@ -395,13 +395,13 @@ class PreferenceController extends Zend_Controller_Action
} }
die(json_encode($out)); die(json_encode($out));
} }
public function setSourceConnectionUrlAction(){ public function setSourceConnectionUrlAction(){
$request = $this->getRequest(); $request = $this->getRequest();
$type = $request->getParam("type", null); $type = $request->getParam("type", null);
$url = urldecode($request->getParam("url", null)); $url = urldecode($request->getParam("url", null));
$override = $request->getParam("override", false); $override = $request->getParam("override", false);
if($type == 'masterdj'){ if($type == 'masterdj'){
Application_Model_Preference::SetMasterDJSourceConnectionURL($url); Application_Model_Preference::SetMasterDJSourceConnectionURL($url);
Application_Model_Preference::SetMasterDjConnectionUrlOverride($override); Application_Model_Preference::SetMasterDjConnectionUrlOverride($override);
@ -409,7 +409,7 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::SetLiveDJSourceConnectionURL($url); Application_Model_Preference::SetLiveDJSourceConnectionURL($url);
Application_Model_Preference::SetLiveDjConnectionUrlOverride($override); Application_Model_Preference::SetLiveDjConnectionUrlOverride($override);
} }
die(); die();
} }
} }

View File

@ -10,16 +10,16 @@ class ScheduleController extends Zend_Controller_Action
$ajaxContext = $this->_helper->getHelper('AjaxContext'); $ajaxContext = $this->_helper->getHelper('AjaxContext');
$ajaxContext->addActionContext('event-feed', 'json') $ajaxContext->addActionContext('event-feed', 'json')
->addActionContext('make-context-menu', 'json') ->addActionContext('make-context-menu', 'json')
->addActionContext('add-show-dialog', 'json') ->addActionContext('add-show-dialog', 'json')
->addActionContext('add-show', 'json') ->addActionContext('add-show', 'json')
->addActionContext('edit-show', 'json') ->addActionContext('edit-show', 'json')
->addActionContext('move-show', 'json') ->addActionContext('move-show', 'json')
->addActionContext('resize-show', 'json') ->addActionContext('resize-show', 'json')
->addActionContext('delete-show', 'json') ->addActionContext('delete-show', 'json')
->addActionContext('show-content-dialog', 'json') ->addActionContext('show-content-dialog', 'json')
->addActionContext('clear-show', 'json') ->addActionContext('clear-show', 'json')
->addActionContext('get-current-playlist', 'json') ->addActionContext('get-current-playlist', 'json')
->addActionContext('remove-group', 'json') ->addActionContext('remove-group', 'json')
->addActionContext('populate-show-form', 'json') ->addActionContext('populate-show-form', 'json')
->addActionContext('populate-show-instance-form', 'json') ->addActionContext('populate-show-instance-form', 'json')
->addActionContext('cancel-show', 'json') ->addActionContext('cancel-show', 'json')
@ -35,7 +35,7 @@ class ScheduleController extends Zend_Controller_Action
->addActionContext('get-current-show', 'json') ->addActionContext('get-current-show', 'json')
->initContext(); ->initContext();
$this->sched_sess = new Zend_Session_Namespace("schedule"); $this->sched_sess = new Zend_Session_Namespace("schedule");
} }
public function indexAction() public function indexAction()
@ -91,11 +91,11 @@ class ScheduleController extends Zend_Controller_Action
Application_Model_Schedule::createNewFormSections($this->view); Application_Model_Schedule::createNewFormSections($this->view);
$user = Application_Model_User::getCurrentUser(); $user = Application_Model_User::getCurrentUser();
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))){ if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))){
$this->view->preloadShowForm = true; $this->view->preloadShowForm = true;
} }
$this->view->headScript()->appendScript("var weekStart = ".Application_Model_Preference::GetWeekStartDay().";"); $this->view->headScript()->appendScript("var weekStart = ".Application_Model_Preference::GetWeekStartDay().";");
} }
@ -106,7 +106,7 @@ class ScheduleController extends Zend_Controller_Action
$end = new DateTime($this->_getParam('end', null)); $end = new DateTime($this->_getParam('end', null));
$end->setTimezone(new DateTimeZone("UTC")); $end->setTimezone(new DateTimeZone("UTC"));
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id); $user = new Application_Model_User($userInfo->id);
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) { if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
$editable = true; $editable = true;
@ -115,9 +115,9 @@ class ScheduleController extends Zend_Controller_Action
$editable = false; $editable = false;
} }
$this->view->events = Application_Model_Show::getFullCalendarEvents($start, $end, $editable); $this->view->events = Application_Model_Show::getFullCalendarEvents($start, $end, $editable);
} }
public function getCurrentShowAction() { public function getCurrentShowAction() {
$currentShow = Application_Model_Show::GetCurrentShow(); $currentShow = Application_Model_Show::GetCurrentShow();
if (!empty($currentShow)) { if (!empty($currentShow)) {
@ -155,8 +155,8 @@ class ScheduleController extends Zend_Controller_Action
public function resizeShowAction() public function resizeShowAction()
{ {
$deltaDay = $this->_getParam('day'); $deltaDay = $this->_getParam('day');
$deltaMin = $this->_getParam('min'); $deltaMin = $this->_getParam('min');
$showId = $this->_getParam('showId'); $showId = $this->_getParam('showId');
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id); $user = new Application_Model_User($userInfo->id);
@ -168,34 +168,34 @@ class ScheduleController extends Zend_Controller_Action
$this->view->show_error = true; $this->view->show_error = true;
return false; return false;
} }
$error = $show->resizeShow($deltaDay, $deltaMin); $error = $show->resizeShow($deltaDay, $deltaMin);
} }
if (isset($error)) { if (isset($error)) {
$this->view->error = $error; $this->view->error = $error;
} }
} }
public function deleteShowAction() public function deleteShowAction()
{ {
$showInstanceId = $this->_getParam('id'); $showInstanceId = $this->_getParam('id');
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id); $user = new Application_Model_User($userInfo->id);
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) { if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
try { try {
$showInstance = new Application_Model_ShowInstance($showInstanceId); $showInstance = new Application_Model_ShowInstance($showInstanceId);
} }
catch(Exception $e){ catch(Exception $e){
$this->view->show_error = true; $this->view->show_error = true;
return false; return false;
} }
$showInstance->delete(); $showInstance->delete();
$this->view->show_id = $showInstance->getShowId(); $this->view->show_id = $showInstance->getShowId();
} }
} }
@ -231,24 +231,24 @@ class ScheduleController extends Zend_Controller_Action
$this->view->show_error = true; $this->view->show_error = true;
return false; return false;
} }
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)); $isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
$isDJ = $user->isHost($instance->getShowId()); $isDJ = $user->isHost($instance->getShowId());
$showStartLocalDT = Application_Common_DateHelper::ConvertToLocalDateTime($instance->getShowInstanceStart()); $showStartLocalDT = Application_Common_DateHelper::ConvertToLocalDateTime($instance->getShowInstanceStart());
$showEndLocalDT = Application_Common_DateHelper::ConvertToLocalDateTime($instance->getShowInstanceEnd()); $showEndLocalDT = Application_Common_DateHelper::ConvertToLocalDateTime($instance->getShowInstanceEnd());
if ($instance->isRecorded() && $epochNow > $showEndLocalDT->getTimestamp()) { if ($instance->isRecorded() && $epochNow > $showEndLocalDT->getTimestamp()) {
$file = $instance->getRecordedFile(); $file = $instance->getRecordedFile();
$fileId = $file->getId(); $fileId = $file->getId();
$menu["view_recorded"] = array("name" => "View Recorded File Metadata", "icon" => "overview", $menu["view_recorded"] = array("name" => "View Recorded File Metadata", "icon" => "overview",
"url" => "/library/edit-file-md/id/".$fileId); "url" => "/library/edit-file-md/id/".$fileId);
} }
if ($epochNow < $showStartLocalDT->getTimestamp()) { if ($epochNow < $showStartLocalDT->getTimestamp()) {
if ( ($isAdminOrPM || $isDJ) if ( ($isAdminOrPM || $isDJ)
&& !$instance->isRecorded() && !$instance->isRecorded()
&& !$instance->isRebroadcast()) { && !$instance->isRebroadcast()) {
@ -268,18 +268,18 @@ class ScheduleController extends Zend_Controller_Action
if ($showEndLocalDT->getTimestamp() <= $epochNow if ($showEndLocalDT->getTimestamp() <= $epochNow
&& $instance->isRecorded() && $instance->isRecorded()
&& Application_Model_Preference::GetUploadToSoundcloudOption()) { && Application_Model_Preference::GetUploadToSoundcloudOption()) {
$file = $instance->getRecordedFile(); $file = $instance->getRecordedFile();
$fileId = $file->getId(); $fileId = $file->getId();
$scid = $instance->getSoundCloudFileId(); $scid = $instance->getSoundCloudFileId();
if ($scid > 0){ if ($scid > 0){
$url = $file->getSoundCloudLinkToFile(); $url = $file->getSoundCloudLinkToFile();
$menu["soundcloud_view"] = array("name" => "View on Soundcloud", "icon" => "soundcloud", "url" => $url); $menu["soundcloud_view"] = array("name" => "View on Soundcloud", "icon" => "soundcloud", "url" => $url);
} }
$text = is_null($scid) ? 'Upload to SoundCloud' : 'Re-upload to SoundCloud'; $text = is_null($scid) ? 'Upload to SoundCloud' : 'Re-upload to SoundCloud';
$menu["soundcloud_upload"] = array("name"=> $text, "icon" => "soundcloud"); $menu["soundcloud_upload"] = array("name"=> $text, "icon" => "soundcloud");
} }
if ($showStartLocalDT->getTimestamp() <= $epochNow && if ($showStartLocalDT->getTimestamp() <= $epochNow &&
@ -287,7 +287,7 @@ class ScheduleController extends Zend_Controller_Action
if ($instance->isRecorded()) { if ($instance->isRecorded()) {
$menu["cancel_recorded"] = array("name"=> "Cancel Current Show", "icon" => "delete"); $menu["cancel_recorded"] = array("name"=> "Cancel Current Show", "icon" => "delete");
} }
else { else {
if (!$instance->isRebroadcast()) { if (!$instance->isRebroadcast()) {
@ -359,26 +359,26 @@ class ScheduleController extends Zend_Controller_Action
Application_Model_Show::convertToLocalTimeZone($range["currentShow"], array("starts", "ends", "start_timestamp", "end_timestamp")); Application_Model_Show::convertToLocalTimeZone($range["currentShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
Application_Model_Show::convertToLocalTimeZone($range["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp")); Application_Model_Show::convertToLocalTimeZone($range["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
$source_status = array(); $source_status = array();
$switch_status = array(); $switch_status = array();
$live_dj = Application_Model_Preference::GetSourceStatus("live_dj"); $live_dj = Application_Model_Preference::GetSourceStatus("live_dj");
$master_dj = Application_Model_Preference::GetSourceStatus("master_dj"); $master_dj = Application_Model_Preference::GetSourceStatus("master_dj");
$scheduled_play_switch = Application_Model_Preference::GetSourceSwitchStatus("scheduled_play"); $scheduled_play_switch = Application_Model_Preference::GetSourceSwitchStatus("scheduled_play");
$live_dj_switch = Application_Model_Preference::GetSourceSwitchStatus("live_dj"); $live_dj_switch = Application_Model_Preference::GetSourceSwitchStatus("live_dj");
$master_dj_switch = Application_Model_Preference::GetSourceSwitchStatus("master_dj"); $master_dj_switch = Application_Model_Preference::GetSourceSwitchStatus("master_dj");
//might not be the correct place to implement this but for now let's just do it here //might not be the correct place to implement this but for now let's just do it here
$source_status['live_dj_source'] = $live_dj; $source_status['live_dj_source'] = $live_dj;
$source_status['master_dj_source'] = $master_dj; $source_status['master_dj_source'] = $master_dj;
$this->view->source_status = $source_status; $this->view->source_status = $source_status;
$switch_status['live_dj_source'] = $live_dj_switch; $switch_status['live_dj_source'] = $live_dj_switch;
$switch_status['master_dj_source'] = $master_dj_switch; $switch_status['master_dj_source'] = $master_dj_switch;
$switch_status['scheduled_play'] = $scheduled_play_switch; $switch_status['scheduled_play'] = $scheduled_play_switch;
$this->view->switch_status = $switch_status; $this->view->switch_status = $switch_status;
$this->view->entries = $range; $this->view->entries = $range;
$this->view->show_name = isset($show[0])?$show[0]["name"]:""; $this->view->show_name = isset($show[0])?$show[0]["name"]:"";
} }
@ -387,9 +387,9 @@ class ScheduleController extends Zend_Controller_Action
{ {
$showInstanceId = $this->sched_sess->showInstanceId; $showInstanceId = $this->sched_sess->showInstanceId;
$group_id = $this->_getParam('groupId'); $group_id = $this->_getParam('groupId');
$search = $this->_getParam('search', null); $search = $this->_getParam('search', null);
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id); $user = new Application_Model_User($userInfo->id);
try{ try{
$show = new Application_Model_ShowInstance($showInstanceId); $show = new Application_Model_ShowInstance($showInstanceId);
@ -399,14 +399,14 @@ class ScheduleController extends Zend_Controller_Action
} }
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST),$show->getShowId())) { if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST),$show->getShowId())) {
$show->removeGroupFromShow($group_id); $show->removeGroupFromShow($group_id);
} }
$this->view->showContent = $show->getShowContent(); $this->view->showContent = $show->getShowContent();
$this->view->timeFilled = $show->getTimeScheduled(); $this->view->timeFilled = $show->getTimeScheduled();
$this->view->percentFilled = $show->getPercentScheduled(); $this->view->percentFilled = $show->getPercentScheduled();
$this->view->chosen = $this->view->render('schedule/scheduled-content.phtml'); $this->view->chosen = $this->view->render('schedule/scheduled-content.phtml');
unset($this->view->showContent); unset($this->view->showContent);
} }
public function showContentDialogAction() public function showContentDialogAction()
@ -451,53 +451,53 @@ class ScheduleController extends Zend_Controller_Action
// this feature is disabled in 2.1 and should be back in 2.2 // this feature is disabled in 2.1 and should be back in 2.2
/*public function populateShowInstanceFormAction(){ /*public function populateShowInstanceFormAction(){
$formWhat = new Application_Form_AddShowWhat(); $formWhat = new Application_Form_AddShowWhat();
$formWho = new Application_Form_AddShowWho(); $formWho = new Application_Form_AddShowWho();
$formWhen = new Application_Form_AddShowWhen(); $formWhen = new Application_Form_AddShowWhen();
$formRepeats = new Application_Form_AddShowRepeats(); $formRepeats = new Application_Form_AddShowRepeats();
$formStyle = new Application_Form_AddShowStyle(); $formStyle = new Application_Form_AddShowStyle();
$formLive = new Application_Form_AddShowLiveStream(); $formLive = new Application_Form_AddShowLiveStream();
$formWhat->removeDecorator('DtDdWrapper'); $formWhat->removeDecorator('DtDdWrapper');
$formWho->removeDecorator('DtDdWrapper'); $formWho->removeDecorator('DtDdWrapper');
$formWhen->removeDecorator('DtDdWrapper'); $formWhen->removeDecorator('DtDdWrapper');
$formRepeats->removeDecorator('DtDdWrapper'); $formRepeats->removeDecorator('DtDdWrapper');
$formStyle->removeDecorator('DtDdWrapper'); $formStyle->removeDecorator('DtDdWrapper');
$this->view->what = $formWhat; $this->view->what = $formWhat;
$this->view->when = $formWhen; $this->view->when = $formWhen;
$this->view->repeats = $formRepeats; $this->view->repeats = $formRepeats;
$this->view->who = $formWho; $this->view->who = $formWho;
$this->view->style = $formStyle; $this->view->style = $formStyle;
$this->view->live = $formLive; $this->view->live = $formLive;
$this->view->addNewShow = false; $this->view->addNewShow = false;
$showInstanceId = $this->_getParam('id'); $showInstanceId = $this->_getParam('id');
$show_instance = CcShowInstancesQuery::create()->findPK($showInstanceId); $show_instance = CcShowInstancesQuery::create()->findPK($showInstanceId);
$show = new Application_Model_Show($show_instance->getDbShowId()); $show = new Application_Model_Show($show_instance->getDbShowId());
$starts_string = $show_instance->getDbStarts(); $starts_string = $show_instance->getDbStarts();
$ends_string = $show_instance->getDbEnds(); $ends_string = $show_instance->getDbEnds();
$starts_datetime = new DateTime($starts_string, new DateTimeZone("UTC")); $starts_datetime = new DateTime($starts_string, new DateTimeZone("UTC"));
$ends_datetime = new DateTime($ends_string, new DateTimeZone("UTC")); $ends_datetime = new DateTime($ends_string, new DateTimeZone("UTC"));
$starts_datetime->setTimezone(new DateTimeZone(date_default_timezone_get())); $starts_datetime->setTimezone(new DateTimeZone(date_default_timezone_get()));
$ends_datetime->setTimezone(new DateTimeZone(date_default_timezone_get())); $ends_datetime->setTimezone(new DateTimeZone(date_default_timezone_get()));
$instance_duration = $starts_datetime->diff($ends_datetime); $instance_duration = $starts_datetime->diff($ends_datetime);
$formWhat->populate(array('add_show_id' => $show->getId(), $formWhat->populate(array('add_show_id' => $show->getId(),
'add_show_instance_id' => $showInstanceId, 'add_show_instance_id' => $showInstanceId,
'add_show_name' => $show->getName(), 'add_show_name' => $show->getName(),
'add_show_url' => $show->getUrl(), 'add_show_url' => $show->getUrl(),
'add_show_genre' => $show->getGenre(), 'add_show_genre' => $show->getGenre(),
'add_show_description' => $show->getDescription())); 'add_show_description' => $show->getDescription()));
$formWhen->populate(array('add_show_start_date' => $starts_datetime->format("Y-m-d"), $formWhen->populate(array('add_show_start_date' => $starts_datetime->format("Y-m-d"),
'add_show_start_time' => $starts_datetime->format("H:i"), 'add_show_start_time' => $starts_datetime->format("H:i"),
'add_show_end_date_no_repeat' => $ends_datetime->format("Y-m-d"), 'add_show_end_date_no_repeat' => $ends_datetime->format("Y-m-d"),
'add_show_end_time' => $ends_datetime->format("H:i"), 'add_show_end_time' => $ends_datetime->format("H:i"),
'add_show_duration' => $instance_duration->format("%h"))); 'add_show_duration' => $instance_duration->format("%h")));
$formWhat->disable(); $formWhat->disable();
@ -505,13 +505,13 @@ class ScheduleController extends Zend_Controller_Action
$formWhen->disableRepeatCheckbox(); $formWhen->disableRepeatCheckbox();
$formRepeats->disable(); $formRepeats->disable();
$formStyle->disable(); $formStyle->disable();
//$formRecord->disable(); //$formRecord->disable();
//$formAbsoluteRebroadcast->disable(); //$formAbsoluteRebroadcast->disable();
//$formRebroadcast->disable(); //$formRebroadcast->disable();
$this->view->action = "edit-show-instance"; $this->view->action = "edit-show-instance";
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml'); $this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
}*/ }*/
@ -527,7 +527,7 @@ class ScheduleController extends Zend_Controller_Action
// $type is used to determine if this edit is for the specific instance or for all // $type is used to determine if this edit is for the specific instance or for all
// repeating shows. It's value is either "instance","rebroadcast", or "all" // repeating shows. It's value is either "instance","rebroadcast", or "all"
$type = $this->_getParam('type'); $type = $this->_getParam('type');
$this->view->action = "edit-show"; $this->view->action = "edit-show";
try{ try{
$showInstance = new Application_Model_ShowInstance($showInstanceId); $showInstance = new Application_Model_ShowInstance($showInstanceId);
@ -535,37 +535,37 @@ class ScheduleController extends Zend_Controller_Action
$this->view->show_error = true; $this->view->show_error = true;
return false; return false;
} }
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)); $isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
$isDJ = $user->isHost($showInstance->getShowId()); $isDJ = $user->isHost($showInstance->getShowId());
if(!($isAdminOrPM || $isDJ)) { if(!($isAdminOrPM || $isDJ)) {
return; return;
} }
if($isDJ){ if($isDJ){
$this->view->action = "dj-edit-show"; $this->view->action = "dj-edit-show";
} }
$formWhat = new Application_Form_AddShowWhat(); $formWhat = new Application_Form_AddShowWhat();
$formWho = new Application_Form_AddShowWho(); $formWho = new Application_Form_AddShowWho();
$formWhen = new Application_Form_AddShowWhen(); $formWhen = new Application_Form_AddShowWhen();
$formRepeats = new Application_Form_AddShowRepeats(); $formRepeats = new Application_Form_AddShowRepeats();
$formStyle = new Application_Form_AddShowStyle(); $formStyle = new Application_Form_AddShowStyle();
$formLive = new Application_Form_AddShowLiveStream(); $formLive = new Application_Form_AddShowLiveStream();
$formWhat->removeDecorator('DtDdWrapper'); $formWhat->removeDecorator('DtDdWrapper');
$formWho->removeDecorator('DtDdWrapper'); $formWho->removeDecorator('DtDdWrapper');
$formWhen->removeDecorator('DtDdWrapper'); $formWhen->removeDecorator('DtDdWrapper');
$formRepeats->removeDecorator('DtDdWrapper'); $formRepeats->removeDecorator('DtDdWrapper');
$formStyle->removeDecorator('DtDdWrapper'); $formStyle->removeDecorator('DtDdWrapper');
$this->view->what = $formWhat; $this->view->what = $formWhat;
$this->view->when = $formWhen; $this->view->when = $formWhen;
$this->view->repeats = $formRepeats; $this->view->repeats = $formRepeats;
$this->view->who = $formWho; $this->view->who = $formWho;
$this->view->style = $formStyle; $this->view->style = $formStyle;
$this->view->live = $formLive; $this->view->live = $formLive;
$this->view->addNewShow = false; $this->view->addNewShow = false;
$show = new Application_Model_Show($showInstance->getShowId()); $show = new Application_Model_Show($showInstance->getShowId());
@ -585,8 +585,8 @@ class ScheduleController extends Zend_Controller_Action
$formWhen->populate(array('add_show_start_date' => $startsDateTime->format("Y-m-d"), $formWhen->populate(array('add_show_start_date' => $startsDateTime->format("Y-m-d"),
'add_show_start_time' => $startsDateTime->format("H:i"), 'add_show_start_time' => $startsDateTime->format("H:i"),
'add_show_end_date_no_repeat' => $endsDateTime->format("Y-m-d"), 'add_show_end_date_no_repeat' => $endsDateTime->format("Y-m-d"),
'add_show_end_time' => $endsDateTime->format("H:i"), 'add_show_end_time' => $endsDateTime->format("H:i"),
'add_show_duration' => $show->getDuration(true), 'add_show_duration' => $show->getDuration(true),
'add_show_repeats' => $show->isRepeating() ? 1 : 0)); 'add_show_repeats' => $show->isRepeating() ? 1 : 0));
@ -626,7 +626,7 @@ class ScheduleController extends Zend_Controller_Action
$formWho->populate(array('add_show_hosts' => $hosts)); $formWho->populate(array('add_show_hosts' => $hosts));
$formStyle->populate(array('add_show_background_color' => $show->getBackgroundColor(), $formStyle->populate(array('add_show_background_color' => $show->getBackgroundColor(),
'add_show_color' => $show->getColor())); 'add_show_color' => $show->getColor()));
$formLive->populate($show->getLiveStreamInfo()); $formLive->populate($show->getLiveStreamInfo());
if(!$isSaas){ if(!$isSaas){
@ -674,7 +674,7 @@ class ScheduleController extends Zend_Controller_Action
$formRebroadcast->disable(); $formRebroadcast->disable();
} }
} }
if(!$isAdminOrPM){ if(!$isAdminOrPM){
$formWhat->disable(); $formWhat->disable();
$formWho->disable(); $formWho->disable();
@ -688,15 +688,15 @@ class ScheduleController extends Zend_Controller_Action
} }
public function getFormAction() { public function getFormAction() {
$user = Application_Model_User::getCurrentUser(); $user = Application_Model_User::getCurrentUser();
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))){ if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))){
Application_Model_Schedule::createNewFormSections($this->view); Application_Model_Schedule::createNewFormSections($this->view);
$this->view->form = $this->view->render('schedule/add-show-form.phtml'); $this->view->form = $this->view->render('schedule/add-show-form.phtml');
} }
} }
public function djEditShowAction(){ public function djEditShowAction(){
$js = $this->_getParam('data'); $js = $this->_getParam('data');
$data = array(); $data = array();
@ -705,17 +705,17 @@ class ScheduleController extends Zend_Controller_Action
foreach($js as $j){ foreach($js as $j){
$data[$j["name"]] = $j["value"]; $data[$j["name"]] = $j["value"];
} }
//update cc_show //update cc_show
$show = new Application_Model_Show($data["add_show_id"]); $show = new Application_Model_Show($data["add_show_id"]);
$show->setAirtimeAuthFlag($data["cb_airtime_auth"]); $show->setAirtimeAuthFlag($data["cb_airtime_auth"]);
$show->setCustomAuthFlag($data["cb_custom_auth"]); $show->setCustomAuthFlag($data["cb_custom_auth"]);
$show->setCustomUsername($data["custom_username"]); $show->setCustomUsername($data["custom_username"]);
$show->setCustomPassword($data["custom_password"]); $show->setCustomPassword($data["custom_password"]);
$this->view->edit = true; $this->view->edit = true;
} }
/*public function editShowInstanceAction(){ /*public function editShowInstanceAction(){
$js = $this->_getParam('data'); $js = $this->_getParam('data');
$data = array(); $data = array();
@ -724,7 +724,7 @@ class ScheduleController extends Zend_Controller_Action
foreach($js as $j){ foreach($js as $j){
$data[$j["name"]] = $j["value"]; $data[$j["name"]] = $j["value"];
} }
$success = Application_Model_Schedule::updateShowInstance($data, $this); $success = Application_Model_Schedule::updateShowInstance($data, $this);
if ($success){ if ($success){
$this->view->addNewShow = true; $this->view->addNewShow = true;
@ -734,9 +734,9 @@ class ScheduleController extends Zend_Controller_Action
$this->view->form = $this->view->render('schedule/add-show-form.phtml'); $this->view->form = $this->view->render('schedule/add-show-form.phtml');
} }
}*/ }*/
public function editShowAction(){ public function editShowAction(){
//1) Get add_show_start_date since it might not have been sent //1) Get add_show_start_date since it might not have been sent
$js = $this->_getParam('data'); $js = $this->_getParam('data');
$data = array(); $data = array();
@ -752,9 +752,9 @@ class ScheduleController extends Zend_Controller_Action
if($data['add_show_day_check'] == "") { if($data['add_show_day_check'] == "") {
$data['add_show_day_check'] = null; $data['add_show_day_check'] = null;
} }
$show = new Application_Model_Show($data['add_show_id']); $show = new Application_Model_Show($data['add_show_id']);
$validateStartDate = true; $validateStartDate = true;
$validateStartTime = true; $validateStartTime = true;
if (!array_key_exists('add_show_start_date', $data)){ if (!array_key_exists('add_show_start_date', $data)){
@ -763,7 +763,7 @@ class ScheduleController extends Zend_Controller_Action
//The start date will be returned in UTC time, so lets convert it to local time. //The start date will be returned in UTC time, so lets convert it to local time.
$dt = Application_Common_DateHelper::ConvertToLocalDateTime($show->getStartDateAndTime()); $dt = Application_Common_DateHelper::ConvertToLocalDateTime($show->getStartDateAndTime());
$data['add_show_start_date'] = $dt->format("Y-m-d"); $data['add_show_start_date'] = $dt->format("Y-m-d");
if (!array_key_exists('add_show_start_time', $data)){ if (!array_key_exists('add_show_start_time', $data)){
$data['add_show_start_time'] = $dt->format("H:i"); $data['add_show_start_time'] = $dt->format("H:i");
$validateStartTime = false; $validateStartTime = false;
@ -771,10 +771,10 @@ class ScheduleController extends Zend_Controller_Action
$validateStartDate = false; $validateStartDate = false;
} }
$data['add_show_record'] = $show->isRecorded(); $data['add_show_record'] = $show->isRecorded();
$origianlShowStartDateTime = Application_Common_DateHelper::ConvertToLocalDateTime($show->getStartDateAndTime()); $origianlShowStartDateTime = Application_Common_DateHelper::ConvertToLocalDateTime($show->getStartDateAndTime());
$success = Application_Model_Schedule::addUpdateShow($data, $this, $validateStartDate, $origianlShowStartDateTime, true, $data['add_show_instance_id']); $success = Application_Model_Schedule::addUpdateShow($data, $this, $validateStartDate, $origianlShowStartDateTime, true, $data['add_show_instance_id']);
if ($success){ if ($success){
$this->view->addNewShow = true; $this->view->addNewShow = true;
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml'); $this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
@ -791,7 +791,7 @@ class ScheduleController extends Zend_Controller_Action
$this->view->form = $this->view->render('schedule/add-show-form.phtml'); $this->view->form = $this->view->render('schedule/add-show-form.phtml');
} }
} }
public function addShowAction(){ public function addShowAction(){
$js = $this->_getParam('data'); $js = $this->_getParam('data');
$data = array(); $data = array();
@ -807,10 +807,10 @@ class ScheduleController extends Zend_Controller_Action
if($data['add_show_day_check'] == "") { if($data['add_show_day_check'] == "") {
$data['add_show_day_check'] = null; $data['add_show_day_check'] = null;
} }
$validateStartDate = true; $validateStartDate = true;
$success = Application_Model_Schedule::addUpdateShow($data, $this, $validateStartDate); $success = Application_Model_Schedule::addUpdateShow($data, $this, $validateStartDate);
if ($success){ if ($success){
$this->view->addNewShow = true; $this->view->addNewShow = true;
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml'); $this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
@ -825,11 +825,11 @@ class ScheduleController extends Zend_Controller_Action
$user = Application_Model_User::getCurrentUser(); $user = Application_Model_User::getCurrentUser();
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) { if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
$showInstanceId = $this->_getParam('id'); $showInstanceId = $this->_getParam('id');
try { try {
$showInstance = new Application_Model_ShowInstance($showInstanceId); $showInstance = new Application_Model_ShowInstance($showInstanceId);
} catch(Exception $e) { } catch(Exception $e) {
$this->view->show_error = true; $this->view->show_error = true;
return false; return false;
} }
@ -846,7 +846,7 @@ class ScheduleController extends Zend_Controller_Action
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) { if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
$id = $this->_getParam('id'); $id = $this->_getParam('id');
try { try {
$scheduler = new Application_Model_Scheduler(); $scheduler = new Application_Model_Scheduler();
$scheduler->cancelShow($id); $scheduler->cancelShow($id);
@ -864,9 +864,9 @@ class ScheduleController extends Zend_Controller_Action
} }
public function contentContextMenuAction(){ public function contentContextMenuAction(){
global $CC_CONFIG; global $CC_CONFIG;
$id = $this->_getParam('id'); $id = $this->_getParam('id');
$params = '/format/json/id/#id#/'; $params = '/format/json/id/#id#/';
@ -881,7 +881,7 @@ class ScheduleController extends Zend_Controller_Action
$baseUrl = $this->getRequest()->getBaseUrl(); $baseUrl = $this->getRequest()->getBaseUrl();
$url = $file->getRelativeFileUrl($baseUrl).'/download/true'; $url = $file->getRelativeFileUrl($baseUrl).'/download/true';
$menu[] = array('action' => array('type' => 'gourl', 'url' => $url), $menu[] = array('action' => array('type' => 'gourl', 'url' => $url),
'title' => 'Download'); 'title' => 'Download');
//returns format jjmenu is looking for. //returns format jjmenu is looking for.
die(json_encode($menu)); die(json_encode($menu));
@ -892,7 +892,7 @@ class ScheduleController extends Zend_Controller_Action
* This is only being used by schedule.js at the moment. * This is only being used by schedule.js at the moment.
*/ */
public function setTimeScaleAction() { public function setTimeScaleAction() {
Application_Model_Preference::SetCalendarTimeScale($this->_getParam('timeScale')); Application_Model_Preference::SetCalendarTimeScale($this->_getParam('timeScale'));
} }
/** /**
@ -900,24 +900,24 @@ class ScheduleController extends Zend_Controller_Action
* This is only being used by schedule.js at the moment. * This is only being used by schedule.js at the moment.
*/ */
public function setTimeIntervalAction() { public function setTimeIntervalAction() {
Application_Model_Preference::SetCalendarTimeInterval($this->_getParam('timeInterval')); Application_Model_Preference::SetCalendarTimeInterval($this->_getParam('timeInterval'));
} }
public function calculateDurationAction() { public function calculateDurationAction() {
global $CC_CONFIG; global $CC_CONFIG;
$startParam = $this->_getParam('startTime'); $startParam = $this->_getParam('startTime');
$endParam = $this->_getParam('endTime'); $endParam = $this->_getParam('endTime');
try{ try{
$startDateTime = new DateTime($startParam); $startDateTime = new DateTime($startParam);
$endDateTime = new DateTime($endParam); $endDateTime = new DateTime($endParam);
$UTCStartDateTime = $startDateTime->setTimezone(new DateTimeZone('UTC')); $UTCStartDateTime = $startDateTime->setTimezone(new DateTimeZone('UTC'));
$UTCEndDateTime = $endDateTime->setTimezone(new DateTimeZone('UTC')); $UTCEndDateTime = $endDateTime->setTimezone(new DateTimeZone('UTC'));
$duration = $UTCEndDateTime->diff($UTCStartDateTime); $duration = $UTCEndDateTime->diff($UTCStartDateTime);
$day = intval($duration->format('%d')); $day = intval($duration->format('%d'));
if($day > 0){ if($day > 0){
$hour = intval($duration->format('%h')); $hour = intval($duration->format('%h'));
@ -932,7 +932,7 @@ class ScheduleController extends Zend_Controller_Action
}catch (Exception $e){ }catch (Exception $e){
$result = "Invalid Date"; $result = "Invalid Date";
} }
echo Zend_Json::encode($result); echo Zend_Json::encode($result);
exit(); exit();
} }

View File

@ -17,16 +17,16 @@ class ShowbuilderController extends Zend_Controller_Action
} }
public function indexAction() { public function indexAction() {
global $CC_CONFIG; global $CC_CONFIG;
$request = $this->getRequest(); $request = $this->getRequest();
$baseUrl = $request->getBaseUrl(); $baseUrl = $request->getBaseUrl();
$user = Application_Model_User::getCurrentUser(); $user = Application_Model_User::getCurrentUser();
$userType = $user->getType(); $userType = $user->getType();
$this->view->headScript()->appendScript("localStorage.setItem( 'user-type', '$userType' );"); $this->view->headScript()->appendScript("localStorage.setItem( 'user-type', '$userType' );");
$data = Application_Model_Preference::getValue("library_datatable", true); $data = Application_Model_Preference::getValue("library_datatable", true);
if ($data != "") { if ($data != "") {
$libraryTable = json_encode(unserialize($data)); $libraryTable = json_encode(unserialize($data));
@ -35,7 +35,7 @@ class ShowbuilderController extends Zend_Controller_Action
else { else {
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-library', '' );"); $this->view->headScript()->appendScript("localStorage.setItem( 'datatables-library', '' );");
} }
$data = Application_Model_Preference::getValue("timeline_datatable", true); $data = Application_Model_Preference::getValue("timeline_datatable", true);
if ($data != "") { if ($data != "") {
$timelineTable = json_encode(unserialize($data)); $timelineTable = json_encode(unserialize($data));
@ -44,7 +44,7 @@ class ShowbuilderController extends Zend_Controller_Action
else { else {
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-timeline', '' );"); $this->view->headScript()->appendScript("localStorage.setItem( 'datatables-timeline', '' );");
} }
$this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
@ -52,7 +52,7 @@ class ShowbuilderController extends Zend_Controller_Action
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColVis.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColVis.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColReorder.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColReorder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.FixedColumns.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.FixedColumns.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/blockui/jquery.blockUI.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/blockui/jquery.blockUI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/utilities/utilities.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/utilities/utilities.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
@ -62,89 +62,89 @@ class ShowbuilderController extends Zend_Controller_Action
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']);
$this->view->headScript()->appendFile($this->view->baseUrl('/js/airtime/library/events/library_showbuilder.js?'.$CC_CONFIG['airtime_version']),'text/javascript'); $this->view->headScript()->appendFile($this->view->baseUrl('/js/airtime/library/events/library_showbuilder.js?'.$CC_CONFIG['airtime_version']),'text/javascript');
$refer_sses = new Zend_Session_Namespace('referrer'); $refer_sses = new Zend_Session_Namespace('referrer');
if ($request->isPost()) { if ($request->isPost()) {
$form = new Application_Form_RegisterAirtime(); $form = new Application_Form_RegisterAirtime();
$values = $request->getPost(); $values = $request->getPost();
if ($values["Publicise"] != 1 && $form->isValid($values)) { if ($values["Publicise"] != 1 && $form->isValid($values)) {
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]); Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
if (isset($values["Privacy"])) { if (isset($values["Privacy"])) {
Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]); Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]);
} }
// unset session // unset session
Zend_Session::namespaceUnset('referrer'); Zend_Session::namespaceUnset('referrer');
} }
else if ($values["Publicise"] == '1' && $form->isValid($values)) { else if ($values["Publicise"] == '1' && $form->isValid($values)) {
Application_Model_Preference::SetHeadTitle($values["stnName"], $this->view); Application_Model_Preference::SetHeadTitle($values["stnName"], $this->view);
Application_Model_Preference::SetPhone($values["Phone"]); Application_Model_Preference::SetPhone($values["Phone"]);
Application_Model_Preference::SetEmail($values["Email"]); Application_Model_Preference::SetEmail($values["Email"]);
Application_Model_Preference::SetStationWebSite($values["StationWebSite"]); Application_Model_Preference::SetStationWebSite($values["StationWebSite"]);
Application_Model_Preference::SetPublicise($values["Publicise"]); Application_Model_Preference::SetPublicise($values["Publicise"]);
$form->Logo->receive(); $form->Logo->receive();
$imagePath = $form->Logo->getFileName(); $imagePath = $form->Logo->getFileName();
Application_Model_Preference::SetStationCountry($values["Country"]); Application_Model_Preference::SetStationCountry($values["Country"]);
Application_Model_Preference::SetStationCity($values["City"]); Application_Model_Preference::SetStationCity($values["City"]);
Application_Model_Preference::SetStationDescription($values["Description"]); Application_Model_Preference::SetStationDescription($values["Description"]);
Application_Model_Preference::SetStationLogo($imagePath); Application_Model_Preference::SetStationLogo($imagePath);
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]); Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
if (isset($values["Privacy"])){ if (isset($values["Privacy"])){
Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]); Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]);
} }
// unset session // unset session
Zend_Session::namespaceUnset('referrer'); Zend_Session::namespaceUnset('referrer');
} }
else { else {
$logo = Application_Model_Preference::GetStationLogo(); $logo = Application_Model_Preference::GetStationLogo();
if ($logo) { if ($logo) {
$this->view->logoImg = $logo; $this->view->logoImg = $logo;
} }
$this->view->dialog = $form; $this->view->dialog = $form;
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/register.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/register.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
} }
} }
//popup if previous page was login //popup if previous page was login
if ($refer_sses->referrer == 'login' && Application_Model_Preference::ShouldShowPopUp() if ($refer_sses->referrer == 'login' && Application_Model_Preference::ShouldShowPopUp()
&& !Application_Model_Preference::GetSupportFeedback() && $user->isAdmin()){ && !Application_Model_Preference::GetSupportFeedback() && $user->isAdmin()){
$form = new Application_Form_RegisterAirtime(); $form = new Application_Form_RegisterAirtime();
$logo = Application_Model_Preference::GetStationLogo(); $logo = Application_Model_Preference::GetStationLogo();
if ($logo) { if ($logo) {
$this->view->logoImg = $logo; $this->view->logoImg = $logo;
} }
$this->view->dialog = $form; $this->view->dialog = $form;
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/register.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/register.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
} }
//determine whether to remove/hide/display the library. //determine whether to remove/hide/display the library.
$showLib = false; $showLib = false;
if (!$user->isGuest()) { if (!$user->isGuest()) {
$disableLib = false; $disableLib = false;
$data = Application_Model_Preference::getValue("nowplaying_screen", true); $data = Application_Model_Preference::getValue("nowplaying_screen", true);
if ($data != "") { if ($data != "") {
$settings = unserialize($data); $settings = unserialize($data);
if ($settings["library"] == "true") { if ($settings["library"] == "true") {
$showLib = true; $showLib = true;
} }
} }
} }
else { else {
$disableLib = true; $disableLib = true;
} }
$this->view->disableLib = $disableLib; $this->view->disableLib = $disableLib;
$this->view->showLib = $showLib; $this->view->showLib = $showLib;
//populate date range form for show builder. //populate date range form for show builder.
$now = time(); $now = time();
$from = $request->getParam("from", $now); $from = $request->getParam("from", $now);
@ -174,7 +174,7 @@ class ShowbuilderController extends Zend_Controller_Action
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'/css/showbuilder.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'/css/showbuilder.css?'.$CC_CONFIG['airtime_version']);
} }
public function contextMenuAction() public function contextMenuAction()
{ {
$id = $this->_getParam('id'); $id = $this->_getParam('id');
@ -263,7 +263,7 @@ class ShowbuilderController extends Zend_Controller_Action
public function builderFeedAction() { public function builderFeedAction() {
$start = microtime(true); $start = microtime(true);
$request = $this->getRequest(); $request = $this->getRequest();
$current_time = time(); $current_time = time();
@ -284,7 +284,7 @@ class ShowbuilderController extends Zend_Controller_Action
$this->view->schedule = $data["schedule"]; $this->view->schedule = $data["schedule"];
$this->view->instances = $data["showInstances"]; $this->view->instances = $data["showInstances"];
$this->view->timestamp = $current_time; $this->view->timestamp = $current_time;
$end = microtime(true); $end = microtime(true);
Logging::debug("getting builder feed info took:"); Logging::debug("getting builder feed info took:");

View File

@ -5,10 +5,10 @@ class SystemstatusController extends Zend_Controller_Action
public function init() public function init()
{ {
global $CC_CONFIG; global $CC_CONFIG;
$request = $this->getRequest(); $request = $this->getRequest();
$baseUrl = $request->getBaseUrl(); $baseUrl = $request->getBaseUrl();
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/status/status.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/status/status.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
} }
@ -22,7 +22,7 @@ class SystemstatusController extends Zend_Controller_Action
); );
$partitions = Application_Model_Systemstatus::GetDiskInfo(); $partitions = Application_Model_Systemstatus::GetDiskInfo();
$this->view->status = new StdClass; $this->view->status = new StdClass;
$this->view->status->services = $services; $this->view->status->services = $services;
$this->view->status->partitions = $partitions; $this->view->status->partitions = $partitions;

View File

@ -20,24 +20,24 @@ class UserController extends Zend_Controller_Action
public function addUserAction() public function addUserAction()
{ {
global $CC_CONFIG; global $CC_CONFIG;
$request = $this->getRequest(); $request = $this->getRequest();
$baseUrl = $request->getBaseUrl(); $baseUrl = $request->getBaseUrl();
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/user/user.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/user/user.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headLink()->appendStylesheet($baseUrl.'/css/users.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'/css/users.css?'.$CC_CONFIG['airtime_version']);
$form = new Application_Form_AddUser(); $form = new Application_Form_AddUser();
$this->view->successMessage = ""; $this->view->successMessage = "";
if ($request->isPost()) { if ($request->isPost()) {
if ($form->isValid($request->getPost())) { if ($form->isValid($request->getPost())) {
$formdata = $form->getValues(); $formdata = $form->getValues();
if(isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1 && $formdata['login'] == 'admin' && $formdata['user_id'] != 0){ if(isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1 && $formdata['login'] == 'admin' && $formdata['user_id'] != 0){
$this->view->successMessage = "<div class='errors'>Specific action is not allowed in demo version!</div>"; $this->view->successMessage = "<div class='errors'>Specific action is not allowed in demo version!</div>";
} }
@ -54,7 +54,7 @@ class UserController extends Zend_Controller_Action
$user->setSkype($formdata['skype']); $user->setSkype($formdata['skype']);
$user->setJabber($formdata['jabber']); $user->setJabber($formdata['jabber']);
$user->save(); $user->save();
$form->reset(); $form->reset();
if (strlen($formdata['user_id']) == 0){ if (strlen($formdata['user_id']) == 0){
@ -65,7 +65,7 @@ class UserController extends Zend_Controller_Action
} }
} }
} }
$this->view->form = $form; $this->view->form = $form;
} }
@ -80,7 +80,7 @@ class UserController extends Zend_Controller_Action
{ {
$post = $this->getRequest()->getPost(); $post = $this->getRequest()->getPost();
$users = Application_Model_User::getUsersDataTablesInfo($post); $users = Application_Model_User::getUsersDataTablesInfo($post);
die(json_encode($users)); die(json_encode($users));
} }
@ -102,7 +102,7 @@ class UserController extends Zend_Controller_Action
$user = new Application_Model_User($delId); $user = new Application_Model_User($delId);
$this->view->entries = $user->delete(); $this->view->entries = $user->delete();
} }
} }

View File

@ -16,18 +16,18 @@ class UsersettingsController extends Zend_Controller_Action
->addActionContext('donotshowregistrationpopup', 'json') ->addActionContext('donotshowregistrationpopup', 'json')
->initContext(); ->initContext();
} }
public function setNowPlayingScreenSettingsAction() { public function setNowPlayingScreenSettingsAction() {
$request = $this->getRequest(); $request = $this->getRequest();
$settings = $request->getParam("settings"); $settings = $request->getParam("settings");
$data = serialize($settings); $data = serialize($settings);
Application_Model_Preference::setValue("nowplaying_screen", $data, true); Application_Model_Preference::setValue("nowplaying_screen", $data, true);
} }
public function getNowPlayingScreenSettingsAction() { public function getNowPlayingScreenSettingsAction() {
$data = Application_Model_Preference::getValue("nowplaying_screen", true); $data = Application_Model_Preference::getValue("nowplaying_screen", true);
if ($data != "") { if ($data != "") {
$this->view->settings = unserialize($data); $this->view->settings = unserialize($data);
@ -54,34 +54,34 @@ class UsersettingsController extends Zend_Controller_Action
public function setTimelineDatatableAction() { public function setTimelineDatatableAction() {
$start = microtime(true); $start = microtime(true);
$request = $this->getRequest(); $request = $this->getRequest();
$settings = $request->getParam("settings"); $settings = $request->getParam("settings");
$data = serialize($settings); $data = serialize($settings);
Application_Model_Preference::setValue("timeline_datatable", $data, true); Application_Model_Preference::setValue("timeline_datatable", $data, true);
$end = microtime(true); $end = microtime(true);
Logging::debug("saving timeline datatables info took:"); Logging::debug("saving timeline datatables info took:");
Logging::debug(floatval($end) - floatval($start)); Logging::debug(floatval($end) - floatval($start));
} }
public function getTimelineDatatableAction() { public function getTimelineDatatableAction() {
$start = microtime(true); $start = microtime(true);
$data = Application_Model_Preference::getValue("timeline_datatable", true); $data = Application_Model_Preference::getValue("timeline_datatable", true);
if ($data != "") { if ($data != "") {
$this->view->settings = unserialize($data); $this->view->settings = unserialize($data);
} }
$end = microtime(true); $end = microtime(true);
Logging::debug("getting timeline datatables info took:"); Logging::debug("getting timeline datatables info took:");
Logging::debug(floatval($end) - floatval($start)); Logging::debug(floatval($end) - floatval($start));
} }
public function remindmeAction() public function remindmeAction()
{ {
// unset session // unset session

View File

@ -26,8 +26,8 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
**/ **/
public function __construct(Zend_Acl $aclData, $roleName = 'G') public function __construct(Zend_Acl $aclData, $roleName = 'G')
{ {
$this->_errorPage = array('module' => 'default', $this->_errorPage = array('module' => 'default',
'controller' => 'error', 'controller' => 'error',
'action' => 'denied'); 'action' => 'denied');
$this->_roleName = $roleName; $this->_roleName = $roleName;
@ -62,17 +62,17 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
* Returns the ACL role used * Returns the ACL role used
* *
* @return string * @return string
* @author * @author
**/ **/
public function getRoleName() public function getRoleName()
{ {
return $this->_roleName; return $this->_roleName;
} }
public function setRoleName($type) public function setRoleName($type)
{ {
$this->_roleName = $type; $this->_roleName = $type;
} }
/** /**
* Sets the error page * Sets the error page
@ -84,7 +84,7 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
**/ **/
public function setErrorPage($action, $controller = 'error', $module = null) public function setErrorPage($action, $controller = 'error', $module = null)
{ {
$this->_errorPage = array('module' => $module, $this->_errorPage = array('module' => $module,
'controller' => $controller, 'controller' => $controller,
'action' => $action); 'action' => $action);
} }
@ -108,58 +108,58 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
**/ **/
public function preDispatch(Zend_Controller_Request_Abstract $request) public function preDispatch(Zend_Controller_Request_Abstract $request)
{ {
$controller = strtolower($request->getControllerName()); $controller = strtolower($request->getControllerName());
if (in_array($controller, array("api", "auth"))){ if (in_array($controller, array("api", "auth"))){
$this->setRoleName("G"); $this->setRoleName("G");
} }
else if (!Zend_Auth::getInstance()->hasIdentity()){ else if (!Zend_Auth::getInstance()->hasIdentity()){
if ($controller !== 'login') { if ($controller !== 'login') {
if ($request->isXmlHttpRequest()) { if ($request->isXmlHttpRequest()) {
$url = 'http://'.$request->getHttpHost().'/login'; $url = 'http://'.$request->getHttpHost().'/login';
$json = Zend_Json::encode(array('auth' => false, 'url' => $url)); $json = Zend_Json::encode(array('auth' => false, 'url' => $url));
// Prepare response // Prepare response
$this->getResponse() $this->getResponse()
->setHttpResponseCode(401) ->setHttpResponseCode(401)
->setBody($json) ->setBody($json)
->sendResponse(); ->sendResponse();
//redirectAndExit() cleans up, sends the headers and stops the script //redirectAndExit() cleans up, sends the headers and stops the script
Zend_Controller_Action_HelperBroker::getStaticHelper('redirector')->redirectAndExit(); Zend_Controller_Action_HelperBroker::getStaticHelper('redirector')->redirectAndExit();
} }
else { else {
$r = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector'); $r = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
$r->gotoSimpleAndExit('index', 'login', $request->getModuleName()); $r->gotoSimpleAndExit('index', 'login', $request->getModuleName());
} }
} }
} }
else { else {
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$this->setRoleName($userInfo->type); $this->setRoleName($userInfo->type);
Zend_View_Helper_Navigation_HelperAbstract::setDefaultAcl($this->_acl); Zend_View_Helper_Navigation_HelperAbstract::setDefaultAcl($this->_acl);
Zend_View_Helper_Navigation_HelperAbstract::setDefaultRole($this->_roleName); Zend_View_Helper_Navigation_HelperAbstract::setDefaultRole($this->_roleName);
$resourceName = '';
if ($request->getModuleName() != 'default') { $resourceName = '';
$resourceName .= strtolower($request->getModuleName()) . ':';
}
$resourceName .= $controller; if ($request->getModuleName() != 'default') {
$resourceName .= strtolower($request->getModuleName()) . ':';
}
/** Check if the controller/action can be accessed by the current user */ $resourceName .= $controller;
if (!$this->getAcl()->isAllowed($this->_roleName, $resourceName, $request->getActionName())) {
/** Redirect to access denied page */ /** Check if the controller/action can be accessed by the current user */
$this->denyAccess(); if (!$this->getAcl()->isAllowed($this->_roleName, $resourceName, $request->getActionName())) {
} /** Redirect to access denied page */
} $this->denyAccess();
}
}
} }
/** /**