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()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,18 +270,18 @@ 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');
|
||||||
|
@ -292,8 +292,8 @@ class ApiController extends Zend_Controller_Action
|
||||||
$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.
|
||||||
|
@ -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);
|
||||||
|
|
||||||
|
|
|
@ -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,7 +204,7 @@ 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;
|
||||||
|
|
|
@ -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()
|
||||||
|
@ -229,8 +228,8 @@ class PlaylistController extends Zend_Controller_Action
|
||||||
{
|
{
|
||||||
$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.
|
||||||
|
@ -37,48 +37,48 @@ 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"];
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -254,10 +254,10 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
||||||
|
|
|
@ -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,7 +90,7 @@ 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;
|
||||||
|
@ -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,7 +115,7 @@ 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() {
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,8 +357,8 @@ 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();
|
||||||
|
@ -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,24 +451,24 @@ 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');
|
||||||
|
@ -496,8 +496,8 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
$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();
|
||||||
|
@ -548,24 +548,24 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
|
|
||||||
$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));
|
||||||
|
|
||||||
|
@ -689,7 +689,7 @@ 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);
|
||||||
|
@ -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,7 +842,7 @@ 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');
|
||||||
|
@ -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,7 +900,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 setTimeIntervalAction() {
|
public function setTimeIntervalAction() {
|
||||||
Application_Model_Preference::SetCalendarTimeInterval($this->_getParam('timeInterval'));
|
Application_Model_Preference::SetCalendarTimeInterval($this->_getParam('timeInterval'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function calculateDurationAction() {
|
public function calculateDurationAction() {
|
||||||
|
|
|
@ -22,12 +22,12 @@ class ShowbuilderController extends Zend_Controller_Action
|
||||||
|
|
||||||
$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) );");
|
||||||
|
@ -36,7 +36,7 @@ class ShowbuilderController extends Zend_Controller_Action
|
||||||
$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) );");
|
||||||
|
@ -68,69 +68,69 @@ class ShowbuilderController extends Zend_Controller_Action
|
||||||
$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);
|
||||||
|
|
||||||
|
@ -138,12 +138,12 @@ class ShowbuilderController extends Zend_Controller_Action
|
||||||
$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();
|
||||||
|
@ -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();
|
||||||
|
|
|
@ -37,7 +37,7 @@ class UserController extends Zend_Controller_Action
|
||||||
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>";
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,12 +23,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("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);
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ class UsersettingsController extends Zend_Controller_Action
|
||||||
$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);
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ class UsersettingsController extends Zend_Controller_Action
|
||||||
|
|
||||||
$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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,10 +69,10 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
|
||||||
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
|
||||||
|
@ -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 = '';
|
$resourceName = '';
|
||||||
|
|
||||||
if ($request->getModuleName() != 'default') {
|
if ($request->getModuleName() != 'default') {
|
||||||
$resourceName .= strtolower($request->getModuleName()) . ':';
|
$resourceName .= strtolower($request->getModuleName()) . ':';
|
||||||
}
|
}
|
||||||
|
|
||||||
$resourceName .= $controller;
|
$resourceName .= $controller;
|
||||||
|
|
||||||
/** Check if the controller/action can be accessed by the current user */
|
/** Check if the controller/action can be accessed by the current user */
|
||||||
if (!$this->getAcl()->isAllowed($this->_roleName, $resourceName, $request->getActionName())) {
|
if (!$this->getAcl()->isAllowed($this->_roleName, $resourceName, $request->getActionName())) {
|
||||||
/** Redirect to access denied page */
|
/** Redirect to access denied page */
|
||||||
$this->denyAccess();
|
$this->denyAccess();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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(){
|
||||||
|
|
|
@ -6,54 +6,54 @@ 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(){
|
||||||
|
|
|
@ -25,7 +25,7 @@ class Application_Form_AddShowStyle extends Zend_Form_SubForm
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
||||||
// 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',
|
||||||
|
|
|
@ -4,9 +4,9 @@ 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.
|
||||||
|
@ -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');
|
||||||
|
|
||||||
|
|
|
@ -86,6 +86,9 @@ 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'];
|
||||||
|
|
||||||
|
@ -148,10 +151,112 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
$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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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(){
|
||||||
|
|
|
@ -79,7 +79,7 @@ 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);
|
||||||
|
|
|
@ -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,33 +37,33 @@ 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',
|
||||||
|
@ -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',
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
||||||
|
|
||||||
//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)
|
||||||
|
@ -92,7 +92,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
||||||
->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)
|
||||||
|
@ -102,7 +102,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
||||||
$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)
|
||||||
|
@ -111,7 +111,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
||||||
->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)
|
||||||
|
@ -159,7 +159,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
||||||
}
|
}
|
||||||
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){
|
||||||
|
|
|
@ -7,14 +7,14 @@ class Application_Form_Login extends Zend_Form
|
||||||
{
|
{
|
||||||
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',
|
||||||
|
@ -29,7 +29,7 @@ class Application_Form_Login extends Zend_Form
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
// 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',
|
||||||
|
@ -53,7 +53,7 @@ class Application_Form_Login extends Zend_Form
|
||||||
$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',
|
||||||
|
|
|
@ -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,28 +85,28 @@ 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(
|
||||||
|
@ -116,23 +116,23 @@ 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(
|
||||||
|
|
|
@ -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'))
|
||||||
|
|
|
@ -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(
|
||||||
|
|
|
@ -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)
|
||||||
|
@ -131,14 +131,14 @@ class Application_Form_SupportSettings extends Zend_Form
|
||||||
}
|
}
|
||||||
$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'
|
||||||
|
|
|
@ -2,27 +2,27 @@
|
||||||
|
|
||||||
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";
|
||||||
|
@ -31,22 +31,22 @@ class Application_Model_Auth {
|
||||||
|
|
||||||
$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)
|
||||||
|
|
|
@ -2,103 +2,103 @@
|
||||||
|
|
||||||
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
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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()
|
||||||
|
@ -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) {
|
||||||
|
@ -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(
|
private $mDataPropMap = array(
|
||||||
"artist" => "file.artist_name",
|
"artist" => "file.artist_name",
|
||||||
"title" => "file.track_title",
|
"title" => "file.track_title",
|
||||||
"played" => "playout.played",
|
"played" => "playout.played",
|
||||||
"length" => "file.length",
|
"length" => "file.length",
|
||||||
"composer" => "file.composer",
|
"composer" => "file.composer",
|
||||||
"copyright" => "file.copyright",
|
"copyright" => "file.copyright",
|
||||||
);
|
);
|
||||||
|
|
||||||
public function __construct($p_startDT, $p_endDT, $p_opts) {
|
public function __construct($p_startDT, $p_endDT, $p_opts) {
|
||||||
|
|
||||||
$this->con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
|
$this->con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
|
||||||
$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->epoch_now = time();
|
$this->epoch_now = time();
|
||||||
$this->opts = $p_opts;
|
$this->opts = $p_opts;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* map front end mDataProp labels to proper column names for searching etc.
|
* map front end mDataProp labels to proper column names for searching etc.
|
||||||
*/
|
*/
|
||||||
private function translateColumns() {
|
private function translateColumns() {
|
||||||
|
|
||||||
for ($i = 0; $i < $this->opts["iColumns"]; $i++){
|
for ($i = 0; $i < $this->opts["iColumns"]; $i++){
|
||||||
|
|
||||||
$this->opts["mDataProp_{$i}"] = $this->mDataPropMap[$this->opts["mDataProp_{$i}"]];
|
$this->opts["mDataProp_{$i}"] = $this->mDataPropMap[$this->opts["mDataProp_{$i}"]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getItems() {
|
public function getItems() {
|
||||||
|
|
||||||
$this->translateColumns();
|
$this->translateColumns();
|
||||||
|
|
||||||
$select = array(
|
$select = array(
|
||||||
"file.track_title as title",
|
"file.track_title as title",
|
||||||
"file.artist_name as artist",
|
"file.artist_name as artist",
|
||||||
"playout.played",
|
"playout.played",
|
||||||
"playout.file_id",
|
"playout.file_id",
|
||||||
"file.composer",
|
"file.composer",
|
||||||
"file.copyright",
|
"file.copyright",
|
||||||
"file.length"
|
"file.length"
|
||||||
);
|
);
|
||||||
|
|
||||||
$start = $this->startDT->format("Y-m-d H:i:s");
|
$start = $this->startDT->format("Y-m-d H:i:s");
|
||||||
$end = $this->endDT->format("Y-m-d H:i:s");
|
$end = $this->endDT->format("Y-m-d H:i:s");
|
||||||
|
|
||||||
$historyTable = "(
|
$historyTable = "(
|
||||||
select count(schedule.file_id) as played, schedule.file_id as file_id
|
select count(schedule.file_id) as played, schedule.file_id as file_id
|
||||||
from cc_schedule as schedule
|
from cc_schedule as schedule
|
||||||
where schedule.starts >= '{$start}' and schedule.starts < '{$end}'
|
where schedule.starts >= '{$start}' and schedule.starts < '{$end}'
|
||||||
and schedule.playout_status > 0 and schedule.media_item_played != FALSE and schedule.broadcasted = 1
|
and schedule.playout_status > 0 and schedule.media_item_played != FALSE and schedule.broadcasted = 1
|
||||||
group by schedule.file_id
|
group by schedule.file_id
|
||||||
)
|
)
|
||||||
AS playout left join cc_files as file on (file.id = playout.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");
|
$results = Application_Model_Datatables::findEntries($this->con, $select, $historyTable, $this->opts, "history");
|
||||||
|
|
||||||
foreach ($results["history"] as &$row) {
|
foreach ($results["history"] as &$row) {
|
||||||
$formatter = new LengthFormatter($row['length']);
|
$formatter = new LengthFormatter($row['length']);
|
||||||
$row['length'] = $formatter->format();
|
$row['length'] = $formatter->format();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -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;
|
||||||
|
@ -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;
|
||||||
|
@ -681,18 +681,18 @@ class Application_Model_Schedule {
|
||||||
$isSaas = (Application_Model_Preference::GetPlanLevel() != 'disabled');
|
$isSaas = (Application_Model_Preference::GetPlanLevel() != 'disabled');
|
||||||
|
|
||||||
$formWhat = new Application_Form_AddShowWhat();
|
$formWhat = new Application_Form_AddShowWhat();
|
||||||
$formWhen = new Application_Form_AddShowWhen();
|
$formWhen = new Application_Form_AddShowWhen();
|
||||||
$formRepeats = new Application_Form_AddShowRepeats();
|
$formRepeats = new Application_Form_AddShowRepeats();
|
||||||
$formWho = new Application_Form_AddShowWho();
|
$formWho = new Application_Form_AddShowWho();
|
||||||
$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');
|
||||||
$formWhen->removeDecorator('DtDdWrapper');
|
$formWhen->removeDecorator('DtDdWrapper');
|
||||||
$formRepeats->removeDecorator('DtDdWrapper');
|
$formRepeats->removeDecorator('DtDdWrapper');
|
||||||
$formWho->removeDecorator('DtDdWrapper');
|
$formWho->removeDecorator('DtDdWrapper');
|
||||||
$formStyle->removeDecorator('DtDdWrapper');
|
$formStyle->removeDecorator('DtDdWrapper');
|
||||||
$formLive->removeDecorator('DtDdWrapper');
|
$formLive->removeDecorator('DtDdWrapper');
|
||||||
|
|
||||||
if(!$isSaas){
|
if(!$isSaas){
|
||||||
$formRecord = new Application_Form_AddShowRR();
|
$formRecord = new Application_Form_AddShowRR();
|
||||||
|
@ -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){
|
||||||
|
@ -898,7 +898,7 @@ 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;
|
||||||
|
|
|
@ -32,7 +32,7 @@ class Application_Model_Scheduler {
|
||||||
$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) {
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1733,7 +1731,8 @@ class Application_Model_Show {
|
||||||
$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,14 +1745,16 @@ 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'"
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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();
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ 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;
|
||||||
|
|
|
@ -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,10 +777,10 @@ 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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ class Application_Model_Soundcloud {
|
||||||
|
|
||||||
private $_soundcloud;
|
private $_soundcloud;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
@ -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)
|
||||||
|
@ -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()
|
||||||
{
|
{
|
||||||
|
@ -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",
|
||||||
|
@ -967,9 +967,9 @@ Logging::log("getting media! - 2");
|
||||||
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')))";
|
||||||
|
@ -1023,8 +1023,8 @@ Logging::log("getting media! - 2");
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
|
|
|
@ -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,7 +174,7 @@ 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';
|
||||||
|
@ -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)
|
||||||
|
|
|
@ -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,24 +324,16 @@ 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();
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
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);
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 492242f4bb7367afebbf2f096067cb5a5d3c0449
|
Subproject commit 0653ec0b89362921f075af96ee8772538b801a7c
|
Loading…
Reference in New Issue