Merge branch 'cc-84-smart-playlist' of dev.sourcefabric.org:airtime into cc-84-smart-playlist
This commit is contained in:
commit
fe75ba0e93
|
@ -83,7 +83,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||||
|
|
||||||
$view->headScript()->appendFile($baseUrl.'/js/airtime/common/common.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$view->headScript()->appendFile($baseUrl.'/js/airtime/common/common.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
|
|
||||||
$user = Application_Model_User::GetCurrentUser();
|
$user = Application_Model_User::getCurrentUser();
|
||||||
if (!is_null($user)){
|
if (!is_null($user)){
|
||||||
$userType = $user->getType();
|
$userType = $user->getType();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -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 {
|
||||||
|
@ -270,32 +270,32 @@ class ApiController extends Zend_Controller_Action
|
||||||
|
|
||||||
$date = new Application_Common_DateHelper;
|
$date = new Application_Common_DateHelper;
|
||||||
$utcTimeNow = $date->getUtcTimestamp();
|
$utcTimeNow = $date->getUtcTimestamp();
|
||||||
$utcTimeEnd = ""; // if empty, GetNextShows will use interval instead of end of day
|
$utcTimeEnd = ""; // if empty, getNextShows will use interval instead of end of day
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$type = $request->getParam('type');
|
$type = $request->getParam('type');
|
||||||
if($type == "endofday") {
|
if($type == "endofday") {
|
||||||
// make GetNextShows use end of day
|
// make getNextShows use end of day
|
||||||
$utcTimeEnd = Application_Common_DateHelper::GetDayEndTimestampInUtc();
|
$utcTimeEnd = Application_Common_DateHelper::GetDayEndTimestampInUtc();
|
||||||
$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);
|
||||||
|
@ -324,14 +324,14 @@ class ApiController extends Zend_Controller_Action
|
||||||
$result = array();
|
$result = array();
|
||||||
for ($i=0; $i<7; $i++){
|
for ($i=0; $i<7; $i++){
|
||||||
$utcDayEnd = Application_Common_DateHelper::GetDayEndTimestamp($utcDayStart);
|
$utcDayEnd = Application_Common_DateHelper::GetDayEndTimestamp($utcDayStart);
|
||||||
$shows = Application_Model_Show::GetNextShows($utcDayStart, "0", $utcDayEnd);
|
$shows = Application_Model_Show::getNextShows($utcDayStart, "0", $utcDayEnd);
|
||||||
$utcDayStart = $utcDayEnd;
|
$utcDayStart = $utcDayEnd;
|
||||||
|
|
||||||
Application_Model_Show::ConvertToLocalTimeZone($shows, array("starts", "ends", "start_timestamp", "end_timestamp"));
|
Application_Model_Show::convertToLocalTimeZone($shows, array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||||
|
|
||||||
$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 {
|
||||||
|
@ -413,7 +413,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
$this->view->server_timezone = Application_Model_Preference::GetTimezone();
|
$this->view->server_timezone = Application_Model_Preference::GetTimezone();
|
||||||
|
|
||||||
$rows = Application_Model_Show::GetCurrentShow($today_timestamp);
|
$rows = Application_Model_Show::GetCurrentShow($today_timestamp);
|
||||||
Application_Model_Show::ConvertToLocalTimeZone($rows, array("starts", "ends", "start_timestamp", "end_timestamp"));
|
Application_Model_Show::convertToLocalTimeZone($rows, array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||||
|
|
||||||
if (count($rows) > 0){
|
if (count($rows) > 0){
|
||||||
$this->view->is_recording = ($rows[0]['record'] == 1);
|
$this->view->is_recording = ($rows[0]['record'] == 1);
|
||||||
|
@ -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()))
|
||||||
{
|
{
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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');
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ class LibraryController extends Zend_Controller_Action
|
||||||
//array containing id and type of media to delete.
|
//array containing id and type of media to delete.
|
||||||
$mediaItems = $this->_getParam('media', null);
|
$mediaItems = $this->_getParam('media', null);
|
||||||
|
|
||||||
$user = Application_Model_User::GetCurrentUser();
|
$user = Application_Model_User::getCurrentUser();
|
||||||
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
||||||
|
|
||||||
$files = array();
|
$files = array();
|
||||||
|
@ -204,12 +204,12 @@ class LibraryController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function editFileMdAction()
|
public function editFileMdAction()
|
||||||
{
|
{
|
||||||
$user = Application_Model_User::GetCurrentUser();
|
$user = Application_Model_User::getCurrentUser();
|
||||||
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
||||||
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();
|
||||||
|
|
||||||
|
|
|
@ -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');
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,7 +135,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->headScript()->appendFile($baseUrl.'/js/airtime/playlist/smart_playlistbuilder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/playlist/smart_playlistbuilder.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']);
|
||||||
|
@ -162,14 +162,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()
|
||||||
|
@ -179,21 +179,20 @@ class PlaylistController extends Zend_Controller_Action
|
||||||
//$form = new Application_Form_SmartPlaylistCriteria();
|
//$form = new Application_Form_SmartPlaylistCriteria();
|
||||||
|
|
||||||
|
|
||||||
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);
|
||||||
//$this->view->form = $form;
|
}
|
||||||
}
|
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()
|
||||||
|
@ -224,13 +223,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();
|
||||||
|
@ -295,9 +294,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();
|
||||||
|
@ -324,9 +323,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();
|
||||||
|
@ -379,8 +378,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();
|
||||||
|
|
|
@ -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"];
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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');
|
||||||
|
|
|
@ -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::SetMasterLiveSteamPort($values["master_harbor_input_port"]);
|
Application_Model_StreamSetting::setMasterLiveStreamPort($values["master_harbor_input_port"]);
|
||||||
Application_Model_StreamSetting::SetMasterLiveSteamMountPoint($values["master_harbor_input_mount_point"]);
|
Application_Model_StreamSetting::setMasterLiveStreamMountPoint($values["master_harbor_input_mount_point"]);
|
||||||
Application_Model_StreamSetting::SetDJLiveSteamPort($values["dj_harbor_input_port"]);
|
Application_Model_StreamSetting::setDjLiveStreamPort($values["dj_harbor_input_port"]);
|
||||||
Application_Model_StreamSetting::SetDJLiveSteamMountPoint($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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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()
|
||||||
|
@ -90,12 +90,12 @@ 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()) {
|
||||||
|
@ -357,28 +357,28 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$range["next"]["ends"] = Application_Common_DateHelper::ConvertToLocalDateTimeString($range["next"]["ends"]);
|
$range["next"]["ends"] = Application_Common_DateHelper::ConvertToLocalDateTimeString($range["next"]["ends"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
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');
|
||||||
|
@ -822,14 +822,14 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function cancelShowAction()
|
public function cancelShowAction()
|
||||||
{
|
{
|
||||||
$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;
|
||||||
}
|
}
|
||||||
|
@ -842,11 +842,11 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function cancelCurrentShowAction()
|
public function cancelCurrentShowAction()
|
||||||
{
|
{
|
||||||
$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))) {
|
||||||
$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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,17 +17,17 @@ 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));
|
||||||
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-library', JSON.stringify($libraryTable) );");
|
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-library', JSON.stringify($libraryTable) );");
|
||||||
|
@ -35,8 +35,8 @@ 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));
|
||||||
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-timeline', JSON.stringify($timelineTable) );");
|
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-timeline', JSON.stringify($timelineTable) );");
|
||||||
|
@ -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');
|
||||||
|
@ -184,7 +184,7 @@ class ShowbuilderController extends Zend_Controller_Action
|
||||||
$baseUrl = $request->getBaseUrl();
|
$baseUrl = $request->getBaseUrl();
|
||||||
$menu = array();
|
$menu = array();
|
||||||
|
|
||||||
$user = Application_Model_User::GetCurrentUser();
|
$user = Application_Model_User::getCurrentUser();
|
||||||
|
|
||||||
$item = CcScheduleQuery::create()->findPK($id);
|
$item = CcScheduleQuery::create()->findPK($id);
|
||||||
$instance = $item->getCcShowInstances();
|
$instance = $item->getCcShowInstances();
|
||||||
|
@ -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:");
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,19 +16,19 @@ 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);
|
||||||
}
|
}
|
||||||
|
@ -40,12 +40,12 @@ class UsersettingsController extends Zend_Controller_Action
|
||||||
$settings = $request->getParam("settings");
|
$settings = $request->getParam("settings");
|
||||||
|
|
||||||
$data = serialize($settings);
|
$data = serialize($settings);
|
||||||
Application_Model_Preference::SetValue("library_datatable", $data, true);
|
Application_Model_Preference::setValue("library_datatable", $data, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLibraryDatatableAction() {
|
public function getLibraryDatatableAction() {
|
||||||
|
|
||||||
$data = Application_Model_Preference::GetValue("library_datatable", true);
|
$data = Application_Model_Preference::getValue("library_datatable", 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
|
||||||
|
|
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -29,7 +29,7 @@ class Application_Form_AddShowAbsoluteRebroadcastDates extends Zend_Form_SubForm
|
||||||
$this->addElement($text);
|
$this->addElement($text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function disable(){
|
public function disable(){
|
||||||
$elements = $this->getElements();
|
$elements = $this->getElements();
|
||||||
foreach ($elements as $element)
|
foreach ($elements as $element)
|
||||||
|
|
|
@ -11,13 +11,13 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm
|
||||||
->setRequired(false)
|
->setRequired(false)
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($cb_airtime_auth);
|
$this->addElement($cb_airtime_auth);
|
||||||
|
|
||||||
$cb_custom_auth = new Zend_Form_Element_Checkbox("cb_custom_auth");
|
$cb_custom_auth = new Zend_Form_Element_Checkbox("cb_custom_auth");
|
||||||
$cb_custom_auth ->setLabel("Use Custom Authentication:")
|
$cb_custom_auth ->setLabel("Use Custom Authentication:")
|
||||||
->setRequired(false)
|
->setRequired(false)
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($cb_custom_auth);
|
$this->addElement($cb_custom_auth);
|
||||||
|
|
||||||
//custom username
|
//custom username
|
||||||
$custom_username = new Zend_Form_Element_Text('custom_username');
|
$custom_username = new Zend_Form_Element_Text('custom_username');
|
||||||
$custom_username->setAttrib('class', 'input_text')
|
$custom_username->setAttrib('class', 'input_text')
|
||||||
|
@ -29,7 +29,7 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm
|
||||||
new ConditionalNotEmpty(array("cb_custom_auth"=>"1"))))
|
new ConditionalNotEmpty(array("cb_custom_auth"=>"1"))))
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($custom_username);
|
$this->addElement($custom_username);
|
||||||
|
|
||||||
//custom password
|
//custom password
|
||||||
$custom_password = new Zend_Form_Element_Password('custom_password');
|
$custom_password = new Zend_Form_Element_Password('custom_password');
|
||||||
$custom_password->setAttrib('class', 'input_text')
|
$custom_password->setAttrib('class', 'input_text')
|
||||||
|
@ -42,20 +42,20 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm
|
||||||
new ConditionalNotEmpty(array("cb_custom_auth"=>"1"))))
|
new ConditionalNotEmpty(array("cb_custom_auth"=>"1"))))
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($custom_password);
|
$this->addElement($custom_password);
|
||||||
|
|
||||||
$connection_url = Application_Model_Preference::GetLiveDJSourceConnectionURL();
|
$connection_url = Application_Model_Preference::GetLiveDJSourceConnectionURL();
|
||||||
if(trim($connection_url) == ""){
|
if(trim($connection_url) == ""){
|
||||||
$connection_url = "N/A";
|
$connection_url = "N/A";
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setDecorators(array(
|
$this->setDecorators(array(
|
||||||
array('ViewScript', array('viewScript' => 'form/add-show-live-stream.phtml', "connection_url"=>$connection_url))
|
array('ViewScript', array('viewScript' => 'form/add-show-live-stream.phtml', "connection_url"=>$connection_url))
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isValid($data){
|
public function isValid($data){
|
||||||
$isValid = parent::isValid($data);
|
$isValid = parent::isValid($data);
|
||||||
|
|
||||||
if($data['cb_custom_auth'] == 1){
|
if($data['cb_custom_auth'] == 1){
|
||||||
if(trim($data['custom_username']) == ''){
|
if(trim($data['custom_username']) == ''){
|
||||||
$element = $this->getElement("custom_username");
|
$element = $this->getElement("custom_username");
|
||||||
|
|
|
@ -6,16 +6,16 @@ class Application_Form_AddShowRR extends Zend_Form_SubForm
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
// Add record element
|
// Add record element
|
||||||
$this->addElement('checkbox', 'add_show_record', array(
|
$this->addElement('checkbox', 'add_show_record', array(
|
||||||
'label' => 'Record from Line In?',
|
'label' => 'Record from Line In?',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add record element
|
// Add record element
|
||||||
$this->addElement('checkbox', 'add_show_rebroadcast', array(
|
$this->addElement('checkbox', 'add_show_rebroadcast', array(
|
||||||
'label' => 'Rebroadcast?',
|
'label' => 'Rebroadcast?',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function disable(){
|
public function disable(){
|
||||||
|
|
|
@ -34,7 +34,7 @@ class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm
|
||||||
$this->addElement($text);
|
$this->addElement($text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function disable(){
|
public function disable(){
|
||||||
$elements = $this->getElements();
|
$elements = $this->getElements();
|
||||||
foreach ($elements as $element)
|
foreach ($elements as $element)
|
||||||
|
|
|
@ -6,56 +6,56 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
//Add type select
|
//Add type select
|
||||||
$this->addElement('select', 'add_show_repeat_type', array(
|
$this->addElement('select', 'add_show_repeat_type', array(
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'label' => 'Repeat Type:',
|
'label' => 'Repeat Type:',
|
||||||
'class' => ' input_select',
|
'class' => ' input_select',
|
||||||
'multiOptions' => array(
|
'multiOptions' => array(
|
||||||
"0" => "weekly",
|
"0" => "weekly",
|
||||||
"1" => "bi-weekly",
|
"1" => "bi-weekly",
|
||||||
"2" => "monthly"
|
"2" => "monthly"
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add days checkboxes
|
// Add days checkboxes
|
||||||
$this->addElement(
|
$this->addElement(
|
||||||
'multiCheckbox',
|
'multiCheckbox',
|
||||||
'add_show_day_check',
|
'add_show_day_check',
|
||||||
array(
|
array(
|
||||||
'label' => 'Select Days:',
|
'label' => 'Select Days:',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'multiOptions' => array(
|
'multiOptions' => array(
|
||||||
"0" => "Sun",
|
"0" => "Sun",
|
||||||
"1" => "Mon",
|
"1" => "Mon",
|
||||||
"2" => "Tue",
|
"2" => "Tue",
|
||||||
"3" => "Wed",
|
"3" => "Wed",
|
||||||
"4" => "Thu",
|
"4" => "Thu",
|
||||||
"5" => "Fri",
|
"5" => "Fri",
|
||||||
"6" => "Sat",
|
"6" => "Sat",
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add end date element
|
// Add end date element
|
||||||
$this->addElement('text', 'add_show_end_date', array(
|
$this->addElement('text', 'add_show_end_date', array(
|
||||||
'label' => 'Date End:',
|
'label' => 'Date End:',
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
'value' => date("Y-m-d"),
|
'value' => date("Y-m-d"),
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'filters' => array('StringTrim'),
|
'filters' => array('StringTrim'),
|
||||||
'validators' => array(
|
'validators' => array(
|
||||||
'NotEmpty',
|
'NotEmpty',
|
||||||
array('date', false, array('YYYY-MM-DD'))
|
array('date', false, array('YYYY-MM-DD'))
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add no end element
|
// Add no end element
|
||||||
$this->addElement('checkbox', 'add_show_no_end', array(
|
$this->addElement('checkbox', 'add_show_no_end', array(
|
||||||
'label' => 'No End?',
|
'label' => 'No End?',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'checked' => true,
|
'checked' => true,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function disable(){
|
public function disable(){
|
||||||
$elements = $this->getElements();
|
$elements = $this->getElements();
|
||||||
foreach ($elements as $element)
|
foreach ($elements as $element)
|
||||||
|
@ -69,10 +69,10 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm
|
||||||
|
|
||||||
public function checkReliantFields($formData) {
|
public function checkReliantFields($formData) {
|
||||||
|
|
||||||
if (!$formData['add_show_no_end']){
|
if (!$formData['add_show_no_end']){
|
||||||
$start_timestamp = $formData['add_show_start_date'];
|
$start_timestamp = $formData['add_show_start_date'];
|
||||||
$end_timestamp = $formData['add_show_end_date'];
|
$end_timestamp = $formData['add_show_end_date'];
|
||||||
|
|
||||||
$start_epoch = strtotime($start_timestamp);
|
$start_epoch = strtotime($start_timestamp);
|
||||||
$end_epoch = strtotime($end_timestamp);
|
$end_epoch = strtotime($end_timestamp);
|
||||||
|
|
||||||
|
|
|
@ -18,14 +18,14 @@ class Application_Form_AddShowStyle extends Zend_Form_SubForm
|
||||||
'viewScript' => 'form/add-show-style.phtml',
|
'viewScript' => 'form/add-show-style.phtml',
|
||||||
'class' => 'big'
|
'class' => 'big'
|
||||||
))));
|
))));
|
||||||
|
|
||||||
$bg->setValidators(array(
|
$bg->setValidators(array(
|
||||||
'Hex',
|
'Hex',
|
||||||
array('stringLength', false, array(6, 6))
|
array('stringLength', false, array(6, 6))
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
||||||
// Add show color input
|
|
||||||
|
// Add show color input
|
||||||
$this->addElement('text', 'add_show_color', array(
|
$this->addElement('text', 'add_show_color', array(
|
||||||
'label' => 'Text Colour:',
|
'label' => 'Text Colour:',
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
|
@ -38,7 +38,7 @@ class Application_Form_AddShowStyle extends Zend_Form_SubForm
|
||||||
'viewScript' => 'form/add-show-style.phtml',
|
'viewScript' => 'form/add-show-style.phtml',
|
||||||
'class' => 'big'
|
'class' => 'big'
|
||||||
))));
|
))));
|
||||||
|
|
||||||
$c->setValidators(array(
|
$c->setValidators(array(
|
||||||
'Hex',
|
'Hex',
|
||||||
array('stringLength', false, array(6, 6))
|
array('stringLength', false, array(6, 6))
|
||||||
|
|
|
@ -4,22 +4,22 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
|
||||||
{
|
{
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
// retrieves the length limit for each char field
|
// retrieves the length limit for each char field
|
||||||
// and store to assoc array
|
// and store to assoc array
|
||||||
$maxLens = Application_Model_Show::GetMaxLengths();
|
$maxLens = Application_Model_Show::getMaxLengths();
|
||||||
|
|
||||||
// Hidden element to indicate whether the show is new or
|
// Hidden element to indicate whether the show is new or
|
||||||
// whether we are updating an existing show.
|
// whether we are updating an existing show.
|
||||||
$this->addElement('hidden', 'add_show_id', array(
|
$this->addElement('hidden', 'add_show_id', array(
|
||||||
'decorators' => array('ViewHelper')
|
'decorators' => array('ViewHelper')
|
||||||
));
|
));
|
||||||
|
|
||||||
// Hidden element to indicate the instance id of the show
|
// Hidden element to indicate the instance id of the show
|
||||||
// being edited.
|
// being edited.
|
||||||
$this->addElement('hidden', 'add_show_instance_id', array(
|
$this->addElement('hidden', 'add_show_instance_id', array(
|
||||||
'decorators' => array('ViewHelper')
|
'decorators' => array('ViewHelper')
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add name element
|
// Add name element
|
||||||
$this->addElement('text', 'add_show_name', array(
|
$this->addElement('text', 'add_show_name', array(
|
||||||
'label' => 'Name:',
|
'label' => 'Name:',
|
||||||
|
@ -27,8 +27,8 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'filters' => array('StringTrim'),
|
'filters' => array('StringTrim'),
|
||||||
'validators' => array('NotEmpty'),
|
'validators' => array('NotEmpty'),
|
||||||
'value' => 'Untitled Show',
|
'value' => 'Untitled Show',
|
||||||
'validators' => array(array('StringLength', false, array(0, $maxLens['name'])))
|
'validators' => array(array('StringLength', false, array(0, $maxLens['name'])))
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add URL element
|
// Add URL element
|
||||||
|
@ -46,16 +46,16 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'filters' => array('StringTrim'),
|
'filters' => array('StringTrim'),
|
||||||
'validators' => array(array('StringLength', false, array(0, $maxLens['genre'])))
|
'validators' => array(array('StringLength', false, array(0, $maxLens['genre'])))
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add the description element
|
// Add the description element
|
||||||
$this->addElement('textarea', 'add_show_description', array(
|
$this->addElement('textarea', 'add_show_description', array(
|
||||||
'label' => 'Description:',
|
'label' => 'Description:',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'class' => 'input_text_area',
|
'class' => 'input_text_area',
|
||||||
'validators' => array(array('StringLength', false, array(0, $maxLens['description'])))
|
'validators' => array(array('StringLength', false, array(0, $maxLens['description'])))
|
||||||
));
|
));
|
||||||
|
|
||||||
$descText = $this->getElement('add_show_description');
|
$descText = $this->getElement('add_show_description');
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
|
||||||
))));
|
))));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function disable(){
|
public function disable(){
|
||||||
$elements = $this->getElements();
|
$elements = $this->getElements();
|
||||||
foreach ($elements as $element)
|
foreach ($elements as $element)
|
||||||
|
|
|
@ -8,7 +8,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
$this->setDecorators(array(
|
$this->setDecorators(array(
|
||||||
array('ViewScript', array('viewScript' => 'form/add-show-when.phtml'))
|
array('ViewScript', array('viewScript' => 'form/add-show-when.phtml'))
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add start date element
|
// Add start date element
|
||||||
$startDate = new Zend_Form_Element_Text('add_show_start_date');
|
$startDate = new Zend_Form_Element_Text('add_show_start_date');
|
||||||
$startDate->class = 'input_text';
|
$startDate->class = 'input_text';
|
||||||
|
@ -22,7 +22,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$startDate->setAttrib('alt', 'date');
|
$startDate->setAttrib('alt', 'date');
|
||||||
$this->addElement($startDate);
|
$this->addElement($startDate);
|
||||||
|
|
||||||
// Add start time element
|
// Add start time element
|
||||||
$startTime = new Zend_Form_Element_Text('add_show_start_time');
|
$startTime = new Zend_Form_Element_Text('add_show_start_time');
|
||||||
$startTime->class = 'input_text';
|
$startTime->class = 'input_text';
|
||||||
|
@ -50,7 +50,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$endDate->setAttrib('alt', 'date');
|
$endDate->setAttrib('alt', 'date');
|
||||||
$this->addElement($endDate);
|
$this->addElement($endDate);
|
||||||
|
|
||||||
// Add end time element
|
// Add end time element
|
||||||
$endTime = new Zend_Form_Element_Text('add_show_end_time');
|
$endTime = new Zend_Form_Element_Text('add_show_end_time');
|
||||||
$endTime->class = 'input_text';
|
$endTime->class = 'input_text';
|
||||||
|
@ -64,7 +64,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$endTime->setAttrib('alt', 'time');
|
$endTime->setAttrib('alt', 'time');
|
||||||
$this->addElement($endTime);
|
$this->addElement($endTime);
|
||||||
|
|
||||||
// Add duration element
|
// Add duration element
|
||||||
$this->addElement('text', 'add_show_duration', array(
|
$this->addElement('text', 'add_show_duration', array(
|
||||||
'label' => 'Duration:',
|
'label' => 'Duration:',
|
||||||
|
@ -85,10 +85,13 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
|
|
||||||
public function checkReliantFields($formData, $validateStartDate, $originalStartDate=null, $update=false, $instanceId=null) {
|
public function checkReliantFields($formData, $validateStartDate, $originalStartDate=null, $update=false, $instanceId=null) {
|
||||||
$valid = true;
|
$valid = true;
|
||||||
|
|
||||||
|
$hours;
|
||||||
|
$minutes;
|
||||||
|
|
||||||
$start_time = $formData['add_show_start_date']." ".$formData['add_show_start_time'];
|
$start_time = $formData['add_show_start_date']." ".$formData['add_show_start_time'];
|
||||||
$end_time = $formData['add_show_end_date_no_repeat']." ".$formData['add_show_end_time'];
|
$end_time = $formData['add_show_end_date_no_repeat']." ".$formData['add_show_end_time'];
|
||||||
|
|
||||||
//DateTime stores $start_time in the current timezone
|
//DateTime stores $start_time in the current timezone
|
||||||
$nowDateTime = new DateTime();
|
$nowDateTime = new DateTime();
|
||||||
$showStartDateTime = new DateTime($start_time);
|
$showStartDateTime = new DateTime($start_time);
|
||||||
|
@ -109,15 +112,15 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if end time is in the past, return error
|
// if end time is in the past, return error
|
||||||
if($showEndDateTime->getTimestamp() < $nowDateTime->getTimestamp()) {
|
if($showEndDateTime->getTimestamp() < $nowDateTime->getTimestamp()) {
|
||||||
$this->getElement('add_show_end_time')->setErrors(array('End date/time cannot be in the past'));
|
$this->getElement('add_show_end_time')->setErrors(array('End date/time cannot be in the past'));
|
||||||
$valid = false;
|
$valid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$pattern = '/([0-9][0-9])h ([0-9][0-9])m/';
|
$pattern = '/([0-9][0-9])h ([0-9][0-9])m/';
|
||||||
|
|
||||||
if (preg_match($pattern, $formData['add_show_duration'], $matches) && count($matches) == 3) {
|
if (preg_match($pattern, $formData['add_show_duration'], $matches) && count($matches) == 3) {
|
||||||
$hours = $matches[1];
|
$hours = $matches[1];
|
||||||
$minutes = $matches[2];
|
$minutes = $matches[2];
|
||||||
|
@ -147,17 +150,119 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
$show_start->setTimezone(new DateTimeZone('UTC'));
|
$show_start->setTimezone(new DateTimeZone('UTC'));
|
||||||
$show_end = new DateTime($end_time);
|
$show_end = new DateTime($end_time);
|
||||||
$show_end->setTimezone(new DateTimeZone('UTC'));
|
$show_end->setTimezone(new DateTimeZone('UTC'));
|
||||||
|
|
||||||
$overlapping = Application_Model_Schedule::checkOverlappingShows($show_start, $show_end, $update, $instanceId);
|
if ($formData["add_show_repeats"]) {
|
||||||
if ($overlapping) {
|
|
||||||
$this->getElement('add_show_duration')->setErrors(array('Cannot schedule overlapping shows'));
|
//get repeating show end date
|
||||||
$valid = false;
|
if ($formData["add_show_no_end"]) {
|
||||||
|
$date = Application_Model_Preference::GetShowsPopulatedUntil();
|
||||||
|
|
||||||
|
if (is_null($date)) {
|
||||||
|
$populateUntilDateTime = new DateTime("now", new DateTimeZone('UTC'));
|
||||||
|
Application_Model_Preference::SetShowsPopulatedUntil($populateUntilDateTime);
|
||||||
|
} else {
|
||||||
|
$populateUntilDateTime = clone $date;
|
||||||
|
}
|
||||||
|
|
||||||
|
} elseif (!$formData["add_show_no_end"]) {
|
||||||
|
$popUntil = $formData["add_show_end_date"]." ".$formData["add_show_end_time"];
|
||||||
|
$populateUntilDateTime = new DateTime($popUntil, new DateTimeZone('UTC'));
|
||||||
|
}
|
||||||
|
|
||||||
|
//get repeat interval
|
||||||
|
if ($formData["add_show_repeat_type"] == 0) {
|
||||||
|
$interval = 'P7D';
|
||||||
|
} elseif ($formData["add_show_repeat_type"] == 1) {
|
||||||
|
$interval = 'P14D';
|
||||||
|
} elseif ($formData["add_show_repeat_type"] == 2) {
|
||||||
|
$interval = 'P1M';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check first show
|
||||||
|
* Continue if the first show does not overlap
|
||||||
|
*/
|
||||||
|
$overlapping = Application_Model_Schedule::checkOverlappingShows($show_start, $show_end, $update, $instanceId);
|
||||||
|
|
||||||
|
/* Check if repeats overlap with previously scheduled shows
|
||||||
|
* Do this for each show day
|
||||||
|
*/
|
||||||
|
if (!$overlapping) {
|
||||||
|
$startDow = date("w", $show_start->getTimestamp());
|
||||||
|
foreach($formData["add_show_day_check"] as $day) {
|
||||||
|
$repeatShowStart = clone $show_start;
|
||||||
|
$repeatShowEnd = clone $show_end;
|
||||||
|
$daysAdd=0;
|
||||||
|
if ($startDow !== $day){
|
||||||
|
if ($startDow > $day)
|
||||||
|
$daysAdd = 6 - $startDow + 1 + $day;
|
||||||
|
else
|
||||||
|
$daysAdd = $day - $startDow;
|
||||||
|
|
||||||
|
$repeatShowStart->add(new DateInterval("P".$daysAdd."D"));
|
||||||
|
$repeatShowEnd->add(new DateInterval("P".$daysAdd."D"));
|
||||||
|
}
|
||||||
|
while ($repeatShowStart->getTimestamp() < $populateUntilDateTime->getTimestamp()) {
|
||||||
|
$overlapping = Application_Model_Schedule::checkOverlappingShows($repeatShowStart, $repeatShowEnd, $update, $instanceId);
|
||||||
|
if ($overlapping) {
|
||||||
|
$valid = false;
|
||||||
|
$this->getElement('add_show_duration')->setErrors(array('Cannot schedule overlapping shows'));
|
||||||
|
break 1;
|
||||||
|
} else {
|
||||||
|
$repeatShowStart->add(new DateInterval($interval));
|
||||||
|
$repeatShowEnd->add(new DateInterval($interval));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$valid = false;
|
||||||
|
$this->getElement('add_show_duration')->setErrors(array('Cannot schedule overlapping shows'));
|
||||||
|
}
|
||||||
|
} elseif ($formData["add_show_rebroadcast"]) {
|
||||||
|
/* Check first show
|
||||||
|
* Continue if the first show does not overlap
|
||||||
|
*/
|
||||||
|
$overlapping = Application_Model_Schedule::checkOverlappingShows($show_start, $show_end, $update, $instanceId);
|
||||||
|
|
||||||
|
if (!$overlapping) {
|
||||||
|
for ($i = 1; $i <= 10; $i++) {
|
||||||
|
$hours = ltrim($hours, '0');
|
||||||
|
if ($minutes != "00") {
|
||||||
|
$minutes = ltrim($minutes, '0');
|
||||||
|
$durationToAdd = "PT".$hours."H".$minutes."I";
|
||||||
|
} else {
|
||||||
|
$minutes = "0";
|
||||||
|
$durationToAdd = "PT".$hours."H";
|
||||||
|
}
|
||||||
|
|
||||||
|
$abs_rebroadcast_start = $formData["add_show_rebroadcast_date_absolute_".$i]." ".
|
||||||
|
$formData["add_show_rebroadcast_time_absolute_".$i];
|
||||||
|
$rebroadcastShowStart = new DateTime($abs_rebroadcast_start);
|
||||||
|
$rebroadcastShowStart->setTimezone(new DateTimeZone('UTC'));
|
||||||
|
$rebroadcastShowEnd = clone $rebroadcastShowStart;
|
||||||
|
$rebroadcastShowEnd->add(new DateInterval($durationToAdd));
|
||||||
|
$overlapping = Application_Model_Schedule::checkOverlappingShows($rebroadcastShowStart, $rebroadcastShowEnd, $update, $instanceId);
|
||||||
|
if ($overlapping) {
|
||||||
|
$valid = false;
|
||||||
|
$this->getElement('add_show_duration')->setErrors(array('Cannot schedule overlapping shows'));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$valid = false;
|
||||||
|
$this->getElement('add_show_duration')->setErrors(array('Cannot schedule overlapping shows'));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$overlapping = Application_Model_Schedule::checkOverlappingShows($show_start, $show_end, $update, $instanceId);
|
||||||
|
if ($overlapping) {
|
||||||
|
$this->getElement('add_show_duration')->setErrors(array('Cannot schedule overlapping shows'));
|
||||||
|
$valid = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $valid;
|
return $valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function disable(){
|
public function disable(){
|
||||||
$elements = $this->getElements();
|
$elements = $this->getElements();
|
||||||
foreach ($elements as $element)
|
foreach ($elements as $element)
|
||||||
|
@ -168,7 +273,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function disableRepeatCheckbox(){
|
public function disableRepeatCheckbox(){
|
||||||
$element = $this->getElement('add_show_repeats');
|
$element = $this->getElement('add_show_repeats');
|
||||||
if ($element->getType() != 'Zend_Form_Element_Hidden')
|
if ($element->getType() != 'Zend_Form_Element_Hidden')
|
||||||
|
@ -176,7 +281,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
$element->setAttrib('disabled','disabled');
|
$element->setAttrib('disabled','disabled');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function disableStartDateAndTime(){
|
public function disableStartDateAndTime(){
|
||||||
$elements = array($this->getElement('add_show_start_date'), $this->getElement('add_show_start_time'));
|
$elements = array($this->getElement('add_show_start_date'), $this->getElement('add_show_start_time'));
|
||||||
foreach ($elements as $element)
|
foreach ($elements as $element)
|
||||||
|
|
|
@ -10,21 +10,21 @@ class Application_Form_AddShowWho extends Zend_Form_SubForm
|
||||||
'label' => 'Search Users:',
|
'label' => 'Search Users:',
|
||||||
'class' => 'input_text ui-autocomplete-input',
|
'class' => 'input_text ui-autocomplete-input',
|
||||||
'required' => false
|
'required' => false
|
||||||
));
|
));
|
||||||
|
|
||||||
$options = array();
|
$options = array();
|
||||||
$hosts = Application_Model_User::getHosts();
|
$hosts = Application_Model_User::getHosts();
|
||||||
|
|
||||||
foreach ($hosts as $host) {
|
foreach ($hosts as $host) {
|
||||||
$options[$host['index']] = $host['label'];
|
$options[$host['index']] = $host['label'];
|
||||||
}
|
}
|
||||||
|
|
||||||
//Add hosts selection
|
//Add hosts selection
|
||||||
$hosts = new Zend_Form_Element_MultiCheckbox('add_show_hosts');
|
$hosts = new Zend_Form_Element_MultiCheckbox('add_show_hosts');
|
||||||
$hosts->setLabel('DJs:')
|
$hosts->setLabel('DJs:')
|
||||||
->setMultiOptions($options);
|
->setMultiOptions($options);
|
||||||
|
|
||||||
$this->addElement($hosts);
|
$this->addElement($hosts);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function disable(){
|
public function disable(){
|
||||||
|
|
|
@ -10,11 +10,11 @@ class Application_Form_AddUser extends Zend_Form
|
||||||
'../application/validate',
|
'../application/validate',
|
||||||
'validate');
|
'validate');
|
||||||
* */
|
* */
|
||||||
|
|
||||||
$hidden = new Zend_Form_Element_Hidden('user_id');
|
$hidden = new Zend_Form_Element_Hidden('user_id');
|
||||||
$hidden->setDecorators(array('ViewHelper'));
|
$hidden->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($hidden);
|
$this->addElement($hidden);
|
||||||
|
|
||||||
$login = new Zend_Form_Element_Text('login');
|
$login = new Zend_Form_Element_Text('login');
|
||||||
$login->setLabel('Username:');
|
$login->setLabel('Username:');
|
||||||
$login->setAttrib('class', 'input_text');
|
$login->setAttrib('class', 'input_text');
|
||||||
|
@ -22,7 +22,7 @@ class Application_Form_AddUser extends Zend_Form
|
||||||
$login->addFilter('StringTrim');
|
$login->addFilter('StringTrim');
|
||||||
//$login->addValidator('UserNameValidate');
|
//$login->addValidator('UserNameValidate');
|
||||||
$this->addElement($login);
|
$this->addElement($login);
|
||||||
|
|
||||||
$password = new Zend_Form_Element_Password('password');
|
$password = new Zend_Form_Element_Password('password');
|
||||||
$password->setLabel('Password:');
|
$password->setLabel('Password:');
|
||||||
$password->setAttrib('class', 'input_text');
|
$password->setAttrib('class', 'input_text');
|
||||||
|
@ -30,21 +30,21 @@ class Application_Form_AddUser extends Zend_Form
|
||||||
$password->addFilter('StringTrim');
|
$password->addFilter('StringTrim');
|
||||||
$password->addValidator('NotEmpty');
|
$password->addValidator('NotEmpty');
|
||||||
$this->addElement($password);
|
$this->addElement($password);
|
||||||
|
|
||||||
$firstName = new Zend_Form_Element_Text('first_name');
|
$firstName = new Zend_Form_Element_Text('first_name');
|
||||||
$firstName->setLabel('Firstname:');
|
$firstName->setLabel('Firstname:');
|
||||||
$firstName->setAttrib('class', 'input_text');
|
$firstName->setAttrib('class', 'input_text');
|
||||||
$firstName->addFilter('StringTrim');
|
$firstName->addFilter('StringTrim');
|
||||||
$firstName->addValidator('NotEmpty');
|
$firstName->addValidator('NotEmpty');
|
||||||
$this->addElement($firstName);
|
$this->addElement($firstName);
|
||||||
|
|
||||||
$lastName = new Zend_Form_Element_Text('last_name');
|
$lastName = new Zend_Form_Element_Text('last_name');
|
||||||
$lastName->setLabel('Lastname:');
|
$lastName->setLabel('Lastname:');
|
||||||
$lastName->setAttrib('class', 'input_text');
|
$lastName->setAttrib('class', 'input_text');
|
||||||
$lastName->addFilter('StringTrim');
|
$lastName->addFilter('StringTrim');
|
||||||
$lastName->addValidator('NotEmpty');
|
$lastName->addValidator('NotEmpty');
|
||||||
$this->addElement($lastName);
|
$this->addElement($lastName);
|
||||||
|
|
||||||
$email = new Zend_Form_Element_Text('email');
|
$email = new Zend_Form_Element_Text('email');
|
||||||
$email->setLabel('Email:');
|
$email->setLabel('Email:');
|
||||||
$email->setAttrib('class', 'input_text');
|
$email->setAttrib('class', 'input_text');
|
||||||
|
@ -52,7 +52,7 @@ class Application_Form_AddUser extends Zend_Form
|
||||||
$email->setRequired(true);
|
$email->setRequired(true);
|
||||||
$email->addValidator('EmailAddress');
|
$email->addValidator('EmailAddress');
|
||||||
$this->addElement($email);
|
$this->addElement($email);
|
||||||
|
|
||||||
$cellPhone = new Zend_Form_Element_Text('cell_phone');
|
$cellPhone = new Zend_Form_Element_Text('cell_phone');
|
||||||
$cellPhone->setLabel('Mobile Phone:');
|
$cellPhone->setLabel('Mobile Phone:');
|
||||||
$cellPhone->setAttrib('class', 'input_text');
|
$cellPhone->setAttrib('class', 'input_text');
|
||||||
|
@ -79,30 +79,30 @@ class Application_Form_AddUser extends Zend_Form
|
||||||
$select->setMultiOptions(array(
|
$select->setMultiOptions(array(
|
||||||
"G" => "Guest",
|
"G" => "Guest",
|
||||||
"H" => "DJ",
|
"H" => "DJ",
|
||||||
"P" => "Program Manager",
|
"P" => "Program Manager",
|
||||||
"A" => "Admin"
|
"A" => "Admin"
|
||||||
));
|
));
|
||||||
$select->setRequired(true);
|
$select->setRequired(true);
|
||||||
$this->addElement($select);
|
$this->addElement($select);
|
||||||
|
|
||||||
$submit = new Zend_Form_Element_Submit('submit');
|
$submit = new Zend_Form_Element_Submit('submit');
|
||||||
$submit->setAttrib('class', 'ui-button ui-state-default right-floated');
|
$submit->setAttrib('class', 'ui-button ui-state-default right-floated');
|
||||||
$submit->setIgnore(true);
|
$submit->setIgnore(true);
|
||||||
$submit->setLabel('Save');
|
$submit->setLabel('Save');
|
||||||
$this->addElement($submit);
|
$this->addElement($submit);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function validateLogin($data){
|
public function validateLogin($data){
|
||||||
|
|
||||||
if (strlen($data['user_id']) == 0){
|
if (strlen($data['user_id']) == 0){
|
||||||
$count = CcSubjsQuery::create()->filterByDbLogin($data['login'])->count();
|
$count = CcSubjsQuery::create()->filterByDbLogin($data['login'])->count();
|
||||||
|
|
||||||
if ($count != 0){
|
if ($count != 0){
|
||||||
$this->getElement('login')->setErrors(array("Login name is not unique."));
|
$this->getElement('login')->setErrors(array("Login name is not unique."));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,21 +7,21 @@ class Application_Form_EditAudioMD extends Zend_Form
|
||||||
// Set the method for the display form to POST
|
// Set the method for the display form to POST
|
||||||
$this->setMethod('post');
|
$this->setMethod('post');
|
||||||
|
|
||||||
// Add title field
|
// Add title field
|
||||||
$this->addElement('text', 'track_title', array(
|
$this->addElement('text', 'track_title', array(
|
||||||
'label' => 'Title:',
|
'label' => 'Title:',
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
'filters' => array('StringTrim'),
|
'filters' => array('StringTrim'),
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add artist field
|
// Add artist field
|
||||||
$this->addElement('text', 'artist_name', array(
|
$this->addElement('text', 'artist_name', array(
|
||||||
'label' => 'Creator:',
|
'label' => 'Creator:',
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
'filters' => array('StringTrim'),
|
'filters' => array('StringTrim'),
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add album field
|
// Add album field
|
||||||
$this->addElement('text', 'album_title', array(
|
$this->addElement('text', 'album_title', array(
|
||||||
'label' => 'Album:',
|
'label' => 'Album:',
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
|
@ -37,39 +37,39 @@ class Application_Form_EditAudioMD extends Zend_Form
|
||||||
'required' => true
|
'required' => true
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add genre field
|
// Add genre field
|
||||||
$this->addElement('text', 'genre', array(
|
$this->addElement('text', 'genre', array(
|
||||||
'label' => 'Genre:',
|
'label' => 'Genre:',
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
'filters' => array('StringTrim')
|
'filters' => array('StringTrim')
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add year field
|
// Add year field
|
||||||
$this->addElement('text', 'year', array(
|
$this->addElement('text', 'year', array(
|
||||||
'label' => 'Year:',
|
'label' => 'Year:',
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
'filters' => array('StringTrim'),
|
'filters' => array('StringTrim'),
|
||||||
'validators' => array(
|
'validators' => array(
|
||||||
array('date', false, array('YYYY-MM-DD')),
|
array('date', false, array('YYYY-MM-DD')),
|
||||||
array('date', false, array('YYYY-MM')),
|
array('date', false, array('YYYY-MM')),
|
||||||
array('date', false, array('YYYY'))
|
array('date', false, array('YYYY'))
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add label field
|
// Add label field
|
||||||
$this->addElement('text', 'label', array(
|
$this->addElement('text', 'label', array(
|
||||||
'label' => 'Label:',
|
'label' => 'Label:',
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
'filters' => array('StringTrim')
|
'filters' => array('StringTrim')
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add composer field
|
// Add composer field
|
||||||
$this->addElement('text', 'composer', array(
|
$this->addElement('text', 'composer', array(
|
||||||
'label' => 'Composer:',
|
'label' => 'Composer:',
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
'filters' => array('StringTrim')
|
'filters' => array('StringTrim')
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add conductor field
|
// Add conductor field
|
||||||
$this->addElement('text', 'conductor', array(
|
$this->addElement('text', 'conductor', array(
|
||||||
'label' => 'Conductor:',
|
'label' => 'Conductor:',
|
||||||
|
@ -77,7 +77,7 @@ class Application_Form_EditAudioMD extends Zend_Form
|
||||||
'filters' => array('StringTrim')
|
'filters' => array('StringTrim')
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add mood field
|
// Add mood field
|
||||||
$this->addElement('text', 'mood', array(
|
$this->addElement('text', 'mood', array(
|
||||||
'label' => 'Mood:',
|
'label' => 'Mood:',
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
|
@ -122,7 +122,7 @@ class Application_Form_EditAudioMD extends Zend_Form
|
||||||
'filters' => array('StringTrim')
|
'filters' => array('StringTrim')
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add the submit button
|
// Add the submit button
|
||||||
$this->addElement('submit', 'submit', array(
|
$this->addElement('submit', 'submit', array(
|
||||||
'ignore' => true,
|
'ignore' => true,
|
||||||
'class' => 'ui-button ui-state-default',
|
'class' => 'ui-button ui-state-default',
|
||||||
|
@ -132,7 +132,7 @@ class Application_Form_EditAudioMD extends Zend_Form
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add the submit button
|
// Add the submit button
|
||||||
$this->addElement('button', 'cancel', array(
|
$this->addElement('button', 'cancel', array(
|
||||||
'ignore' => true,
|
'ignore' => true,
|
||||||
'class' => 'ui-button ui-state-default ui-button-text-only md-cancel',
|
'class' => 'ui-button ui-state-default ui-button-text-only md-cancel',
|
||||||
|
|
|
@ -9,8 +9,8 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
||||||
$this->isSaas = $isSaas;
|
$this->isSaas = $isSaas;
|
||||||
|
|
||||||
$this->setDecorators(array(
|
$this->setDecorators(array(
|
||||||
array('ViewScript', array('viewScript' => 'form/preferences_email_server.phtml', "isSaas" => $isSaas))
|
array('ViewScript', array('viewScript' => 'form/preferences_email_server.phtml', "isSaas" => $isSaas))
|
||||||
));
|
));
|
||||||
|
@ -24,7 +24,7 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
|
||||||
'ViewHelper'
|
'ViewHelper'
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->addElement('text', 'systemEmail', array(
|
$this->addElement('text', 'systemEmail', array(
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
'label' => 'Reset Password \'From\' Email',
|
'label' => 'Reset Password \'From\' Email',
|
||||||
|
@ -32,7 +32,7 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
|
||||||
'readonly' => true,
|
'readonly' => true,
|
||||||
'decorators' => array('viewHelper')
|
'decorators' => array('viewHelper')
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->addElement('checkbox', 'configureMailServer', array(
|
$this->addElement('checkbox', 'configureMailServer', array(
|
||||||
'label' => 'Configure Mail Server',
|
'label' => 'Configure Mail Server',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
|
@ -41,7 +41,7 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
|
||||||
'viewHelper'
|
'viewHelper'
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->addElement('text', 'mailServer', array(
|
$this->addElement('text', 'mailServer', array(
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
'label' => 'Mail Server',
|
'label' => 'Mail Server',
|
||||||
|
@ -53,7 +53,7 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
|
||||||
new ConditionalNotEmpty(array('configureMailServer'=>'1'))
|
new ConditionalNotEmpty(array('configureMailServer'=>'1'))
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->addElement('text', 'email', array(
|
$this->addElement('text', 'email', array(
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
'label' => 'Email Address',
|
'label' => 'Email Address',
|
||||||
|
@ -65,7 +65,7 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
|
||||||
new ConditionalNotEmpty(array('configureMailServer'=>'1'))
|
new ConditionalNotEmpty(array('configureMailServer'=>'1'))
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->addElement('password', 'ms_password', array(
|
$this->addElement('password', 'ms_password', array(
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
'label' => 'Password',
|
'label' => 'Password',
|
||||||
|
@ -78,7 +78,7 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
|
||||||
),
|
),
|
||||||
'renderPassword' => true
|
'renderPassword' => true
|
||||||
));
|
));
|
||||||
|
|
||||||
$port = new Zend_Form_Element_Text('port');
|
$port = new Zend_Form_Element_Text('port');
|
||||||
$port->class = 'input_text';
|
$port->class = 'input_text';
|
||||||
$port->setRequired(false)
|
$port->setRequired(false)
|
||||||
|
@ -86,7 +86,7 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
|
||||||
->setLabel('Port')
|
->setLabel('Port')
|
||||||
->setAttrib('readonly', true)
|
->setAttrib('readonly', true)
|
||||||
->setDecorators(array('viewHelper'));
|
->setDecorators(array('viewHelper'));
|
||||||
|
|
||||||
$this->addElement($port);
|
$this->addElement($port);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
class Application_Form_GeneralPreferences extends Zend_Form_SubForm
|
class Application_Form_GeneralPreferences extends Zend_Form_SubForm
|
||||||
{
|
{
|
||||||
private $isSaas;
|
private $isSaas;
|
||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
||||||
$this->isSaas = $isSaas;
|
$this->isSaas = $isSaas;
|
||||||
|
|
||||||
$this->setDecorators(array(
|
$this->setDecorators(array(
|
||||||
array('ViewScript', array('viewScript' => 'form/preferences_general.phtml', "isSaas" => $isSaas))
|
array('ViewScript', array('viewScript' => 'form/preferences_general.phtml', "isSaas" => $isSaas))
|
||||||
));
|
));
|
||||||
|
@ -24,7 +24,7 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
|
||||||
'label' => 'Station Name',
|
'label' => 'Station Name',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'filters' => array('StringTrim'),
|
'filters' => array('StringTrim'),
|
||||||
'value' => Application_Model_Preference::GetValue("station_name"),
|
'value' => Application_Model_Preference::getValue("station_name"),
|
||||||
'decorators' => array(
|
'decorators' => array(
|
||||||
'ViewHelper'
|
'ViewHelper'
|
||||||
)
|
)
|
||||||
|
@ -98,16 +98,16 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
|
||||||
|
|
||||||
|
|
||||||
private function getWeekStartDays() {
|
private function getWeekStartDays() {
|
||||||
$days = array(
|
$days = array(
|
||||||
'Sunday',
|
'Sunday',
|
||||||
'Monday',
|
'Monday',
|
||||||
'Tuesday',
|
'Tuesday',
|
||||||
'Wednesday',
|
'Wednesday',
|
||||||
'Thursday',
|
'Thursday',
|
||||||
'Friday',
|
'Friday',
|
||||||
'Saturday'
|
'Saturday'
|
||||||
);
|
);
|
||||||
return $days;
|
return $days;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,33 +2,33 @@
|
||||||
|
|
||||||
class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
||||||
{
|
{
|
||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
$isDemo = isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1;
|
$isDemo = isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1;
|
||||||
$isStreamConfigable = Application_Model_Preference::GetEnableStreamConf() == "true";
|
$isStreamConfigable = Application_Model_Preference::GetEnableStreamConf() == "true";
|
||||||
|
|
||||||
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
||||||
$defaultFade = Application_Model_Preference::GetDefaultTransitionFade();
|
$defaultFade = Application_Model_Preference::GetDefaultTransitionFade();
|
||||||
if($defaultFade == ""){
|
if($defaultFade == ""){
|
||||||
$defaultFade = '00.000000';
|
$defaultFade = '00.000000';
|
||||||
}
|
}
|
||||||
|
|
||||||
// automatic trasition on source disconnection
|
// automatic trasition on source disconnection
|
||||||
$auto_transition = new Zend_Form_Element_Checkbox("auto_transition");
|
$auto_transition = new Zend_Form_Element_Checkbox("auto_transition");
|
||||||
$auto_transition->setLabel("Auto Switch Off")
|
$auto_transition->setLabel("Auto Switch Off")
|
||||||
->setValue(Application_Model_Preference::GetAutoTransition())
|
->setValue(Application_Model_Preference::GetAutoTransition())
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($auto_transition);
|
$this->addElement($auto_transition);
|
||||||
|
|
||||||
// automatic switch on upon source connection
|
// automatic switch on upon source connection
|
||||||
$auto_switch = new Zend_Form_Element_Checkbox("auto_switch");
|
$auto_switch = new Zend_Form_Element_Checkbox("auto_switch");
|
||||||
$auto_switch->setLabel("Auto Switch On")
|
$auto_switch->setLabel("Auto Switch On")
|
||||||
->setValue(Application_Model_Preference::GetAutoSwitch())
|
->setValue(Application_Model_Preference::GetAutoSwitch())
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($auto_switch);
|
$this->addElement($auto_switch);
|
||||||
|
|
||||||
// Default transition fade
|
// Default transition fade
|
||||||
$transition_fade = new Zend_Form_Element_Text("transition_fade");
|
$transition_fade = new Zend_Form_Element_Text("transition_fade");
|
||||||
$transition_fade->setLabel("Switch Transition Fade (s)")
|
$transition_fade->setLabel("Switch Transition Fade (s)")
|
||||||
|
@ -38,7 +38,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
||||||
->setValue($defaultFade)
|
->setValue($defaultFade)
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($transition_fade);
|
$this->addElement($transition_fade);
|
||||||
|
|
||||||
//Master username
|
//Master username
|
||||||
$master_username = new Zend_Form_Element_Text('master_username');
|
$master_username = new Zend_Form_Element_Text('master_username');
|
||||||
$master_username->setAttrib('autocomplete', 'off')
|
$master_username->setAttrib('autocomplete', 'off')
|
||||||
|
@ -48,7 +48,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
||||||
->setValue(Application_Model_Preference::GetLiveSteamMasterUsername())
|
->setValue(Application_Model_Preference::GetLiveSteamMasterUsername())
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($master_username);
|
$this->addElement($master_username);
|
||||||
|
|
||||||
//Master password
|
//Master password
|
||||||
if($isDemo){
|
if($isDemo){
|
||||||
$master_password = new Zend_Form_Element_Text('master_password');
|
$master_password = new Zend_Form_Element_Text('master_password');
|
||||||
|
@ -64,7 +64,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
||||||
->setFilters(array('StringTrim'))
|
->setFilters(array('StringTrim'))
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($master_password);
|
$this->addElement($master_password);
|
||||||
|
|
||||||
//Master source connection url
|
//Master source connection url
|
||||||
$master_dj_connection_url = new Zend_Form_Element_Text('master_dj_connection_url');
|
$master_dj_connection_url = new Zend_Form_Element_Text('master_dj_connection_url');
|
||||||
$master_dj_connection_url->setAttrib('readonly', true)
|
$master_dj_connection_url->setAttrib('readonly', true)
|
||||||
|
@ -72,7 +72,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
||||||
->setValue(Application_Model_Preference::GetMasterDJSourceConnectionURL())
|
->setValue(Application_Model_Preference::GetMasterDJSourceConnectionURL())
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($master_dj_connection_url);
|
$this->addElement($master_dj_connection_url);
|
||||||
|
|
||||||
//Show source connection url
|
//Show source connection url
|
||||||
$live_dj_connection_url = new Zend_Form_Element_Text('live_dj_connection_url');
|
$live_dj_connection_url = new Zend_Form_Element_Text('live_dj_connection_url');
|
||||||
$live_dj_connection_url->setAttrib('readonly', true)
|
$live_dj_connection_url->setAttrib('readonly', true)
|
||||||
|
@ -80,10 +80,10 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
||||||
->setValue(Application_Model_Preference::GetLiveDJSourceConnectionURL())
|
->setValue(Application_Model_Preference::GetLiveDJSourceConnectionURL())
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($live_dj_connection_url);
|
$this->addElement($live_dj_connection_url);
|
||||||
|
|
||||||
//liquidsoap harbor.input port
|
//liquidsoap harbor.input port
|
||||||
if (!$isSaas) {
|
if (!$isSaas) {
|
||||||
$m_port = Application_Model_StreamSetting::GetMasterLiveSteamPort();
|
$m_port = Application_Model_StreamSetting::getMasterLiveStreamPort();
|
||||||
$master_dj_port = new Zend_Form_Element_Text('master_harbor_input_port');
|
$master_dj_port = new Zend_Form_Element_Text('master_harbor_input_port');
|
||||||
$master_dj_port->setLabel("Master Source Port")
|
$master_dj_port->setLabel("Master Source Port")
|
||||||
->setValue($m_port)
|
->setValue($m_port)
|
||||||
|
@ -91,8 +91,8 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
||||||
->addValidator('regex', false, array('pattern'=>'/^[0-9]+$/', 'messages'=>array('regexNotMatch'=>'Only numbers are allowed.')))
|
->addValidator('regex', false, array('pattern'=>'/^[0-9]+$/', 'messages'=>array('regexNotMatch'=>'Only numbers are allowed.')))
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($master_dj_port);
|
$this->addElement($master_dj_port);
|
||||||
|
|
||||||
$m_mount = Application_Model_StreamSetting::GetMasterLiveSteamMountPoint();
|
$m_mount = Application_Model_StreamSetting::getMasterLiveStreamMountPoint();
|
||||||
$master_dj_mount = new Zend_Form_Element_Text('master_harbor_input_mount_point');
|
$master_dj_mount = new Zend_Form_Element_Text('master_harbor_input_mount_point');
|
||||||
$master_dj_mount->setLabel("Master Source Mount Point")
|
$master_dj_mount->setLabel("Master Source Mount Point")
|
||||||
->setValue($m_mount)
|
->setValue($m_mount)
|
||||||
|
@ -100,9 +100,9 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
||||||
array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered'))))
|
array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered'))))
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($master_dj_mount);
|
$this->addElement($master_dj_mount);
|
||||||
|
|
||||||
//liquidsoap harbor.input port
|
//liquidsoap harbor.input port
|
||||||
$l_port = Application_Model_StreamSetting::GetDJLiveSteamPort();
|
$l_port = Application_Model_StreamSetting::getDjLiveStreamPort();
|
||||||
$live_dj_port = new Zend_Form_Element_Text('dj_harbor_input_port');
|
$live_dj_port = new Zend_Form_Element_Text('dj_harbor_input_port');
|
||||||
$live_dj_port->setLabel("Show Source Port")
|
$live_dj_port->setLabel("Show Source Port")
|
||||||
->setValue($l_port)
|
->setValue($l_port)
|
||||||
|
@ -110,8 +110,8 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
||||||
->addValidator('regex', false, array('pattern'=>'/^[0-9]+$/', 'messages'=>array('regexNotMatch'=>'Only numbers are allowed.')))
|
->addValidator('regex', false, array('pattern'=>'/^[0-9]+$/', 'messages'=>array('regexNotMatch'=>'Only numbers are allowed.')))
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($live_dj_port);
|
$this->addElement($live_dj_port);
|
||||||
|
|
||||||
$l_mount = Application_Model_StreamSetting::GetDJLiveSteamMountPoint();
|
$l_mount = Application_Model_StreamSetting::getDjLiveStreamMountPoint();
|
||||||
$live_dj_mount = new Zend_Form_Element_Text('dj_harbor_input_mount_point');
|
$live_dj_mount = new Zend_Form_Element_Text('dj_harbor_input_mount_point');
|
||||||
$live_dj_mount->setLabel("Show Source Mount Point")
|
$live_dj_mount->setLabel("Show Source Mount Point")
|
||||||
->setValue($l_mount)
|
->setValue($l_mount)
|
||||||
|
@ -132,34 +132,34 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateVariables(){
|
public function updateVariables(){
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
|
||||||
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
||||||
$isDemo = isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1;
|
$isDemo = isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1;
|
||||||
$master_dj_connection_url = Application_Model_Preference::GetMasterDJSourceConnectionURL();
|
$master_dj_connection_url = Application_Model_Preference::GetMasterDJSourceConnectionURL();
|
||||||
$live_dj_connection_url = Application_Model_Preference::GetLiveDJSourceConnectionURL();
|
$live_dj_connection_url = Application_Model_Preference::GetLiveDJSourceConnectionURL();
|
||||||
|
|
||||||
$this->setDecorators(array(
|
$this->setDecorators(array(
|
||||||
array('ViewScript', array('viewScript' => 'form/preferences_livestream.phtml', 'master_dj_connection_url'=>$master_dj_connection_url, 'live_dj_connection_url'=>$live_dj_connection_url, 'isSaas' => $isSaas, 'isDemo' => $isDemo))
|
array('ViewScript', array('viewScript' => 'form/preferences_livestream.phtml', 'master_dj_connection_url'=>$master_dj_connection_url, 'live_dj_connection_url'=>$live_dj_connection_url, 'isSaas' => $isSaas, 'isDemo' => $isDemo))
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isValid($data){
|
public function isValid($data){
|
||||||
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
||||||
$isValid = parent::isValid($data);
|
$isValid = parent::isValid($data);
|
||||||
if (!$isSaas) {
|
if (!$isSaas) {
|
||||||
$master_harbor_input_port = $data['master_harbor_input_port'];
|
$master_harbor_input_port = $data['master_harbor_input_port'];
|
||||||
$dj_harbor_input_port = $data['dj_harbor_input_port'];
|
$dj_harbor_input_port = $data['dj_harbor_input_port'];
|
||||||
|
|
||||||
if($master_harbor_input_port == $dj_harbor_input_port && $master_harbor_input_port != ""){
|
if($master_harbor_input_port == $dj_harbor_input_port && $master_harbor_input_port != ""){
|
||||||
$element = $this->getElement("dj_harbor_input_port");
|
$element = $this->getElement("dj_harbor_input_port");
|
||||||
$element->addError("You cannot use same port as Master DJ port.");
|
$element->addError("You cannot use same port as Master DJ port.");
|
||||||
}
|
}
|
||||||
if($master_harbor_input_port != ""){
|
if($master_harbor_input_port != ""){
|
||||||
if(is_numeric($master_harbor_input_port)){
|
if(is_numeric($master_harbor_input_port)){
|
||||||
if($master_harbor_input_port != Application_Model_StreamSetting::GetMasterLiveSteamPort()){
|
if($master_harbor_input_port != Application_Model_StreamSetting::getMasterLiveStreamPort()){
|
||||||
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
|
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
|
||||||
$res = socket_bind($sock, 0, $master_harbor_input_port);
|
$res = socket_bind($sock, 0, $master_harbor_input_port);
|
||||||
if(!$res){
|
if(!$res){
|
||||||
|
@ -175,7 +175,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
||||||
}
|
}
|
||||||
if($dj_harbor_input_port != ""){
|
if($dj_harbor_input_port != ""){
|
||||||
if(is_numeric($dj_harbor_input_port)){
|
if(is_numeric($dj_harbor_input_port)){
|
||||||
if($dj_harbor_input_port != Application_Model_StreamSetting::GetDJLiveSteamPort()){
|
if($dj_harbor_input_port != Application_Model_StreamSetting::getDjLiveStreamPort()){
|
||||||
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
|
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
|
||||||
$res = socket_bind($sock, 0, $dj_harbor_input_port);
|
$res = socket_bind($sock, 0, $dj_harbor_input_port);
|
||||||
if(!$res){
|
if(!$res){
|
||||||
|
@ -192,5 +192,5 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
||||||
}
|
}
|
||||||
return $isValid;
|
return $isValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,17 +4,17 @@ class Application_Form_Login extends Zend_Form
|
||||||
{
|
{
|
||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
|
||||||
// Set the method for the display form to POST
|
// Set the method for the display form to POST
|
||||||
$this->setMethod('post');
|
$this->setMethod('post');
|
||||||
|
|
||||||
$this->setDecorators(array(
|
$this->setDecorators(array(
|
||||||
array('ViewScript', array('viewScript' => 'form/login.phtml'))
|
array('ViewScript', array('viewScript' => 'form/login.phtml'))
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add username element
|
// Add username element
|
||||||
$this->addElement('text', 'username', array(
|
$this->addElement('text', 'username', array(
|
||||||
'label' => 'Username:',
|
'label' => 'Username:',
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
|
@ -28,8 +28,8 @@ class Application_Form_Login extends Zend_Form
|
||||||
'ViewHelper'
|
'ViewHelper'
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add password element
|
// Add password element
|
||||||
$this->addElement('password', 'password', array(
|
$this->addElement('password', 'password', array(
|
||||||
'label' => 'Password:',
|
'label' => 'Password:',
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
|
@ -43,7 +43,7 @@ class Application_Form_Login extends Zend_Form
|
||||||
'ViewHelper'
|
'ViewHelper'
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
$recaptchaNeeded = false;
|
$recaptchaNeeded = false;
|
||||||
if(Application_Model_LoginAttempts::getAttempts($_SERVER['REMOTE_ADDR']) >= 3){
|
if(Application_Model_LoginAttempts::getAttempts($_SERVER['REMOTE_ADDR']) >= 3){
|
||||||
$recaptchaNeeded = true;
|
$recaptchaNeeded = true;
|
||||||
|
@ -52,8 +52,8 @@ class Application_Form_Login extends Zend_Form
|
||||||
// recaptcha
|
// recaptcha
|
||||||
$this->addRecaptcha();
|
$this->addRecaptcha();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the submit button
|
// Add the submit button
|
||||||
$this->addElement('submit', 'submit', array(
|
$this->addElement('submit', 'submit', array(
|
||||||
'ignore' => true,
|
'ignore' => true,
|
||||||
'label' => 'Login',
|
'label' => 'Login',
|
||||||
|
@ -64,13 +64,13 @@ class Application_Form_Login extends Zend_Form
|
||||||
));
|
));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRecaptcha(){
|
public function addRecaptcha(){
|
||||||
$pubKey = '6Ld4JsISAAAAAIxUKT4IjjOGi3DHqdoH2zk6WkYG';
|
$pubKey = '6Ld4JsISAAAAAIxUKT4IjjOGi3DHqdoH2zk6WkYG';
|
||||||
$privKey = '6Ld4JsISAAAAAJynYlXdrE4hfTReTSxYFe5szdyv';
|
$privKey = '6Ld4JsISAAAAAJynYlXdrE4hfTReTSxYFe5szdyv';
|
||||||
|
|
||||||
$recaptcha = new Zend_Service_ReCaptcha($pubKey, $privKey);
|
$recaptcha = new Zend_Service_ReCaptcha($pubKey, $privKey);
|
||||||
|
|
||||||
$captcha = new Zend_Form_Element_Captcha('captcha',
|
$captcha = new Zend_Form_Element_Captcha('captcha',
|
||||||
array(
|
array(
|
||||||
'label' => 'Type the characters you see in the picture below.',
|
'label' => 'Type the characters you see in the picture below.',
|
||||||
|
|
|
@ -9,7 +9,7 @@ class Application_Form_PasswordChange extends Zend_Form
|
||||||
$this->setDecorators(array(
|
$this->setDecorators(array(
|
||||||
array('ViewScript', array('viewScript' => 'form/password-change.phtml'))
|
array('ViewScript', array('viewScript' => 'form/password-change.phtml'))
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->addElement('password', 'password', array(
|
$this->addElement('password', 'password', array(
|
||||||
'label' => 'Password',
|
'label' => 'Password',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
|
|
|
@ -9,7 +9,7 @@ class Application_Form_PasswordRestore extends Zend_Form
|
||||||
$this->setDecorators(array(
|
$this->setDecorators(array(
|
||||||
array('ViewScript', array('viewScript' => 'form/password-restore.phtml'))
|
array('ViewScript', array('viewScript' => 'form/password-restore.phtml'))
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->addElement('text', 'email', array(
|
$this->addElement('text', 'email', array(
|
||||||
'label' => 'E-mail',
|
'label' => 'E-mail',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
|
@ -29,7 +29,7 @@ class Application_Form_PasswordRestore extends Zend_Form
|
||||||
'ViewHelper'
|
'ViewHelper'
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
$cancel = new Zend_Form_Element_Button("cancel");
|
$cancel = new Zend_Form_Element_Button("cancel");
|
||||||
$cancel->class = 'ui-button ui-widget ui-state-default ui-button-text-only center';
|
$cancel->class = 'ui-button ui-widget ui-state-default ui-button-text-only center';
|
||||||
$cancel->setLabel("Cancel")
|
$cancel->setLabel("Cancel")
|
||||||
|
|
|
@ -8,22 +8,22 @@ class Application_Form_Preferences extends Zend_Form
|
||||||
{
|
{
|
||||||
$this->setAction('/Preference');
|
$this->setAction('/Preference');
|
||||||
$this->setMethod('post');
|
$this->setMethod('post');
|
||||||
|
|
||||||
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
||||||
$this->isSaas = $isSaas;
|
$this->isSaas = $isSaas;
|
||||||
|
|
||||||
$this->setDecorators(array(
|
$this->setDecorators(array(
|
||||||
array('ViewScript', array('viewScript' => 'form/preferences.phtml', "isSaas" => $this->isSaas))
|
array('ViewScript', array('viewScript' => 'form/preferences.phtml', "isSaas" => $this->isSaas))
|
||||||
));
|
));
|
||||||
|
|
||||||
$general_pref = new Application_Form_GeneralPreferences();
|
$general_pref = new Application_Form_GeneralPreferences();
|
||||||
$this->addSubForm($general_pref, 'preferences_general');
|
$this->addSubForm($general_pref, 'preferences_general');
|
||||||
|
|
||||||
if (!$isSaas) {
|
if (!$isSaas) {
|
||||||
$email_pref = new Application_Form_EmailServerPreferences();
|
$email_pref = new Application_Form_EmailServerPreferences();
|
||||||
$this->addSubForm($email_pref, 'preferences_email_server');
|
$this->addSubForm($email_pref, 'preferences_email_server');
|
||||||
}
|
}
|
||||||
|
|
||||||
$soundcloud_pref = new Application_Form_SoundcloudPreferences();
|
$soundcloud_pref = new Application_Form_SoundcloudPreferences();
|
||||||
$this->addSubForm($soundcloud_pref, 'preferences_soundcloud');
|
$this->addSubForm($soundcloud_pref, 'preferences_soundcloud');
|
||||||
|
|
||||||
|
|
|
@ -9,19 +9,19 @@ class Application_Form_RegisterAirtime extends Zend_Form
|
||||||
{
|
{
|
||||||
$this->setAction('/Showbuilder');
|
$this->setAction('/Showbuilder');
|
||||||
$this->setMethod('post');
|
$this->setMethod('post');
|
||||||
|
|
||||||
$country_list = Application_Model_Preference::GetCountryList();
|
$country_list = Application_Model_Preference::GetCountryList();
|
||||||
|
|
||||||
$privacyChecked = false;
|
$privacyChecked = false;
|
||||||
if(Application_Model_Preference::GetPrivacyPolicyCheck() == 1){
|
if(Application_Model_Preference::GetPrivacyPolicyCheck() == 1){
|
||||||
$privacyChecked = true;
|
$privacyChecked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setDecorators(array(
|
$this->setDecorators(array(
|
||||||
array('ViewScript', array('viewScript' => 'form/register-dialog.phtml', 'privacyChecked'=>$privacyChecked)),
|
array('ViewScript', array('viewScript' => 'form/register-dialog.phtml', 'privacyChecked'=>$privacyChecked)),
|
||||||
array('File', array('viewScript' => 'form/register-dialog.phtml', 'placement' => false)))
|
array('File', array('viewScript' => 'form/register-dialog.phtml', 'placement' => false)))
|
||||||
);
|
);
|
||||||
|
|
||||||
// Station Name
|
// Station Name
|
||||||
$stnName = new Zend_Form_Element_Text("stnName");
|
$stnName = new Zend_Form_Element_Text("stnName");
|
||||||
$stnName->setLabel("Station Name")
|
$stnName->setLabel("Station Name")
|
||||||
|
@ -29,7 +29,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
|
||||||
->setValue(Application_Model_Preference::GetStationName())
|
->setValue(Application_Model_Preference::GetStationName())
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($stnName);
|
$this->addElement($stnName);
|
||||||
|
|
||||||
// Phone number
|
// Phone number
|
||||||
$this->addElement('text', 'Phone', array(
|
$this->addElement('text', 'Phone', array(
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
|
@ -63,20 +63,20 @@ class Application_Form_RegisterAirtime extends Zend_Form
|
||||||
'decorators' => array(
|
'decorators' => array(
|
||||||
'ViewHelper'
|
'ViewHelper'
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
// county list dropdown
|
// county list dropdown
|
||||||
$this->addElement('select', 'Country', array(
|
$this->addElement('select', 'Country', array(
|
||||||
'label' => 'Country:',
|
'label' => 'Country:',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'value' => Application_Model_Preference::GetStationCountry(),
|
'value' => Application_Model_Preference::GetStationCountry(),
|
||||||
'multiOptions' => $country_list,
|
'multiOptions' => $country_list,
|
||||||
'decorators' => array(
|
'decorators' => array(
|
||||||
'ViewHelper'
|
'ViewHelper'
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
// Station city
|
// Station city
|
||||||
$this->addElement('text', 'City', array(
|
$this->addElement('text', 'City', array(
|
||||||
'label' => 'City:',
|
'label' => 'City:',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
|
@ -85,29 +85,29 @@ class Application_Form_RegisterAirtime extends Zend_Form
|
||||||
'decorators' => array(
|
'decorators' => array(
|
||||||
'ViewHelper'
|
'ViewHelper'
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
// Station Description
|
// Station Description
|
||||||
$description = new Zend_Form_Element_Textarea('Description');
|
$description = new Zend_Form_Element_Textarea('Description');
|
||||||
$description->class = 'input_text_area';
|
$description->class = 'input_text_area';
|
||||||
$description->setLabel('Station Description:')
|
$description->setLabel('Station Description:')
|
||||||
->setRequired(false)
|
->setRequired(false)
|
||||||
->setValue(Application_Model_Preference::GetStationDescription())
|
->setValue(Application_Model_Preference::GetStationDescription())
|
||||||
->setDecorators(array('ViewHelper'))
|
->setDecorators(array('ViewHelper'))
|
||||||
->setAttrib('ROWS','2')
|
->setAttrib('ROWS','2')
|
||||||
->setAttrib('COLS','58');
|
->setAttrib('COLS','58');
|
||||||
$this->addElement($description);
|
$this->addElement($description);
|
||||||
|
|
||||||
// Station Logo
|
// Station Logo
|
||||||
$upload = new Zend_Form_Element_File('Logo');
|
$upload = new Zend_Form_Element_File('Logo');
|
||||||
$upload->setLabel('Station Logo:')
|
$upload->setLabel('Station Logo:')
|
||||||
->setRequired(false)
|
->setRequired(false)
|
||||||
->setDecorators(array('File'))
|
->setDecorators(array('File'))
|
||||||
->addValidator('Count', false, 1)
|
->addValidator('Count', false, 1)
|
||||||
->addValidator('Extension', false, 'jpg,jpeg,png,gif')
|
->addValidator('Extension', false, 'jpg,jpeg,png,gif')
|
||||||
->addFilter('ImageSize');
|
->addFilter('ImageSize');
|
||||||
$this->addElement($upload);
|
$this->addElement($upload);
|
||||||
|
|
||||||
//enable support feedback
|
//enable support feedback
|
||||||
$this->addElement('checkbox', 'SupportFeedback', array(
|
$this->addElement('checkbox', 'SupportFeedback', array(
|
||||||
'label' => 'Send support feedback',
|
'label' => 'Send support feedback',
|
||||||
|
@ -116,37 +116,37 @@ class Application_Form_RegisterAirtime extends Zend_Form
|
||||||
'decorators' => array(
|
'decorators' => array(
|
||||||
'ViewHelper'
|
'ViewHelper'
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
// checkbox for publicise
|
// checkbox for publicise
|
||||||
$checkboxPublicise = new Zend_Form_Element_Checkbox("Publicise");
|
$checkboxPublicise = new Zend_Form_Element_Checkbox("Publicise");
|
||||||
$checkboxPublicise->setLabel('Promote my station on Sourcefabric.org')
|
$checkboxPublicise->setLabel('Promote my station on Sourcefabric.org')
|
||||||
->setRequired(false)
|
->setRequired(false)
|
||||||
->setDecorators(array('ViewHelper'))
|
->setDecorators(array('ViewHelper'))
|
||||||
->setValue(Application_Model_Preference::GetPublicise());
|
->setValue(Application_Model_Preference::GetPublicise());
|
||||||
$this->addElement($checkboxPublicise);
|
$this->addElement($checkboxPublicise);
|
||||||
|
|
||||||
// text area for sending detail
|
// text area for sending detail
|
||||||
$this->addElement('textarea', 'SendInfo', array(
|
$this->addElement('textarea', 'SendInfo', array(
|
||||||
'class' => 'sending_textarea',
|
'class' => 'sending_textarea',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'filters' => array('StringTrim'),
|
'filters' => array('StringTrim'),
|
||||||
'readonly' => true,
|
'readonly' => true,
|
||||||
'rows' => 5,
|
'rows' => 5,
|
||||||
'cols' => 61,
|
'cols' => 61,
|
||||||
'value' => Application_Model_Preference::GetSystemInfo(false, true),
|
'value' => Application_Model_Preference::GetSystemInfo(false, true),
|
||||||
'decorators' => array(
|
'decorators' => array(
|
||||||
'ViewHelper'
|
'ViewHelper'
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
// checkbox for privacy policy
|
// checkbox for privacy policy
|
||||||
$checkboxPrivacy = new Zend_Form_Element_Checkbox("Privacy");
|
$checkboxPrivacy = new Zend_Form_Element_Checkbox("Privacy");
|
||||||
$checkboxPrivacy->setLabel("By checking this box, I agree to Sourcefabric's <a id=\"link_to_privacy\" href=\"http://www.sourcefabric.org/en/about/policy/\" onclick=\"window.open(this.href); return false;\">privacy policy</a>.")
|
$checkboxPrivacy->setLabel("By checking this box, I agree to Sourcefabric's <a id=\"link_to_privacy\" href=\"http://www.sourcefabric.org/en/about/policy/\" onclick=\"window.open(this.href); return false;\">privacy policy</a>.")
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($checkboxPrivacy);
|
$this->addElement($checkboxPrivacy);
|
||||||
}
|
}
|
||||||
|
|
||||||
// overriding isValid function
|
// overriding isValid function
|
||||||
public function isValid ($data)
|
public function isValid ($data)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,7 +5,7 @@ class Application_Form_ShowBuilder extends Zend_Form_SubForm
|
||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
$user = Application_Model_User::GetCurrentUser();
|
$user = Application_Model_User::getCurrentUser();
|
||||||
|
|
||||||
$this->setDecorators(array(
|
$this->setDecorators(array(
|
||||||
array('ViewScript', array('viewScript' => 'form/showbuilder.phtml'))
|
array('ViewScript', array('viewScript' => 'form/showbuilder.phtml'))
|
||||||
|
|
|
@ -30,7 +30,7 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
|
||||||
'ViewHelper'
|
'ViewHelper'
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
//enable downloadable for soundcloud
|
//enable downloadable for soundcloud
|
||||||
$this->addElement('checkbox', 'SoundCloudDownloadbleOption', array(
|
$this->addElement('checkbox', 'SoundCloudDownloadbleOption', array(
|
||||||
'label' => 'Automatically Mark Files "Downloadable" on SoundCloud',
|
'label' => 'Automatically Mark Files "Downloadable" on SoundCloud',
|
||||||
|
@ -51,7 +51,7 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
|
||||||
'decorators' => array(
|
'decorators' => array(
|
||||||
'ViewHelper'
|
'ViewHelper'
|
||||||
),
|
),
|
||||||
|
|
||||||
// By default, 'allowEmpty' is true. This means that our custom
|
// By default, 'allowEmpty' is true. This means that our custom
|
||||||
// validators are going to be skipped if this field is empty,
|
// validators are going to be skipped if this field is empty,
|
||||||
// which is something we don't want
|
// which is something we don't want
|
||||||
|
@ -71,7 +71,7 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
|
||||||
'decorators' => array(
|
'decorators' => array(
|
||||||
'ViewHelper'
|
'ViewHelper'
|
||||||
),
|
),
|
||||||
|
|
||||||
// By default, 'allowEmpty' is true. This means that our custom
|
// By default, 'allowEmpty' is true. This means that our custom
|
||||||
// validators are going to be skipped if this field is empty,
|
// validators are going to be skipped if this field is empty,
|
||||||
// which is something we don't want
|
// which is something we don't want
|
||||||
|
@ -79,7 +79,7 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
|
||||||
'validators' => array(
|
'validators' => array(
|
||||||
new ConditionalNotEmpty(array('UploadToSoundcloudOption'=>'1'))
|
new ConditionalNotEmpty(array('UploadToSoundcloudOption'=>'1'))
|
||||||
),
|
),
|
||||||
'renderPassword' => true
|
'renderPassword' => true
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add the description element
|
// Add the description element
|
||||||
|
@ -91,7 +91,7 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
|
||||||
'decorators' => array(
|
'decorators' => array(
|
||||||
'ViewHelper'
|
'ViewHelper'
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
//SoundCloud default genre
|
//SoundCloud default genre
|
||||||
$this->addElement('text', 'SoundCloudGenre', array(
|
$this->addElement('text', 'SoundCloudGenre', array(
|
||||||
|
|
|
@ -37,7 +37,7 @@ class Application_Form_StreamSetting extends Zend_Form
|
||||||
}
|
}
|
||||||
$this->addElement($output_type);
|
$this->addElement($output_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
$icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata');
|
$icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata');
|
||||||
$icecast_vorbis_metadata->setLabel('Icecast Vorbis Metadata')
|
$icecast_vorbis_metadata->setLabel('Icecast Vorbis Metadata')
|
||||||
->setRequired(false)
|
->setRequired(false)
|
||||||
|
|
|
@ -177,9 +177,9 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
}
|
}
|
||||||
$user->setAttrib('alt', 'regular_text');
|
$user->setAttrib('alt', 'regular_text');
|
||||||
$this->addElement($user);
|
$this->addElement($user);
|
||||||
|
|
||||||
$liquidsopa_error_msg = '<div class="stream-status status-info"><h3>Getting information from the server...</h3></div>';
|
$liquidsopa_error_msg = '<div class="stream-status status-info"><h3>Getting information from the server...</h3></div>';
|
||||||
|
|
||||||
$this->setDecorators(array(
|
$this->setDecorators(array(
|
||||||
array('ViewScript', array('viewScript' => 'form/stream-setting-form.phtml', "stream_number"=>$stream_number, "enabled"=>$enable->getValue(), "liquidsoap_error_msg"=>$liquidsopa_error_msg))
|
array('ViewScript', array('viewScript' => 'form/stream-setting-form.phtml', "stream_number"=>$stream_number, "enabled"=>$enable->getValue(), "liquidsoap_error_msg"=>$liquidsopa_error_msg))
|
||||||
));
|
));
|
||||||
|
|
|
@ -5,18 +5,18 @@ require_once 'customfilters/ImageSize.php';
|
||||||
class Application_Form_SupportSettings extends Zend_Form
|
class Application_Form_SupportSettings extends Zend_Form
|
||||||
{
|
{
|
||||||
private $isSass;
|
private $isSass;
|
||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
$country_list = Application_Model_Preference::GetCountryList();
|
$country_list = Application_Model_Preference::GetCountryList();
|
||||||
$isSass = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
$isSass = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
||||||
$this->isSass = $isSass;
|
$this->isSass = $isSass;
|
||||||
|
|
||||||
$this->setDecorators(array(
|
$this->setDecorators(array(
|
||||||
array('ViewScript', array('viewScript' => 'form/support-setting.phtml', "isSaas" => $isSass)),
|
array('ViewScript', array('viewScript' => 'form/support-setting.phtml', "isSaas" => $isSass)),
|
||||||
array('File', array('viewScript' => 'form/support-setting.phtml', 'placement' => false)))
|
array('File', array('viewScript' => 'form/support-setting.phtml', 'placement' => false)))
|
||||||
);
|
);
|
||||||
|
|
||||||
//Station name
|
//Station name
|
||||||
$this->addElement('text', 'stationName', array(
|
$this->addElement('text', 'stationName', array(
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
|
@ -24,7 +24,7 @@ class Application_Form_SupportSettings extends Zend_Form
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'filters' => array('StringTrim'),
|
'filters' => array('StringTrim'),
|
||||||
'validator' => array('NotEmpty'),
|
'validator' => array('NotEmpty'),
|
||||||
'value' => Application_Model_Preference::GetValue("station_name"),
|
'value' => Application_Model_Preference::getValue("station_name"),
|
||||||
'decorators' => array(
|
'decorators' => array(
|
||||||
'ViewHelper'
|
'ViewHelper'
|
||||||
)
|
)
|
||||||
|
@ -63,20 +63,20 @@ class Application_Form_SupportSettings extends Zend_Form
|
||||||
'decorators' => array(
|
'decorators' => array(
|
||||||
'ViewHelper'
|
'ViewHelper'
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
// county list dropdown
|
// county list dropdown
|
||||||
$this->addElement('select', 'Country', array(
|
$this->addElement('select', 'Country', array(
|
||||||
'label' => 'Country:',
|
'label' => 'Country:',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'value' => Application_Model_Preference::GetStationCountry(),
|
'value' => Application_Model_Preference::GetStationCountry(),
|
||||||
'multiOptions' => $country_list,
|
'multiOptions' => $country_list,
|
||||||
'decorators' => array(
|
'decorators' => array(
|
||||||
'ViewHelper'
|
'ViewHelper'
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
// Station city
|
// Station city
|
||||||
$this->addElement('text', 'City', array(
|
$this->addElement('text', 'City', array(
|
||||||
'label' => 'City:',
|
'label' => 'City:',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
|
@ -85,31 +85,31 @@ class Application_Form_SupportSettings extends Zend_Form
|
||||||
'decorators' => array(
|
'decorators' => array(
|
||||||
'ViewHelper'
|
'ViewHelper'
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
// Station Description
|
// Station Description
|
||||||
$description = new Zend_Form_Element_Textarea('Description');
|
$description = new Zend_Form_Element_Textarea('Description');
|
||||||
$description->class = 'input_text_area';
|
$description->class = 'input_text_area';
|
||||||
$description->setLabel('Station Description:')
|
$description->setLabel('Station Description:')
|
||||||
->setRequired(false)
|
->setRequired(false)
|
||||||
->setValue(Application_Model_Preference::GetStationDescription())
|
->setValue(Application_Model_Preference::GetStationDescription())
|
||||||
->setDecorators(array('ViewHelper'))
|
->setDecorators(array('ViewHelper'))
|
||||||
->setAttrib('ROWS','2')
|
->setAttrib('ROWS','2')
|
||||||
->setAttrib('COLS','58');
|
->setAttrib('COLS','58');
|
||||||
$this->addElement($description);
|
$this->addElement($description);
|
||||||
|
|
||||||
// Station Logo
|
// Station Logo
|
||||||
$upload = new Zend_Form_Element_File('Logo');
|
$upload = new Zend_Form_Element_File('Logo');
|
||||||
$upload->setLabel('Station Logo:')
|
$upload->setLabel('Station Logo:')
|
||||||
->setRequired(false)
|
->setRequired(false)
|
||||||
->setDecorators(array('File'))
|
->setDecorators(array('File'))
|
||||||
->addValidator('Count', false, 1)
|
->addValidator('Count', false, 1)
|
||||||
->addValidator('Extension', false, 'jpg,jpeg,png,gif')
|
->addValidator('Extension', false, 'jpg,jpeg,png,gif')
|
||||||
->addFilter('ImageSize');
|
->addFilter('ImageSize');
|
||||||
$upload->setAttrib('accept', 'image/*');
|
$upload->setAttrib('accept', 'image/*');
|
||||||
$this->addElement($upload);
|
$this->addElement($upload);
|
||||||
|
|
||||||
if(!$isSass){
|
if(!$isSass){
|
||||||
//enable support feedback
|
//enable support feedback
|
||||||
$this->addElement('checkbox', 'SupportFeedback', array(
|
$this->addElement('checkbox', 'SupportFeedback', array(
|
||||||
'label' => 'Send support feedback',
|
'label' => 'Send support feedback',
|
||||||
|
@ -118,9 +118,9 @@ class Application_Form_SupportSettings extends Zend_Form
|
||||||
'decorators' => array(
|
'decorators' => array(
|
||||||
'ViewHelper'
|
'ViewHelper'
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
// checkbox for publicise
|
// checkbox for publicise
|
||||||
$checkboxPublicise = new Zend_Form_Element_Checkbox("Publicise");
|
$checkboxPublicise = new Zend_Form_Element_Checkbox("Publicise");
|
||||||
$checkboxPublicise->setLabel('Promote my station on Sourcefabric.org')
|
$checkboxPublicise->setLabel('Promote my station on Sourcefabric.org')
|
||||||
->setRequired(false)
|
->setRequired(false)
|
||||||
|
@ -130,28 +130,28 @@ class Application_Form_SupportSettings extends Zend_Form
|
||||||
$checkboxPublicise->setAttrib("disabled", "disabled");
|
$checkboxPublicise->setAttrib("disabled", "disabled");
|
||||||
}
|
}
|
||||||
$this->addElement($checkboxPublicise);
|
$this->addElement($checkboxPublicise);
|
||||||
|
|
||||||
// text area for sending detail
|
// text area for sending detail
|
||||||
$this->addElement('textarea', 'SendInfo', array(
|
$this->addElement('textarea', 'SendInfo', array(
|
||||||
'class' => 'sending_textarea',
|
'class' => 'sending_textarea',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'filters' => array('StringTrim'),
|
'filters' => array('StringTrim'),
|
||||||
'readonly' => true,
|
'readonly' => true,
|
||||||
'cols' => 61,
|
'cols' => 61,
|
||||||
'rows' => 5,
|
'rows' => 5,
|
||||||
'value' => Application_Model_Preference::GetSystemInfo(false, true),
|
'value' => Application_Model_Preference::GetSystemInfo(false, true),
|
||||||
'decorators' => array(
|
'decorators' => array(
|
||||||
'ViewHelper'
|
'ViewHelper'
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
// checkbox for privacy policy
|
// checkbox for privacy policy
|
||||||
$checkboxPrivacy = new Zend_Form_Element_Checkbox("Privacy");
|
$checkboxPrivacy = new Zend_Form_Element_Checkbox("Privacy");
|
||||||
$checkboxPrivacy->setLabel("By checking this box, I agree to Sourcefabric's <a id=\"link_to_privacy\" href=\"http://www.sourcefabric.org/en/about/policy/\" onclick=\"window.open(this.href); return false;\">privacy policy</a>.")
|
$checkboxPrivacy->setLabel("By checking this box, I agree to Sourcefabric's <a id=\"link_to_privacy\" href=\"http://www.sourcefabric.org/en/about/policy/\" onclick=\"window.open(this.href); return false;\">privacy policy</a>.")
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($checkboxPrivacy);
|
$this->addElement($checkboxPrivacy);
|
||||||
}
|
}
|
||||||
|
|
||||||
// submit button
|
// submit button
|
||||||
$submit = new Zend_Form_Element_Submit("submit");
|
$submit = new Zend_Form_Element_Submit("submit");
|
||||||
$submit->class = 'ui-button ui-state-default right-floated';
|
$submit->class = 'ui-button ui-state-default right-floated';
|
||||||
|
@ -160,7 +160,7 @@ class Application_Form_SupportSettings extends Zend_Form
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($submit);
|
$this->addElement($submit);
|
||||||
}
|
}
|
||||||
|
|
||||||
// overriding isValid function
|
// overriding isValid function
|
||||||
public function isValid ($data)
|
public function isValid ($data)
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,7 +16,7 @@ class Zend_Filter_ImageSize implements Zend_Filter_Interface {
|
||||||
$origWidth = imagesx($image);
|
$origWidth = imagesx($image);
|
||||||
$origHeight = imagesy($image);
|
$origHeight = imagesy($image);
|
||||||
$ratio = max($origWidth, $origHeight) / 600;
|
$ratio = max($origWidth, $origHeight) / 600;
|
||||||
|
|
||||||
if ($ratio > 1) {
|
if ($ratio > 1) {
|
||||||
// img too big! create a scaled down image
|
// img too big! create a scaled down image
|
||||||
$newWidth = round($origWidth / $ratio);
|
$newWidth = round($origWidth / $ratio);
|
||||||
|
@ -34,7 +34,7 @@ class Zend_Filter_ImageSize implements Zend_Filter_Interface {
|
||||||
$writeFunc($resized, $value);
|
$writeFunc($resized, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,34 +4,34 @@
|
||||||
* Check if a field is empty but only when specific fields have specific values
|
* Check if a field is empty but only when specific fields have specific values
|
||||||
*/
|
*/
|
||||||
class ConditionalNotEmpty extends Zend_Validate_Abstract {
|
class ConditionalNotEmpty extends Zend_Validate_Abstract {
|
||||||
|
|
||||||
const KEY_IS_EMPTY = 'keyIsEmpty';
|
const KEY_IS_EMPTY = 'keyIsEmpty';
|
||||||
|
|
||||||
protected $_messageTemplates = array(
|
protected $_messageTemplates = array(
|
||||||
self::KEY_IS_EMPTY => 'Value is required and can\'t be empty'
|
self::KEY_IS_EMPTY => 'Value is required and can\'t be empty'
|
||||||
);
|
);
|
||||||
|
|
||||||
protected $_fieldValues;
|
protected $_fieldValues;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new ConditionalNotEmpty validator.
|
* Constructs a new ConditionalNotEmpty validator.
|
||||||
*
|
*
|
||||||
* @param array $fieldValues - the names and expected values of the fields we're depending on;
|
* @param array $fieldValues - the names and expected values of the fields we're depending on;
|
||||||
* E.g., if we have a field that should only be validated when two other
|
* E.g., if we have a field that should only be validated when two other
|
||||||
* fields PARENT_1 and PARENT_2 have values of '1' and '0' respectively, then
|
* fields PARENT_1 and PARENT_2 have values of '1' and '0' respectively, then
|
||||||
* $fieldValues should contain ('PARENT_1'=>'1', 'PARENT_2'=>'0')
|
* $fieldValues should contain ('PARENT_1'=>'1', 'PARENT_2'=>'0')
|
||||||
*/
|
*/
|
||||||
public function __construct($fieldValues)
|
public function __construct($fieldValues)
|
||||||
{
|
{
|
||||||
$this->_fieldValues = $fieldValues;
|
$this->_fieldValues = $fieldValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements Zend_Validate_Abstract.
|
* Implements Zend_Validate_Abstract.
|
||||||
* Given names and expected values of the fields we're depending on ($_fieldValues),
|
* Given names and expected values of the fields we're depending on ($_fieldValues),
|
||||||
* this function returns true if the expected values doesn't match the actual user input,
|
* this function returns true if the expected values doesn't match the actual user input,
|
||||||
* or if $value is not empty. Returns false otherwise.
|
* or if $value is not empty. Returns false otherwise.
|
||||||
*
|
*
|
||||||
* @param String $value - this field's value
|
* @param String $value - this field's value
|
||||||
* @param array $context - names and values of the rest of the fields in this form
|
* @param array $context - names and values of the rest of the fields in this form
|
||||||
* @return boolean - true if valid; false otherwise
|
* @return boolean - true if valid; false otherwise
|
||||||
|
@ -41,7 +41,7 @@ class ConditionalNotEmpty extends Zend_Validate_Abstract {
|
||||||
if ($value != "") {
|
if ($value != "") {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($context)) {
|
if (is_array($context)) {
|
||||||
foreach($this->_fieldValues as $fieldName=>$fieldValue) {
|
foreach($this->_fieldValues as $fieldName=>$fieldValue) {
|
||||||
if (!isset($context[$fieldName]) || $context[$fieldName] != $fieldValue) {
|
if (!isset($context[$fieldName]) || $context[$fieldName] != $fieldValue) {
|
||||||
|
@ -53,7 +53,7 @@ class ConditionalNotEmpty extends Zend_Validate_Abstract {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_error(self::KEY_IS_EMPTY);
|
$this->_error(self::KEY_IS_EMPTY);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,53 +1,53 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class Application_Model_Auth {
|
class Application_Model_Auth {
|
||||||
|
|
||||||
const TOKEN_LIFETIME = 'P2D'; // DateInterval syntax
|
const TOKEN_LIFETIME = 'P2D'; // DateInterval syntax
|
||||||
|
|
||||||
private function generateToken($action, $user_id)
|
private function generateToken($action, $user_id)
|
||||||
{
|
{
|
||||||
$salt = md5("pro");
|
$salt = md5("pro");
|
||||||
$token = self::generateRandomString();
|
$token = self::generateRandomString();
|
||||||
|
|
||||||
$info = new CcSubjsToken();
|
$info = new CcSubjsToken();
|
||||||
$info->setDbUserId($user_id);
|
$info->setDbUserId($user_id);
|
||||||
$info->setDbAction($action);
|
$info->setDbAction($action);
|
||||||
$info->setDbToken(sha1($token.$salt));
|
$info->setDbToken(sha1($token.$salt));
|
||||||
$info->setDbCreated(gmdate('Y-m-d H:i:s'));
|
$info->setDbCreated(gmdate('Y-m-d H:i:s'));
|
||||||
$info->save();
|
$info->save();
|
||||||
|
|
||||||
Logging::debug("generated token {$token}");
|
Logging::debug("generated token {$token}");
|
||||||
|
|
||||||
return $token;
|
return $token;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sendPasswordRestoreLink($user, $view)
|
public function sendPasswordRestoreLink($user, $view)
|
||||||
{
|
{
|
||||||
$token = $this->generateToken('password.restore', $user->getDbId());
|
$token = $this->generateToken('password.restore', $user->getDbId());
|
||||||
|
|
||||||
$e_link_protocol = empty($_SERVER['HTTPS']) ? "http" : "https";
|
$e_link_protocol = empty($_SERVER['HTTPS']) ? "http" : "https";
|
||||||
$e_link_base = $_SERVER['SERVER_NAME'];
|
$e_link_base = $_SERVER['SERVER_NAME'];
|
||||||
$e_link_path = $view->url(array('user_id' => $user->getDbId(), 'token' => $token), 'password-change');
|
$e_link_path = $view->url(array('user_id' => $user->getDbId(), 'token' => $token), 'password-change');
|
||||||
|
|
||||||
$message = "Click this link: {$e_link_protocol}://{$e_link_base}{$e_link_path}";
|
$message = "Click this link: {$e_link_protocol}://{$e_link_base}{$e_link_path}";
|
||||||
|
|
||||||
$success = Application_Model_Email::send('Airtime Password Reset', $message, $user->getDbEmail());
|
$success = Application_Model_Email::send('Airtime Password Reset', $message, $user->getDbEmail());
|
||||||
|
|
||||||
return $success;
|
return $success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function invalidateTokens($user, $action)
|
public function invalidateTokens($user, $action)
|
||||||
{
|
{
|
||||||
CcSubjsTokenQuery::create()
|
CcSubjsTokenQuery::create()
|
||||||
->filterByDbAction($action)
|
->filterByDbAction($action)
|
||||||
->filterByDbUserId($user->getDbId())
|
->filterByDbUserId($user->getDbId())
|
||||||
->delete();
|
->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkToken($user_id, $token, $action)
|
public function checkToken($user_id, $token, $action)
|
||||||
{
|
{
|
||||||
$salt = md5("pro");
|
$salt = md5("pro");
|
||||||
|
|
||||||
$token_info = CcSubjsTokenQuery::create()
|
$token_info = CcSubjsTokenQuery::create()
|
||||||
->filterByDbAction($action)
|
->filterByDbAction($action)
|
||||||
->filterByDbUserId($user_id)
|
->filterByDbUserId($user_id)
|
||||||
|
@ -61,10 +61,10 @@ class Application_Model_Auth {
|
||||||
$now = new DateTime();
|
$now = new DateTime();
|
||||||
$token_life = new DateInterval(self::TOKEN_LIFETIME);
|
$token_life = new DateInterval(self::TOKEN_LIFETIME);
|
||||||
$token_created = new DateTime($token_info->getDbCreated(), new DateTimeZone("UTC"));
|
$token_created = new DateTime($token_info->getDbCreated(), new DateTimeZone("UTC"));
|
||||||
|
|
||||||
return $now->sub($token_life)->getTimestamp() < $token_created->getTimestamp();
|
return $now->sub($token_life)->getTimestamp() < $token_created->getTimestamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the adapter for authentication against a database table
|
* Gets the adapter for authentication against a database table
|
||||||
*
|
*
|
||||||
|
@ -79,10 +79,10 @@ class Application_Model_Auth {
|
||||||
->setIdentityColumn('login')
|
->setIdentityColumn('login')
|
||||||
->setCredentialColumn('pass')
|
->setCredentialColumn('pass')
|
||||||
->setCredentialTreatment('MD5(?)');
|
->setCredentialTreatment('MD5(?)');
|
||||||
|
|
||||||
return $authAdapter;
|
return $authAdapter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get random string
|
* Get random string
|
||||||
*
|
*
|
||||||
|
|
|
@ -121,7 +121,7 @@ class Application_Model_Dashboard
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//return the one that starts sooner.
|
//return the one that starts sooner.
|
||||||
|
|
||||||
if ($row[0]["starts"] <= $showInstance->getShowInstanceStart()){
|
if ($row[0]["starts"] <= $showInstance->getShowInstanceStart()){
|
||||||
return array("name"=>$row[0]["artist_name"]." - ".$row[0]["track_title"],
|
return array("name"=>$row[0]["artist_name"]." - ".$row[0]["track_title"],
|
||||||
"starts"=>$row[0]["starts"],
|
"starts"=>$row[0]["starts"],
|
||||||
|
|
|
@ -1,104 +1,104 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class Application_Model_Datatables {
|
class Application_Model_Datatables {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* query used to return data for a paginated/searchable datatable.
|
* query used to return data for a paginated/searchable datatable.
|
||||||
*/
|
*/
|
||||||
public static function findEntries($con, $displayColumns, $fromTable, $data, $dataProp = "aaData")
|
public static function findEntries($con, $displayColumns, $fromTable, $data, $dataProp = "aaData")
|
||||||
{
|
{
|
||||||
$where = array();
|
$where = array();
|
||||||
|
|
||||||
if ($data["sSearch"] !== "") {
|
if ($data["sSearch"] !== "") {
|
||||||
$searchTerms = explode(" ", $data["sSearch"]);
|
$searchTerms = explode(" ", $data["sSearch"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$selectorCount = "SELECT COUNT(*) ";
|
$selectorCount = "SELECT COUNT(*) ";
|
||||||
$selectorRows = "SELECT ".join(",", $displayColumns)." ";
|
$selectorRows = "SELECT ".join(",", $displayColumns)." ";
|
||||||
|
|
||||||
$sql = $selectorCount." FROM ".$fromTable;
|
$sql = $selectorCount." FROM ".$fromTable;
|
||||||
$sqlTotalRows = $sql;
|
$sqlTotalRows = $sql;
|
||||||
|
|
||||||
if (isset($searchTerms)) {
|
if (isset($searchTerms)) {
|
||||||
$searchCols = array();
|
$searchCols = array();
|
||||||
for ($i = 0; $i < $data["iColumns"]; $i++) {
|
for ($i = 0; $i < $data["iColumns"]; $i++) {
|
||||||
if ($data["bSearchable_".$i] == "true") {
|
if ($data["bSearchable_".$i] == "true") {
|
||||||
$searchCols[] = $data["mDataProp_{$i}"];
|
$searchCols[] = $data["mDataProp_{$i}"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$outerCond = array();
|
$outerCond = array();
|
||||||
|
|
||||||
foreach ($searchTerms as $term) {
|
foreach ($searchTerms as $term) {
|
||||||
$innerCond = array();
|
$innerCond = array();
|
||||||
|
|
||||||
foreach ($searchCols as $col) {
|
foreach ($searchCols as $col) {
|
||||||
$escapedTerm = pg_escape_string($term);
|
$escapedTerm = pg_escape_string($term);
|
||||||
$innerCond[] = "{$col}::text ILIKE '%{$escapedTerm}%'";
|
$innerCond[] = "{$col}::text ILIKE '%{$escapedTerm}%'";
|
||||||
}
|
}
|
||||||
$outerCond[] = "(".join(" OR ", $innerCond).")";
|
$outerCond[] = "(".join(" OR ", $innerCond).")";
|
||||||
}
|
}
|
||||||
$where[] = "(".join(" AND ", $outerCond).")";
|
$where[] = "(".join(" AND ", $outerCond).")";
|
||||||
}
|
}
|
||||||
// End Where clause
|
// End Where clause
|
||||||
|
|
||||||
// Order By clause
|
// Order By clause
|
||||||
$orderby = array();
|
$orderby = array();
|
||||||
for ($i = 0; $i < $data["iSortingCols"]; $i++){
|
for ($i = 0; $i < $data["iSortingCols"]; $i++){
|
||||||
$num = $data["iSortCol_".$i];
|
$num = $data["iSortCol_".$i];
|
||||||
$orderby[] = $data["mDataProp_{$num}"]." ".$data["sSortDir_".$i];
|
$orderby[] = $data["mDataProp_{$num}"]." ".$data["sSortDir_".$i];
|
||||||
}
|
}
|
||||||
$orderby[] = "id";
|
$orderby[] = "id";
|
||||||
$orderby = join("," , $orderby);
|
$orderby = join("," , $orderby);
|
||||||
// End Order By clause
|
// End Order By clause
|
||||||
|
|
||||||
$displayLength = intval($data["iDisplayLength"]);
|
$displayLength = intval($data["iDisplayLength"]);
|
||||||
if (count($where) > 0) {
|
if (count($where) > 0) {
|
||||||
$where = join(" AND ", $where);
|
$where = join(" AND ", $where);
|
||||||
$sql = $selectorCount." FROM ".$fromTable." WHERE ".$where;
|
$sql = $selectorCount." FROM ".$fromTable." WHERE ".$where;
|
||||||
$sqlTotalDisplayRows = $sql;
|
$sqlTotalDisplayRows = $sql;
|
||||||
|
|
||||||
$sql = $selectorRows." FROM ".$fromTable." WHERE ".$where." ORDER BY ".$orderby;
|
$sql = $selectorRows." FROM ".$fromTable." WHERE ".$where." ORDER BY ".$orderby;
|
||||||
|
|
||||||
//limit the results returned.
|
//limit the results returned.
|
||||||
if ($displayLength !== -1) {
|
if ($displayLength !== -1) {
|
||||||
$sql .= " OFFSET ".$data["iDisplayStart"]." LIMIT ".$displayLength;
|
$sql .= " OFFSET ".$data["iDisplayStart"]." LIMIT ".$displayLength;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$sql = $selectorRows." FROM ".$fromTable." ORDER BY ".$orderby;
|
$sql = $selectorRows." FROM ".$fromTable." ORDER BY ".$orderby;
|
||||||
|
|
||||||
//limit the results returned.
|
//limit the results returned.
|
||||||
if ($displayLength !== -1) {
|
if ($displayLength !== -1) {
|
||||||
$sql .= " OFFSET ".$data["iDisplayStart"]." LIMIT ".$displayLength;
|
$sql .= " OFFSET ".$data["iDisplayStart"]." LIMIT ".$displayLength;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$r = $con->query($sqlTotalRows);
|
$r = $con->query($sqlTotalRows);
|
||||||
$totalRows = $r->fetchColumn(0);
|
$totalRows = $r->fetchColumn(0);
|
||||||
|
|
||||||
if (isset($sqlTotalDisplayRows)) {
|
if (isset($sqlTotalDisplayRows)) {
|
||||||
$r = $con->query($sqlTotalDisplayRows);
|
$r = $con->query($sqlTotalDisplayRows);
|
||||||
$totalDisplayRows = $r->fetchColumn(0);
|
$totalDisplayRows = $r->fetchColumn(0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$totalDisplayRows = $totalRows;
|
$totalDisplayRows = $totalRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = $con->query($sql);
|
$r = $con->query($sql);
|
||||||
$r->setFetchMode(PDO::FETCH_ASSOC);
|
$r->setFetchMode(PDO::FETCH_ASSOC);
|
||||||
$results = $r->fetchAll();
|
$results = $r->fetchAll();
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
Logging::debug($e->getMessage());
|
Logging::debug($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
"sEcho" => intval($data["sEcho"]),
|
"sEcho" => intval($data["sEcho"]),
|
||||||
"iTotalDisplayRecords" => intval($totalDisplayRows),
|
"iTotalDisplayRecords" => intval($totalDisplayRows),
|
||||||
"iTotalRecords" => intval($totalRows),
|
"iTotalRecords" => intval($totalRows),
|
||||||
$dataProp => $results
|
$dataProp => $results
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class Application_Model_Email {
|
class Application_Model_Email {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send email
|
* Send email
|
||||||
*
|
*
|
||||||
|
@ -14,7 +14,7 @@ class Application_Model_Email {
|
||||||
{
|
{
|
||||||
$mailServerConfigured = Application_Model_Preference::GetMailServerConfigured() == true ? true : false;
|
$mailServerConfigured = Application_Model_Preference::GetMailServerConfigured() == true ? true : false;
|
||||||
$success = true;
|
$success = true;
|
||||||
|
|
||||||
if ($mailServerConfigured) {
|
if ($mailServerConfigured) {
|
||||||
$username = Application_Model_Preference::GetMailServerEmailAddress();
|
$username = Application_Model_Preference::GetMailServerEmailAddress();
|
||||||
$password = Application_Model_Preference::GetMailServerPassword();
|
$password = Application_Model_Preference::GetMailServerPassword();
|
||||||
|
@ -23,25 +23,25 @@ class Application_Model_Email {
|
||||||
if (!empty($mailServerPort)) {
|
if (!empty($mailServerPort)) {
|
||||||
$port = Application_Model_Preference::GetMailServerPort();
|
$port = Application_Model_Preference::GetMailServerPort();
|
||||||
}
|
}
|
||||||
|
|
||||||
$config = array(
|
$config = array(
|
||||||
'auth' => 'login',
|
'auth' => 'login',
|
||||||
'ssl' => 'ssl',
|
'ssl' => 'ssl',
|
||||||
'username' => $username,
|
'username' => $username,
|
||||||
'password' => $password
|
'password' => $password
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isset($port)) {
|
if (isset($port)) {
|
||||||
$config['port'] = $port;
|
$config['port'] = $port;
|
||||||
}
|
}
|
||||||
|
|
||||||
$transport = new Zend_Mail_Transport_Smtp($mailServer, $config);
|
$transport = new Zend_Mail_Transport_Smtp($mailServer, $config);
|
||||||
}
|
}
|
||||||
|
|
||||||
$mail = new Zend_Mail('utf-8');
|
$mail = new Zend_Mail('utf-8');
|
||||||
$mail->setSubject($subject);
|
$mail->setSubject($subject);
|
||||||
$mail->setBodyText($message);
|
$mail->setBodyText($message);
|
||||||
|
|
||||||
foreach ((array) $tos as $to) {
|
foreach ((array) $tos as $to) {
|
||||||
$mail->addTo($to);
|
$mail->addTo($to);
|
||||||
}
|
}
|
||||||
|
@ -60,8 +60,8 @@ class Application_Model_Email {
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$success = false;
|
$success = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $success;
|
return $success;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ class Application_Model_LiveLog
|
||||||
." WHERE state = 'L'"
|
." WHERE state = 'L'"
|
||||||
." ORDER BY id";
|
." ORDER BY id";
|
||||||
$rows = $con->query($sql)->fetchAll();
|
$rows = $con->query($sql)->fetchAll();
|
||||||
|
|
||||||
if ($rows != null) {
|
if ($rows != null) {
|
||||||
$last_row = self::UpdateLastLogEndTime(array_pop($rows));
|
$last_row = self::UpdateLastLogEndTime(array_pop($rows));
|
||||||
array_push($rows, $last_row);
|
array_push($rows, $last_row);
|
||||||
|
@ -36,7 +36,7 @@ class Application_Model_LiveLog
|
||||||
$con->exec($sql_delete);
|
$con->exec($sql_delete);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$skip = true;
|
$skip = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$hours = 0;
|
$hours = 0;
|
||||||
|
@ -55,13 +55,13 @@ class Application_Model_LiveLog
|
||||||
$intervals[$i] = 0;
|
$intervals[$i] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trim milliseconds (DateInterval does not support)
|
// Trim milliseconds (DateInterval does not support)
|
||||||
$sec = explode(".", $intervals[2]);
|
$sec = explode(".", $intervals[2]);
|
||||||
if (isset($sec[0])) {
|
if (isset($sec[0])) {
|
||||||
$intervals[2] = $sec[0];
|
$intervals[2] = $sec[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
$seconds += $intervals[2];
|
$seconds += $intervals[2];
|
||||||
if ($seconds / 60 >= 1) {
|
if ($seconds / 60 >= 1) {
|
||||||
$minutes += 1;
|
$minutes += 1;
|
||||||
|
@ -89,7 +89,7 @@ class Application_Model_LiveLog
|
||||||
$minutes = (double)(($hours*60)+$minutes . "." . $seconds[0]);
|
$minutes = (double)(($hours*60)+$minutes . "." . $seconds[0]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$minutes = (double)(($hours*60)+$minutes);
|
$minutes = (double)(($hours*60)+$minutes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $minutes;
|
return $minutes;
|
||||||
|
@ -100,7 +100,7 @@ class Application_Model_LiveLog
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetScheduledDuration($p_keepData=false)
|
public static function GetScheduledDuration($p_keepData=false)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
@ -125,7 +125,7 @@ class Application_Model_LiveLog
|
||||||
." WHERE state = 'S'"
|
." WHERE state = 'S'"
|
||||||
." ORDER BY id";
|
." ORDER BY id";
|
||||||
$rows = $con->query($sql)->fetchAll();
|
$rows = $con->query($sql)->fetchAll();
|
||||||
|
|
||||||
if ($rows != null) {
|
if ($rows != null) {
|
||||||
$last_row = self::UpdateLastLogEndTime(array_pop($rows));
|
$last_row = self::UpdateLastLogEndTime(array_pop($rows));
|
||||||
array_push($rows, $last_row);
|
array_push($rows, $last_row);
|
||||||
|
@ -135,7 +135,7 @@ class Application_Model_LiveLog
|
||||||
$con->exec($sql_delete);
|
$con->exec($sql_delete);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$skip = true;
|
$skip = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$hours = 0;
|
$hours = 0;
|
||||||
|
@ -173,7 +173,7 @@ class Application_Model_LiveLog
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$clip_length_seconds = $clip_length_intervals[0]*3600 + $clip_length_intervals[1]*60 + $clip_length_intervals[2];
|
$clip_length_seconds = $clip_length_intervals[0]*3600 + $clip_length_intervals[1]*60 + $clip_length_intervals[2];
|
||||||
|
|
||||||
$extra_time = $extra_time->format("%H:%i:%s");
|
$extra_time = $extra_time->format("%H:%i:%s");
|
||||||
//Convert extra_time into seconds;
|
//Convert extra_time into seconds;
|
||||||
$extra_time_intervals = explode(":", $extra_time);
|
$extra_time_intervals = explode(":", $extra_time);
|
||||||
|
@ -185,7 +185,7 @@ class Application_Model_LiveLog
|
||||||
$extra_time_seconds = $extra_time_intervals[0]*3600 + $extra_time_intervals[1]*60 + $extra_time_intervals[2];
|
$extra_time_seconds = $extra_time_intervals[0]*3600 + $extra_time_intervals[1]*60 + $extra_time_intervals[2];
|
||||||
|
|
||||||
$clip_length_seconds -= $extra_time_seconds;
|
$clip_length_seconds -= $extra_time_seconds;
|
||||||
|
|
||||||
//Convert new clip_length into "H-i-s" format
|
//Convert new clip_length into "H-i-s" format
|
||||||
$clip_length_arr = array();
|
$clip_length_arr = array();
|
||||||
if ($clip_length_seconds / 3600 >= 1) {
|
if ($clip_length_seconds / 3600 >= 1) {
|
||||||
|
@ -276,7 +276,7 @@ class Application_Model_LiveLog
|
||||||
public static function SetNewLogTime($state, $dateTime){
|
public static function SetNewLogTime($state, $dateTime){
|
||||||
try {
|
try {
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
|
||||||
$scheduled = Application_Model_Preference::GetSourceSwitchStatus('scheduled_play');
|
$scheduled = Application_Model_Preference::GetSourceSwitchStatus('scheduled_play');
|
||||||
if ($state == 'L' && $scheduled == 'on') {
|
if ($state == 'L' && $scheduled == 'on') {
|
||||||
self::SetEndTime('S', $dateTime);
|
self::SetEndTime('S', $dateTime);
|
||||||
|
|
|
@ -44,35 +44,35 @@ class Application_Model_MusicDir {
|
||||||
$this->_dir->setExists($flag);
|
$this->_dir->setExists($flag);
|
||||||
$this->_dir->save();
|
$this->_dir->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setWatchedFlag($flag){
|
public function setWatchedFlag($flag){
|
||||||
$this->_dir->setWatched($flag);
|
$this->_dir->setWatched($flag);
|
||||||
$this->_dir->save();
|
$this->_dir->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getWatchedFlag(){
|
public function getWatchedFlag(){
|
||||||
return $this->_dir->getWatched();
|
return $this->_dir->getWatched();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getExistsFlag(){
|
public function getExistsFlag(){
|
||||||
return $this->_dir->getExists();
|
return $this->_dir->getExists();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* There are 2 cases where this function can be called.
|
* There are 2 cases where this function can be called.
|
||||||
* 1. When watched dir was removed
|
* 1. When watched dir was removed
|
||||||
* 2. When some dir was watched, but it was unmounted
|
* 2. When some dir was watched, but it was unmounted
|
||||||
*
|
*
|
||||||
* In case of 1, $userAddedWatchedDir should be true
|
* In case of 1, $userAddedWatchedDir should be true
|
||||||
* In case of 2, $userAddedWatchedDir should be false
|
* In case of 2, $userAddedWatchedDir should be false
|
||||||
*
|
*
|
||||||
* When $userAddedWatchedDir is true, it will set "Watched" flag to false
|
* When $userAddedWatchedDir is true, it will set "Watched" flag to false
|
||||||
* otherwise, it will set "Exists" flag to true
|
* otherwise, it will set "Exists" flag to true
|
||||||
*/
|
*/
|
||||||
public function remove($userAddedWatchedDir=true)
|
public function remove($userAddedWatchedDir=true)
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
|
||||||
$music_dir_id = $this->getId();
|
$music_dir_id = $this->getId();
|
||||||
|
|
||||||
$sql = "SELECT DISTINCT s.instance_id from cc_music_dirs as md "
|
$sql = "SELECT DISTINCT s.instance_id from cc_music_dirs as md "
|
||||||
|
@ -80,12 +80,12 @@ class Application_Model_MusicDir {
|
||||||
." RIGHT JOIN cc_schedule as s on s.file_id = f.id WHERE md.id = $music_dir_id";
|
." RIGHT JOIN cc_schedule as s on s.file_id = f.id WHERE md.id = $music_dir_id";
|
||||||
|
|
||||||
$show_instances = $con->query($sql)->fetchAll();
|
$show_instances = $con->query($sql)->fetchAll();
|
||||||
|
|
||||||
// get all the files on this dir
|
// get all the files on this dir
|
||||||
$sql = "UPDATE cc_files SET file_exists = 'f' WHERE id IN (SELECT f.id FROM cc_music_dirs as md "
|
$sql = "UPDATE cc_files SET file_exists = 'f' WHERE id IN (SELECT f.id FROM cc_music_dirs as md "
|
||||||
." LEFT JOIN cc_files as f on f.directory = md.id WHERE md.id = $music_dir_id)";
|
." LEFT JOIN cc_files as f on f.directory = md.id WHERE md.id = $music_dir_id)";
|
||||||
$affected = $con->exec($sql);
|
$affected = $con->exec($sql);
|
||||||
|
|
||||||
// set RemovedFlag to true
|
// set RemovedFlag to true
|
||||||
if ($userAddedWatchedDir) {
|
if ($userAddedWatchedDir) {
|
||||||
self::setWatchedFlag(false);
|
self::setWatchedFlag(false);
|
||||||
|
@ -93,7 +93,7 @@ class Application_Model_MusicDir {
|
||||||
self::setExistsFlag(false);
|
self::setExistsFlag(false);
|
||||||
}
|
}
|
||||||
//$res = $this->_dir->delete();
|
//$res = $this->_dir->delete();
|
||||||
|
|
||||||
foreach ($show_instances as $show_instance_row) {
|
foreach ($show_instances as $show_instance_row) {
|
||||||
$temp_show = new Application_Model_ShowInstance($show_instance_row["instance_id"]);
|
$temp_show = new Application_Model_ShowInstance($show_instance_row["instance_id"]);
|
||||||
$temp_show->updateScheduledTime();
|
$temp_show->updateScheduledTime();
|
||||||
|
@ -133,7 +133,7 @@ class Application_Model_MusicDir {
|
||||||
public static function isPathValid($p_path){
|
public static function isPathValid($p_path){
|
||||||
$dirs = self::getWatchedDirs();
|
$dirs = self::getWatchedDirs();
|
||||||
$dirs[] = self::getStorDir();
|
$dirs[] = self::getStorDir();
|
||||||
|
|
||||||
foreach ($dirs as $dirObj){
|
foreach ($dirs as $dirObj){
|
||||||
$dir = $dirObj->getDirectory();
|
$dir = $dirObj->getDirectory();
|
||||||
$diff = strlen($dir) - strlen($p_path);
|
$diff = strlen($dir) - strlen($p_path);
|
||||||
|
@ -156,15 +156,15 @@ class Application_Model_MusicDir {
|
||||||
/** There are 2 cases where this function can be called.
|
/** There are 2 cases where this function can be called.
|
||||||
* 1. When watched dir was added
|
* 1. When watched dir was added
|
||||||
* 2. When some dir was watched, but it was unmounted somehow, but gets mounted again
|
* 2. When some dir was watched, but it was unmounted somehow, but gets mounted again
|
||||||
*
|
*
|
||||||
* In case of 1, $userAddedWatchedDir should be true
|
* In case of 1, $userAddedWatchedDir should be true
|
||||||
* In case of 2, $userAddedWatchedDir should be false
|
* In case of 2, $userAddedWatchedDir should be false
|
||||||
*
|
*
|
||||||
* When $userAddedWatchedDir is true, it will set "Removed" flag to false
|
* When $userAddedWatchedDir is true, it will set "Removed" flag to false
|
||||||
* otherwise, it will set "Exists" flag to true
|
* otherwise, it will set "Exists" flag to true
|
||||||
*
|
*
|
||||||
* @param $nestedWatch - if true, bypass path check, and Watched to false
|
* @param $nestedWatch - if true, bypass path check, and Watched to false
|
||||||
**/
|
**/
|
||||||
public static function addDir($p_path, $p_type, $userAddedWatchedDir=true, $nestedWatch=false)
|
public static function addDir($p_path, $p_type, $userAddedWatchedDir=true, $nestedWatch=false)
|
||||||
{
|
{
|
||||||
if(!is_dir($p_path)){
|
if(!is_dir($p_path)){
|
||||||
|
@ -174,16 +174,16 @@ class Application_Model_MusicDir {
|
||||||
if($real_path != "/"){
|
if($real_path != "/"){
|
||||||
$p_path = $real_path;
|
$p_path = $real_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
$exist_dir = self::getDirByPath($p_path);
|
$exist_dir = self::getDirByPath($p_path);
|
||||||
|
|
||||||
if( $exist_dir == NULL ){
|
if( $exist_dir == NULL ){
|
||||||
$temp_dir = new CcMusicDirs();
|
$temp_dir = new CcMusicDirs();
|
||||||
$dir = new Application_Model_MusicDir($temp_dir);
|
$dir = new Application_Model_MusicDir($temp_dir);
|
||||||
}else{
|
}else{
|
||||||
$dir = $exist_dir;
|
$dir = $exist_dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
$dir->setType($p_type);
|
$dir->setType($p_type);
|
||||||
$p_path = Application_Common_OsPath::normpath($p_path)."/";
|
$p_path = Application_Common_OsPath::normpath($p_path)."/";
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ class Application_Model_MusicDir {
|
||||||
$dir->setExistsFlag(true);
|
$dir->setExistsFlag(true);
|
||||||
}
|
}
|
||||||
$dir->setDirectory($p_path);
|
$dir->setDirectory($p_path);
|
||||||
|
|
||||||
return array("code"=>0);
|
return array("code"=>0);
|
||||||
} catch (NestedDirectoryException $nde){
|
} catch (NestedDirectoryException $nde){
|
||||||
$msg = $nde->getMessage();
|
$msg = $nde->getMessage();
|
||||||
|
@ -217,17 +217,17 @@ class Application_Model_MusicDir {
|
||||||
/** There are 2 cases where this function can be called.
|
/** There are 2 cases where this function can be called.
|
||||||
* 1. When watched dir was added
|
* 1. When watched dir was added
|
||||||
* 2. When some dir was watched, but it was unmounted somehow, but gets mounted again
|
* 2. When some dir was watched, but it was unmounted somehow, but gets mounted again
|
||||||
*
|
*
|
||||||
* In case of 1, $userAddedWatchedDir should be true
|
* In case of 1, $userAddedWatchedDir should be true
|
||||||
* In case of 2, $userAddedWatchedDir should be false
|
* In case of 2, $userAddedWatchedDir should be false
|
||||||
*
|
*
|
||||||
* When $userAddedWatchedDir is true, it will set "Watched" flag to true
|
* When $userAddedWatchedDir is true, it will set "Watched" flag to true
|
||||||
* otherwise, it will set "Exists" flag to true
|
* otherwise, it will set "Exists" flag to true
|
||||||
**/
|
**/
|
||||||
public static function addWatchedDir($p_path, $userAddedWatchedDir=true, $nestedWatch=false)
|
public static function addWatchedDir($p_path, $userAddedWatchedDir=true, $nestedWatch=false)
|
||||||
{
|
{
|
||||||
$res = self::addDir($p_path, "watched", $userAddedWatchedDir, $nestedWatch);
|
$res = self::addDir($p_path, "watched", $userAddedWatchedDir, $nestedWatch);
|
||||||
|
|
||||||
if ($res['code'] == 0){
|
if ($res['code'] == 0){
|
||||||
|
|
||||||
//convert "linked" files (Airtime <= 1.8.2) to watched files.
|
//convert "linked" files (Airtime <= 1.8.2) to watched files.
|
||||||
|
@ -296,10 +296,10 @@ class Application_Model_MusicDir {
|
||||||
return $mus_dir;
|
return $mus_dir;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search and returns watched dirs
|
* Search and returns watched dirs
|
||||||
*
|
*
|
||||||
* @param $exists search condition with exists flag
|
* @param $exists search condition with exists flag
|
||||||
* @param $watched search condition with watched flag
|
* @param $watched search condition with watched flag
|
||||||
*/
|
*/
|
||||||
|
@ -383,16 +383,16 @@ class Application_Model_MusicDir {
|
||||||
/** There are 2 cases where this function can be called.
|
/** There are 2 cases where this function can be called.
|
||||||
* 1. When watched dir was removed
|
* 1. When watched dir was removed
|
||||||
* 2. When some dir was watched, but it was unmounted
|
* 2. When some dir was watched, but it was unmounted
|
||||||
*
|
*
|
||||||
* In case of 1, $userAddedWatchedDir should be true
|
* In case of 1, $userAddedWatchedDir should be true
|
||||||
* In case of 2, $userAddedWatchedDir should be false
|
* In case of 2, $userAddedWatchedDir should be false
|
||||||
*
|
*
|
||||||
* When $userAddedWatchedDir is true, it will set "Watched" flag to false
|
* When $userAddedWatchedDir is true, it will set "Watched" flag to false
|
||||||
* otherwise, it will set "Exists" flag to true
|
* otherwise, it will set "Exists" flag to true
|
||||||
**/
|
**/
|
||||||
public static function removeWatchedDir($p_dir, $userAddedWatchedDir=true){
|
public static function removeWatchedDir($p_dir, $userAddedWatchedDir=true){
|
||||||
|
|
||||||
//make sure that $p_dir has a trailing "/"
|
//make sure that $p_dir has a trailing "/"
|
||||||
$real_path = Application_Common_OsPath::normpath($p_dir)."/";
|
$real_path = Application_Common_OsPath::normpath($p_dir)."/";
|
||||||
if($real_path != "/"){
|
if($real_path != "/"){
|
||||||
$p_dir = $real_path;
|
$p_dir = $real_path;
|
||||||
|
@ -412,7 +412,7 @@ class Application_Model_MusicDir {
|
||||||
public static function splitFilePath($p_filepath)
|
public static function splitFilePath($p_filepath)
|
||||||
{
|
{
|
||||||
$mus_dir = self::getWatchedDirFromFilepath($p_filepath);
|
$mus_dir = self::getWatchedDirFromFilepath($p_filepath);
|
||||||
|
|
||||||
if(is_null($mus_dir)) {
|
if(is_null($mus_dir)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,17 +20,17 @@ class Application_Model_Playlist {
|
||||||
*/
|
*/
|
||||||
private $id;
|
private $id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* propel object for this playlist.
|
* propel object for this playlist.
|
||||||
*/
|
*/
|
||||||
private $pl;
|
private $pl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* info needed to insert a new playlist element.
|
* info needed to insert a new playlist element.
|
||||||
*/
|
*/
|
||||||
private $plItem = array(
|
private $plItem = array(
|
||||||
"id" => "",
|
"id" => "",
|
||||||
"pos" => "",
|
"pos" => "",
|
||||||
"cliplength" => "",
|
"cliplength" => "",
|
||||||
"cuein" => "00:00:00",
|
"cuein" => "00:00:00",
|
||||||
"cueout" => "00:00:00",
|
"cueout" => "00:00:00",
|
||||||
|
@ -38,13 +38,13 @@ class Application_Model_Playlist {
|
||||||
"fadeout" => "0.0",
|
"fadeout" => "0.0",
|
||||||
);
|
);
|
||||||
|
|
||||||
//using propel's phpNames.
|
//using propel's phpNames.
|
||||||
private $categories = array(
|
private $categories = array(
|
||||||
"dc:title" => "Name",
|
"dc:title" => "Name",
|
||||||
"dc:creator" => "Creator",
|
"dc:creator" => "Creator",
|
||||||
"dc:description" => "Description",
|
"dc:description" => "Description",
|
||||||
"dcterms:extent" => "Length"
|
"dcterms:extent" => "Length"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
public function __construct($id=null, $con=null)
|
public function __construct($id=null, $con=null)
|
||||||
|
@ -90,12 +90,12 @@ class Application_Model_Playlist {
|
||||||
*/
|
*/
|
||||||
public function setName($p_newname)
|
public function setName($p_newname)
|
||||||
{
|
{
|
||||||
$this->pl->setDbName($p_newname);
|
$this->pl->setDbName($p_newname);
|
||||||
$this->pl->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
|
$this->pl->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
|
||||||
$this->pl->save($this->con);
|
$this->pl->save($this->con);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get mnemonic playlist name
|
* Get mnemonic playlist name
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
|
@ -107,9 +107,9 @@ class Application_Model_Playlist {
|
||||||
|
|
||||||
public function setDescription($p_description)
|
public function setDescription($p_description)
|
||||||
{
|
{
|
||||||
$this->pl->setDbDescription($p_description);
|
$this->pl->setDbDescription($p_description);
|
||||||
$this->pl->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
|
$this->pl->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
|
||||||
$this->pl->save($this->con);
|
$this->pl->save($this->con);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDescription()
|
public function getDescription()
|
||||||
|
@ -121,7 +121,7 @@ class Application_Model_Playlist {
|
||||||
|
|
||||||
return $this->pl->getCcSubjs()->getDbLogin();
|
return $this->pl->getCcSubjs()->getDbLogin();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCreatorId() {
|
public function getCreatorId() {
|
||||||
return $this->pl->getCcSubjs()->getDbId();
|
return $this->pl->getCcSubjs()->getDbId();
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ class Application_Model_Playlist {
|
||||||
/**
|
/**
|
||||||
* Get the entire playlist as a two dimentional array, sorted in order of play.
|
* Get the entire playlist as a two dimentional array, sorted in order of play.
|
||||||
* @param boolean $filterFiles if this is true, it will only return files that has
|
* @param boolean $filterFiles if this is true, it will only return files that has
|
||||||
* file_exists flag set to true
|
* file_exists flag set to true
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getContents($filterFiles=false) {
|
public function getContents($filterFiles=false) {
|
||||||
|
@ -155,7 +155,7 @@ class Application_Model_Playlist {
|
||||||
$files = array();
|
$files = array();
|
||||||
$query = CcPlaylistcontentsQuery::create()
|
$query = CcPlaylistcontentsQuery::create()
|
||||||
->filterByDbPlaylistId($this->id);
|
->filterByDbPlaylistId($this->id);
|
||||||
|
|
||||||
if($filterFiles){
|
if($filterFiles){
|
||||||
$query->useCcFilesQuery()
|
$query->useCcFilesQuery()
|
||||||
->filterByDbFileExists(true)
|
->filterByDbFileExists(true)
|
||||||
|
@ -416,7 +416,7 @@ class Application_Model_Playlist {
|
||||||
* Remove audioClip from playlist
|
* Remove audioClip from playlist
|
||||||
*
|
*
|
||||||
* @param array $p_items
|
* @param array $p_items
|
||||||
* array of unique item ids to remove from the playlist..
|
* array of unique item ids to remove from the playlist..
|
||||||
*/
|
*/
|
||||||
public function delAudioClips($p_items)
|
public function delAudioClips($p_items)
|
||||||
{
|
{
|
||||||
|
@ -452,11 +452,11 @@ class Application_Model_Playlist {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getFadeInfo($pos) {
|
public function getFadeInfo($pos) {
|
||||||
|
|
||||||
Logging::log("Getting fade info for pos {$pos}");
|
Logging::log("Getting fade info for pos {$pos}");
|
||||||
|
|
||||||
$row = CcPlaylistcontentsQuery::create()
|
$row = CcPlaylistcontentsQuery::create()
|
||||||
->joinWith(CcFilesPeer::OM_CLASS)
|
->joinWith(CcFilesPeer::OM_CLASS)
|
||||||
->filterByDbPlaylistId($this->id)
|
->filterByDbPlaylistId($this->id)
|
||||||
->filterByDbPosition($pos)
|
->filterByDbPosition($pos)
|
||||||
|
@ -466,24 +466,24 @@ class Application_Model_Playlist {
|
||||||
$fadeIn = $row->getDbFadein();
|
$fadeIn = $row->getDbFadein();
|
||||||
$fadeOut = $row->getDbFadeout();
|
$fadeOut = $row->getDbFadeout();
|
||||||
return array($fadeIn, $fadeOut);
|
return array($fadeIn, $fadeOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change fadeIn and fadeOut values for playlist Element
|
* Change fadeIn and fadeOut values for playlist Element
|
||||||
*
|
*
|
||||||
* @param int $pos
|
* @param int $pos
|
||||||
* position of audioclip in playlist
|
* position of audioclip in playlist
|
||||||
* @param string $fadeIn
|
* @param string $fadeIn
|
||||||
* new value in ss.ssssss or extent format
|
* new value in ss.ssssss or extent format
|
||||||
* @param string $fadeOut
|
* @param string $fadeOut
|
||||||
* new value in ss.ssssss or extent format
|
* new value in ss.ssssss or extent format
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function changeFadeInfo($id, $fadeIn, $fadeOut)
|
public function changeFadeInfo($id, $fadeIn, $fadeOut)
|
||||||
{
|
{
|
||||||
//See issue CC-2065, pad the fadeIn and fadeOut so that it is TIME compatable with the DB schema
|
//See issue CC-2065, pad the fadeIn and fadeOut so that it is TIME compatable with the DB schema
|
||||||
//For the top level PlayList either fadeIn or fadeOut will sometimes be Null so need a gaurd against
|
//For the top level PlayList either fadeIn or fadeOut will sometimes be Null so need a gaurd against
|
||||||
//setting it to nonNull for checks down below
|
//setting it to nonNull for checks down below
|
||||||
$fadeIn = $fadeIn?'00:00:'.$fadeIn:$fadeIn;
|
$fadeIn = $fadeIn?'00:00:'.$fadeIn:$fadeIn;
|
||||||
$fadeOut = $fadeOut?'00:00:'.$fadeOut:$fadeOut;
|
$fadeOut = $fadeOut?'00:00:'.$fadeOut:$fadeOut;
|
||||||
|
|
||||||
|
@ -502,8 +502,8 @@ class Application_Model_Playlist {
|
||||||
|
|
||||||
if (!is_null($fadeIn)) {
|
if (!is_null($fadeIn)) {
|
||||||
|
|
||||||
$sql = "SELECT INTERVAL '{$fadeIn}' > INTERVAL '{$clipLength}'";
|
$sql = "SELECT INTERVAL '{$fadeIn}' > INTERVAL '{$clipLength}'";
|
||||||
$r = $this->con->query($sql);
|
$r = $this->con->query($sql);
|
||||||
if ($r->fetchColumn(0)) {
|
if ($r->fetchColumn(0)) {
|
||||||
//"Fade In can't be larger than overall playlength.";
|
//"Fade In can't be larger than overall playlength.";
|
||||||
$fadeIn = $clipLength;
|
$fadeIn = $clipLength;
|
||||||
|
@ -512,8 +512,8 @@ class Application_Model_Playlist {
|
||||||
}
|
}
|
||||||
if (!is_null($fadeOut)){
|
if (!is_null($fadeOut)){
|
||||||
|
|
||||||
$sql = "SELECT INTERVAL '{$fadeOut}' > INTERVAL '{$clipLength}'";
|
$sql = "SELECT INTERVAL '{$fadeOut}' > INTERVAL '{$clipLength}'";
|
||||||
$r = $this->con->query($sql);
|
$r = $this->con->query($sql);
|
||||||
if ($r->fetchColumn(0)) {
|
if ($r->fetchColumn(0)) {
|
||||||
//Fade Out can't be larger than overall playlength.";
|
//Fade Out can't be larger than overall playlength.";
|
||||||
$fadeOut = $clipLength;
|
$fadeOut = $clipLength;
|
||||||
|
@ -562,11 +562,11 @@ class Application_Model_Playlist {
|
||||||
* Change cueIn/cueOut values for playlist element
|
* Change cueIn/cueOut values for playlist element
|
||||||
*
|
*
|
||||||
* @param int $pos
|
* @param int $pos
|
||||||
* position of audioclip in playlist
|
* position of audioclip in playlist
|
||||||
* @param string $cueIn
|
* @param string $cueIn
|
||||||
* new value in ss.ssssss or extent format
|
* new value in ss.ssssss or extent format
|
||||||
* @param string $cueOut
|
* @param string $cueOut
|
||||||
* new value in ss.ssssss or extent format
|
* new value in ss.ssssss or extent format
|
||||||
* @return boolean or pear error object
|
* @return boolean or pear error object
|
||||||
*/
|
*/
|
||||||
public function changeClipLength($id, $cueIn, $cueOut)
|
public function changeClipLength($id, $cueIn, $cueOut)
|
||||||
|
@ -604,23 +604,23 @@ class Application_Model_Playlist {
|
||||||
$cueOut = $origLength;
|
$cueOut = $origLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT INTERVAL '{$cueIn}' > INTERVAL '{$cueOut}'";
|
$sql = "SELECT INTERVAL '{$cueIn}' > INTERVAL '{$cueOut}'";
|
||||||
$r = $this->con->query($sql);
|
$r = $this->con->query($sql);
|
||||||
if ($r->fetchColumn(0)) {
|
if ($r->fetchColumn(0)) {
|
||||||
$errArray["error"] = "Can't set cue in to be larger than cue out.";
|
$errArray["error"] = "Can't set cue in to be larger than cue out.";
|
||||||
return $errArray;
|
return $errArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT INTERVAL '{$cueOut}' > INTERVAL '{$origLength}'";
|
$sql = "SELECT INTERVAL '{$cueOut}' > INTERVAL '{$origLength}'";
|
||||||
$r = $this->con->query($sql);
|
$r = $this->con->query($sql);
|
||||||
if ($r->fetchColumn(0)){
|
if ($r->fetchColumn(0)){
|
||||||
$errArray["error"] = "Can't set cue out to be greater than file length.";
|
$errArray["error"] = "Can't set cue out to be greater than file length.";
|
||||||
return $errArray;
|
return $errArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT INTERVAL '{$cueOut}' - INTERVAL '{$cueIn}'";
|
$sql = "SELECT INTERVAL '{$cueOut}' - INTERVAL '{$cueIn}'";
|
||||||
$r = $this->con->query($sql);
|
$r = $this->con->query($sql);
|
||||||
$cliplength = $r->fetchColumn(0);
|
$cliplength = $r->fetchColumn(0);
|
||||||
|
|
||||||
$row->setDbCuein($cueIn);
|
$row->setDbCuein($cueIn);
|
||||||
$row->setDbCueout($cueOut);
|
$row->setDbCueout($cueOut);
|
||||||
|
@ -629,16 +629,16 @@ class Application_Model_Playlist {
|
||||||
}
|
}
|
||||||
else if (!is_null($cueIn)) {
|
else if (!is_null($cueIn)) {
|
||||||
|
|
||||||
$sql = "SELECT INTERVAL '{$cueIn}' > INTERVAL '{$oldCueOut}'";
|
$sql = "SELECT INTERVAL '{$cueIn}' > INTERVAL '{$oldCueOut}'";
|
||||||
$r = $this->con->query($sql);
|
$r = $this->con->query($sql);
|
||||||
if ($r->fetchColumn(0)) {
|
if ($r->fetchColumn(0)) {
|
||||||
$errArray["error"] = "Can't set cue in to be larger than cue out.";
|
$errArray["error"] = "Can't set cue in to be larger than cue out.";
|
||||||
return $errArray;
|
return $errArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT INTERVAL '{$oldCueOut}' - INTERVAL '{$cueIn}'";
|
$sql = "SELECT INTERVAL '{$oldCueOut}' - INTERVAL '{$cueIn}'";
|
||||||
$r = $this->con->query($sql);
|
$r = $this->con->query($sql);
|
||||||
$cliplength = $r->fetchColumn(0);
|
$cliplength = $r->fetchColumn(0);
|
||||||
|
|
||||||
$row->setDbCuein($cueIn);
|
$row->setDbCuein($cueIn);
|
||||||
$row->setDBCliplength($cliplength);
|
$row->setDBCliplength($cliplength);
|
||||||
|
@ -649,23 +649,23 @@ class Application_Model_Playlist {
|
||||||
$cueOut = $origLength;
|
$cueOut = $origLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT INTERVAL '{$cueOut}' < INTERVAL '{$oldCueIn}'";
|
$sql = "SELECT INTERVAL '{$cueOut}' < INTERVAL '{$oldCueIn}'";
|
||||||
$r = $this->con->query($sql);
|
$r = $this->con->query($sql);
|
||||||
if ($r->fetchColumn(0)) {
|
if ($r->fetchColumn(0)) {
|
||||||
$errArray["error"] = "Can't set cue out to be smaller than cue in.";
|
$errArray["error"] = "Can't set cue out to be smaller than cue in.";
|
||||||
return $errArray;
|
return $errArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT INTERVAL '{$cueOut}' > INTERVAL '{$origLength}'";
|
$sql = "SELECT INTERVAL '{$cueOut}' > INTERVAL '{$origLength}'";
|
||||||
$r = $this->con->query($sql);
|
$r = $this->con->query($sql);
|
||||||
if ($r->fetchColumn(0)){
|
if ($r->fetchColumn(0)){
|
||||||
$errArray["error"] = "Can't set cue out to be greater than file length.";
|
$errArray["error"] = "Can't set cue out to be greater than file length.";
|
||||||
return $errArray;
|
return $errArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT INTERVAL '{$cueOut}' - INTERVAL '{$oldCueIn}'";
|
$sql = "SELECT INTERVAL '{$cueOut}' - INTERVAL '{$oldCueIn}'";
|
||||||
$r = $this->con->query($sql);
|
$r = $this->con->query($sql);
|
||||||
$cliplength = $r->fetchColumn(0);
|
$cliplength = $r->fetchColumn(0);
|
||||||
|
|
||||||
$row->setDbCueout($cueOut);
|
$row->setDbCueout($cueOut);
|
||||||
$row->setDBCliplength($cliplength);
|
$row->setDBCliplength($cliplength);
|
||||||
|
@ -673,15 +673,15 @@ class Application_Model_Playlist {
|
||||||
|
|
||||||
$cliplength = $row->getDbCliplength();
|
$cliplength = $row->getDbCliplength();
|
||||||
|
|
||||||
$sql = "SELECT INTERVAL '{$fadeIn}' > INTERVAL '{$cliplength}'";
|
$sql = "SELECT INTERVAL '{$fadeIn}' > INTERVAL '{$cliplength}'";
|
||||||
$r = $this->con->query($sql);
|
$r = $this->con->query($sql);
|
||||||
if ($r->fetchColumn(0)){
|
if ($r->fetchColumn(0)){
|
||||||
$fadeIn = $cliplength;
|
$fadeIn = $cliplength;
|
||||||
$row->setDbFadein($fadeIn);
|
$row->setDbFadein($fadeIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT INTERVAL '{$fadeOut}' > INTERVAL '{$cliplength}'";
|
$sql = "SELECT INTERVAL '{$fadeOut}' > INTERVAL '{$cliplength}'";
|
||||||
$r = $this->con->query($sql);
|
$r = $this->con->query($sql);
|
||||||
if ($r->fetchColumn(0)){
|
if ($r->fetchColumn(0)){
|
||||||
$fadeOut = $cliplength;
|
$fadeOut = $cliplength;
|
||||||
$row->setDbFadein($fadeOut);
|
$row->setDbFadein($fadeOut);
|
||||||
|
|
|
@ -4,80 +4,80 @@ require_once 'formatters/LengthFormatter.php';
|
||||||
|
|
||||||
class Application_Model_PlayoutHistory {
|
class Application_Model_PlayoutHistory {
|
||||||
|
|
||||||
private $con;
|
private $con;
|
||||||
private $timezone;
|
private $timezone;
|
||||||
|
|
||||||
//in UTC timezone
|
//in UTC timezone
|
||||||
private $startDT;
|
private $startDT;
|
||||||
//in UTC timezone
|
//in UTC timezone
|
||||||
private $endDT;
|
private $endDT;
|
||||||
|
|
||||||
private $epoch_now;
|
private $epoch_now;
|
||||||
private $opts;
|
private $opts;
|
||||||
|
|
||||||
private $mDataPropMap = array(
|
|
||||||
"artist" => "file.artist_name",
|
|
||||||
"title" => "file.track_title",
|
|
||||||
"played" => "playout.played",
|
|
||||||
"length" => "file.length",
|
|
||||||
"composer" => "file.composer",
|
|
||||||
"copyright" => "file.copyright",
|
|
||||||
);
|
|
||||||
|
|
||||||
public function __construct($p_startDT, $p_endDT, $p_opts) {
|
|
||||||
|
|
||||||
$this->con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
|
|
||||||
$this->startDT = $p_startDT;
|
|
||||||
$this->endDT = $p_endDT;
|
|
||||||
$this->timezone = date_default_timezone_get();
|
|
||||||
$this->epoch_now = time();
|
|
||||||
$this->opts = $p_opts;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* map front end mDataProp labels to proper column names for searching etc.
|
|
||||||
*/
|
|
||||||
private function translateColumns() {
|
|
||||||
|
|
||||||
for ($i = 0; $i < $this->opts["iColumns"]; $i++){
|
|
||||||
|
|
||||||
$this->opts["mDataProp_{$i}"] = $this->mDataPropMap[$this->opts["mDataProp_{$i}"]];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getItems() {
|
|
||||||
|
|
||||||
$this->translateColumns();
|
|
||||||
|
|
||||||
$select = array(
|
|
||||||
"file.track_title as title",
|
|
||||||
"file.artist_name as artist",
|
|
||||||
"playout.played",
|
|
||||||
"playout.file_id",
|
|
||||||
"file.composer",
|
|
||||||
"file.copyright",
|
|
||||||
"file.length"
|
|
||||||
);
|
|
||||||
|
|
||||||
$start = $this->startDT->format("Y-m-d H:i:s");
|
|
||||||
$end = $this->endDT->format("Y-m-d H:i:s");
|
|
||||||
|
|
||||||
$historyTable = "(
|
|
||||||
select count(schedule.file_id) as played, schedule.file_id as file_id
|
|
||||||
from cc_schedule as schedule
|
|
||||||
where schedule.starts >= '{$start}' and schedule.starts < '{$end}'
|
|
||||||
and schedule.playout_status > 0 and schedule.media_item_played != FALSE and schedule.broadcasted = 1
|
|
||||||
group by schedule.file_id
|
|
||||||
)
|
|
||||||
AS playout left join cc_files as file on (file.id = playout.file_id)";
|
|
||||||
|
|
||||||
$results = Application_Model_Datatables::findEntries($this->con, $select, $historyTable, $this->opts, "history");
|
private $mDataPropMap = array(
|
||||||
|
"artist" => "file.artist_name",
|
||||||
foreach ($results["history"] as &$row) {
|
"title" => "file.track_title",
|
||||||
$formatter = new LengthFormatter($row['length']);
|
"played" => "playout.played",
|
||||||
$row['length'] = $formatter->format();
|
"length" => "file.length",
|
||||||
}
|
"composer" => "file.composer",
|
||||||
|
"copyright" => "file.copyright",
|
||||||
return $results;
|
);
|
||||||
}
|
|
||||||
}
|
public function __construct($p_startDT, $p_endDT, $p_opts) {
|
||||||
|
|
||||||
|
$this->con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
|
||||||
|
$this->startDT = $p_startDT;
|
||||||
|
$this->endDT = $p_endDT;
|
||||||
|
$this->timezone = date_default_timezone_get();
|
||||||
|
$this->epoch_now = time();
|
||||||
|
$this->opts = $p_opts;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* map front end mDataProp labels to proper column names for searching etc.
|
||||||
|
*/
|
||||||
|
private function translateColumns() {
|
||||||
|
|
||||||
|
for ($i = 0; $i < $this->opts["iColumns"]; $i++){
|
||||||
|
|
||||||
|
$this->opts["mDataProp_{$i}"] = $this->mDataPropMap[$this->opts["mDataProp_{$i}"]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getItems() {
|
||||||
|
|
||||||
|
$this->translateColumns();
|
||||||
|
|
||||||
|
$select = array(
|
||||||
|
"file.track_title as title",
|
||||||
|
"file.artist_name as artist",
|
||||||
|
"playout.played",
|
||||||
|
"playout.file_id",
|
||||||
|
"file.composer",
|
||||||
|
"file.copyright",
|
||||||
|
"file.length"
|
||||||
|
);
|
||||||
|
|
||||||
|
$start = $this->startDT->format("Y-m-d H:i:s");
|
||||||
|
$end = $this->endDT->format("Y-m-d H:i:s");
|
||||||
|
|
||||||
|
$historyTable = "(
|
||||||
|
select count(schedule.file_id) as played, schedule.file_id as file_id
|
||||||
|
from cc_schedule as schedule
|
||||||
|
where schedule.starts >= '{$start}' and schedule.starts < '{$end}'
|
||||||
|
and schedule.playout_status > 0 and schedule.media_item_played != FALSE and schedule.broadcasted = 1
|
||||||
|
group by schedule.file_id
|
||||||
|
)
|
||||||
|
AS playout left join cc_files as file on (file.id = playout.file_id)";
|
||||||
|
|
||||||
|
$results = Application_Model_Datatables::findEntries($this->con, $select, $historyTable, $this->opts, "history");
|
||||||
|
|
||||||
|
foreach ($results["history"] as &$row) {
|
||||||
|
$formatter = new LengthFormatter($row['length']);
|
||||||
|
$row['length'] = $formatter->format();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -61,7 +61,7 @@ class Application_Model_RabbitMq
|
||||||
$channel->close();
|
$channel->close();
|
||||||
$conn->close();
|
$conn->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SendMessageToShowRecorder($event_type)
|
public static function SendMessageToShowRecorder($event_type)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
@ -73,10 +73,10 @@ class Application_Model_RabbitMq
|
||||||
$CC_CONFIG["rabbitmq"]["vhost"]);
|
$CC_CONFIG["rabbitmq"]["vhost"]);
|
||||||
$channel = $conn->channel();
|
$channel = $conn->channel();
|
||||||
$channel->access_request($CC_CONFIG["rabbitmq"]["vhost"], false, false, true, true);
|
$channel->access_request($CC_CONFIG["rabbitmq"]["vhost"], false, false, true, true);
|
||||||
|
|
||||||
$EXCHANGE = 'airtime-pypo';
|
$EXCHANGE = 'airtime-pypo';
|
||||||
$channel->exchange_declare($EXCHANGE, 'direct', false, true);
|
$channel->exchange_declare($EXCHANGE, 'direct', false, true);
|
||||||
|
|
||||||
$now = new DateTime("@".time()); //in UTC timezone
|
$now = new DateTime("@".time()); //in UTC timezone
|
||||||
$end_timestamp = new DateTime("@".(time() + 3600*2)); //in UTC timezone
|
$end_timestamp = new DateTime("@".(time() + 3600*2)); //in UTC timezone
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ class Application_Model_RabbitMq
|
||||||
}
|
}
|
||||||
$data = json_encode($temp);
|
$data = json_encode($temp);
|
||||||
$msg = new AMQPMessage($data, array('content_type' => 'text/plain'));
|
$msg = new AMQPMessage($data, array('content_type' => 'text/plain'));
|
||||||
|
|
||||||
$channel->basic_publish($msg, $EXCHANGE);
|
$channel->basic_publish($msg, $EXCHANGE);
|
||||||
$channel->close();
|
$channel->close();
|
||||||
$conn->close();
|
$conn->close();
|
||||||
|
|
|
@ -81,7 +81,7 @@ class Application_Model_Schedule {
|
||||||
|
|
||||||
/* Alternate SQL...merge conflict and I'm not sure which on is right.... -MK
|
/* Alternate SQL...merge conflict and I'm not sure which on is right.... -MK
|
||||||
$sql = 'Select ft.artist_name, ft.track_title, st.starts as starts, st.ends as ends, st.media_item_played as media_item_played, si.ends as show_ends
|
$sql = 'Select ft.artist_name, ft.track_title, st.starts as starts, st.ends as ends, st.media_item_played as media_item_played, si.ends as show_ends
|
||||||
FROM cc_schedule st LEFT JOIN cc_files ft ON st.file_id = ft.id
|
FROM cc_schedule st LEFT JOIN cc_files ft ON st.file_id = ft.id
|
||||||
WHERE ';
|
WHERE ';
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -231,15 +231,15 @@ class Application_Model_Schedule {
|
||||||
return $row;
|
return $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* @param DateTime $p_startDateTime
|
* @param DateTime $p_startDateTime
|
||||||
*
|
*
|
||||||
* @param DateTime $p_endDateTime
|
* @param DateTime $p_endDateTime
|
||||||
*
|
*
|
||||||
* @return array $scheduledItems
|
* @return array $scheduledItems
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function GetScheduleDetailItems($p_start, $p_end, $p_shows)
|
public static function GetScheduleDetailItems($p_start, $p_end, $p_shows)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
@ -279,7 +279,7 @@ class Application_Model_Schedule {
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= " ORDER BY si.starts, sched.starts;";
|
$sql .= " ORDER BY si.starts, sched.starts;";
|
||||||
|
|
||||||
Logging::debug($sql);
|
Logging::debug($sql);
|
||||||
|
|
||||||
$rows = $con->query($sql)->fetchAll();
|
$rows = $con->query($sql)->fetchAll();
|
||||||
|
@ -297,17 +297,17 @@ class Application_Model_Schedule {
|
||||||
$live_dj = Application_Model_Preference::GetSourceSwitchStatus('live_dj') == 'on'?true:false;
|
$live_dj = Application_Model_Preference::GetSourceSwitchStatus('live_dj') == 'on'?true:false;
|
||||||
$master_dj = Application_Model_Preference::GetSourceSwitchStatus('master_dj') == 'on'?true:false;
|
$master_dj = Application_Model_Preference::GetSourceSwitchStatus('master_dj') == 'on'?true:false;
|
||||||
$scheduled_play = Application_Model_Preference::GetSourceSwitchStatus('scheduled_play') == 'on'?true:false;
|
$scheduled_play = Application_Model_Preference::GetSourceSwitchStatus('scheduled_play') == 'on'?true:false;
|
||||||
|
|
||||||
if(!$live_dj && !$master_dj && $scheduled_play){
|
if(!$live_dj && !$master_dj && $scheduled_play){
|
||||||
$sql .= ", broadcasted=1";
|
$sql .= ", broadcasted=1";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= " WHERE id=$p_id";
|
$sql .= " WHERE id=$p_id";
|
||||||
|
|
||||||
$retVal = $con->exec($sql);
|
$retVal = $con->exec($sql);
|
||||||
return $retVal;
|
return $retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function UpdateBrodcastedStatus($dateTime, $value){
|
public static function UpdateBrodcastedStatus($dateTime, $value){
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
@ -551,7 +551,7 @@ class Application_Model_Schedule {
|
||||||
$data["media"][$kick_start]['end'] = $kick_start;
|
$data["media"][$kick_start]['end'] = $kick_start;
|
||||||
$data["media"][$kick_start]['event_type'] = "kick_out";
|
$data["media"][$kick_start]['event_type'] = "kick_out";
|
||||||
$data["media"][$kick_start]['type'] = "event";
|
$data["media"][$kick_start]['type'] = "event";
|
||||||
|
|
||||||
if($kick_time !== $switch_off_time){
|
if($kick_time !== $switch_off_time){
|
||||||
$switch_start = Application_Model_Schedule::AirtimeTimeToPypoTime($switch_off_time);
|
$switch_start = Application_Model_Schedule::AirtimeTimeToPypoTime($switch_off_time);
|
||||||
$data["media"][$switch_start]['start'] = $switch_start;
|
$data["media"][$switch_start]['start'] = $switch_start;
|
||||||
|
@ -562,16 +562,16 @@ class Application_Model_Schedule {
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($items as $item){
|
foreach ($items as $item){
|
||||||
|
|
||||||
$showInstance = CcShowInstancesQuery::create()->findPK($item["instance_id"]);
|
$showInstance = CcShowInstancesQuery::create()->findPK($item["instance_id"]);
|
||||||
$showId = $showInstance->getDbShowId();
|
$showId = $showInstance->getDbShowId();
|
||||||
$show = CcShowQuery::create()->findPK($showId);
|
$show = CcShowQuery::create()->findPK($showId);
|
||||||
$showName = $show->getDbName();
|
$showName = $show->getDbName();
|
||||||
|
|
||||||
$showEndDateTime = new DateTime($item["show_end"], $utcTimeZone);
|
$showEndDateTime = new DateTime($item["show_end"], $utcTimeZone);
|
||||||
$trackStartDateTime = new DateTime($item["start"], $utcTimeZone);
|
$trackStartDateTime = new DateTime($item["start"], $utcTimeZone);
|
||||||
$trackEndDateTime = new DateTime($item["end"], $utcTimeZone);
|
$trackEndDateTime = new DateTime($item["end"], $utcTimeZone);
|
||||||
|
|
||||||
if ($trackStartDateTime->getTimestamp() > $showEndDateTime->getTimestamp()){
|
if ($trackStartDateTime->getTimestamp() > $showEndDateTime->getTimestamp()){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -584,10 +584,10 @@ class Application_Model_Schedule {
|
||||||
$item["cue_out"] = $di->format("%H:%i:%s").".000";
|
$item["cue_out"] = $di->format("%H:%i:%s").".000";
|
||||||
$item["end"] = $showEndDateTime->format("Y-m-d H:i:s");
|
$item["end"] = $showEndDateTime->format("Y-m-d H:i:s");
|
||||||
}
|
}
|
||||||
|
|
||||||
$storedFile = Application_Model_StoredFile::Recall($item["file_id"]);
|
$storedFile = Application_Model_StoredFile::Recall($item["file_id"]);
|
||||||
$uri = $storedFile->getFilePath();
|
$uri = $storedFile->getFilePath();
|
||||||
|
|
||||||
$start = Application_Model_Schedule::AirtimeTimeToPypoTime($item["start"]);
|
$start = Application_Model_Schedule::AirtimeTimeToPypoTime($item["start"]);
|
||||||
$data["media"][$start] = array(
|
$data["media"][$start] = array(
|
||||||
'id' => $storedFile->getGunid(),
|
'id' => $storedFile->getGunid(),
|
||||||
|
@ -614,7 +614,7 @@ class Application_Model_Schedule {
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
$con->exec("TRUNCATE TABLE ".$CC_CONFIG["scheduleTable"]);
|
$con->exec("TRUNCATE TABLE ".$CC_CONFIG["scheduleTable"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function deleteWithFileId($fileId){
|
public static function deleteWithFileId($fileId){
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
@ -626,18 +626,18 @@ class Application_Model_Schedule {
|
||||||
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
||||||
|
|
||||||
$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');
|
||||||
$formLive->removeDecorator('DtDdWrapper');
|
$formLive->removeDecorator('DtDdWrapper');
|
||||||
|
|
||||||
$p_view->what = $formWhat;
|
$p_view->what = $formWhat;
|
||||||
$p_view->when = $formWhen;
|
$p_view->when = $formWhen;
|
||||||
|
@ -646,7 +646,7 @@ class Application_Model_Schedule {
|
||||||
$p_view->style = $formStyle;
|
$p_view->style = $formStyle;
|
||||||
$p_view->live = $formLive;
|
$p_view->live = $formLive;
|
||||||
|
|
||||||
$formWhat->populate(array('add_show_id' => '-1',
|
$formWhat->populate(array('add_show_id' => '-1',
|
||||||
'add_show_instance_id' => '-1'));
|
'add_show_instance_id' => '-1'));
|
||||||
$formWhen->populate(array('add_show_start_date' => date("Y-m-d"),
|
$formWhen->populate(array('add_show_start_date' => date("Y-m-d"),
|
||||||
'add_show_start_time' => '00:00',
|
'add_show_start_time' => '00:00',
|
||||||
|
@ -671,29 +671,29 @@ class Application_Model_Schedule {
|
||||||
}
|
}
|
||||||
$p_view->addNewShow = true;
|
$p_view->addNewShow = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function is responsible for handling the case where an individual
|
/* This function is responsible for handling the case where an individual
|
||||||
* show instance in a repeating show was edited (via the context menu in the Calendar).
|
* show instance in a repeating show was edited (via the context menu in the Calendar).
|
||||||
* There is still lots of clean-up to do. For example we shouldn't be passing $controller into
|
* There is still lots of clean-up to do. For example we shouldn't be passing $controller into
|
||||||
* this method to manipulate the view (this should be done inside the controller function). With
|
* this method to manipulate the view (this should be done inside the controller function). With
|
||||||
* 2.1 deadline looming, this is OK for now. -Martin */
|
* 2.1 deadline looming, this is OK for now. -Martin */
|
||||||
public static function updateShowInstance($data, $controller){
|
public static function updateShowInstance($data, $controller){
|
||||||
$isSaas = (Application_Model_Preference::GetPlanLevel() != 'disabled');
|
$isSaas = (Application_Model_Preference::GetPlanLevel() != 'disabled');
|
||||||
|
|
||||||
$formWhat = new Application_Form_AddShowWhat();
|
|
||||||
$formWhen = new Application_Form_AddShowWhen();
|
|
||||||
$formRepeats = new Application_Form_AddShowRepeats();
|
|
||||||
$formWho = new Application_Form_AddShowWho();
|
|
||||||
$formStyle = new Application_Form_AddShowStyle();
|
|
||||||
$formLive = new Application_Form_AddShowLiveStream();
|
|
||||||
|
|
||||||
$formWhat->removeDecorator('DtDdWrapper');
|
$formWhat = new Application_Form_AddShowWhat();
|
||||||
$formWhen->removeDecorator('DtDdWrapper');
|
$formWhen = new Application_Form_AddShowWhen();
|
||||||
$formRepeats->removeDecorator('DtDdWrapper');
|
$formRepeats = new Application_Form_AddShowRepeats();
|
||||||
$formWho->removeDecorator('DtDdWrapper');
|
$formWho = new Application_Form_AddShowWho();
|
||||||
$formStyle->removeDecorator('DtDdWrapper');
|
$formStyle = new Application_Form_AddShowStyle();
|
||||||
$formLive->removeDecorator('DtDdWrapper');
|
$formLive = new Application_Form_AddShowLiveStream();
|
||||||
|
|
||||||
|
$formWhat->removeDecorator('DtDdWrapper');
|
||||||
|
$formWhen->removeDecorator('DtDdWrapper');
|
||||||
|
$formRepeats->removeDecorator('DtDdWrapper');
|
||||||
|
$formWho->removeDecorator('DtDdWrapper');
|
||||||
|
$formStyle->removeDecorator('DtDdWrapper');
|
||||||
|
$formLive->removeDecorator('DtDdWrapper');
|
||||||
|
|
||||||
if(!$isSaas){
|
if(!$isSaas){
|
||||||
$formRecord = new Application_Form_AddShowRR();
|
$formRecord = new Application_Form_AddShowRR();
|
||||||
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
|
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
|
||||||
|
@ -704,21 +704,21 @@ class Application_Model_Schedule {
|
||||||
$formRebroadcast->removeDecorator('DtDdWrapper');
|
$formRebroadcast->removeDecorator('DtDdWrapper');
|
||||||
}
|
}
|
||||||
$when = $formWhen->isValid($data);
|
$when = $formWhen->isValid($data);
|
||||||
|
|
||||||
if($when && $formWhen->checkReliantFields($data, true, null, true)) {
|
if($when && $formWhen->checkReliantFields($data, true, null, true)) {
|
||||||
$start_dt = new DateTime($data['add_show_start_date']." ".$data['add_show_start_time'], new DateTimeZone(date_default_timezone_get()));
|
$start_dt = new DateTime($data['add_show_start_date']." ".$data['add_show_start_time'], new DateTimeZone(date_default_timezone_get()));
|
||||||
$start_dt->setTimezone(new DateTimeZone('UTC'));
|
$start_dt->setTimezone(new DateTimeZone('UTC'));
|
||||||
|
|
||||||
$end_dt = new DateTime($data['add_show_end_date_no_repeat']." ".$data['add_show_end_time'], new DateTimeZone(date_default_timezone_get()));
|
$end_dt = new DateTime($data['add_show_end_date_no_repeat']." ".$data['add_show_end_time'], new DateTimeZone(date_default_timezone_get()));
|
||||||
$end_dt->setTimezone(new DateTimeZone('UTC'));
|
$end_dt->setTimezone(new DateTimeZone('UTC'));
|
||||||
|
|
||||||
$ccShowInstance = CcShowInstancesQuery::create()->findPK($data["add_show_instance_id"]);
|
$ccShowInstance = CcShowInstancesQuery::create()->findPK($data["add_show_instance_id"]);
|
||||||
$ccShowInstance->setDbStarts($start_dt);
|
$ccShowInstance->setDbStarts($start_dt);
|
||||||
$ccShowInstance->setDbEnds($end_dt);
|
$ccShowInstance->setDbEnds($end_dt);
|
||||||
$ccShowInstance->save();
|
$ccShowInstance->save();
|
||||||
|
|
||||||
Application_Model_Schedule::createNewFormSections($controller->view);
|
Application_Model_Schedule::createNewFormSections($controller->view);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
$formWhat->disable();
|
$formWhat->disable();
|
||||||
|
@ -727,36 +727,36 @@ class Application_Model_Schedule {
|
||||||
$formWho->disable();
|
$formWho->disable();
|
||||||
$formStyle->disable();
|
$formStyle->disable();
|
||||||
//$formLive->disable();
|
//$formLive->disable();
|
||||||
|
|
||||||
$controller->view->what = $formWhat;
|
$controller->view->what = $formWhat;
|
||||||
$controller->view->when = $formWhen;
|
$controller->view->when = $formWhen;
|
||||||
$controller->view->repeats = $formRepeats;
|
$controller->view->repeats = $formRepeats;
|
||||||
$controller->view->who = $formWho;
|
$controller->view->who = $formWho;
|
||||||
$controller->view->style = $formStyle;
|
$controller->view->style = $formStyle;
|
||||||
$controller->view->live = $formLive;
|
$controller->view->live = $formLive;
|
||||||
if(!$isSaas){
|
if(!$isSaas){
|
||||||
$controller->view->rr = $formRecord;
|
$controller->view->rr = $formRecord;
|
||||||
$controller->view->absoluteRebroadcast = $formAbsoluteRebroadcast;
|
$controller->view->absoluteRebroadcast = $formAbsoluteRebroadcast;
|
||||||
$controller->view->rebroadcast = $formRebroadcast;
|
$controller->view->rebroadcast = $formRebroadcast;
|
||||||
|
|
||||||
//$formRecord->disable();
|
//$formRecord->disable();
|
||||||
//$formAbsoluteRebroadcast->disable();
|
//$formAbsoluteRebroadcast->disable();
|
||||||
//$formRebroadcast->disable();
|
//$formRebroadcast->disable();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function is responsible for handling the case where the entire show (not a single show instance)
|
/* This function is responsible for handling the case where the entire show (not a single show instance)
|
||||||
* was edited (via the context menu in the Calendar).
|
* was edited (via the context menu in the Calendar).
|
||||||
* There is still lots of clean-up to do. For example we shouldn't be passing $controller into
|
* There is still lots of clean-up to do. For example we shouldn't be passing $controller into
|
||||||
* this method to manipulate the view (this should be done inside the controller function). With
|
* this method to manipulate the view (this should be done inside the controller function). With
|
||||||
* 2.1 deadline looming, this is OK for now.
|
* 2.1 deadline looming, this is OK for now.
|
||||||
* Another clean-up is to move all the form manipulation to the proper form class.....
|
* Another clean-up is to move all the form manipulation to the proper form class.....
|
||||||
* -Martin
|
* -Martin
|
||||||
*/
|
*/
|
||||||
public static function addUpdateShow($data, $controller, $validateStartDate, $originalStartDate=null, $update=false, $instanceId=null){
|
public static function addUpdateShow($data, $controller, $validateStartDate, $originalStartDate=null, $update=false, $instanceId=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);
|
||||||
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
||||||
|
@ -765,22 +765,22 @@ class Application_Model_Schedule {
|
||||||
$record = false;
|
$record = false;
|
||||||
|
|
||||||
$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');
|
||||||
$formLive->removeDecorator('DtDdWrapper');
|
$formLive->removeDecorator('DtDdWrapper');
|
||||||
|
|
||||||
$what = $formWhat->isValid($data);
|
$what = $formWhat->isValid($data);
|
||||||
$when = $formWhen->isValid($data);
|
$when = $formWhen->isValid($data);
|
||||||
$live = $formLive->isValid($data);
|
$live = $formLive->isValid($data);
|
||||||
if($when) {
|
if($when) {
|
||||||
$when = $formWhen->checkReliantFields($data, $validateStartDate, $originalStartDate, $update, $instanceId);
|
$when = $formWhen->checkReliantFields($data, $validateStartDate, $originalStartDate, $update, $instanceId);
|
||||||
}
|
}
|
||||||
|
@ -798,11 +798,11 @@ class Application_Model_Schedule {
|
||||||
$mValue = 0;
|
$mValue = 0;
|
||||||
|
|
||||||
if($hPos !== false){
|
if($hPos !== false){
|
||||||
$hValue = trim(substr($data["add_show_duration"], 0, $hPos));
|
$hValue = trim(substr($data["add_show_duration"], 0, $hPos));
|
||||||
}
|
}
|
||||||
if($mPos !== false){
|
if($mPos !== false){
|
||||||
$hPos = $hPos === FALSE ? 0 : $hPos+1;
|
$hPos = $hPos === FALSE ? 0 : $hPos+1;
|
||||||
$mValue = trim(substr($data["add_show_duration"], $hPos, -1 ));
|
$mValue = trim(substr($data["add_show_duration"], $hPos, -1 ));
|
||||||
}
|
}
|
||||||
|
|
||||||
$data["add_show_duration"] = $hValue.":".$mValue;
|
$data["add_show_duration"] = $hValue.":".$mValue;
|
||||||
|
@ -821,7 +821,7 @@ class Application_Model_Schedule {
|
||||||
}
|
}
|
||||||
|
|
||||||
if($data["add_show_repeats"]) {
|
if($data["add_show_repeats"]) {
|
||||||
$repeats = $formRepeats->isValid($data);
|
$repeats = $formRepeats->isValid($data);
|
||||||
if($repeats) {
|
if($repeats) {
|
||||||
$repeats = $formRepeats->checkReliantFields($data);
|
$repeats = $formRepeats->checkReliantFields($data);
|
||||||
}
|
}
|
||||||
|
@ -857,8 +857,8 @@ class Application_Model_Schedule {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$who = $formWho->isValid($data);
|
$who = $formWho->isValid($data);
|
||||||
$style = $formStyle->isValid($data);
|
$style = $formStyle->isValid($data);
|
||||||
if ($what && $when && $repeats && $who && $style && $live) {
|
if ($what && $when && $repeats && $who && $style && $live) {
|
||||||
if(!$isSaas){
|
if(!$isSaas){
|
||||||
if($record && $rebroadAb && $rebroad){
|
if($record && $rebroadAb && $rebroad){
|
||||||
|
@ -882,7 +882,7 @@ class Application_Model_Schedule {
|
||||||
$controller->view->rebroadcast = $formRebroadcast;
|
$controller->view->rebroadcast = $formRebroadcast;
|
||||||
$controller->view->live = $formLive;
|
$controller->view->live = $formLive;
|
||||||
//$controller->view->addNewShow = !$editShow;
|
//$controller->view->addNewShow = !$editShow;
|
||||||
|
|
||||||
//$controller->view->form = $controller->view->render('schedule/add-show-form.phtml');
|
//$controller->view->form = $controller->view->render('schedule/add-show-form.phtml');
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -898,14 +898,14 @@ class Application_Model_Schedule {
|
||||||
//$controller->view->newForm = $controller->view->render('schedule/add-show-form.phtml');
|
//$controller->view->newForm = $controller->view->render('schedule/add-show-form.phtml');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$controller->view->what = $formWhat;
|
$controller->view->what = $formWhat;
|
||||||
$controller->view->when = $formWhen;
|
$controller->view->when = $formWhen;
|
||||||
$controller->view->repeats = $formRepeats;
|
$controller->view->repeats = $formRepeats;
|
||||||
$controller->view->who = $formWho;
|
$controller->view->who = $formWho;
|
||||||
$controller->view->style = $formStyle;
|
$controller->view->style = $formStyle;
|
||||||
$controller->view->live = $formLive;
|
$controller->view->live = $formLive;
|
||||||
|
|
||||||
if(!$isSaas){
|
if(!$isSaas){
|
||||||
$controller->view->rr = $formRecord;
|
$controller->view->rr = $formRecord;
|
||||||
$controller->view->absoluteRebroadcast = $formAbsoluteRebroadcast;
|
$controller->view->absoluteRebroadcast = $formAbsoluteRebroadcast;
|
||||||
|
@ -916,14 +916,14 @@ class Application_Model_Schedule {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function checkOverlappingShows($show_start, $show_end, $update=false, $instanceId=null) {
|
public static function checkOverlappingShows($show_start, $show_end, $update=false, $instanceId=null) {
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
|
||||||
$overlapping = false;
|
$overlapping = false;
|
||||||
|
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
|
||||||
if ($update) {
|
if ($update) {
|
||||||
$sql = "SELECT id, starts, ends FROM ".$CC_CONFIG["showInstances"]."
|
$sql = "SELECT id, starts, ends FROM ".$CC_CONFIG["showInstances"]."
|
||||||
where ends <= '{$show_end->format('Y-m-d H:i:s')}'
|
where ends <= '{$show_end->format('Y-m-d H:i:s')}'
|
||||||
|
@ -933,12 +933,12 @@ class Application_Model_Schedule {
|
||||||
where ends <= '{$show_end->format('Y-m-d H:i:s')}' order by ends";
|
where ends <= '{$show_end->format('Y-m-d H:i:s')}' order by ends";
|
||||||
}
|
}
|
||||||
$rows = $con->query($sql);
|
$rows = $con->query($sql);
|
||||||
|
|
||||||
foreach($rows as $row) {
|
foreach($rows as $row) {
|
||||||
$start = new DateTime($row["starts"], new DateTimeZone('UTC'));
|
$start = new DateTime($row["starts"], new DateTimeZone('UTC'));
|
||||||
$end = new DateTime($row["ends"], new DateTimeZone('UTC'));
|
$end = new DateTime($row["ends"], new DateTimeZone('UTC'));
|
||||||
|
|
||||||
if ($show_start->getTimestamp() < $end->getTimestamp() &&
|
if ($show_start->getTimestamp() < $end->getTimestamp() &&
|
||||||
$show_end->getTimestamp() > $start->getTimestamp()) {
|
$show_end->getTimestamp() > $start->getTimestamp()) {
|
||||||
$overlapping = true;
|
$overlapping = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -12,46 +12,46 @@ class Application_Model_Scheduler {
|
||||||
"fadeout" => "00:00:00",
|
"fadeout" => "00:00:00",
|
||||||
"sched_id" => null,
|
"sched_id" => null,
|
||||||
);
|
);
|
||||||
|
|
||||||
private $epochNow;
|
private $epochNow;
|
||||||
private $nowDT;
|
private $nowDT;
|
||||||
private $user;
|
private $user;
|
||||||
|
|
||||||
private $checkUserPermissions = true;
|
private $checkUserPermissions = true;
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
|
|
||||||
$this->con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
|
$this->con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
|
||||||
|
|
||||||
$this->epochNow = microtime(true);
|
$this->epochNow = microtime(true);
|
||||||
$this->nowDT = DateTime::createFromFormat("U.u", $this->epochNow, new DateTimeZone("UTC"));
|
$this->nowDT = DateTime::createFromFormat("U.u", $this->epochNow, new DateTimeZone("UTC"));
|
||||||
|
|
||||||
if ($this->nowDT === false){
|
if ($this->nowDT === false){
|
||||||
// DateTime::createFromFormat does not support millisecond string formatting in PHP 5.3.2 (Ubuntu 10.04).
|
// DateTime::createFromFormat does not support millisecond string formatting in PHP 5.3.2 (Ubuntu 10.04).
|
||||||
// In PHP 5.3.3 (Ubuntu 10.10), this has been fixed.
|
// In PHP 5.3.3 (Ubuntu 10.10), this has been fixed.
|
||||||
$this->nowDT = DateTime::createFromFormat("U", time(), new DateTimeZone("UTC"));
|
$this->nowDT = DateTime::createFromFormat("U", time(), new DateTimeZone("UTC"));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->user = Application_Model_User::GetCurrentUser();
|
$this->user = Application_Model_User::getCurrentUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setCheckUserPermissions($value) {
|
public function setCheckUserPermissions($value) {
|
||||||
$this->checkUserPermissions = $value;
|
$this->checkUserPermissions = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* make sure any incoming requests for scheduling are ligit.
|
* make sure any incoming requests for scheduling are ligit.
|
||||||
*
|
*
|
||||||
* @param array $items, an array containing pks of cc_schedule items.
|
* @param array $items, an array containing pks of cc_schedule items.
|
||||||
*/
|
*/
|
||||||
private function validateRequest($items) {
|
private function validateRequest($items) {
|
||||||
|
|
||||||
$nowEpoch = floatval($this->nowDT->format("U.u"));
|
$nowEpoch = floatval($this->nowDT->format("U.u"));
|
||||||
|
|
||||||
for ($i = 0; $i < count($items); $i++) {
|
for ($i = 0; $i < count($items); $i++) {
|
||||||
$id = $items[$i]["id"];
|
$id = $items[$i]["id"];
|
||||||
|
|
||||||
//could be added to the beginning of a show, which sends id = 0;
|
//could be added to the beginning of a show, which sends id = 0;
|
||||||
if ($id > 0) {
|
if ($id > 0) {
|
||||||
$schedInfo[$id] = $items[$i]["instance"];
|
$schedInfo[$id] = $items[$i]["instance"];
|
||||||
|
@ -59,11 +59,11 @@ class Application_Model_Scheduler {
|
||||||
|
|
||||||
$instanceInfo[$items[$i]["instance"]] = $items[$i]["timestamp"];
|
$instanceInfo[$items[$i]["instance"]] = $items[$i]["timestamp"];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($instanceInfo) === 0) {
|
if (count($instanceInfo) === 0) {
|
||||||
throw new Exception("Invalid Request.");
|
throw new Exception("Invalid Request.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$schedIds = array();
|
$schedIds = array();
|
||||||
if (isset($schedInfo)) {
|
if (isset($schedInfo)) {
|
||||||
$schedIds = array_keys($schedInfo);
|
$schedIds = array_keys($schedInfo);
|
||||||
|
@ -71,41 +71,41 @@ class Application_Model_Scheduler {
|
||||||
$schedItems = CcScheduleQuery::create()->findPKs($schedIds, $this->con);
|
$schedItems = CcScheduleQuery::create()->findPKs($schedIds, $this->con);
|
||||||
$instanceIds = array_keys($instanceInfo);
|
$instanceIds = array_keys($instanceInfo);
|
||||||
$showInstances = CcShowInstancesQuery::create()->findPKs($instanceIds, $this->con);
|
$showInstances = CcShowInstancesQuery::create()->findPKs($instanceIds, $this->con);
|
||||||
|
|
||||||
//an item has been deleted
|
//an item has been deleted
|
||||||
if (count($schedIds) !== count($schedItems)) {
|
if (count($schedIds) !== count($schedItems)) {
|
||||||
throw new OutDatedScheduleException("The schedule you're viewing is out of date! (sched mismatch)");
|
throw new OutDatedScheduleException("The schedule you're viewing is out of date! (sched mismatch)");
|
||||||
}
|
}
|
||||||
|
|
||||||
//a show has been deleted
|
//a show has been deleted
|
||||||
if (count($instanceIds) !== count($showInstances)) {
|
if (count($instanceIds) !== count($showInstances)) {
|
||||||
throw new OutDatedScheduleException("The schedule you're viewing is out of date! (instance mismatch)");
|
throw new OutDatedScheduleException("The schedule you're viewing is out of date! (instance mismatch)");
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($schedItems as $schedItem) {
|
foreach ($schedItems as $schedItem) {
|
||||||
$id = $schedItem->getDbId();
|
$id = $schedItem->getDbId();
|
||||||
$instance = $schedItem->getCcShowInstances($this->con);
|
$instance = $schedItem->getCcShowInstances($this->con);
|
||||||
|
|
||||||
if (intval($schedInfo[$id]) !== $instance->getDbId()) {
|
if (intval($schedInfo[$id]) !== $instance->getDbId()) {
|
||||||
throw new OutDatedScheduleException("The schedule you're viewing is out of date!");
|
throw new OutDatedScheduleException("The schedule you're viewing is out of date!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($showInstances as $instance) {
|
foreach ($showInstances as $instance) {
|
||||||
|
|
||||||
$id = $instance->getDbId();
|
$id = $instance->getDbId();
|
||||||
$show = $instance->getCcShow($this->con);
|
$show = $instance->getCcShow($this->con);
|
||||||
|
|
||||||
if ($this->checkUserPermissions && $this->user->canSchedule($show->getDbId()) === false) {
|
if ($this->checkUserPermissions && $this->user->canSchedule($show->getDbId()) === false) {
|
||||||
throw new Exception("You are not allowed to schedule show {$show->getDbName()}.");
|
throw new Exception("You are not allowed to schedule show {$show->getDbName()}.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$showEndEpoch = floatval($instance->getDbEnds("U.u"));
|
$showEndEpoch = floatval($instance->getDbEnds("U.u"));
|
||||||
|
|
||||||
if ($showEndEpoch < $nowEpoch) {
|
if ($showEndEpoch < $nowEpoch) {
|
||||||
throw new OutDatedScheduleException("The show {$show->getDbName()} is over and cannot be scheduled.");
|
throw new OutDatedScheduleException("The show {$show->getDbName()} is over and cannot be scheduled.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$ts = intval($instanceInfo[$id]);
|
$ts = intval($instanceInfo[$id]);
|
||||||
$lastSchedTs = intval($instance->getDbLastScheduled("U")) ? : 0;
|
$lastSchedTs = intval($instance->getDbLastScheduled("U")) ? : 0;
|
||||||
if ($ts < $lastSchedTs) {
|
if ($ts < $lastSchedTs) {
|
||||||
|
@ -196,17 +196,17 @@ class Application_Model_Scheduler {
|
||||||
$endEpoch = bcadd($startEpoch , (string) $durationSeconds, 6);
|
$endEpoch = bcadd($startEpoch , (string) $durationSeconds, 6);
|
||||||
|
|
||||||
$dt = DateTime::createFromFormat("U.u", $endEpoch, new DateTimeZone("UTC"));
|
$dt = DateTime::createFromFormat("U.u", $endEpoch, new DateTimeZone("UTC"));
|
||||||
|
|
||||||
if ($dt === false) {
|
if ($dt === false) {
|
||||||
//PHP 5.3.2 problem
|
//PHP 5.3.2 problem
|
||||||
$dt = DateTime::createFromFormat("U", intval($endEpoch), new DateTimeZone("UTC"));
|
$dt = DateTime::createFromFormat("U", intval($endEpoch), new DateTimeZone("UTC"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $dt;
|
return $dt;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function findNextStartTime($DT, $instance) {
|
private function findNextStartTime($DT, $instance) {
|
||||||
|
|
||||||
$sEpoch = $DT->format("U.u");
|
$sEpoch = $DT->format("U.u");
|
||||||
$nEpoch = $this->epochNow;
|
$nEpoch = $this->epochNow;
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ class Application_Model_Scheduler {
|
||||||
//need some kind of placeholder for cc_schedule.
|
//need some kind of placeholder for cc_schedule.
|
||||||
//playout_status will be -1.
|
//playout_status will be -1.
|
||||||
$nextDT = $this->nowDT;
|
$nextDT = $this->nowDT;
|
||||||
|
|
||||||
$length = bcsub($nEpoch , $sEpoch , 6);
|
$length = bcsub($nEpoch , $sEpoch , 6);
|
||||||
$cliplength = Application_Model_Playlist::secondsToPlaylistTime($length);
|
$cliplength = Application_Model_Playlist::secondsToPlaylistTime($length);
|
||||||
|
|
||||||
|
@ -231,10 +231,10 @@ class Application_Model_Scheduler {
|
||||||
else {
|
else {
|
||||||
$nextDT = $DT;
|
$nextDT = $DT;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $nextDT;
|
return $nextDT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @param int $showInstance
|
* @param int $showInstance
|
||||||
* @param array $exclude
|
* @param array $exclude
|
||||||
|
@ -267,7 +267,7 @@ class Application_Model_Scheduler {
|
||||||
|
|
||||||
$itemStartDT = $itemEndDT;
|
$itemStartDT = $itemEndDT;
|
||||||
}
|
}
|
||||||
|
|
||||||
$schedule->save($this->con);
|
$schedule->save($this->con);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,20 +291,20 @@ class Application_Model_Scheduler {
|
||||||
}
|
}
|
||||||
|
|
||||||
$startProfile = microtime(true);
|
$startProfile = microtime(true);
|
||||||
|
|
||||||
foreach ($scheduleItems as $schedule) {
|
foreach ($scheduleItems as $schedule) {
|
||||||
$id = intval($schedule["id"]);
|
$id = intval($schedule["id"]);
|
||||||
|
|
||||||
if ($id !== 0) {
|
if ($id !== 0) {
|
||||||
$schedItem = CcScheduleQuery::create()->findPK($id, $this->con);
|
$schedItem = CcScheduleQuery::create()->findPK($id, $this->con);
|
||||||
$instance = $schedItem->getCcShowInstances($this->con);
|
$instance = $schedItem->getCcShowInstances($this->con);
|
||||||
|
|
||||||
$schedItemEndDT = $schedItem->getDbEnds(null);
|
$schedItemEndDT = $schedItem->getDbEnds(null);
|
||||||
$nextStartDT = $this->findNextStartTime($schedItemEndDT, $instance);
|
$nextStartDT = $this->findNextStartTime($schedItemEndDT, $instance);
|
||||||
}
|
}
|
||||||
//selected empty row to add after
|
//selected empty row to add after
|
||||||
else {
|
else {
|
||||||
|
|
||||||
$instance = CcShowInstancesQuery::create()->findPK($schedule["instance"], $this->con);
|
$instance = CcShowInstancesQuery::create()->findPK($schedule["instance"], $this->con);
|
||||||
|
|
||||||
$showStartDT = $instance->getDbStarts(null);
|
$showStartDT = $instance->getDbStarts(null);
|
||||||
|
@ -316,16 +316,16 @@ class Application_Model_Scheduler {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($adjustSched === true) {
|
if ($adjustSched === true) {
|
||||||
|
|
||||||
$pstart = microtime(true);
|
$pstart = microtime(true);
|
||||||
|
|
||||||
$followingSchedItems = CcScheduleQuery::create()
|
$followingSchedItems = CcScheduleQuery::create()
|
||||||
->filterByDBStarts($nextStartDT->format("Y-m-d H:i:s.u"), Criteria::GREATER_EQUAL)
|
->filterByDBStarts($nextStartDT->format("Y-m-d H:i:s.u"), Criteria::GREATER_EQUAL)
|
||||||
->filterByDbInstanceId($instance->getDbId())
|
->filterByDbInstanceId($instance->getDbId())
|
||||||
->filterByDbId($excludeIds, Criteria::NOT_IN)
|
->filterByDbId($excludeIds, Criteria::NOT_IN)
|
||||||
->orderByDbStarts()
|
->orderByDbStarts()
|
||||||
->find($this->con);
|
->find($this->con);
|
||||||
|
|
||||||
$pend = microtime(true);
|
$pend = microtime(true);
|
||||||
Logging::debug("finding all following items.");
|
Logging::debug("finding all following items.");
|
||||||
Logging::debug(floatval($pend) - floatval($pstart));
|
Logging::debug(floatval($pend) - floatval($pstart));
|
||||||
|
@ -359,26 +359,26 @@ class Application_Model_Scheduler {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($adjustSched === true) {
|
if ($adjustSched === true) {
|
||||||
|
|
||||||
$pstart = microtime(true);
|
$pstart = microtime(true);
|
||||||
|
|
||||||
//recalculate the start/end times after the inserted items.
|
//recalculate the start/end times after the inserted items.
|
||||||
foreach ($followingSchedItems as $item) {
|
foreach ($followingSchedItems as $item) {
|
||||||
|
|
||||||
$endTimeDT = $this->findEndTime($nextStartDT, $item->getDbClipLength());
|
$endTimeDT = $this->findEndTime($nextStartDT, $item->getDbClipLength());
|
||||||
|
|
||||||
$item->setDbStarts($nextStartDT);
|
$item->setDbStarts($nextStartDT);
|
||||||
$item->setDbEnds($endTimeDT);
|
$item->setDbEnds($endTimeDT);
|
||||||
$item->save($this->con);
|
$item->save($this->con);
|
||||||
$nextStartDT = $endTimeDT;
|
$nextStartDT = $endTimeDT;
|
||||||
}
|
}
|
||||||
|
|
||||||
$pend = microtime(true);
|
$pend = microtime(true);
|
||||||
Logging::debug("adjusting all following items.");
|
Logging::debug("adjusting all following items.");
|
||||||
Logging::debug(floatval($pend) - floatval($pstart));
|
Logging::debug(floatval($pend) - floatval($pstart));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$endProfile = microtime(true);
|
$endProfile = microtime(true);
|
||||||
Logging::debug("finished adding scheduled items.");
|
Logging::debug("finished adding scheduled items.");
|
||||||
Logging::debug(floatval($endProfile) - floatval($startProfile));
|
Logging::debug(floatval($endProfile) - floatval($startProfile));
|
||||||
|
@ -389,22 +389,22 @@ class Application_Model_Scheduler {
|
||||||
->find($this->con);
|
->find($this->con);
|
||||||
|
|
||||||
$startProfile = microtime(true);
|
$startProfile = microtime(true);
|
||||||
|
|
||||||
foreach ($instances as $instance) {
|
foreach ($instances as $instance) {
|
||||||
$instance->updateScheduleStatus($this->con);
|
$instance->updateScheduleStatus($this->con);
|
||||||
}
|
}
|
||||||
|
|
||||||
$endProfile = microtime(true);
|
$endProfile = microtime(true);
|
||||||
Logging::debug("updating show instances status.");
|
Logging::debug("updating show instances status.");
|
||||||
Logging::debug(floatval($endProfile) - floatval($startProfile));
|
Logging::debug(floatval($endProfile) - floatval($startProfile));
|
||||||
|
|
||||||
$startProfile = microtime(true);
|
$startProfile = microtime(true);
|
||||||
|
|
||||||
//update the last scheduled timestamp.
|
//update the last scheduled timestamp.
|
||||||
CcShowInstancesQuery::create()
|
CcShowInstancesQuery::create()
|
||||||
->filterByPrimaryKeys($affectedShowInstances)
|
->filterByPrimaryKeys($affectedShowInstances)
|
||||||
->update(array('DbLastScheduled' => new DateTime("now", new DateTimeZone("UTC"))), $this->con);
|
->update(array('DbLastScheduled' => new DateTime("now", new DateTimeZone("UTC"))), $this->con);
|
||||||
|
|
||||||
$endProfile = microtime(true);
|
$endProfile = microtime(true);
|
||||||
Logging::debug("updating last scheduled timestamp.");
|
Logging::debug("updating last scheduled timestamp.");
|
||||||
Logging::debug(floatval($endProfile) - floatval($startProfile));
|
Logging::debug(floatval($endProfile) - floatval($startProfile));
|
||||||
|
@ -426,7 +426,7 @@ class Application_Model_Scheduler {
|
||||||
$schedFiles = array();
|
$schedFiles = array();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$this->validateRequest($scheduleItems);
|
$this->validateRequest($scheduleItems);
|
||||||
|
|
||||||
foreach ($mediaItems as $media) {
|
foreach ($mediaItems as $media) {
|
||||||
|
@ -451,31 +451,31 @@ class Application_Model_Scheduler {
|
||||||
public function moveItem($selectedItems, $afterItems, $adjustSched = true) {
|
public function moveItem($selectedItems, $afterItems, $adjustSched = true) {
|
||||||
|
|
||||||
$startProfile = microtime(true);
|
$startProfile = microtime(true);
|
||||||
|
|
||||||
$this->con->beginTransaction();
|
$this->con->beginTransaction();
|
||||||
$this->con->useDebug(true);
|
$this->con->useDebug(true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$this->validateRequest($selectedItems);
|
$this->validateRequest($selectedItems);
|
||||||
$this->validateRequest($afterItems);
|
$this->validateRequest($afterItems);
|
||||||
|
|
||||||
$endProfile = microtime(true);
|
$endProfile = microtime(true);
|
||||||
Logging::debug("validating move request took:");
|
Logging::debug("validating move request took:");
|
||||||
Logging::debug(floatval($endProfile) - floatval($startProfile));
|
Logging::debug(floatval($endProfile) - floatval($startProfile));
|
||||||
|
|
||||||
$afterInstance = CcShowInstancesQuery::create()->findPK($afterItems[0]["instance"], $this->con);
|
$afterInstance = CcShowInstancesQuery::create()->findPK($afterItems[0]["instance"], $this->con);
|
||||||
|
|
||||||
//map show instances to cc_schedule primary keys.
|
//map show instances to cc_schedule primary keys.
|
||||||
$modifiedMap = array();
|
$modifiedMap = array();
|
||||||
$movedData = array();
|
$movedData = array();
|
||||||
|
|
||||||
//prepare each of the selected items.
|
//prepare each of the selected items.
|
||||||
for ($i = 0; $i < count($selectedItems); $i++) {
|
for ($i = 0; $i < count($selectedItems); $i++) {
|
||||||
|
|
||||||
$selected = CcScheduleQuery::create()->findPk($selectedItems[$i]["id"], $this->con);
|
$selected = CcScheduleQuery::create()->findPk($selectedItems[$i]["id"], $this->con);
|
||||||
$selectedInstance = $selected->getCcShowInstances($this->con);
|
$selectedInstance = $selected->getCcShowInstances($this->con);
|
||||||
|
|
||||||
$data = $this->fileInfo;
|
$data = $this->fileInfo;
|
||||||
$data["id"] = $selected->getDbFileId();
|
$data["id"] = $selected->getDbFileId();
|
||||||
$data["cliplength"] = $selected->getDbClipLength();
|
$data["cliplength"] = $selected->getDbClipLength();
|
||||||
|
@ -484,48 +484,48 @@ class Application_Model_Scheduler {
|
||||||
$data["fadein"] = $selected->getDbFadeIn();
|
$data["fadein"] = $selected->getDbFadeIn();
|
||||||
$data["fadeout"] = $selected->getDbFadeOut();
|
$data["fadeout"] = $selected->getDbFadeOut();
|
||||||
$data["sched_id"] = $selected->getDbId();
|
$data["sched_id"] = $selected->getDbId();
|
||||||
|
|
||||||
$movedData[] = $data;
|
$movedData[] = $data;
|
||||||
|
|
||||||
//figure out which items must be removed from calculated show times.
|
//figure out which items must be removed from calculated show times.
|
||||||
$showInstanceId = $selectedInstance->getDbId();
|
$showInstanceId = $selectedInstance->getDbId();
|
||||||
$schedId = $selected->getDbId();
|
$schedId = $selected->getDbId();
|
||||||
if (isset($modifiedMap[$showInstanceId])) {
|
if (isset($modifiedMap[$showInstanceId])) {
|
||||||
array_push($modifiedMap[$showInstanceId], $schedId);
|
array_push($modifiedMap[$showInstanceId], $schedId);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$modifiedMap[$showInstanceId] = array($schedId);
|
$modifiedMap[$showInstanceId] = array($schedId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//calculate times excluding the to be moved items.
|
//calculate times excluding the to be moved items.
|
||||||
foreach ($modifiedMap as $instance => $schedIds) {
|
foreach ($modifiedMap as $instance => $schedIds) {
|
||||||
$startProfile = microtime(true);
|
$startProfile = microtime(true);
|
||||||
|
|
||||||
$this->removeGaps($instance, $schedIds);
|
$this->removeGaps($instance, $schedIds);
|
||||||
|
|
||||||
$endProfile = microtime(true);
|
$endProfile = microtime(true);
|
||||||
Logging::debug("removing gaps from instance $instance:");
|
Logging::debug("removing gaps from instance $instance:");
|
||||||
Logging::debug(floatval($endProfile) - floatval($startProfile));
|
Logging::debug(floatval($endProfile) - floatval($startProfile));
|
||||||
}
|
}
|
||||||
|
|
||||||
$startProfile = microtime(true);
|
$startProfile = microtime(true);
|
||||||
|
|
||||||
$this->insertAfter($afterItems, $movedData, $adjustSched);
|
$this->insertAfter($afterItems, $movedData, $adjustSched);
|
||||||
|
|
||||||
$endProfile = microtime(true);
|
$endProfile = microtime(true);
|
||||||
Logging::debug("inserting after removing gaps.");
|
Logging::debug("inserting after removing gaps.");
|
||||||
Logging::debug(floatval($endProfile) - floatval($startProfile));
|
Logging::debug(floatval($endProfile) - floatval($startProfile));
|
||||||
|
|
||||||
$afterInstanceId = $afterInstance->getDbId();
|
$afterInstanceId = $afterInstance->getDbId();
|
||||||
$modified = array_keys($modifiedMap);
|
$modified = array_keys($modifiedMap);
|
||||||
//need to adjust shows we have moved items from.
|
//need to adjust shows we have moved items from.
|
||||||
foreach($modified as $instanceId) {
|
foreach($modified as $instanceId) {
|
||||||
|
|
||||||
$instance = CcShowInstancesQuery::create()->findPK($instanceId, $this->con);
|
$instance = CcShowInstancesQuery::create()->findPK($instanceId, $this->con);
|
||||||
$instance->updateScheduleStatus($this->con);
|
$instance->updateScheduleStatus($this->con);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->con->useDebug(false);
|
$this->con->useDebug(false);
|
||||||
$this->con->commit();
|
$this->con->commit();
|
||||||
|
|
||||||
|
@ -543,9 +543,9 @@ class Application_Model_Scheduler {
|
||||||
$this->con->beginTransaction();
|
$this->con->beginTransaction();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$this->validateRequest($scheduledItems);
|
$this->validateRequest($scheduledItems);
|
||||||
|
|
||||||
$scheduledIds = array();
|
$scheduledIds = array();
|
||||||
foreach ($scheduledItems as $item) {
|
foreach ($scheduledItems as $item) {
|
||||||
$scheduledIds[] = $item["id"];
|
$scheduledIds[] = $item["id"];
|
||||||
|
@ -555,25 +555,25 @@ class Application_Model_Scheduler {
|
||||||
|
|
||||||
//check to make sure all items selected are up to date
|
//check to make sure all items selected are up to date
|
||||||
foreach ($removedItems as $removedItem) {
|
foreach ($removedItems as $removedItem) {
|
||||||
|
|
||||||
$instance = $removedItem->getCcShowInstances($this->con);
|
$instance = $removedItem->getCcShowInstances($this->con);
|
||||||
|
|
||||||
//check to truncate the currently playing item instead of deleting it.
|
//check to truncate the currently playing item instead of deleting it.
|
||||||
if ($removedItem->isCurrentItem($this->epochNow)) {
|
if ($removedItem->isCurrentItem($this->epochNow)) {
|
||||||
|
|
||||||
$nEpoch = $this->epochNow;
|
$nEpoch = $this->epochNow;
|
||||||
$sEpoch = $removedItem->getDbStarts('U.u');
|
$sEpoch = $removedItem->getDbStarts('U.u');
|
||||||
|
|
||||||
$length = bcsub($nEpoch , $sEpoch , 6);
|
$length = bcsub($nEpoch , $sEpoch , 6);
|
||||||
$cliplength = Application_Model_Playlist::secondsToPlaylistTime($length);
|
$cliplength = Application_Model_Playlist::secondsToPlaylistTime($length);
|
||||||
|
|
||||||
$cueinSec = Application_Model_Playlist::playlistTimeToSeconds($removedItem->getDbCueIn());
|
$cueinSec = Application_Model_Playlist::playlistTimeToSeconds($removedItem->getDbCueIn());
|
||||||
$cueOutSec = bcadd($cueinSec , $length, 6);
|
$cueOutSec = bcadd($cueinSec , $length, 6);
|
||||||
$cueout = Application_Model_Playlist::secondsToPlaylistTime($cueOutSec);
|
$cueout = Application_Model_Playlist::secondsToPlaylistTime($cueOutSec);
|
||||||
|
|
||||||
$removedItem->setDbCueOut($cueout)
|
$removedItem->setDbCueOut($cueout)
|
||||||
->setDbClipLength($cliplength)
|
->setDbClipLength($cliplength)
|
||||||
->setDbEnds($this->nowDT)
|
->setDbEnds($this->nowDT)
|
||||||
->save($this->con);
|
->save($this->con);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -619,27 +619,27 @@ class Application_Model_Scheduler {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Used for cancelling the current show instance.
|
* Used for cancelling the current show instance.
|
||||||
*
|
*
|
||||||
* @param $p_id id of the show instance to cancel.
|
* @param $p_id id of the show instance to cancel.
|
||||||
*/
|
*/
|
||||||
public function cancelShow($p_id) {
|
public function cancelShow($p_id) {
|
||||||
|
|
||||||
$this->con->beginTransaction();
|
$this->con->beginTransaction();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$instance = CcShowInstancesQuery::create()->findPK($p_id);
|
$instance = CcShowInstancesQuery::create()->findPK($p_id);
|
||||||
|
|
||||||
if (!$instance->getDbRecord()) {
|
if (!$instance->getDbRecord()) {
|
||||||
|
|
||||||
$items = CcScheduleQuery::create()
|
$items = CcScheduleQuery::create()
|
||||||
->filterByDbInstanceId($p_id)
|
->filterByDbInstanceId($p_id)
|
||||||
->filterByDbEnds($this->nowDT, Criteria::GREATER_THAN)
|
->filterByDbEnds($this->nowDT, Criteria::GREATER_THAN)
|
||||||
->find($this->con);
|
->find($this->con);
|
||||||
|
|
||||||
if (count($items) > 0) {
|
if (count($items) > 0) {
|
||||||
$remove = array();
|
$remove = array();
|
||||||
$ts = $this->nowDT->format('U');
|
$ts = $this->nowDT->format('U');
|
||||||
|
@ -657,12 +657,12 @@ class Application_Model_Scheduler {
|
||||||
$rebroadcasts = $instance->getCcShowInstancessRelatedByDbId(null, $this->con);
|
$rebroadcasts = $instance->getCcShowInstancessRelatedByDbId(null, $this->con);
|
||||||
$rebroadcasts->delete($this->con);
|
$rebroadcasts->delete($this->con);
|
||||||
}
|
}
|
||||||
|
|
||||||
$instance->setDbEnds($this->nowDT);
|
$instance->setDbEnds($this->nowDT);
|
||||||
$instance->save($this->con);
|
$instance->save($this->con);
|
||||||
|
|
||||||
$this->con->commit();
|
$this->con->commit();
|
||||||
|
|
||||||
if ($instance->getDbRecord()) {
|
if ($instance->getDbRecord()) {
|
||||||
Application_Model_RabbitMq::SendMessageToShowRecorder("cancel_recording");
|
Application_Model_RabbitMq::SendMessageToShowRecorder("cancel_recording");
|
||||||
}
|
}
|
||||||
|
@ -670,7 +670,7 @@ class Application_Model_Scheduler {
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
$this->con->rollback();
|
$this->con->rollback();
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ class Application_Model_ServiceRegister {
|
||||||
if ($p_ipAddress == "::1"){
|
if ($p_ipAddress == "::1"){
|
||||||
$p_ipAddress = "127.0.0.1";
|
$p_ipAddress = "127.0.0.1";
|
||||||
}
|
}
|
||||||
|
|
||||||
$component->setDbIp($p_ipAddress);
|
$component->setDbIp($p_ipAddress);
|
||||||
$component->save();
|
$component->save();
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,25 +21,25 @@ class Application_Model_Show {
|
||||||
$show->setDbName($name);
|
$show->setDbName($name);
|
||||||
Application_Model_RabbitMq::PushSchedule();
|
Application_Model_RabbitMq::PushSchedule();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setAirtimeAuthFlag($flag){
|
public function setAirtimeAuthFlag($flag){
|
||||||
$show = CcShowQuery::create()->findPK($this->_showId);
|
$show = CcShowQuery::create()->findPK($this->_showId);
|
||||||
$show->setDbLiveStreamUsingAirtimeAuth($flag);
|
$show->setDbLiveStreamUsingAirtimeAuth($flag);
|
||||||
$show->save();
|
$show->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setCustomAuthFlag($flag){
|
public function setCustomAuthFlag($flag){
|
||||||
$show = CcShowQuery::create()->findPK($this->_showId);
|
$show = CcShowQuery::create()->findPK($this->_showId);
|
||||||
$show->setDbLiveStreamUsingCustomAuth($flag);
|
$show->setDbLiveStreamUsingCustomAuth($flag);
|
||||||
$show->save();
|
$show->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setCustomUsername($username){
|
public function setCustomUsername($username){
|
||||||
$show = CcShowQuery::create()->findPK($this->_showId);
|
$show = CcShowQuery::create()->findPK($this->_showId);
|
||||||
$show->setDbLiveStreamUser($username);
|
$show->setDbLiveStreamUser($username);
|
||||||
$show->save();
|
$show->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setCustomPassword($password){
|
public function setCustomPassword($password){
|
||||||
$show = CcShowQuery::create()->findPK($this->_showId);
|
$show = CcShowQuery::create()->findPK($this->_showId);
|
||||||
$show->setDbLiveStreamPass($password);
|
$show->setDbLiveStreamPass($password);
|
||||||
|
@ -303,8 +303,6 @@ class Application_Model_Show {
|
||||||
." AND starts > TIMESTAMP '$timestamp'"
|
." AND starts > TIMESTAMP '$timestamp'"
|
||||||
." AND show_id = $showId";
|
." AND show_id = $showId";
|
||||||
|
|
||||||
//Logging::log($sql);
|
|
||||||
|
|
||||||
$con->exec($sql);
|
$con->exec($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -557,7 +555,7 @@ class Application_Model_Show {
|
||||||
|
|
||||||
$con->exec($sql);
|
$con->exec($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the start date of the current show in UTC timezone.
|
* Get the start date of the current show in UTC timezone.
|
||||||
*
|
*
|
||||||
|
@ -594,8 +592,8 @@ class Application_Model_Show {
|
||||||
* The start date in the format YYYY-MM-DD
|
* The start date in the format YYYY-MM-DD
|
||||||
*/
|
*/
|
||||||
public function getStartDate(){
|
public function getStartDate(){
|
||||||
list($date,) = explode(" ", $this->getStartDateAndTime());
|
list($date,) = explode(" ", $this->getStartDateAndTime());
|
||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -606,8 +604,8 @@ class Application_Model_Show {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function getStartTime(){
|
public function getStartTime(){
|
||||||
list(,$time) = explode(" ", $this->getStartDateAndTime());
|
list(,$time) = explode(" ", $this->getStartDateAndTime());
|
||||||
return $time;
|
return $time;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1251,8 +1249,8 @@ class Application_Model_Show {
|
||||||
$rebroadcasts = $con->query($sql)->fetchAll();
|
$rebroadcasts = $con->query($sql)->fetchAll();
|
||||||
|
|
||||||
if ($showInstance->isRecorded()){
|
if ($showInstance->isRecorded()){
|
||||||
$showInstance->deleteRebroadcasts();
|
$showInstance->deleteRebroadcasts();
|
||||||
self::createRebroadcastInstances($rebroadcasts, $currentUtcTimestamp, $show_id, $show_instance_id, $start, $duration, $timezone);
|
self::createRebroadcastInstances($rebroadcasts, $currentUtcTimestamp, $show_id, $show_instance_id, $start, $duration, $timezone);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1307,13 +1305,13 @@ class Application_Model_Show {
|
||||||
|
|
||||||
if ($show->hasInstanceOnDate($utcStartDateTime)){
|
if ($show->hasInstanceOnDate($utcStartDateTime)){
|
||||||
$ccShowInstance = $show->getInstanceOnDate($utcStartDateTime);
|
$ccShowInstance = $show->getInstanceOnDate($utcStartDateTime);
|
||||||
|
|
||||||
if ($ccShowInstance->getDbModifiedInstance()){
|
if ($ccShowInstance->getDbModifiedInstance()){
|
||||||
//show instance on this date has been deleted.
|
//show instance on this date has been deleted.
|
||||||
list($start, $utcStartDateTime) = self::advanceRepeatingDate($p_interval, $start, $timezone);
|
list($start, $utcStartDateTime) = self::advanceRepeatingDate($p_interval, $start, $timezone);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$newInstance = false;
|
$newInstance = false;
|
||||||
} else {
|
} else {
|
||||||
$ccShowInstance = new CcShowInstances();
|
$ccShowInstance = new CcShowInstances();
|
||||||
|
@ -1349,7 +1347,7 @@ class Application_Model_Show {
|
||||||
|
|
||||||
Application_Model_Show::setNextPop($start, $show_id, $day);
|
Application_Model_Show::setNextPop($start, $show_id, $day);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function advanceRepeatingDate($p_interval, $start, $timezone){
|
private static function advanceRepeatingDate($p_interval, $start, $timezone){
|
||||||
$startDt = new DateTime($start, new DateTimeZone($timezone));
|
$startDt = new DateTime($start, new DateTimeZone($timezone));
|
||||||
if ($p_interval == 'P1M'){
|
if ($p_interval == 'P1M'){
|
||||||
|
@ -1369,19 +1367,19 @@ class Application_Model_Show {
|
||||||
do {
|
do {
|
||||||
$dt->add(new DateInterval($p_interval));
|
$dt->add(new DateInterval($p_interval));
|
||||||
} while(!checkdate($dt->format("m"), $startDt->format("d"), $dt->format("Y")));
|
} while(!checkdate($dt->format("m"), $startDt->format("d"), $dt->format("Y")));
|
||||||
|
|
||||||
$dt->setDate($dt->format("Y"), $dt->format("m"), $startDt->format("d"));
|
$dt->setDate($dt->format("Y"), $dt->format("m"), $startDt->format("d"));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$dt = new DateTime($start, new DateTimeZone($timezone));
|
$dt = new DateTime($start, new DateTimeZone($timezone));
|
||||||
$dt->add(new DateInterval($p_interval));
|
$dt->add(new DateInterval($p_interval));
|
||||||
}
|
}
|
||||||
|
|
||||||
$start = $dt->format("Y-m-d H:i:s");
|
$start = $dt->format("Y-m-d H:i:s");
|
||||||
|
|
||||||
$dt->setTimezone(new DateTimeZone('UTC'));
|
$dt->setTimezone(new DateTimeZone('UTC'));
|
||||||
$utcStartDateTime = $dt;
|
$utcStartDateTime = $dt;
|
||||||
|
|
||||||
return array($start, $utcStartDateTime);
|
return array($start, $utcStartDateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1585,7 +1583,7 @@ class Application_Model_Show {
|
||||||
$days = $interval->format('%a');
|
$days = $interval->format('%a');
|
||||||
$shows = Application_Model_Show::getShows($p_start, $p_end);
|
$shows = Application_Model_Show::getShows($p_start, $p_end);
|
||||||
$nowEpoch = time();
|
$nowEpoch = time();
|
||||||
|
|
||||||
foreach ($shows as $show) {
|
foreach ($shows as $show) {
|
||||||
$options = array();
|
$options = array();
|
||||||
|
|
||||||
|
@ -1594,14 +1592,14 @@ class Application_Model_Show {
|
||||||
if (intval($days) <= 7) {
|
if (intval($days) <= 7) {
|
||||||
$options["percent"] = Application_Model_Show::getPercentScheduled($show["starts"], $show["ends"], $show["time_filled"]);
|
$options["percent"] = Application_Model_Show::getPercentScheduled($show["starts"], $show["ends"], $show["time_filled"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($show["parent_starts"])) {
|
if (isset($show["parent_starts"])) {
|
||||||
$parentStartsDT = new DateTime($show["parent_starts"], new DateTimeZone("UTC"));
|
$parentStartsDT = new DateTime($show["parent_starts"], new DateTimeZone("UTC"));
|
||||||
$parentStartsEpoch = intval($parentStartsDT->format("U"));
|
$parentStartsEpoch = intval($parentStartsDT->format("U"));
|
||||||
}
|
}
|
||||||
$startsDT = new DateTime($show["starts"], new DateTimeZone("UTC"));
|
$startsDT = new DateTime($show["starts"], new DateTimeZone("UTC"));
|
||||||
$endsDT = new DateTime($show["ends"], new DateTimeZone("UTC"));
|
$endsDT = new DateTime($show["ends"], new DateTimeZone("UTC"));
|
||||||
|
|
||||||
$startsEpoch = intval($startsDT->format("U"));
|
$startsEpoch = intval($startsDT->format("U"));
|
||||||
$endsEpoch = intval($endsDT->format("U"));
|
$endsEpoch = intval($endsDT->format("U"));
|
||||||
|
|
||||||
|
@ -1689,7 +1687,7 @@ class Application_Model_Show {
|
||||||
$showDay = CcShowDaysQuery::create()
|
$showDay = CcShowDaysQuery::create()
|
||||||
->filterByDbShowId($this->_showId)
|
->filterByDbShowId($this->_showId)
|
||||||
->findOne();
|
->findOne();
|
||||||
|
|
||||||
$showDay->setDbFirstShow($dt)->setDbStartTime($dt)
|
$showDay->setDbFirstShow($dt)->setDbStartTime($dt)
|
||||||
->save();
|
->save();
|
||||||
|
|
||||||
|
@ -1730,10 +1728,11 @@ class Application_Model_Show {
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
if($timeNow == null){
|
if($timeNow == null){
|
||||||
$date = new Application_Common_DateHelper;
|
$date = new Application_Common_DateHelper;
|
||||||
$timeNow = $date->getUtcTimestamp();
|
$timeNow = $date->getUtcTimestamp();
|
||||||
}
|
}
|
||||||
//TODO, returning starts + ends twice (once with an alias). Unify this after the 2.0 release. --Martin
|
//TODO, returning starts + ends twice (once with an alias). Unify this after the 2.0 release. --Martin
|
||||||
$sql = "SELECT si.starts as start_timestamp, si.ends as end_timestamp, s.name, s.id, si.id as instance_id, si.record, s.url, starts, ends"
|
$sql = "SELECT si.starts as start_timestamp, si.ends as end_timestamp, s.name,"
|
||||||
|
." s.id, si.id as instance_id, si.record, s.url, starts, ends"
|
||||||
." FROM $CC_CONFIG[showInstances] si, $CC_CONFIG[showTable] s"
|
." FROM $CC_CONFIG[showInstances] si, $CC_CONFIG[showTable] s"
|
||||||
." WHERE si.show_id = s.id"
|
." WHERE si.show_id = s.id"
|
||||||
." AND si.starts <= TIMESTAMP '$timeNow'"
|
." AND si.starts <= TIMESTAMP '$timeNow'"
|
||||||
|
@ -1746,21 +1745,23 @@ class Application_Model_Show {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the current show, previous and next with an 2day window from the given timeNow, so timeNow-2days and timeNow+2days.
|
* Gets the current show, previous and next with an 2day window from
|
||||||
|
* the given timeNow, so timeNow-2days and timeNow+2days.
|
||||||
*/
|
*/
|
||||||
public static function getPrevCurrentNext($p_timeNow)
|
public static function getPrevCurrentNext($p_timeNow)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
//TODO, returning starts + ends twice (once with an alias). Unify this after the 2.0 release. --Martin
|
//TODO, returning starts + ends twice (once with an alias). Unify this after the 2.0 release. --Martin
|
||||||
$sql = "SELECT si.starts as start_timestamp, si.ends as end_timestamp, s.name, s.id, si.id as instance_id, si.record, s.url, starts, ends"
|
$sql = "SELECT si.starts as start_timestamp, si.ends as end_timestamp, s.name,"
|
||||||
|
." s.id, si.id as instance_id, si.record, s.url, starts, ends"
|
||||||
." FROM $CC_CONFIG[showInstances] si, $CC_CONFIG[showTable] s"
|
." FROM $CC_CONFIG[showInstances] si, $CC_CONFIG[showTable] s"
|
||||||
." WHERE si.show_id = s.id"
|
." WHERE si.show_id = s.id"
|
||||||
." AND si.starts > TIMESTAMP '$p_timeNow' - INTERVAL '2 days'"
|
." AND si.starts > TIMESTAMP '$p_timeNow' - INTERVAL '2 days'"
|
||||||
." AND si.ends < TIMESTAMP '$p_timeNow' + INTERVAL '2 days'"
|
." AND si.ends < TIMESTAMP '$p_timeNow' + INTERVAL '2 days'"
|
||||||
." AND modified_instance != TRUE"
|
." AND modified_instance != TRUE"
|
||||||
." ORDER BY si.starts";
|
." ORDER BY si.starts";
|
||||||
|
|
||||||
$rows = $con->query($sql)->fetchAll(PDO::FETCH_ASSOC);
|
$rows = $con->query($sql)->fetchAll(PDO::FETCH_ASSOC);
|
||||||
$numberOfRows = count($rows);
|
$numberOfRows = count($rows);
|
||||||
|
|
||||||
|
@ -1770,10 +1771,11 @@ class Application_Model_Show {
|
||||||
|
|
||||||
$timeNowAsMillis = strtotime($p_timeNow);
|
$timeNowAsMillis = strtotime($p_timeNow);
|
||||||
|
|
||||||
for( $i = 0; $i < $numberOfRows; ++$i ){
|
for ($i = 0; $i < $numberOfRows; ++$i) {
|
||||||
//Find the show that is within the current time.
|
//Find the show that is within the current time.
|
||||||
if ((strtotime($rows[$i]['starts']) <= $timeNowAsMillis) && (strtotime($rows[$i]['ends']) > $timeNowAsMillis)){
|
if ((strtotime($rows[$i]['starts']) <= $timeNowAsMillis)
|
||||||
if ( $i - 1 >= 0){
|
&& (strtotime($rows[$i]['ends']) > $timeNowAsMillis)) {
|
||||||
|
if ($i-1 >= 0) {
|
||||||
$results['previousShow'][0] = array(
|
$results['previousShow'][0] = array(
|
||||||
"id"=>$rows[$i-1]['id'],
|
"id"=>$rows[$i-1]['id'],
|
||||||
"instance_id"=>$rows[$i-1]['instance_id'],
|
"instance_id"=>$rows[$i-1]['instance_id'],
|
||||||
|
@ -1789,7 +1791,7 @@ class Application_Model_Show {
|
||||||
|
|
||||||
$results['currentShow'][0] = $rows[$i];
|
$results['currentShow'][0] = $rows[$i];
|
||||||
|
|
||||||
if ( isset($rows[$i+1])){
|
if (isset($rows[$i+1])) {
|
||||||
$results['nextShow'][0] = array(
|
$results['nextShow'][0] = array(
|
||||||
"id"=>$rows[$i+1]['id'],
|
"id"=>$rows[$i+1]['id'],
|
||||||
"instance_id"=>$rows[$i+1]['instance_id'],
|
"instance_id"=>$rows[$i+1]['instance_id'],
|
||||||
|
@ -1801,7 +1803,6 @@ class Application_Model_Show {
|
||||||
"ends"=>$rows[$i+1]['ends'],
|
"ends"=>$rows[$i+1]['ends'],
|
||||||
"record"=>$rows[$i+1]['record'],
|
"record"=>$rows[$i+1]['record'],
|
||||||
"type"=>"show");
|
"type"=>"show");
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1839,7 +1840,7 @@ class Application_Model_Show {
|
||||||
"record"=>$rows[$previousShowIndex]['record'],
|
"record"=>$rows[$previousShowIndex]['record'],
|
||||||
"type"=>"show");
|
"type"=>"show");
|
||||||
}
|
}
|
||||||
|
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1855,7 +1856,7 @@ class Application_Model_Show {
|
||||||
* @param String $timeEnd - interval end time (in UTC)
|
* @param String $timeEnd - interval end time (in UTC)
|
||||||
* @return array - the next $limit number of shows within the time interval
|
* @return array - the next $limit number of shows within the time interval
|
||||||
*/
|
*/
|
||||||
public static function GetNextShows($timeStart, $limit = "0", $timeEnd = "")
|
public static function getNextShows($timeStart, $limit = "0", $timeEnd = "")
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
@ -1878,7 +1879,7 @@ class Application_Model_Show {
|
||||||
." ORDER BY si.starts";
|
." ORDER BY si.starts";
|
||||||
|
|
||||||
// defaults to retrieve all shows within the interval if $limit not set
|
// defaults to retrieve all shows within the interval if $limit not set
|
||||||
if($limit != "0") {
|
if ($limit != "0") {
|
||||||
$sql = $sql . " LIMIT $limit";
|
$sql = $sql . " LIMIT $limit";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1893,20 +1894,22 @@ class Application_Model_Show {
|
||||||
* @param type $rows arrays of arrays containing database query result
|
* @param type $rows arrays of arrays containing database query result
|
||||||
* @param type $columnsToConvert array of column names to convert
|
* @param type $columnsToConvert array of column names to convert
|
||||||
*/
|
*/
|
||||||
public static function ConvertToLocalTimeZone(&$rows, $columnsToConvert) {
|
public static function convertToLocalTimeZone(&$rows, $columnsToConvert)
|
||||||
|
{
|
||||||
$timezone = date_default_timezone_get();
|
$timezone = date_default_timezone_get();
|
||||||
|
|
||||||
if (!is_array($rows)) {
|
if (!is_array($rows)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
foreach($rows as &$row) {
|
foreach ($rows as &$row) {
|
||||||
foreach($columnsToConvert as $column) {
|
foreach ($columnsToConvert as $column) {
|
||||||
$row[$column] = Application_Common_DateHelper::ConvertToLocalDateTimeString($row[$column]);
|
$row[$column] = Application_Common_DateHelper::ConvertToLocalDateTimeString($row[$column]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetMaxLengths() {
|
public static function getMaxLengths()
|
||||||
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
|
||||||
|
|
|
@ -14,14 +14,14 @@ class Application_Model_ShowBuilder {
|
||||||
|
|
||||||
private $user;
|
private $user;
|
||||||
private $opts;
|
private $opts;
|
||||||
|
|
||||||
private $pos;
|
private $pos;
|
||||||
private $contentDT;
|
private $contentDT;
|
||||||
private $epoch_now;
|
private $epoch_now;
|
||||||
private $currentShow;
|
private $currentShow;
|
||||||
|
|
||||||
private $showInstances = array();
|
private $showInstances = array();
|
||||||
|
|
||||||
private $defaultRowArray = array(
|
private $defaultRowArray = array(
|
||||||
"header" => false,
|
"header" => false,
|
||||||
"footer" => false,
|
"footer" => false,
|
||||||
|
@ -54,16 +54,16 @@ class Application_Model_ShowBuilder {
|
||||||
$this->startDT = $p_startDT;
|
$this->startDT = $p_startDT;
|
||||||
$this->endDT = $p_endDT;
|
$this->endDT = $p_endDT;
|
||||||
$this->timezone = date_default_timezone_get();
|
$this->timezone = date_default_timezone_get();
|
||||||
$this->user = Application_Model_User::GetCurrentUser();
|
$this->user = Application_Model_User::getCurrentUser();
|
||||||
$this->opts = $p_opts;
|
$this->opts = $p_opts;
|
||||||
$this->epoch_now = floatval(microtime(true));
|
$this->epoch_now = floatval(microtime(true));
|
||||||
$this->currentShow = false;
|
$this->currentShow = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getUsersShows() {
|
private function getUsersShows() {
|
||||||
|
|
||||||
$shows = array();
|
$shows = array();
|
||||||
|
|
||||||
$host_shows = CcShowHostsQuery::create()
|
$host_shows = CcShowHostsQuery::create()
|
||||||
->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)
|
->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)
|
||||||
->filterByDbHost($this->user->getId())
|
->filterByDbHost($this->user->getId())
|
||||||
|
@ -72,7 +72,7 @@ class Application_Model_ShowBuilder {
|
||||||
foreach ($host_shows as $host_show) {
|
foreach ($host_shows as $host_show) {
|
||||||
$shows[] = $host_show->getDbShow();
|
$shows[] = $host_show->getDbShow();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $shows;
|
return $shows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,15 +84,15 @@ class Application_Model_ShowBuilder {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->user->canSchedule($p_item["show_id"]) == true) {
|
if ($this->user->canSchedule($p_item["show_id"]) == true) {
|
||||||
$row["allowed"] = true;
|
$row["allowed"] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getItemColor($p_item, &$row) {
|
private function getItemColor($p_item, &$row) {
|
||||||
$defaultColor = "ffffff";
|
$defaultColor = "ffffff";
|
||||||
$defaultBackground = "3366cc";
|
$defaultBackground = "3366cc";
|
||||||
|
|
||||||
$color = $p_item["show_color"];
|
$color = $p_item["show_color"];
|
||||||
if ($color === '') {
|
if ($color === '') {
|
||||||
$color = $defaultColor;
|
$color = $defaultColor;
|
||||||
|
@ -101,7 +101,7 @@ class Application_Model_ShowBuilder {
|
||||||
if ($backgroundColor === '') {
|
if ($backgroundColor === '') {
|
||||||
$backgroundColor = $defaultBackground;
|
$backgroundColor = $defaultBackground;
|
||||||
}
|
}
|
||||||
|
|
||||||
$row["color"] = $color;
|
$row["color"] = $color;
|
||||||
$row["backgroundColor"] = $backgroundColor;
|
$row["backgroundColor"] = $backgroundColor;
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ class Application_Model_ShowBuilder {
|
||||||
}
|
}
|
||||||
$row["timestamp"] = $ts;
|
$row["timestamp"] = $ts;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* marks a row's status.
|
* marks a row's status.
|
||||||
* 0 = past
|
* 0 = past
|
||||||
|
@ -131,7 +131,7 @@ class Application_Model_ShowBuilder {
|
||||||
* 2 = future
|
* 2 = future
|
||||||
*/
|
*/
|
||||||
private function getScheduledStatus($p_epochItemStart, $p_epochItemEnd, &$row) {
|
private function getScheduledStatus($p_epochItemStart, $p_epochItemEnd, &$row) {
|
||||||
|
|
||||||
if ($row["footer"] === true && $this->epoch_now > $p_epochItemStart && $this->epoch_now > $p_epochItemEnd) {
|
if ($row["footer"] === true && $this->epoch_now > $p_epochItemStart && $this->epoch_now > $p_epochItemEnd) {
|
||||||
$row["scheduled"] = 0;
|
$row["scheduled"] = 0;
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ class Application_Model_ShowBuilder {
|
||||||
else if ($row["header"] === true && $this->epoch_now < $p_epochItemEnd) {
|
else if ($row["header"] === true && $this->epoch_now < $p_epochItemEnd) {
|
||||||
$row["scheduled"] = 2;
|
$row["scheduled"] = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
//item is in the past.
|
//item is in the past.
|
||||||
else if ($this->epoch_now > $p_epochItemEnd) {
|
else if ($this->epoch_now > $p_epochItemEnd) {
|
||||||
$row["scheduled"] = 0;
|
$row["scheduled"] = 0;
|
||||||
|
@ -156,7 +156,7 @@ class Application_Model_ShowBuilder {
|
||||||
//how many seconds the view should wait to redraw itself.
|
//how many seconds the view should wait to redraw itself.
|
||||||
$row["refresh"] = $p_epochItemEnd - $this->epoch_now;
|
$row["refresh"] = $p_epochItemEnd - $this->epoch_now;
|
||||||
}
|
}
|
||||||
|
|
||||||
//item is in the future.
|
//item is in the future.
|
||||||
else if ($this->epoch_now < $p_epochItemStart) {
|
else if ($this->epoch_now < $p_epochItemStart) {
|
||||||
$row["scheduled"] = 2;
|
$row["scheduled"] = 2;
|
||||||
|
@ -176,31 +176,31 @@ class Application_Model_ShowBuilder {
|
||||||
$showEndDT = new DateTime($p_item["si_ends"], new DateTimeZone("UTC"));
|
$showEndDT = new DateTime($p_item["si_ends"], new DateTimeZone("UTC"));
|
||||||
$showEndDT->setTimezone(new DateTimeZone($this->timezone));
|
$showEndDT->setTimezone(new DateTimeZone($this->timezone));
|
||||||
$endsEpoch = floatval($showEndDT->format("U.u"));
|
$endsEpoch = floatval($showEndDT->format("U.u"));
|
||||||
|
|
||||||
//is a rebroadcast show
|
//is a rebroadcast show
|
||||||
if (intval($p_item["si_rebroadcast"]) === 1) {
|
if (intval($p_item["si_rebroadcast"]) === 1) {
|
||||||
$row["rebroadcast"] = true;
|
$row["rebroadcast"] = true;
|
||||||
|
|
||||||
$parentInstance = CcShowInstancesQuery::create()->findPk($p_item["parent_show"]);
|
$parentInstance = CcShowInstancesQuery::create()->findPk($p_item["parent_show"]);
|
||||||
$name = $parentInstance->getCcShow()->getDbName();
|
$name = $parentInstance->getCcShow()->getDbName();
|
||||||
$dt = $parentInstance->getDbStarts(null);
|
$dt = $parentInstance->getDbStarts(null);
|
||||||
$dt->setTimezone(new DateTimeZone($this->timezone));
|
$dt->setTimezone(new DateTimeZone($this->timezone));
|
||||||
$time = $dt->format("Y-m-d H:i");
|
$time = $dt->format("Y-m-d H:i");
|
||||||
|
|
||||||
$row["rebroadcast_title"] = "Rebroadcast of {$name} from {$time}";
|
$row["rebroadcast_title"] = "Rebroadcast of {$name} from {$time}";
|
||||||
}
|
}
|
||||||
else if (intval($p_item["si_record"]) === 1) {
|
else if (intval($p_item["si_record"]) === 1) {
|
||||||
$row["record"] = true;
|
$row["record"] = true;
|
||||||
|
|
||||||
if (Application_Model_Preference::GetUploadToSoundcloudOption()) {
|
if (Application_Model_Preference::GetUploadToSoundcloudOption()) {
|
||||||
$file = Application_Model_StoredFile::Recall($p_item["si_file_id"]);
|
$file = Application_Model_StoredFile::Recall($p_item["si_file_id"]);
|
||||||
if (isset($file)) {
|
if (isset($file)) {
|
||||||
$sid = $file->getSoundCloudId();
|
$sid = $file->getSoundCloudId();
|
||||||
$row["soundcloud_id"] = $sid;
|
$row["soundcloud_id"] = $sid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($startsEpoch < $this->epoch_now && $endsEpoch > $this->epoch_now) {
|
if ($startsEpoch < $this->epoch_now && $endsEpoch > $this->epoch_now) {
|
||||||
$row["currentShow"] = true;
|
$row["currentShow"] = true;
|
||||||
$this->currentShow = true;
|
$this->currentShow = true;
|
||||||
|
@ -221,7 +221,7 @@ class Application_Model_ShowBuilder {
|
||||||
$row["title"] = $p_item["show_name"];
|
$row["title"] = $p_item["show_name"];
|
||||||
$row["instance"] = intval($p_item["si_id"]);
|
$row["instance"] = intval($p_item["si_id"]);
|
||||||
$row["image"] = '';
|
$row["image"] = '';
|
||||||
|
|
||||||
$this->getScheduledStatus($startsEpoch, $endsEpoch, $row);
|
$this->getScheduledStatus($startsEpoch, $endsEpoch, $row);
|
||||||
|
|
||||||
$this->contentDT = $showStartDT;
|
$this->contentDT = $showStartDT;
|
||||||
|
@ -254,7 +254,7 @@ class Application_Model_ShowBuilder {
|
||||||
$row["instance"] = intval($p_item["si_id"]);
|
$row["instance"] = intval($p_item["si_id"]);
|
||||||
$row["starts"] = $schedStartDT->format("H:i:s");
|
$row["starts"] = $schedStartDT->format("H:i:s");
|
||||||
$row["ends"] = $schedEndDT->format("H:i:s");
|
$row["ends"] = $schedEndDT->format("H:i:s");
|
||||||
|
|
||||||
$formatter = new LengthFormatter($p_item['file_length']);
|
$formatter = new LengthFormatter($p_item['file_length']);
|
||||||
$row['runtime'] = $formatter->format();
|
$row['runtime'] = $formatter->format();
|
||||||
|
|
||||||
|
@ -266,7 +266,7 @@ class Application_Model_ShowBuilder {
|
||||||
$row["cueout"] = $p_item["cue_out"];
|
$row["cueout"] = $p_item["cue_out"];
|
||||||
$row["fadein"] = round(substr($p_item["fade_in"], 6), 6);
|
$row["fadein"] = round(substr($p_item["fade_in"], 6), 6);
|
||||||
$row["fadeout"] = round(substr($p_item["fade_out"], 6), 6);
|
$row["fadeout"] = round(substr($p_item["fade_out"], 6), 6);
|
||||||
|
|
||||||
$row["pos"] = $this->pos++;
|
$row["pos"] = $this->pos++;
|
||||||
|
|
||||||
$this->contentDT = $schedEndDT;
|
$this->contentDT = $schedEndDT;
|
||||||
|
@ -275,10 +275,10 @@ class Application_Model_ShowBuilder {
|
||||||
else if (intval($p_item["si_record"]) === 1) {
|
else if (intval($p_item["si_record"]) === 1) {
|
||||||
$row["record"] = true;
|
$row["record"] = true;
|
||||||
$row["instance"] = intval($p_item["si_id"]);
|
$row["instance"] = intval($p_item["si_id"]);
|
||||||
|
|
||||||
$showStartDT = new DateTime($p_item["si_starts"], new DateTimeZone("UTC"));
|
$showStartDT = new DateTime($p_item["si_starts"], new DateTimeZone("UTC"));
|
||||||
$showEndDT = new DateTime($p_item["si_ends"], new DateTimeZone("UTC"));
|
$showEndDT = new DateTime($p_item["si_ends"], new DateTimeZone("UTC"));
|
||||||
|
|
||||||
$startsEpoch = floatval($showStartDT->format("U.u"));
|
$startsEpoch = floatval($showStartDT->format("U.u"));
|
||||||
$endsEpoch = floatval($showEndDT->format("U.u"));
|
$endsEpoch = floatval($showEndDT->format("U.u"));
|
||||||
|
|
||||||
|
@ -289,7 +289,7 @@ class Application_Model_ShowBuilder {
|
||||||
$row["id"] = 0 ;
|
$row["id"] = 0 ;
|
||||||
$row["instance"] = intval($p_item["si_id"]);
|
$row["instance"] = intval($p_item["si_id"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (intval($p_item["si_rebroadcast"]) === 1) {
|
if (intval($p_item["si_rebroadcast"]) === 1) {
|
||||||
$row["rebroadcast"] = true;
|
$row["rebroadcast"] = true;
|
||||||
}
|
}
|
||||||
|
@ -320,23 +320,23 @@ class Application_Model_ShowBuilder {
|
||||||
|
|
||||||
$timeFilled = new TimeFilledFormatter($runtime);
|
$timeFilled = new TimeFilledFormatter($runtime);
|
||||||
$row["fRuntime"] = $timeFilled->format();
|
$row["fRuntime"] = $timeFilled->format();
|
||||||
|
|
||||||
$showStartDT = new DateTime($p_item["si_starts"], new DateTimeZone("UTC"));
|
$showStartDT = new DateTime($p_item["si_starts"], new DateTimeZone("UTC"));
|
||||||
$showStartDT->setTimezone(new DateTimeZone($this->timezone));
|
$showStartDT->setTimezone(new DateTimeZone($this->timezone));
|
||||||
$startsEpoch = floatval($showStartDT->format("U.u"));
|
$startsEpoch = floatval($showStartDT->format("U.u"));
|
||||||
$showEndDT = new DateTime($p_item["si_ends"], new DateTimeZone("UTC"));
|
$showEndDT = new DateTime($p_item["si_ends"], new DateTimeZone("UTC"));
|
||||||
$showEndDT->setTimezone(new DateTimeZone($this->timezone));
|
$showEndDT->setTimezone(new DateTimeZone($this->timezone));
|
||||||
$endsEpoch = floatval($showEndDT->format("U.u"));
|
$endsEpoch = floatval($showEndDT->format("U.u"));
|
||||||
|
|
||||||
$row["refresh"] = floatval($showEndDT->format("U.u")) - $this->epoch_now;
|
$row["refresh"] = floatval($showEndDT->format("U.u")) - $this->epoch_now;
|
||||||
|
|
||||||
if ($this->currentShow === true) {
|
if ($this->currentShow === true) {
|
||||||
$row["currentShow"] = true;
|
$row["currentShow"] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->getScheduledStatus($startsEpoch, $endsEpoch, $row);
|
$this->getScheduledStatus($startsEpoch, $endsEpoch, $row);
|
||||||
$this->isAllowed($p_item, $row);
|
$this->isAllowed($p_item, $row);
|
||||||
|
|
||||||
return $row;
|
return $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,7 +349,7 @@ class Application_Model_ShowBuilder {
|
||||||
public function hasBeenUpdatedSince($timestamp, $instances) {
|
public function hasBeenUpdatedSince($timestamp, $instances) {
|
||||||
$outdated = false;
|
$outdated = false;
|
||||||
$shows = Application_Model_Show::getShows($this->startDT, $this->endDT);
|
$shows = Application_Model_Show::getShows($this->startDT, $this->endDT);
|
||||||
|
|
||||||
if ($this->opts["showFilter"] !== 0) {
|
if ($this->opts["showFilter"] !== 0) {
|
||||||
$include[] = $this->opts["showFilter"];
|
$include[] = $this->opts["showFilter"];
|
||||||
}
|
}
|
||||||
|
@ -357,22 +357,22 @@ class Application_Model_ShowBuilder {
|
||||||
|
|
||||||
$include = $this->getUsersShows();
|
$include = $this->getUsersShows();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$currentInstances = array();
|
$currentInstances = array();
|
||||||
|
|
||||||
foreach ($shows as $show) {
|
foreach ($shows as $show) {
|
||||||
|
|
||||||
if (empty($include) || in_array($show["show_id"], $include)) {
|
if (empty($include) || in_array($show["show_id"], $include)) {
|
||||||
$currentInstances[] = $show["instance_id"];
|
$currentInstances[] = $show["instance_id"];
|
||||||
|
|
||||||
if (isset($show["last_scheduled"])) {
|
if (isset($show["last_scheduled"])) {
|
||||||
$dt = new DateTime($show["last_scheduled"], new DateTimeZone("UTC"));
|
$dt = new DateTime($show["last_scheduled"], new DateTimeZone("UTC"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$dt = new DateTime($show["created"], new DateTimeZone("UTC"));
|
$dt = new DateTime($show["created"], new DateTimeZone("UTC"));
|
||||||
}
|
}
|
||||||
|
|
||||||
//check if any of the shows have a more recent timestamp.
|
//check if any of the shows have a more recent timestamp.
|
||||||
$showTimeStamp = intval($dt->format("U"));
|
$showTimeStamp = intval($dt->format("U"));
|
||||||
if ($timestamp < $showTimeStamp) {
|
if ($timestamp < $showTimeStamp) {
|
||||||
|
@ -411,7 +411,7 @@ class Application_Model_ShowBuilder {
|
||||||
for ($i = 0, $rows = count($scheduled_items); $i < $rows; $i++) {
|
for ($i = 0, $rows = count($scheduled_items); $i < $rows; $i++) {
|
||||||
|
|
||||||
$item = $scheduled_items[$i];
|
$item = $scheduled_items[$i];
|
||||||
|
|
||||||
//don't send back data for filler rows.
|
//don't send back data for filler rows.
|
||||||
if (isset($item["playout_status"]) && $item["playout_status"] < 0) {
|
if (isset($item["playout_status"]) && $item["playout_status"] < 0) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -425,11 +425,11 @@ class Application_Model_ShowBuilder {
|
||||||
//pass in the previous row as it's the last row for the previous show.
|
//pass in the previous row as it's the last row for the previous show.
|
||||||
$display_items[] = $this->makeFooterRow($scheduled_items[$i-1]);
|
$display_items[] = $this->makeFooterRow($scheduled_items[$i-1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$display_items[] = $this->makeHeaderRow($item);
|
$display_items[] = $this->makeHeaderRow($item);
|
||||||
|
|
||||||
$current_id = $item["si_id"];
|
$current_id = $item["si_id"];
|
||||||
|
|
||||||
$this->pos = 1;
|
$this->pos = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,7 +449,7 @@ class Application_Model_ShowBuilder {
|
||||||
if (count($scheduled_items) > 0) {
|
if (count($scheduled_items) > 0) {
|
||||||
$display_items[] = $this->makeFooterRow($scheduled_items[count($scheduled_items)-1]);
|
$display_items[] = $this->makeFooterRow($scheduled_items[count($scheduled_items)-1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return array("schedule" => $display_items, "showInstances" => $this->showInstances);
|
return array("schedule" => $display_items, "showInstances" => $this->showInstances);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ class Application_Model_ShowInstance {
|
||||||
public function getShow(){
|
public function getShow(){
|
||||||
return new Application_Model_Show($this->getShowId());
|
return new Application_Model_Show($this->getShowId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteRebroadcasts(){
|
public function deleteRebroadcasts(){
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class Application_Model_ShowInstance {
|
||||||
." AND instance_id = $instance_id"
|
." AND instance_id = $instance_id"
|
||||||
." AND rebroadcast = 1";
|
." AND rebroadcast = 1";
|
||||||
|
|
||||||
$con->exec($sql);
|
$con->exec($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function is weird. It should return a boolean, but instead returns
|
/* This function is weird. It should return a boolean, but instead returns
|
||||||
|
@ -256,11 +256,11 @@ class Application_Model_ShowInstance {
|
||||||
if ($today_timestamp > $newStartsDateTime->getTimestamp()) {
|
if ($today_timestamp > $newStartsDateTime->getTimestamp()) {
|
||||||
return "Can't move show into past";
|
return "Can't move show into past";
|
||||||
}
|
}
|
||||||
|
|
||||||
//check if show is overlapping
|
//check if show is overlapping
|
||||||
$overlapping = Application_Model_Schedule::checkOverlappingShows($newStartsDateTime, $newEndsDateTime, true, $this->getShowInstanceId());
|
$overlapping = Application_Model_Schedule::checkOverlappingShows($newStartsDateTime, $newEndsDateTime, true, $this->getShowInstanceId());
|
||||||
if ($overlapping) {
|
if ($overlapping) {
|
||||||
return "Cannot schedule overlapping shows";
|
return "Cannot schedule overlapping shows";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->isRecorded()) {
|
if ($this->isRecorded()) {
|
||||||
|
@ -579,7 +579,7 @@ class Application_Model_ShowInstance {
|
||||||
public function getTimeScheduled()
|
public function getTimeScheduled()
|
||||||
{
|
{
|
||||||
$time = $this->_showInstance->getDbTimeFilled();
|
$time = $this->_showInstance->getDbTimeFilled();
|
||||||
|
|
||||||
if ($time != "00:00:00" && !empty($time)) {
|
if ($time != "00:00:00" && !empty($time)) {
|
||||||
$time_arr = explode(".", $time);
|
$time_arr = explode(".", $time);
|
||||||
if (count($time_arr) > 1) {
|
if (count($time_arr) > 1) {
|
||||||
|
@ -593,7 +593,7 @@ class Application_Model_ShowInstance {
|
||||||
} else {
|
} else {
|
||||||
$time = "00:00:00.00";
|
$time = "00:00:00.00";
|
||||||
}
|
}
|
||||||
|
|
||||||
return $time;
|
return $time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -637,7 +637,7 @@ class Application_Model_ShowInstance {
|
||||||
} else {
|
} else {
|
||||||
$returnStr = $hours . ":" . $interval->format("%I:%S") . ".00";
|
$returnStr = $hours . ":" . $interval->format("%I:%S") . ".00";
|
||||||
}
|
}
|
||||||
|
|
||||||
return $returnStr;
|
return $returnStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -670,30 +670,30 @@ class Application_Model_ShowInstance {
|
||||||
|
|
||||||
public function getLastAudioItemEnd()
|
public function getLastAudioItemEnd()
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
|
||||||
$sql = "SELECT ends FROM cc_schedule "
|
$sql = "SELECT ends FROM cc_schedule "
|
||||||
."WHERE instance_id = {$this->_instanceId} "
|
."WHERE instance_id = {$this->_instanceId} "
|
||||||
."ORDER BY ends DESC "
|
."ORDER BY ends DESC "
|
||||||
."LIMIT 1";
|
."LIMIT 1";
|
||||||
|
|
||||||
$query = $con->query($sql)->fetchColumn(0);
|
$query = $con->query($sql)->fetchColumn(0);
|
||||||
return ($query !== false) ? $query : NULL;
|
return ($query !== false) ? $query : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getShowEndGapTime(){
|
public function getShowEndGapTime(){
|
||||||
$showEnd = $this->getShowInstanceEnd();
|
$showEnd = $this->getShowInstanceEnd();
|
||||||
$lastItemEnd = $this->getLastAudioItemEnd();
|
$lastItemEnd = $this->getLastAudioItemEnd();
|
||||||
|
|
||||||
if (is_null($lastItemEnd)){
|
if (is_null($lastItemEnd)){
|
||||||
$lastItemEnd = $this->getShowInstanceStart();
|
$lastItemEnd = $this->getShowInstanceStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$diff = strtotime($showEnd) - strtotime($lastItemEnd);
|
$diff = strtotime($showEnd) - strtotime($lastItemEnd);
|
||||||
|
|
||||||
return ($diff < 0) ? 0 : $diff;
|
return ($diff < 0) ? 0 : $diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetLastShowInstance($p_timeNow){
|
public static function GetLastShowInstance($p_timeNow){
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
@ -777,14 +777,14 @@ class Application_Model_ShowInstance {
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
|
||||||
$sql = "SELECT ends
|
$sql = "SELECT ends
|
||||||
FROM cc_show_instances as si
|
FROM cc_show_instances as si
|
||||||
JOIN cc_show as sh ON si.show_id = sh.id
|
JOIN cc_show as sh ON si.show_id = sh.id
|
||||||
WHERE si.ends > '$p_startTime' and si.ends < '$p_endTime' and (sh.live_stream_using_airtime_auth or live_stream_using_custom_auth)
|
WHERE si.ends > '$p_startTime' and si.ends < '$p_endTime' and (sh.live_stream_using_airtime_auth or live_stream_using_custom_auth)
|
||||||
ORDER BY si.ends";
|
ORDER BY si.ends";
|
||||||
|
|
||||||
return $con->query($sql)->fetchAll();
|
return $con->query($sql)->fetchAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
function isRepeating(){
|
function isRepeating(){
|
||||||
if ($this->getShow()->isRepeating()){
|
if ($this->getShow()->isRepeating()){
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -5,7 +5,7 @@ class Application_Model_Soundcloud {
|
||||||
|
|
||||||
private $_soundcloud;
|
private $_soundcloud;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ class Application_Model_Soundcloud {
|
||||||
}
|
}
|
||||||
|
|
||||||
$downloadable = Application_Model_Preference::GetSoundCloudDownloadbleOption() == '1'?true:false;
|
$downloadable = Application_Model_Preference::GetSoundCloudDownloadbleOption() == '1'?true:false;
|
||||||
|
|
||||||
$track_data = array(
|
$track_data = array(
|
||||||
'track[sharing]' => 'private',
|
'track[sharing]' => 'private',
|
||||||
'track[title]' => $filename,
|
'track[title]' => $filename,
|
||||||
|
@ -77,7 +77,7 @@ class Application_Model_Soundcloud {
|
||||||
if ($license != "") {
|
if ($license != "") {
|
||||||
$track_data['track[license]'] = $license;
|
$track_data['track[license]'] = $license;
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = json_decode(
|
$response = json_decode(
|
||||||
$this->_soundcloud->post('tracks', $track_data),
|
$this->_soundcloud->post('tracks', $track_data),
|
||||||
true
|
true
|
||||||
|
|
|
@ -91,7 +91,7 @@ class Application_Model_StoredFile {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$dbMd = array();
|
$dbMd = array();
|
||||||
|
|
||||||
if (isset($p_md["MDATA_KEY_YEAR"])){
|
if (isset($p_md["MDATA_KEY_YEAR"])){
|
||||||
// We need to make sure to clean this value before inserting into database.
|
// We need to make sure to clean this value before inserting into database.
|
||||||
// If value is outside of range [-2^31, 2^31-1] then postgresl will throw error
|
// If value is outside of range [-2^31, 2^31-1] then postgresl will throw error
|
||||||
|
@ -100,9 +100,9 @@ class Application_Model_StoredFile {
|
||||||
// new garbage value won't cause errors). If the value is 2012-01-01, then substring to
|
// new garbage value won't cause errors). If the value is 2012-01-01, then substring to
|
||||||
// first 4 digits is an OK result.
|
// first 4 digits is an OK result.
|
||||||
// CC-3771
|
// CC-3771
|
||||||
|
|
||||||
$year = $p_md["MDATA_KEY_YEAR"];
|
$year = $p_md["MDATA_KEY_YEAR"];
|
||||||
|
|
||||||
if (strlen($year) > 4){
|
if (strlen($year) > 4){
|
||||||
$year = substr($year, 0, 4);
|
$year = substr($year, 0, 4);
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@ class Application_Model_StoredFile {
|
||||||
}
|
}
|
||||||
$p_md["MDATA_KEY_YEAR"] = $year;
|
$p_md["MDATA_KEY_YEAR"] = $year;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($p_md as $mdConst => $mdValue) {
|
foreach ($p_md as $mdConst => $mdValue) {
|
||||||
if (defined($mdConst)){
|
if (defined($mdConst)){
|
||||||
$dbMd[constant($mdConst)] = $mdValue;
|
$dbMd[constant($mdConst)] = $mdValue;
|
||||||
|
@ -161,9 +161,9 @@ class Application_Model_StoredFile {
|
||||||
* Set metadata element value
|
* Set metadata element value
|
||||||
*
|
*
|
||||||
* @param string $category
|
* @param string $category
|
||||||
* Metadata element by metadata constant
|
* Metadata element by metadata constant
|
||||||
* @param string $value
|
* @param string $value
|
||||||
* value to store, if NULL then delete record
|
* value to store, if NULL then delete record
|
||||||
*/
|
*/
|
||||||
public function setMetadataValue($p_category, $p_value)
|
public function setMetadataValue($p_category, $p_value)
|
||||||
{
|
{
|
||||||
|
@ -176,9 +176,9 @@ class Application_Model_StoredFile {
|
||||||
* Set metadata element value
|
* Set metadata element value
|
||||||
*
|
*
|
||||||
* @param string $category
|
* @param string $category
|
||||||
* Metadata element by db column
|
* Metadata element by db column
|
||||||
* @param string $value
|
* @param string $value
|
||||||
* value to store, if NULL then delete record
|
* value to store, if NULL then delete record
|
||||||
*/
|
*/
|
||||||
public function setDbColMetadataValue($p_category, $p_value)
|
public function setDbColMetadataValue($p_category, $p_value)
|
||||||
{
|
{
|
||||||
|
@ -245,12 +245,12 @@ class Application_Model_StoredFile {
|
||||||
{
|
{
|
||||||
$c = get_defined_constants(true);
|
$c = get_defined_constants(true);
|
||||||
$md = array();
|
$md = array();
|
||||||
|
|
||||||
/* Create a copy of dbMD here and create a "filepath" key inside of
|
/* Create a copy of dbMD here and create a "filepath" key inside of
|
||||||
* it. The reason we do this here, instead of creating this key inside
|
* it. The reason we do this here, instead of creating this key inside
|
||||||
* dbMD is because "filepath" isn't really metadata, and we don't want
|
* dbMD is because "filepath" isn't really metadata, and we don't want
|
||||||
* filepath updated everytime the metadata changes. Also it needs extra
|
* filepath updated everytime the metadata changes. Also it needs extra
|
||||||
* processing before we can write it to the database (needs to be split
|
* processing before we can write it to the database (needs to be split
|
||||||
* into base and relative path)
|
* into base and relative path)
|
||||||
* */
|
* */
|
||||||
$dbmd_copy = $this->_dbMD;
|
$dbmd_copy = $this->_dbMD;
|
||||||
|
@ -273,9 +273,9 @@ class Application_Model_StoredFile {
|
||||||
* Set state of virtual file
|
* Set state of virtual file
|
||||||
*
|
*
|
||||||
* @param string $p_state
|
* @param string $p_state
|
||||||
* 'empty'|'incomplete'|'ready'|'edited'
|
* 'empty'|'incomplete'|'ready'|'edited'
|
||||||
* @param int $p_editedby
|
* @param int $p_editedby
|
||||||
* user id | 'NULL' for clear editedBy field
|
* user id | 'NULL' for clear editedBy field
|
||||||
* @return TRUE
|
* @return TRUE
|
||||||
*/
|
*/
|
||||||
public function setState($p_state, $p_editedby=NULL)
|
public function setState($p_state, $p_editedby=NULL)
|
||||||
|
@ -330,7 +330,7 @@ class Application_Model_StoredFile {
|
||||||
|
|
||||||
$music_dir = Application_Model_MusicDir::getDirByPK($this->_file->getDbDirectory());
|
$music_dir = Application_Model_MusicDir::getDirByPK($this->_file->getDbDirectory());
|
||||||
$type = $music_dir->getType();
|
$type = $music_dir->getType();
|
||||||
|
|
||||||
if (file_exists($filepath) && $type == "stor") {
|
if (file_exists($filepath) && $type == "stor") {
|
||||||
$data = array("filepath" => $filepath, "delete" => 1);
|
$data = array("filepath" => $filepath, "delete" => 1);
|
||||||
Application_Model_RabbitMq::SendMessageToMediaMonitor("file_delete", $data);
|
Application_Model_RabbitMq::SendMessageToMediaMonitor("file_delete", $data);
|
||||||
|
@ -343,7 +343,7 @@ class Application_Model_StoredFile {
|
||||||
$this->_file->setDbFileExists(false);
|
$this->_file->setDbFileExists(false);
|
||||||
$this->_file->save();
|
$this->_file->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is for when media monitor detects deletion of file
|
* This function is for when media monitor detects deletion of file
|
||||||
* and trying to update airtime side
|
* and trying to update airtime side
|
||||||
|
@ -367,7 +367,7 @@ class Application_Model_StoredFile {
|
||||||
* Return suitable extension.
|
* Return suitable extension.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
* file extension without a dot
|
* file extension without a dot
|
||||||
*/
|
*/
|
||||||
public function getFileExtension()
|
public function getFileExtension()
|
||||||
{
|
{
|
||||||
|
@ -395,7 +395,7 @@ class Application_Model_StoredFile {
|
||||||
|
|
||||||
return $directory.$filepath;
|
return $directory.$filepath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set real filename of raw media data
|
* Set real filename of raw media data
|
||||||
*
|
*
|
||||||
|
@ -500,9 +500,9 @@ Logging::log("getting media! - 2");
|
||||||
* be NULL.
|
* be NULL.
|
||||||
*
|
*
|
||||||
* @param int $p_id
|
* @param int $p_id
|
||||||
* local id
|
* local id
|
||||||
* @param string $p_gunid
|
* @param string $p_gunid
|
||||||
* global unique id of file
|
* global unique id of file
|
||||||
* @param string $p_md5sum
|
* @param string $p_md5sum
|
||||||
* MD5 sum of the file
|
* MD5 sum of the file
|
||||||
* @param boolean $exist
|
* @param boolean $exist
|
||||||
|
@ -570,7 +570,7 @@ Logging::log("getting media! - 2");
|
||||||
* by gunid.
|
* by gunid.
|
||||||
*
|
*
|
||||||
* @param string $p_gunid
|
* @param string $p_gunid
|
||||||
* global unique id of file
|
* global unique id of file
|
||||||
* @return Application_Model_StoredFile|NULL
|
* @return Application_Model_StoredFile|NULL
|
||||||
*/
|
*/
|
||||||
public static function RecallByGunid($p_gunid)
|
public static function RecallByGunid($p_gunid)
|
||||||
|
@ -624,7 +624,7 @@ Logging::log("getting media! - 2");
|
||||||
|
|
||||||
public static function searchLibraryFiles($datatables) {
|
public static function searchLibraryFiles($datatables) {
|
||||||
|
|
||||||
$con = Propel::getConnection(CcFilesPeer::DATABASE_NAME);
|
$con = Propel::getConnection(CcFilesPeer::DATABASE_NAME);
|
||||||
|
|
||||||
$displayColumns = array("id", "track_title", "artist_name", "album_title", "genre", "length",
|
$displayColumns = array("id", "track_title", "artist_name", "album_title", "genre", "length",
|
||||||
"year", "utime", "mtime", "ftype", "track_number", "mood", "bpm", "composer", "info_url",
|
"year", "utime", "mtime", "ftype", "track_number", "mood", "bpm", "composer", "info_url",
|
||||||
|
@ -871,26 +871,26 @@ Logging::log("getting media! - 2");
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chmod($audio_file, 0644) === false){
|
if (chmod($audio_file, 0644) === false){
|
||||||
Logging::log("Warning: couldn't change permissions of $audio_file to 0644");
|
Logging::log("Warning: couldn't change permissions of $audio_file to 0644");
|
||||||
}
|
}
|
||||||
|
|
||||||
//check to see if there is enough space in $stor to continue.
|
//check to see if there is enough space in $stor to continue.
|
||||||
if (self::isEnoughDiskSpaceToCopy($stor, $audio_file)){
|
if (self::isEnoughDiskSpaceToCopy($stor, $audio_file)){
|
||||||
$audio_stor = Application_Common_OsPath::join($stor, "organize", $fileName);
|
$audio_stor = Application_Common_OsPath::join($stor, "organize", $fileName);
|
||||||
|
|
||||||
if (self::liquidsoapFilePlayabilityTest($audio_file)){
|
if (self::liquidsoapFilePlayabilityTest($audio_file)){
|
||||||
|
|
||||||
Logging::log("copyFileToStor: moving file $audio_file to $audio_stor");
|
Logging::log("copyFileToStor: moving file $audio_file to $audio_stor");
|
||||||
|
|
||||||
//Martin K.: changed to rename: Much less load + quicker since this is an atomic operation
|
//Martin K.: changed to rename: Much less load + quicker since this is an atomic operation
|
||||||
if (@rename($audio_file, $audio_stor) === false) {
|
if (@rename($audio_file, $audio_stor) === false) {
|
||||||
#something went wrong likely there wasn't enough space in the audio_stor to move the file too.
|
#something went wrong likely there wasn't enough space in the audio_stor to move the file too.
|
||||||
#warn the user that the file wasn't uploaded and they should check if there is enough disk space.
|
#warn the user that the file wasn't uploaded and they should check if there is enough disk space.
|
||||||
unlink($audio_file);//remove the file after failed rename
|
unlink($audio_file);//remove the file after failed rename
|
||||||
$result = array("code" => 108, "message" => "The file was not uploaded, this error can occur if the computer hard drive does not have enough disk space.");
|
$result = array("code" => 108, "message" => "The file was not uploaded, this error can occur if the computer hard drive does not have enough disk space.");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$result = array("code" => 110, "message" => "This file appears to be corrupted and will not be added to media library.");
|
$result = array("code" => 110, "message" => "This file appears to be corrupted and will not be added to media library.");
|
||||||
}
|
}
|
||||||
|
@ -901,23 +901,23 @@ Logging::log("getting media! - 2");
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Pass the file through Liquidsoap and test if it is readable. Return True if readable, and False otherwise.
|
* Pass the file through Liquidsoap and test if it is readable. Return True if readable, and False otherwise.
|
||||||
*/
|
*/
|
||||||
public static function liquidsoapFilePlayabilityTest($audio_file){
|
public static function liquidsoapFilePlayabilityTest($audio_file){
|
||||||
|
|
||||||
$LIQUIDSOAP_ERRORS = array('TagLib: MPEG::Properties::read() -- Could not find a valid last MPEG frame in the stream.');
|
$LIQUIDSOAP_ERRORS = array('TagLib: MPEG::Properties::read() -- Could not find a valid last MPEG frame in the stream.');
|
||||||
|
|
||||||
// Ask Liquidsoap if file is playable
|
// Ask Liquidsoap if file is playable
|
||||||
$command = sprintf("/usr/bin/airtime-liquidsoap -c 'output.dummy(audio_to_stereo(single(\"%s\")))' 2>&1", $audio_file);
|
$command = sprintf("/usr/bin/airtime-liquidsoap -c 'output.dummy(audio_to_stereo(single(\"%s\")))' 2>&1", $audio_file);
|
||||||
|
|
||||||
exec($command, $output, $rv);
|
exec($command, $output, $rv);
|
||||||
|
|
||||||
$isError = count($output) > 0 && in_array($output[0], $LIQUIDSOAP_ERRORS);
|
$isError = count($output) > 0 && in_array($output[0], $LIQUIDSOAP_ERRORS);
|
||||||
return ($rv == 0 && !$isError);
|
return ($rv == 0 && !$isError);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getFileCount()
|
public static function getFileCount()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
@ -960,28 +960,28 @@ Logging::log("getting media! - 2");
|
||||||
|
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Gets number of tracks uploaded to
|
/* Gets number of tracks uploaded to
|
||||||
* Soundcloud in the last 24 hours
|
* Soundcloud in the last 24 hours
|
||||||
*/
|
*/
|
||||||
public static function getSoundCloudUploads()
|
public static function getSoundCloudUploads()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
|
||||||
$sql = "SELECT soundcloud_id as id, soundcloud_upload_time"
|
$sql = "SELECT soundcloud_id as id, soundcloud_upload_time"
|
||||||
." FROM CC_FILES"
|
." FROM CC_FILES"
|
||||||
." WHERE (id != -2 and id != -3) and"
|
." WHERE (id != -2 and id != -3) and"
|
||||||
." (soundcloud_upload_time >= (now() - (INTERVAL '1 day')))";
|
." (soundcloud_upload_time >= (now() - (INTERVAL '1 day')))";
|
||||||
|
|
||||||
$rows = $con->query($sql)->fetchAll();
|
$rows = $con->query($sql)->fetchAll();
|
||||||
return count($rows);
|
return count($rows);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
header('HTTP/1.0 503 Service Unavailable');
|
header('HTTP/1.0 503 Service Unavailable');
|
||||||
Logging::log("Could not connect to database.");
|
Logging::log("Could not connect to database.");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setSoundCloudLinkToFile($link_to_file)
|
public function setSoundCloudLinkToFile($link_to_file)
|
||||||
|
@ -1021,10 +1021,10 @@ Logging::log("getting media! - 2");
|
||||||
public function getSoundCloudErrorMsg(){
|
public function getSoundCloudErrorMsg(){
|
||||||
return $this->_file->getDbSoundCloudErrorMsg();
|
return $this->_file->getDbSoundCloudErrorMsg();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDirectory(){
|
public function getDirectory(){
|
||||||
return $this->_file->getDbDirectory();
|
return $this->_file->getDbDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setFileExistsFlag($flag){
|
public function setFileExistsFlag($flag){
|
||||||
$this->_file->setDbFileExists($flag)
|
$this->_file->setDbFileExists($flag)
|
||||||
|
@ -1032,7 +1032,7 @@ Logging::log("getting media! - 2");
|
||||||
}
|
}
|
||||||
public function setSoundCloudUploadTime($time){
|
public function setSoundCloudUploadTime($time){
|
||||||
$this->_file->setDbSoundCloundUploadTime($time)
|
$this->_file->setDbSoundCloundUploadTime($time)
|
||||||
->save();
|
->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFileExistsFlag(){
|
public function getFileExistsFlag(){
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
class Application_Model_StreamSetting {
|
class Application_Model_StreamSetting {
|
||||||
|
|
||||||
public static function SetValue($key, $value, $type)
|
public static function setValue($key, $value, $type)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
@ -27,7 +27,7 @@ class Application_Model_StreamSetting {
|
||||||
return $con->exec($sql);
|
return $con->exec($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetValue($key)
|
public static function getValue($key)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
@ -37,14 +37,14 @@ class Application_Model_StreamSetting {
|
||||||
." WHERE keyname = '$key'";
|
." WHERE keyname = '$key'";
|
||||||
$result = $con->query($sql)->fetchColumn(0);
|
$result = $con->query($sql)->fetchColumn(0);
|
||||||
|
|
||||||
if ($result == 0)
|
if ($result == 0) {
|
||||||
return "";
|
return "";
|
||||||
else {
|
} else {
|
||||||
$sql = "SELECT value FROM cc_stream_setting"
|
$sql = "SELECT value FROM cc_stream_setting"
|
||||||
." WHERE keyname = '$key'";
|
." WHERE keyname = '$key'";
|
||||||
|
|
||||||
$result = $con->query($sql)->fetchColumn(0);
|
$result = $con->query($sql)->fetchColumn(0);
|
||||||
return ($result !== false) ? $result : NULL;
|
return ($result !== false) ? $result : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,16 +130,24 @@ class Application_Model_StreamSetting {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($exists["master_live_stream_port"])) {
|
if (!isset($exists["master_live_stream_port"])) {
|
||||||
$rows[] = (array("keyname" =>"master_live_stream_port", "value"=>self::GetMasterLiveSteamPort(), "type"=>"integer"));
|
$rows[] = array("keyname" =>"master_live_stream_port",
|
||||||
|
"value"=>self::getMasterLiveStreamPort(),
|
||||||
|
"type"=>"integer");
|
||||||
}
|
}
|
||||||
if (!isset($exists["master_live_stream_mp"])) {
|
if (!isset($exists["master_live_stream_mp"])) {
|
||||||
$rows[] = (array("keyname" =>"master_live_stream_mp", "value"=>self::GetMasterLiveSteamMountPoint(), "type"=>"string"));
|
$rows[] = array("keyname" =>"master_live_stream_mp",
|
||||||
|
"value"=>self::getMasterLiveStreamMountPoint(),
|
||||||
|
"type"=>"string");
|
||||||
}
|
}
|
||||||
if (!isset($exists["dj_live_stream_port"])) {
|
if (!isset($exists["dj_live_stream_port"])) {
|
||||||
$rows[] = (array("keyname" =>"dj_live_stream_port", "value"=>self::GetDJLiveSteamPort(), "type"=>"integer"));
|
$rows[] = array("keyname" =>"dj_live_stream_port",
|
||||||
|
"value"=>self::getDjLiveStreamPort(),
|
||||||
|
"type"=>"integer");
|
||||||
}
|
}
|
||||||
if (!isset($exists["dj_live_stream_mp"])) {
|
if (!isset($exists["dj_live_stream_mp"])) {
|
||||||
$rows[] = (array("keyname" =>"dj_live_stream_mp", "value"=>self::GetDJLiveSteamMountPoint(), "type"=>"string"));
|
$rows[] = array("keyname" =>"dj_live_stream_mp",
|
||||||
|
"value"=>self::getDjLiveStreamMountPoint(),
|
||||||
|
"type"=>"string");
|
||||||
}
|
}
|
||||||
return $rows;
|
return $rows;
|
||||||
}
|
}
|
||||||
|
@ -155,7 +163,7 @@ class Application_Model_StreamSetting {
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
|
||||||
foreach ($data as $key=>$d) {
|
foreach ($data as $key => $d) {
|
||||||
if ($key == "output_sound_device" || $key == "icecast_vorbis_metadata") {
|
if ($key == "output_sound_device" || $key == "icecast_vorbis_metadata") {
|
||||||
$v = $d == 1?"true":"false";
|
$v = $d == 1?"true":"false";
|
||||||
$sql = "UPDATE cc_stream_setting SET value='$v' WHERE keyname='$key'";
|
$sql = "UPDATE cc_stream_setting SET value='$v' WHERE keyname='$key'";
|
||||||
|
@ -166,13 +174,13 @@ class Application_Model_StreamSetting {
|
||||||
} else if (is_array($d)) {
|
} else if (is_array($d)) {
|
||||||
$temp = explode('_', $key);
|
$temp = explode('_', $key);
|
||||||
$prefix = $temp[0];
|
$prefix = $temp[0];
|
||||||
foreach ($d as $k=>$v) {
|
foreach ($d as $k => $v) {
|
||||||
$keyname = $prefix . "_" . $k;
|
$keyname = $prefix . "_" . $k;
|
||||||
if ($k == 'enable') {
|
if ($k == 'enable') {
|
||||||
$v = $d['enable'] == 1 ? 'true' : 'false';
|
$v = $d['enable'] == 1 ? 'true' : 'false';
|
||||||
}
|
}
|
||||||
$v = trim($v);
|
$v = trim($v);
|
||||||
|
|
||||||
#escape double single quotes CC-3926
|
#escape double single quotes CC-3926
|
||||||
$v = str_replace("'", "''", $v);
|
$v = str_replace("'", "''", $v);
|
||||||
$sql = "UPDATE cc_stream_setting SET value='$v' WHERE keyname='$keyname'";
|
$sql = "UPDATE cc_stream_setting SET value='$v' WHERE keyname='$keyname'";
|
||||||
|
@ -233,7 +241,7 @@ class Application_Model_StreamSetting {
|
||||||
." WHERE keyname = '$keyname'";
|
." WHERE keyname = '$keyname'";
|
||||||
$result = $con->query($sql)->fetchColumn(0);
|
$result = $con->query($sql)->fetchColumn(0);
|
||||||
|
|
||||||
return ($result !== false) ? $result : NULL;
|
return ($result !== false) ? $result : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getStreamEnabled($stream_id)
|
public static function getStreamEnabled($stream_id)
|
||||||
|
@ -264,7 +272,8 @@ class Application_Model_StreamSetting {
|
||||||
$enabled_stream = self::getEnabledStreamIds();
|
$enabled_stream = self::getEnabledStreamIds();
|
||||||
|
|
||||||
foreach ($enabled_stream as $stream) {
|
foreach ($enabled_stream as $stream) {
|
||||||
$keys = "'".$stream."_output', "."'".$stream."_type', "."'".$stream."_bitrate', "."'".$stream."_host'";
|
$keys = "'".$stream."_output', "."'".$stream."_type', "."'"
|
||||||
|
.$stream."_bitrate', "."'".$stream."_host'";
|
||||||
|
|
||||||
$sql = "SELECT keyname, value FROM cc_stream_setting"
|
$sql = "SELECT keyname, value FROM cc_stream_setting"
|
||||||
." WHERE keyname IN ($keys)";
|
." WHERE keyname IN ($keys)";
|
||||||
|
@ -280,35 +289,43 @@ class Application_Model_StreamSetting {
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetMasterLiveSteamPort($value){
|
public static function setMasterLiveStreamPort($value)
|
||||||
self::SetValue("master_live_stream_port", $value, "integer");
|
{
|
||||||
|
self::setValue("master_live_stream_port", $value, "integer");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetMasterLiveSteamPort(){
|
public static function getMasterLiveStreamPort()
|
||||||
return self::GetValue("master_live_stream_port");
|
{
|
||||||
|
return self::getValue("master_live_stream_port");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetMasterLiveSteamMountPoint($value){
|
public static function setMasterLiveStreamMountPoint($value)
|
||||||
self::SetValue("master_live_stream_mp", $value, "string");
|
{
|
||||||
|
self::setValue("master_live_stream_mp", $value, "string");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetMasterLiveSteamMountPoint(){
|
public static function getMasterLiveStreamMountPoint()
|
||||||
return self::GetValue("master_live_stream_mp");
|
{
|
||||||
|
return self::getValue("master_live_stream_mp");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetDJLiveSteamPort($value){
|
public static function setDjLiveStreamPort($value)
|
||||||
self::SetValue("dj_live_stream_port", $value, "integer");
|
{
|
||||||
|
self::setValue("dj_live_stream_port", $value, "integer");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetDJLiveSteamPort(){
|
public static function getDjLiveStreamPort()
|
||||||
return self::GetValue("dj_live_stream_port");
|
{
|
||||||
|
return self::getValue("dj_live_stream_port");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetDJLiveSteamMountPoint($value){
|
public static function setDjLiveStreamMountPoint($value)
|
||||||
self::SetValue("dj_live_stream_mp", $value, "string");
|
{
|
||||||
|
self::setValue("dj_live_stream_mp", $value, "string");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetDJLiveSteamMountPoint(){
|
public static function getDjLiveStreamMountPoint()
|
||||||
return self::GetValue("dj_live_stream_mp");
|
{
|
||||||
|
return self::getValue("dj_live_stream_mp");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,102 +18,6 @@ class Application_Model_Subjects {
|
||||||
|
|
||||||
/* ======================================================= public methods */
|
/* ======================================================= public methods */
|
||||||
|
|
||||||
/**
|
|
||||||
* Check login and password
|
|
||||||
*
|
|
||||||
* @param string $login
|
|
||||||
* @param string $pass
|
|
||||||
* optional
|
|
||||||
* @return boolean|int|PEAR_Error
|
|
||||||
*/
|
|
||||||
public static function Authenticate($login, $pass='')
|
|
||||||
{
|
|
||||||
global $CC_CONFIG;
|
|
||||||
$con = Propel::getConnection();
|
|
||||||
$cpass = md5($pass);
|
|
||||||
$sql = "SELECT id FROM ".$CC_CONFIG['subjTable']
|
|
||||||
." WHERE login='$login' AND pass='$cpass' AND type='U'"
|
|
||||||
." LIMIT 1";
|
|
||||||
$query = $con->query($sql)->fetchColumn(0);
|
|
||||||
return $query;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Change user password
|
|
||||||
*
|
|
||||||
* @param string $login
|
|
||||||
* @param string $oldpass
|
|
||||||
* old password (optional for 'superuser mode')
|
|
||||||
* @param string $pass
|
|
||||||
* optional
|
|
||||||
* @param boolean $passenc
|
|
||||||
* optional, password already encrypted if true
|
|
||||||
* @return boolean|PEAR_Error
|
|
||||||
*/
|
|
||||||
public static function Passwd($login, $oldpass=null, $pass='', $passenc=FALSE)
|
|
||||||
{
|
|
||||||
global $CC_CONFIG;
|
|
||||||
$con = Propel::getConnection();
|
|
||||||
if (!$passenc) {
|
|
||||||
$cpass = md5($pass);
|
|
||||||
} else {
|
|
||||||
$cpass = $pass;
|
|
||||||
}
|
|
||||||
if (!is_null($oldpass)) {
|
|
||||||
$oldcpass = md5($oldpass);
|
|
||||||
$oldpCond = "AND pass='$oldcpass'";
|
|
||||||
} else {
|
|
||||||
$oldpCond = '';
|
|
||||||
}
|
|
||||||
$sql = "UPDATE ".$CC_CONFIG['subjTable']." SET pass='$cpass'"
|
|
||||||
." WHERE login='$login' $oldpCond AND type='U'";
|
|
||||||
$con->exec($sql);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------- groups */
|
|
||||||
|
|
||||||
/* --------------------------------------------------------- info methods */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get subject id from login
|
|
||||||
*
|
|
||||||
* @param string $login
|
|
||||||
* @return int|false
|
|
||||||
*/
|
|
||||||
public static function GetSubjId($login)
|
|
||||||
{
|
|
||||||
global $CC_CONFIG;
|
|
||||||
$con = Propel::getConnection();
|
|
||||||
$sql = "SELECT id FROM ".$CC_CONFIG['subjTable']
|
|
||||||
." WHERE login='$login'";
|
|
||||||
$query = $con->query($sql)->fetchColumn(0);
|
|
||||||
return ($query !== false) ? $query : NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return true if uid is direct member of gid
|
|
||||||
*
|
|
||||||
* @param int $uid
|
|
||||||
* local user id
|
|
||||||
* @param int $gid
|
|
||||||
* local group id
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
public static function IsMemberOf($uid, $gid)
|
|
||||||
{
|
|
||||||
global $CC_CONFIG;
|
|
||||||
$con = Propel::getConnection();
|
|
||||||
$sql = "SELECT count(*) as cnt"
|
|
||||||
." FROM ".$CC_CONFIG['smembTable']
|
|
||||||
." WHERE uid='$uid' AND gid='$gid'";
|
|
||||||
$res = $con->query($sql)->fetchColumn(0);
|
|
||||||
return (intval($res) > 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function increaseLoginAttempts($login)
|
public static function increaseLoginAttempts($login)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
@ -131,7 +35,7 @@ class Application_Model_Subjects {
|
||||||
$sql = "UPDATE ".$CC_CONFIG['subjTable']." SET login_attempts = '0'"
|
$sql = "UPDATE ".$CC_CONFIG['subjTable']." SET login_attempts = '0'"
|
||||||
." WHERE login='$login'";
|
." WHERE login='$login'";
|
||||||
$res = $con->exec($sql);
|
$res = $con->exec($sql);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getLoginAttempts($login)
|
public static function getLoginAttempts($login)
|
||||||
|
|
|
@ -9,15 +9,15 @@ class Application_Model_Systemstatus
|
||||||
$monit_password = $CC_CONFIG['monit_password'];
|
$monit_password = $CC_CONFIG['monit_password'];
|
||||||
|
|
||||||
$url = "http://$p_ip:2812/_status?format=xml";
|
$url = "http://$p_ip:2812/_status?format=xml";
|
||||||
|
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
curl_setopt($ch, CURLOPT_USERPWD, "$monit_user:$monit_password");
|
curl_setopt($ch, CURLOPT_USERPWD, "$monit_user:$monit_password");
|
||||||
//wait a max of 3 seconds before aborting connection attempt
|
//wait a max of 3 seconds before aborting connection attempt
|
||||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
|
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
|
||||||
$result = curl_exec($ch);
|
$result = curl_exec($ch);
|
||||||
|
|
||||||
$info = curl_getinfo($ch);
|
$info = curl_getinfo($ch);
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class Application_Model_Systemstatus
|
||||||
|
|
||||||
return $docRoot;
|
return $docRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function ExtractServiceInformation($p_docRoot, $p_serviceName){
|
public static function ExtractServiceInformation($p_docRoot, $p_serviceName){
|
||||||
|
|
||||||
$starting = array(
|
$starting = array(
|
||||||
|
@ -43,7 +43,7 @@ class Application_Model_Systemstatus
|
||||||
"memory_perc"=>"0%",
|
"memory_perc"=>"0%",
|
||||||
"memory_kb"=>"0",
|
"memory_kb"=>"0",
|
||||||
"cpu_perc"=>"0%");
|
"cpu_perc"=>"0%");
|
||||||
|
|
||||||
$notMonitored = array(
|
$notMonitored = array(
|
||||||
"name"=>$p_serviceName,
|
"name"=>$p_serviceName,
|
||||||
"process_id"=>"NOT MONITORED",
|
"process_id"=>"NOT MONITORED",
|
||||||
|
@ -53,7 +53,7 @@ class Application_Model_Systemstatus
|
||||||
"memory_kb"=>"0",
|
"memory_kb"=>"0",
|
||||||
"cpu_perc"=>"0%"
|
"cpu_perc"=>"0%"
|
||||||
);
|
);
|
||||||
|
|
||||||
$notRunning = array(
|
$notRunning = array(
|
||||||
"name"=>$p_serviceName,
|
"name"=>$p_serviceName,
|
||||||
"process_id"=>"FAILED",
|
"process_id"=>"FAILED",
|
||||||
|
@ -65,7 +65,7 @@ class Application_Model_Systemstatus
|
||||||
);
|
);
|
||||||
$data = $notRunning;
|
$data = $notRunning;
|
||||||
|
|
||||||
|
|
||||||
if (!is_null($p_docRoot)){
|
if (!is_null($p_docRoot)){
|
||||||
foreach ($p_docRoot->getElementsByTagName("service") AS $item)
|
foreach ($p_docRoot->getElementsByTagName("service") AS $item)
|
||||||
{
|
{
|
||||||
|
@ -93,7 +93,7 @@ class Application_Model_Systemstatus
|
||||||
if ($process_id->length > 0){
|
if ($process_id->length > 0){
|
||||||
$data["name"] = $process_id->item(0)->nodeValue;
|
$data["name"] = $process_id->item(0)->nodeValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$process_id = $item->getElementsByTagName("pid");
|
$process_id = $item->getElementsByTagName("pid");
|
||||||
if ($process_id->length > 0){
|
if ($process_id->length > 0){
|
||||||
$data["process_id"] = $process_id->item(0)->nodeValue;
|
$data["process_id"] = $process_id->item(0)->nodeValue;
|
||||||
|
@ -104,13 +104,13 @@ class Application_Model_Systemstatus
|
||||||
if ($uptime->length > 0){
|
if ($uptime->length > 0){
|
||||||
$data["uptime_seconds"] = $uptime->item(0)->nodeValue;
|
$data["uptime_seconds"] = $uptime->item(0)->nodeValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$memory = $item->getElementsByTagName("memory");
|
$memory = $item->getElementsByTagName("memory");
|
||||||
if ($memory->length > 0){
|
if ($memory->length > 0){
|
||||||
$data["memory_perc"] = $memory->item(0)->getElementsByTagName("percenttotal")->item(0)->nodeValue."%";
|
$data["memory_perc"] = $memory->item(0)->getElementsByTagName("percenttotal")->item(0)->nodeValue."%";
|
||||||
$data["memory_kb"] = $memory->item(0)->getElementsByTagName("kilobytetotal")->item(0)->nodeValue;
|
$data["memory_kb"] = $memory->item(0)->getElementsByTagName("kilobytetotal")->item(0)->nodeValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$cpu = $item->getElementsByTagName("cpu");
|
$cpu = $item->getElementsByTagName("cpu");
|
||||||
if ($cpu->length > 0){
|
if ($cpu->length > 0){
|
||||||
$data["cpu_perc"] = $cpu->item(0)->getElementsByTagName("percent")->item(0)->nodeValue."%";
|
$data["cpu_perc"] = $cpu->item(0)->getElementsByTagName("percent")->item(0)->nodeValue."%";
|
||||||
|
@ -127,7 +127,7 @@ class Application_Model_Systemstatus
|
||||||
foreach($keys as $key) {
|
foreach($keys as $key) {
|
||||||
$data[$key] = "UNKNOWN";
|
$data[$key] = "UNKNOWN";
|
||||||
}
|
}
|
||||||
|
|
||||||
$docRoot = self::GetMonitStatus("localhost");
|
$docRoot = self::GetMonitStatus("localhost");
|
||||||
if (!is_null($docRoot)){
|
if (!is_null($docRoot)){
|
||||||
foreach ($docRoot->getElementsByTagName("platform") AS $item)
|
foreach ($docRoot->getElementsByTagName("platform") AS $item)
|
||||||
|
@ -140,7 +140,7 @@ class Application_Model_Systemstatus
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,14 +151,14 @@ class Application_Model_Systemstatus
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
$ip = $component->getDbIp();
|
$ip = $component->getDbIp();
|
||||||
|
|
||||||
$docRoot = self::GetMonitStatus($ip);
|
$docRoot = self::GetMonitStatus($ip);
|
||||||
$data = self::ExtractServiceInformation($docRoot, "airtime-playout");
|
$data = self::ExtractServiceInformation($docRoot, "airtime-playout");
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetLiquidsoapStatus(){
|
public static function GetLiquidsoapStatus(){
|
||||||
|
|
||||||
$component = CcServiceRegisterQuery::create()->findOneByDbName("pypo");
|
$component = CcServiceRegisterQuery::create()->findOneByDbName("pypo");
|
||||||
|
@ -166,14 +166,14 @@ class Application_Model_Systemstatus
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
$ip = $component->getDbIp();
|
$ip = $component->getDbIp();
|
||||||
|
|
||||||
$docRoot = self::GetMonitStatus($ip);
|
$docRoot = self::GetMonitStatus($ip);
|
||||||
$data = self::ExtractServiceInformation($docRoot, "airtime-liquidsoap");
|
$data = self::ExtractServiceInformation($docRoot, "airtime-liquidsoap");
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetMediaMonitorStatus(){
|
public static function GetMediaMonitorStatus(){
|
||||||
|
|
||||||
$component = CcServiceRegisterQuery::create()->findOneByDbName("media-monitor");
|
$component = CcServiceRegisterQuery::create()->findOneByDbName("media-monitor");
|
||||||
|
@ -181,15 +181,15 @@ class Application_Model_Systemstatus
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
$ip = $component->getDbIp();
|
$ip = $component->getDbIp();
|
||||||
|
|
||||||
$docRoot = self::GetMonitStatus($ip);
|
$docRoot = self::GetMonitStatus($ip);
|
||||||
$data = self::ExtractServiceInformation($docRoot, "airtime-media-monitor");
|
$data = self::ExtractServiceInformation($docRoot, "airtime-media-monitor");
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetIcecastStatus(){
|
public static function GetIcecastStatus(){
|
||||||
$docRoot = self::GetMonitStatus("localhost");
|
$docRoot = self::GetMonitStatus("localhost");
|
||||||
$data = self::ExtractServiceInformation($docRoot, "icecast2");
|
$data = self::ExtractServiceInformation($docRoot, "icecast2");
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ class Application_Model_Systemstatus
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetRabbitMqStatus(){
|
public static function GetRabbitMqStatus(){
|
||||||
|
|
||||||
if (isset($_SERVER["RABBITMQ_HOST"])){
|
if (isset($_SERVER["RABBITMQ_HOST"])){
|
||||||
$rabbitmq_host = $_SERVER["RABBITMQ_HOST"];
|
$rabbitmq_host = $_SERVER["RABBITMQ_HOST"];
|
||||||
} else {
|
} else {
|
||||||
|
@ -208,18 +208,18 @@ class Application_Model_Systemstatus
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetDiskInfo(){
|
public static function GetDiskInfo(){
|
||||||
$partions = array();
|
$partions = array();
|
||||||
|
|
||||||
if (isset($_SERVER['AIRTIME_SRV'])){
|
if (isset($_SERVER['AIRTIME_SRV'])){
|
||||||
//connect to DB and find how much total space user has allocated.
|
//connect to DB and find how much total space user has allocated.
|
||||||
$totalSpace = Application_Model_Preference::GetDiskQuota();
|
$totalSpace = Application_Model_Preference::GetDiskQuota();
|
||||||
|
|
||||||
$storPath = Application_Model_MusicDir::getStorDir()->getDirectory();
|
$storPath = Application_Model_MusicDir::getStorDir()->getDirectory();
|
||||||
|
|
||||||
list($usedSpace,) = preg_split("/[\s]+/", exec("du -bs $storPath"));
|
list($usedSpace,) = preg_split("/[\s]+/", exec("du -bs $storPath"));
|
||||||
|
|
||||||
$partitions[$totalSpace]->totalSpace = $totalSpace;
|
$partitions[$totalSpace]->totalSpace = $totalSpace;
|
||||||
$partitions[$totalSpace]->totalFreeSpace = $totalSpace - $usedSpace;
|
$partitions[$totalSpace]->totalFreeSpace = $totalSpace - $usedSpace;
|
||||||
Logging::log($partitions[$totalSpace]->totalFreeSpace);
|
Logging::log($partitions[$totalSpace]->totalFreeSpace);
|
||||||
|
@ -228,7 +228,7 @@ class Application_Model_Systemstatus
|
||||||
* into the same partitions by comparing the partition sizes. */
|
* into the same partitions by comparing the partition sizes. */
|
||||||
$musicDirs = Application_Model_MusicDir::getWatchedDirs();
|
$musicDirs = Application_Model_MusicDir::getWatchedDirs();
|
||||||
$musicDirs[] = Application_Model_MusicDir::getStorDir();
|
$musicDirs[] = Application_Model_MusicDir::getStorDir();
|
||||||
|
|
||||||
foreach($musicDirs as $md){
|
foreach($musicDirs as $md){
|
||||||
$totalSpace = disk_total_space($md->getDirectory());
|
$totalSpace = disk_total_space($md->getDirectory());
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ class Application_Model_Systemstatus
|
||||||
$partitions[$totalSpace]->totalFreeSpace = disk_free_space($md->getDirectory());
|
$partitions[$totalSpace]->totalFreeSpace = disk_free_space($md->getDirectory());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$partitions[$totalSpace]->dirs[] = $md->getDirectory();
|
$partitions[$totalSpace]->dirs[] = $md->getDirectory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,191 +11,220 @@ class Application_Model_User {
|
||||||
|
|
||||||
public function __construct($userId)
|
public function __construct($userId)
|
||||||
{
|
{
|
||||||
if (empty($userId)){
|
if (empty($userId)) {
|
||||||
$this->_userInstance = $this->createUser();
|
$this->_userInstance = $this->createUser();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->_userInstance = CcSubjsQuery::create()->findPK($userId);
|
$this->_userInstance = CcSubjsQuery::create()->findPK($userId);
|
||||||
|
|
||||||
if (is_null($this->_userInstance)){
|
if (is_null($this->_userInstance)) {
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getId() {
|
public function getId()
|
||||||
|
{
|
||||||
return $this->_userInstance->getDbId();
|
return $this->_userInstance->getDbId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isGuest() {
|
public function isGuest()
|
||||||
|
{
|
||||||
return $this->getType() == UTYPE_GUEST;
|
return $this->getType() == UTYPE_GUEST;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isHost($showId) {
|
public function isHost($showId)
|
||||||
return $this->isUserType(UTYPE_HOST, $showId);
|
{
|
||||||
|
return $this->isUserType(UTYPE_HOST, $showId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isPM() {
|
public function isPM()
|
||||||
|
{
|
||||||
return $this->isUserType(UTYPE_PROGRAM_MANAGER);
|
return $this->isUserType(UTYPE_PROGRAM_MANAGER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isAdmin() {
|
public function isAdmin()
|
||||||
|
{
|
||||||
return $this->isUserType(UTYPE_ADMIN);
|
return $this->isUserType(UTYPE_ADMIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function canSchedule($p_showId) {
|
public function canSchedule($p_showId)
|
||||||
$type = $this->getType();
|
{
|
||||||
$result = false;
|
$type = $this->getType();
|
||||||
|
$result = false;
|
||||||
|
|
||||||
if ( $type === UTYPE_ADMIN ||
|
if ($type === UTYPE_ADMIN ||
|
||||||
$type === UTYPE_PROGRAM_MANAGER ||
|
$type === UTYPE_PROGRAM_MANAGER ||
|
||||||
CcShowHostsQuery::create()->filterByDbShow($p_showId)->filterByDbHost($this->getId())->count() > 0 )
|
CcShowHostsQuery::create()->filterByDbShow($p_showId)->filterByDbHost($this->getId())->count() > 0) {
|
||||||
{
|
$result = true;
|
||||||
$result = true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isUserType($type, $showId=''){
|
public function isUserType($type, $showId='')
|
||||||
if(is_array($type)){
|
{
|
||||||
$result = false;
|
if (is_array($type)) {
|
||||||
foreach($type as $t){
|
$result = false;
|
||||||
switch($t){
|
foreach ($type as $t) {
|
||||||
case UTYPE_ADMIN:
|
switch($t){
|
||||||
$result = $this->_userInstance->getDbType() === 'A';
|
case UTYPE_ADMIN:
|
||||||
break;
|
$result = $this->_userInstance->getDbType() === 'A';
|
||||||
case UTYPE_HOST:
|
break;
|
||||||
$userId = $this->_userInstance->getDbId();
|
case UTYPE_HOST:
|
||||||
$result = CcShowHostsQuery::create()->filterByDbShow($showId)->filterByDbHost($userId)->count() > 0;
|
$userId = $this->_userInstance->getDbId();
|
||||||
break;
|
$result = CcShowHostsQuery::create()
|
||||||
case UTYPE_PROGRAM_MANAGER:
|
->filterByDbShow($showId)
|
||||||
$result = $this->_userInstance->getDbType() === 'P';
|
->filterByDbHost($userId)->count() > 0;
|
||||||
break;
|
break;
|
||||||
}
|
case UTYPE_PROGRAM_MANAGER:
|
||||||
if($result){
|
$result = $this->_userInstance->getDbType() === 'P';
|
||||||
return $result;
|
break;
|
||||||
}
|
}
|
||||||
}
|
if ($result) {
|
||||||
}else{
|
return $result;
|
||||||
switch($type){
|
}
|
||||||
case UTYPE_ADMIN:
|
}
|
||||||
return $this->_userInstance->getDbType() === 'A';
|
} else {
|
||||||
case UTYPE_HOST:
|
switch($type) {
|
||||||
$userId = $this->_userInstance->getDbId();
|
case UTYPE_ADMIN:
|
||||||
return CcShowHostsQuery::create()->filterByDbShow($showId)->filterByDbHost($userId)->count() > 0;
|
return $this->_userInstance->getDbType() === 'A';
|
||||||
case UTYPE_PROGRAM_MANAGER:
|
case UTYPE_HOST:
|
||||||
return $this->_userInstance->getDbType() === 'P';
|
$userId = $this->_userInstance->getDbId();
|
||||||
}
|
return CcShowHostsQuery::create()->filterByDbShow($showId)->filterByDbHost($userId)->count() > 0;
|
||||||
}
|
case UTYPE_PROGRAM_MANAGER:
|
||||||
|
return $this->_userInstance->getDbType() === 'P';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setLogin($login){
|
public function setLogin($login)
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
$user->setDbLogin($login);
|
$user->setDbLogin($login);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setPassword($password){
|
public function setPassword($password)
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
$user->setDbPass(md5($password));
|
$user->setDbPass(md5($password));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setFirstName($firstName){
|
public function setFirstName($firstName)
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
$user->setDbFirstName($firstName);
|
$user->setDbFirstName($firstName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setLastName($lastName){
|
public function setLastName($lastName)
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
$user->setDbLastName($lastName);
|
$user->setDbLastName($lastName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setType($type){
|
public function setType($type)
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
$user->setDbType($type);
|
$user->setDbType($type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setEmail($email){
|
public function setEmail($email)
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
$user->setDbEmail(strtolower($email));
|
$user->setDbEmail(strtolower($email));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setCellPhone($cellPhone){
|
public function setCellPhone($cellPhone)
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
$user->setDbCellPhone($cellPhone);
|
$user->setDbCellPhone($cellPhone);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setSkype($skype){
|
public function setSkype($skype)
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
$user->setDbSkypeContact($skype);
|
$user->setDbSkypeContact($skype);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setJabber($jabber){
|
public function setJabber($jabber)
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
$user->setDbJabberContact($jabber);
|
$user->setDbJabberContact($jabber);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLogin(){
|
public function getLogin()
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
return $user->getDbLogin();
|
return $user->getDbLogin();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPassword(){
|
public function getPassword()
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
return $user->getDbPass();
|
return $user->getDbPass();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFirstName(){
|
public function getFirstName()
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
return $user->getDbFirstName();
|
return $user->getDbFirstName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLastName(){
|
public function getLastName()
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
return $user->getDbLastName();
|
return $user->getDbLastName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getType(){
|
public function getType()
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
return $user->getDbType();
|
return $user->getDbType();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getEmail(){
|
public function getEmail()
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
return $user->getDbEmail();
|
return $user->getDbEmail();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCellPhone(){
|
public function getCellPhone()
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
return $user->getDbCellPhone();
|
return $user->getDbCellPhone();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSkype(){
|
public function getSkype()
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
return $user->getDbSkypeContact();
|
return $user->getDbSkypeContact();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJabber(){
|
public function getJabber()
|
||||||
|
{
|
||||||
$user = $this->_userInstance;
|
$user = $this->_userInstance;
|
||||||
return $user->getDbJabberContact();
|
return $user->getDbJabberContact();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function save(){
|
public function save()
|
||||||
|
{
|
||||||
$this->_userInstance->save();
|
$this->_userInstance->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete(){
|
public function delete()
|
||||||
if (!$this->_userInstance->isDeleted())
|
{
|
||||||
|
if (!$this->_userInstance->isDeleted()) {
|
||||||
$this->_userInstance->delete();
|
$this->_userInstance->delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createUser() {
|
private function createUser()
|
||||||
|
{
|
||||||
$user = new CcSubjs();
|
$user = new CcSubjs();
|
||||||
return $user;
|
return $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getUsers($type, $search=NULL)
|
public static function getUsers($type, $search=null)
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
|
||||||
|
@ -203,12 +232,11 @@ class Application_Model_User {
|
||||||
$sql = $sql_gen;
|
$sql = $sql_gen;
|
||||||
|
|
||||||
if (is_array($type)) {
|
if (is_array($type)) {
|
||||||
for($i=0; $i<count($type); $i++) {
|
for ($i=0; $i<count($type); $i++) {
|
||||||
$type[$i] = "type = '{$type[$i]}'";
|
$type[$i] = "type = '{$type[$i]}'";
|
||||||
}
|
}
|
||||||
$sql_type = join(" OR ", $type);
|
$sql_type = join(" OR ", $type);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$sql_type = "type = {$type}";
|
$sql_type = "type = {$type}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,39 +253,40 @@ class Application_Model_User {
|
||||||
return $con->query($sql)->fetchAll();;
|
return $con->query($sql)->fetchAll();;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getUserCount($type=NULL){
|
public static function getUserCount($type=null)
|
||||||
|
{
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
$sql = '';
|
$sql = '';
|
||||||
$sql_gen = "SELECT count(*) AS cnt FROM cc_subjs ";
|
$sql_gen = "SELECT count(*) AS cnt FROM cc_subjs ";
|
||||||
|
|
||||||
if (!isset($type)) {
|
if (!isset($type)) {
|
||||||
$sql = $sql_gen;
|
$sql = $sql_gen;
|
||||||
}
|
} else {
|
||||||
else{
|
if (is_array($type)) {
|
||||||
if (is_array($type)) {
|
for ($i=0; $i<count($type); $i++) {
|
||||||
for ($i=0; $i<count($type); $i++) {
|
$type[$i] = "type = '{$type[$i]}'";
|
||||||
$type[$i] = "type = '{$type[$i]}'";
|
}
|
||||||
}
|
$sql_type = join(" OR ", $type);
|
||||||
$sql_type = join(" OR ", $type);
|
} else {
|
||||||
}
|
$sql_type = "type = {$type}";
|
||||||
else {
|
}
|
||||||
$sql_type = "type = {$type}";
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = $sql_gen ." WHERE (". $sql_type.") ";
|
$sql = $sql_gen ." WHERE (". $sql_type.") ";
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = $con->query($sql)->fetchColumn(0);
|
$query = $con->query($sql)->fetchColumn(0);
|
||||||
return ($query !== false) ? $query : NULL;
|
return ($query !== false) ? $query : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getHosts($search=NULL) {
|
public static function getHosts($search=null)
|
||||||
|
{
|
||||||
return Application_Model_User::getUsers(array('H'), $search);
|
return Application_Model_User::getUsers(array('H'), $search);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getUsersDataTablesInfo($datatables) {
|
public static function getUsersDataTablesInfo($datatables)
|
||||||
|
{
|
||||||
|
|
||||||
$con = Propel::getConnection(CcSubjsPeer::DATABASE_NAME);
|
$con = Propel::getConnection(CcSubjsPeer::DATABASE_NAME);
|
||||||
|
|
||||||
$displayColumns = array("id", "login", "first_name", "last_name", "type");
|
$displayColumns = array("id", "login", "first_name", "last_name", "type");
|
||||||
$fromTable = "cc_subjs";
|
$fromTable = "cc_subjs";
|
||||||
|
@ -273,8 +302,8 @@ class Application_Model_User {
|
||||||
$res = Application_Model_Datatables::findEntries($con, $displayColumns, $fromTable, $datatables);
|
$res = Application_Model_Datatables::findEntries($con, $displayColumns, $fromTable, $datatables);
|
||||||
|
|
||||||
// mark record which is for the current user
|
// mark record which is for the current user
|
||||||
foreach($res['aaData'] as &$record){
|
foreach ($res['aaData'] as &$record) {
|
||||||
if($record['login'] == $username){
|
if ($record['login'] == $username) {
|
||||||
$record['delete'] = "self";
|
$record['delete'] = "self";
|
||||||
} else {
|
} else {
|
||||||
$record['delete'] = "";
|
$record['delete'] = "";
|
||||||
|
@ -284,7 +313,8 @@ class Application_Model_User {
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getUserData($id){
|
public static function getUserData($id)
|
||||||
|
{
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
|
||||||
$sql = "SELECT login, first_name, last_name, type, id, email, cell_phone, skype_contact, jabber_contact"
|
$sql = "SELECT login, first_name, last_name, type, id, email, cell_phone, skype_contact, jabber_contact"
|
||||||
|
@ -294,26 +324,18 @@ class Application_Model_User {
|
||||||
return $con->query($sql)->fetch();
|
return $con->query($sql)->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetUserID($login){
|
public static function getCurrentUser()
|
||||||
$user = CcSubjsQuery::create()->findOneByDbLogin($login);
|
{
|
||||||
if (is_null($user)){
|
|
||||||
return -1;
|
|
||||||
} else {
|
|
||||||
return $user->getDbId();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function GetCurrentUser() {
|
|
||||||
$userinfo = Zend_Auth::getInstance()->getStorage()->read();
|
$userinfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
|
|
||||||
if (is_null($userinfo)){
|
if (is_null($userinfo)) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
return new self($userinfo->id);
|
return new self($userinfo->id);
|
||||||
} catch (Exception $e){
|
} catch (Exception $e) {
|
||||||
//we get here if $userinfo->id is defined, but doesn't exist
|
//we get here if $userinfo->id is defined, but doesn't exist
|
||||||
//in the database anymore.
|
//in the database anymore.
|
||||||
Zend_Auth::getInstance()->clearIdentity();
|
Zend_Auth::getInstance()->clearIdentity();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*/
|
*/
|
||||||
class CcFiles extends BaseCcFiles {
|
class CcFiles extends BaseCcFiles {
|
||||||
|
|
||||||
public function getDbLength($format = "H:i:s.u")
|
public function getDbLength($format = "H:i:s.u")
|
||||||
{
|
{
|
||||||
return parent::getDbLength($format);
|
return parent::getDbLength($format);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class Common {
|
class Common {
|
||||||
|
|
||||||
public static function setTimeInSub($row, $col, $time)
|
public static function setTimeInSub($row, $col, $time)
|
||||||
{
|
{
|
||||||
$class = get_class($row).'Peer';
|
$class = get_class($row).'Peer';
|
||||||
|
|
||||||
$con = Propel::getConnection($class::DATABASE_NAME);
|
$con = Propel::getConnection($class::DATABASE_NAME);
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,8 @@ class StoredFileTest extends PHPUnit_TestCase {
|
||||||
|| ($metadata["audio"]["dataformat"] != "mp3")
|
|| ($metadata["audio"]["dataformat"] != "mp3")
|
||||||
|| ($metadata["dc:type"] != "Speech")) {
|
|| ($metadata["dc:type"] != "Speech")) {
|
||||||
$str = " [dc:description] = " . $metadata["dc:description"] ."\n"
|
$str = " [dc:description] = " . $metadata["dc:description"] ."\n"
|
||||||
. " [audio][dataformat] = " . $metadata["audio"]["dataformat"]."\n"
|
. " [audio][dataformat] = " . $metadata["audio"]["dataformat"]."\n"
|
||||||
. " [dc:type] = ".$metadata["dc:type"]."\n";
|
. " [dc:type] = ".$metadata["dc:type"]."\n";
|
||||||
$this->fail("Metadata has unexpected values:\n".$str);
|
$this->fail("Metadata has unexpected values:\n".$str);
|
||||||
}
|
}
|
||||||
//var_dump($metadata);
|
//var_dump($metadata);
|
||||||
|
|
|
@ -29,7 +29,7 @@ class MediaMonitorCommon:
|
||||||
return filter(lambda e: len(e) > 0, [ f.strip(" \n") for f in dirty_files ])
|
return filter(lambda e: len(e) > 0, [ f.strip(" \n") for f in dirty_files ])
|
||||||
|
|
||||||
def find_command(self, directory, extra_arguments=""):
|
def find_command(self, directory, extra_arguments=""):
|
||||||
""" Builds a find command that respects supported_file_formats list
|
""" Builds a find command that respects supported_file_formats list
|
||||||
Note: Use single quotes to quote arguments """
|
Note: Use single quotes to quote arguments """
|
||||||
ext_globs = [ "-iname '*.%s'" % ext for ext in self.supported_file_formats ]
|
ext_globs = [ "-iname '*.%s'" % ext for ext in self.supported_file_formats ]
|
||||||
find_glob = ' -o '.join(ext_globs)
|
find_glob = ' -o '.join(ext_globs)
|
||||||
|
@ -51,7 +51,7 @@ class MediaMonitorCommon:
|
||||||
|
|
||||||
def is_audio_file(self, filename):
|
def is_audio_file(self, filename):
|
||||||
info = filename.split(".")
|
info = filename.split(".")
|
||||||
if len(info) < 2: return false # handle cases like filename="mp3"
|
if len(info) < 2: return False # handle cases like filename="mp3"
|
||||||
return info[-1].lower() in self.supported_file_formats
|
return info[-1].lower() in self.supported_file_formats
|
||||||
|
|
||||||
#check if file is readable by "nobody"
|
#check if file is readable by "nobody"
|
||||||
|
@ -101,7 +101,7 @@ class MediaMonitorCommon:
|
||||||
will attempt to make the file world readable by modifying the file's permission's
|
will attempt to make the file world readable by modifying the file's permission's
|
||||||
as well as the file's parent directory permissions. We should only call this function
|
as well as the file's parent directory permissions. We should only call this function
|
||||||
on files in Airtime's stor directory, not watched directories!
|
on files in Airtime's stor directory, not watched directories!
|
||||||
|
|
||||||
Returns True if we were able to make the file world readable. False otherwise.
|
Returns True if we were able to make the file world readable. False otherwise.
|
||||||
"""
|
"""
|
||||||
original_file = pathname
|
original_file = pathname
|
||||||
|
@ -278,7 +278,7 @@ class MediaMonitorCommon:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
"""
|
"""
|
||||||
File name charset encoding is UTF-8.
|
File name charset encoding is UTF-8.
|
||||||
"""
|
"""
|
||||||
stdout = stdout.decode("UTF-8")
|
stdout = stdout.decode("UTF-8")
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 492242f4bb7367afebbf2f096067cb5a5d3c0449
|
Subproject commit 0653ec0b89362921f075af96ee8772538b801a7c
|
Loading…
Reference in New Issue