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');
|
||||
|
||||
$user = Application_Model_User::GetCurrentUser();
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
if (!is_null($user)){
|
||||
$userType = $user->getType();
|
||||
} else {
|
||||
|
|
|
@ -74,7 +74,7 @@ class ApiController extends Zend_Controller_Action
|
|||
* This is only being used by schedule.js at the moment.
|
||||
*/
|
||||
public function calendarInitAction(){
|
||||
$this->view->layout()->disableLayout();
|
||||
$this->view->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
if(is_null(Zend_Auth::getInstance()->getStorage()->read())) {
|
||||
|
@ -83,12 +83,12 @@ class ApiController extends Zend_Controller_Action
|
|||
return;
|
||||
}
|
||||
|
||||
$this->view->calendarInit = array(
|
||||
"timestamp" => time(),
|
||||
"timezoneOffset" => date("Z"),
|
||||
"timeScale" => Application_Model_Preference::GetCalendarTimeScale(),
|
||||
"timeInterval" => Application_Model_Preference::GetCalendarTimeInterval(),
|
||||
"weekStartDay" => Application_Model_Preference::GetWeekStartDay()
|
||||
$this->view->calendarInit = array(
|
||||
"timestamp" => time(),
|
||||
"timezoneOffset" => date("Z"),
|
||||
"timeScale" => Application_Model_Preference::GetCalendarTimeScale(),
|
||||
"timeInterval" => Application_Model_Preference::GetCalendarTimeInterval(),
|
||||
"weekStartDay" => Application_Model_Preference::GetWeekStartDay()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -270,18 +270,18 @@ class ApiController extends Zend_Controller_Action
|
|||
|
||||
$date = new Application_Common_DateHelper;
|
||||
$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();
|
||||
$type = $request->getParam('type');
|
||||
if($type == "endofday") {
|
||||
// make GetNextShows use end of day
|
||||
// make getNextShows use end of day
|
||||
$utcTimeEnd = Application_Common_DateHelper::GetDayEndTimestampInUtc();
|
||||
$result = array("env"=>APPLICATION_ENV,
|
||||
"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{
|
||||
|
||||
$limit = $request->getParam('limit');
|
||||
|
@ -292,8 +292,8 @@ class ApiController extends Zend_Controller_Action
|
|||
$result = Application_Model_Schedule::GetPlayOrderRange();
|
||||
|
||||
//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["nextShow"], 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"));
|
||||
}
|
||||
|
||||
$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();
|
||||
for ($i=0; $i<7; $i++){
|
||||
$utcDayEnd = Application_Common_DateHelper::GetDayEndTimestamp($utcDayStart);
|
||||
$shows = Application_Model_Show::GetNextShows($utcDayStart, "0", $utcDayEnd);
|
||||
$shows = Application_Model_Show::getNextShows($utcDayStart, "0", $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['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");
|
||||
echo $_GET['callback'].'('.json_encode($result).')';
|
||||
} else {
|
||||
|
@ -413,7 +413,7 @@ class ApiController extends Zend_Controller_Action
|
|||
$this->view->server_timezone = Application_Model_Preference::GetTimezone();
|
||||
|
||||
$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){
|
||||
$this->view->is_recording = ($rows[0]['record'] == 1);
|
||||
|
@ -466,8 +466,8 @@ class ApiController extends Zend_Controller_Action
|
|||
$this->view->showinstanceid = $show_instance_id;
|
||||
|
||||
|
||||
$showCanceled = false;
|
||||
$file = Application_Model_StoredFile::Recall($file_id);
|
||||
$showCanceled = false;
|
||||
$file = Application_Model_StoredFile::Recall($file_id);
|
||||
//$show_instance = $this->_getParam('show_instance');
|
||||
|
||||
$show_name = null;
|
||||
|
@ -508,7 +508,7 @@ class ApiController extends Zend_Controller_Action
|
|||
$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_TRACKNUMBER', $show_instance_id);
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
//array containing id and type of media to delete.
|
||||
$mediaItems = $this->_getParam('media', null);
|
||||
|
||||
$user = Application_Model_User::GetCurrentUser();
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
||||
|
||||
$files = array();
|
||||
|
@ -204,7 +204,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
|
||||
public function editFileMdAction()
|
||||
{
|
||||
$user = Application_Model_User::GetCurrentUser();
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
||||
if(!$isAdminOrPM){
|
||||
return;
|
||||
|
|
|
@ -162,14 +162,14 @@ class PlaylistController extends Zend_Controller_Action
|
|||
public function newAction()
|
||||
{
|
||||
$pl_sess = $this->pl_sess;
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
|
||||
$pl = new Application_Model_Playlist();
|
||||
$pl->setName("Untitled Playlist");
|
||||
$pl->setPLMetaData('dc:creator', $userInfo->id);
|
||||
$pl->setPLMetaData('dc:creator', $userInfo->id);
|
||||
|
||||
$this->changePlaylist($pl->getId());
|
||||
$this->createFullResponse($pl);
|
||||
$this->changePlaylist($pl->getId());
|
||||
$this->createFullResponse($pl);
|
||||
}
|
||||
|
||||
public function editAction()
|
||||
|
@ -179,21 +179,20 @@ class PlaylistController extends Zend_Controller_Action
|
|||
//$form = new Application_Form_SmartPlaylistCriteria();
|
||||
|
||||
|
||||
if (!is_null($id)) {
|
||||
$this->changePlaylist($id);
|
||||
}
|
||||
if (!is_null($id)) {
|
||||
$this->changePlaylist($id);
|
||||
}
|
||||
|
||||
try {
|
||||
try {
|
||||
$pl = new Application_Model_Playlist($id);
|
||||
$this->createFullResponse($pl);
|
||||
//$this->view->form = $form;
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
$this->playlistNotFound();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->playlistUnknownError($e);
|
||||
}
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
$this->playlistNotFound();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->playlistUnknownError($e);
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteAction()
|
||||
|
@ -229,8 +228,8 @@ class PlaylistController extends Zend_Controller_Action
|
|||
{
|
||||
$ids = $this->_getParam('ids', array());
|
||||
$ids = (!is_array($ids)) ? array($ids) : $ids;
|
||||
$afterItem = $this->_getParam('afterItem', null);
|
||||
$addType = $this->_getParam('type', 'after');
|
||||
$afterItem = $this->_getParam('afterItem', null);
|
||||
$addType = $this->_getParam('type', 'after');
|
||||
|
||||
try {
|
||||
$pl = $this->getPlaylist();
|
||||
|
@ -295,9 +294,9 @@ class PlaylistController extends Zend_Controller_Action
|
|||
|
||||
public function setCueAction()
|
||||
{
|
||||
$id = $this->_getParam('id');
|
||||
$cueIn = $this->_getParam('cueIn', null);
|
||||
$cueOut = $this->_getParam('cueOut', null);
|
||||
$id = $this->_getParam('id');
|
||||
$cueIn = $this->_getParam('cueIn', null);
|
||||
$cueOut = $this->_getParam('cueOut', null);
|
||||
|
||||
try {
|
||||
$pl = $this->getPlaylist();
|
||||
|
@ -324,9 +323,9 @@ class PlaylistController extends Zend_Controller_Action
|
|||
|
||||
public function setFadeAction()
|
||||
{
|
||||
$id = $this->_getParam('id');
|
||||
$fadeIn = $this->_getParam('fadeIn', null);
|
||||
$fadeOut = $this->_getParam('fadeOut', null);
|
||||
$id = $this->_getParam('id');
|
||||
$fadeIn = $this->_getParam('fadeIn', null);
|
||||
$fadeOut = $this->_getParam('fadeOut', null);
|
||||
|
||||
try {
|
||||
$pl = $this->getPlaylist();
|
||||
|
@ -379,8 +378,8 @@ class PlaylistController extends Zend_Controller_Action
|
|||
**/
|
||||
public function setPlaylistFadesAction()
|
||||
{
|
||||
$fadeIn = $this->_getParam('fadeIn', null);
|
||||
$fadeOut = $this->_getParam('fadeOut', null);
|
||||
$fadeIn = $this->_getParam('fadeIn', null);
|
||||
$fadeOut = $this->_getParam('fadeOut', null);
|
||||
|
||||
try {
|
||||
$pl = $this->getPlaylist();
|
||||
|
|
|
@ -2,19 +2,19 @@
|
|||
|
||||
class PlayoutHistoryController extends Zend_Controller_Action
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
||||
$ajaxContext
|
||||
->addActionContext('playout-history-feed', 'json')
|
||||
->initContext();
|
||||
}
|
||||
public function init()
|
||||
{
|
||||
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
||||
$ajaxContext
|
||||
->addActionContext('playout-history-feed', 'json')
|
||||
->initContext();
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
public function indexAction()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
$request = $this->getRequest();
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
//default time is the last 24 hours.
|
||||
|
@ -37,48 +37,48 @@ class PlayoutHistoryController extends Zend_Controller_Action
|
|||
|
||||
$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/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.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/TableTools.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/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/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');
|
||||
|
||||
$offset = date("Z") * -1;
|
||||
$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/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/playouthistory/historytable.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$offset = date("Z") * -1;
|
||||
$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/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/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.'/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.'/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/playouthistory.css?'.$CC_CONFIG['airtime_version']);
|
||||
}
|
||||
|
||||
public function playoutHistoryFeedAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$current_time = time();
|
||||
public function playoutHistoryFeedAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$current_time = time();
|
||||
|
||||
$params = $request->getParams();
|
||||
$params = $request->getParams();
|
||||
|
||||
$starts_epoch = $request->getParam("start", $current_time - (60*60*24));
|
||||
$ends_epoch = $request->getParam("end", $current_time);
|
||||
$starts_epoch = $request->getParam("start", $current_time - (60*60*24));
|
||||
$ends_epoch = $request->getParam("end", $current_time);
|
||||
|
||||
$startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC"));
|
||||
$endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC"));
|
||||
$startsDT = DateTime::createFromFormat("U", $starts_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 ends {$endsDT->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")}");
|
||||
|
||||
$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->iTotalDisplayRecords = $r["iTotalDisplayRecords"];
|
||||
$this->view->iTotalRecords = $r["iTotalRecords"];
|
||||
$this->view->history = $r["history"];
|
||||
}
|
||||
$this->view->sEcho = $r["sEcho"];
|
||||
$this->view->iTotalDisplayRecords = $r["iTotalDisplayRecords"];
|
||||
$this->view->iTotalRecords = $r["iTotalRecords"];
|
||||
$this->view->history = $r["history"];
|
||||
}
|
||||
}
|
|
@ -254,10 +254,10 @@ class PreferenceController extends Zend_Controller_Action
|
|||
}
|
||||
|
||||
// extra info that goes into cc_stream_setting
|
||||
Application_Model_StreamSetting::SetMasterLiveSteamPort($values["master_harbor_input_port"]);
|
||||
Application_Model_StreamSetting::SetMasterLiveSteamMountPoint($values["master_harbor_input_mount_point"]);
|
||||
Application_Model_StreamSetting::SetDJLiveSteamPort($values["dj_harbor_input_port"]);
|
||||
Application_Model_StreamSetting::SetDJLiveSteamMountPoint($values["dj_harbor_input_mount_point"]);
|
||||
Application_Model_StreamSetting::setMasterLiveStreamPort($values["master_harbor_input_port"]);
|
||||
Application_Model_StreamSetting::setMasterLiveStreamMountPoint($values["master_harbor_input_mount_point"]);
|
||||
Application_Model_StreamSetting::setDjLiveStreamPort($values["dj_harbor_input_port"]);
|
||||
Application_Model_StreamSetting::setDjLiveStreamMountPoint($values["dj_harbor_input_mount_point"]);
|
||||
}
|
||||
|
||||
// store stream update timestamp
|
||||
|
|
|
@ -10,16 +10,16 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
||||
$ajaxContext->addActionContext('event-feed', 'json')
|
||||
->addActionContext('make-context-menu', 'json')
|
||||
->addActionContext('add-show-dialog', 'json')
|
||||
->addActionContext('add-show', 'json')
|
||||
->addActionContext('edit-show', 'json')
|
||||
->addActionContext('move-show', 'json')
|
||||
->addActionContext('resize-show', 'json')
|
||||
->addActionContext('delete-show', 'json')
|
||||
->addActionContext('add-show-dialog', 'json')
|
||||
->addActionContext('add-show', 'json')
|
||||
->addActionContext('edit-show', 'json')
|
||||
->addActionContext('move-show', 'json')
|
||||
->addActionContext('resize-show', 'json')
|
||||
->addActionContext('delete-show', 'json')
|
||||
->addActionContext('show-content-dialog', 'json')
|
||||
->addActionContext('clear-show', 'json')
|
||||
->addActionContext('clear-show', 'json')
|
||||
->addActionContext('get-current-playlist', 'json')
|
||||
->addActionContext('remove-group', 'json')
|
||||
->addActionContext('remove-group', 'json')
|
||||
->addActionContext('populate-show-form', 'json')
|
||||
->addActionContext('populate-show-instance-form', 'json')
|
||||
->addActionContext('cancel-show', 'json')
|
||||
|
@ -35,7 +35,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
->addActionContext('get-current-show', 'json')
|
||||
->initContext();
|
||||
|
||||
$this->sched_sess = new Zend_Session_Namespace("schedule");
|
||||
$this->sched_sess = new Zend_Session_Namespace("schedule");
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
|
@ -90,7 +90,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
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))){
|
||||
$this->view->preloadShowForm = true;
|
||||
|
@ -106,7 +106,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$end = new DateTime($this->_getParam('end', null));
|
||||
$end->setTimezone(new DateTimeZone("UTC"));
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||
$editable = true;
|
||||
|
@ -115,7 +115,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$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() {
|
||||
|
@ -155,8 +155,8 @@ class ScheduleController extends Zend_Controller_Action
|
|||
public function resizeShowAction()
|
||||
{
|
||||
$deltaDay = $this->_getParam('day');
|
||||
$deltaMin = $this->_getParam('min');
|
||||
$showId = $this->_getParam('showId');
|
||||
$deltaMin = $this->_getParam('min');
|
||||
$showId = $this->_getParam('showId');
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
|
@ -168,34 +168,34 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$this->view->show_error = true;
|
||||
return false;
|
||||
}
|
||||
$error = $show->resizeShow($deltaDay, $deltaMin);
|
||||
$error = $show->resizeShow($deltaDay, $deltaMin);
|
||||
}
|
||||
|
||||
if (isset($error)) {
|
||||
$this->view->error = $error;
|
||||
}
|
||||
if (isset($error)) {
|
||||
$this->view->error = $error;
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteShowAction()
|
||||
{
|
||||
$showInstanceId = $this->_getParam('id');
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
|
||||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||
|
||||
try {
|
||||
$showInstance = new Application_Model_ShowInstance($showInstanceId);
|
||||
$showInstance = new Application_Model_ShowInstance($showInstanceId);
|
||||
}
|
||||
catch(Exception $e){
|
||||
$this->view->show_error = true;
|
||||
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"]);
|
||||
}
|
||||
|
||||
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["currentShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||
Application_Model_Show::convertToLocalTimeZone($range["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||
|
||||
$source_status = array();
|
||||
$switch_status = array();
|
||||
|
@ -387,9 +387,9 @@ class ScheduleController extends Zend_Controller_Action
|
|||
{
|
||||
$showInstanceId = $this->sched_sess->showInstanceId;
|
||||
$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);
|
||||
try{
|
||||
$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())) {
|
||||
$show->removeGroupFromShow($group_id);
|
||||
$show->removeGroupFromShow($group_id);
|
||||
}
|
||||
|
||||
$this->view->showContent = $show->getShowContent();
|
||||
$this->view->timeFilled = $show->getTimeScheduled();
|
||||
$this->view->percentFilled = $show->getPercentScheduled();
|
||||
$this->view->chosen = $this->view->render('schedule/scheduled-content.phtml');
|
||||
unset($this->view->showContent);
|
||||
$this->view->showContent = $show->getShowContent();
|
||||
$this->view->timeFilled = $show->getTimeScheduled();
|
||||
$this->view->percentFilled = $show->getPercentScheduled();
|
||||
$this->view->chosen = $this->view->render('schedule/scheduled-content.phtml');
|
||||
unset($this->view->showContent);
|
||||
}
|
||||
|
||||
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
|
||||
/*public function populateShowInstanceFormAction(){
|
||||
$formWhat = new Application_Form_AddShowWhat();
|
||||
$formWho = new Application_Form_AddShowWho();
|
||||
$formWhen = new Application_Form_AddShowWhen();
|
||||
$formRepeats = new Application_Form_AddShowRepeats();
|
||||
$formStyle = new Application_Form_AddShowStyle();
|
||||
$formLive = new Application_Form_AddShowLiveStream();
|
||||
$formWho = new Application_Form_AddShowWho();
|
||||
$formWhen = new Application_Form_AddShowWhen();
|
||||
$formRepeats = new Application_Form_AddShowRepeats();
|
||||
$formStyle = new Application_Form_AddShowStyle();
|
||||
$formLive = new Application_Form_AddShowLiveStream();
|
||||
|
||||
$formWhat->removeDecorator('DtDdWrapper');
|
||||
$formWho->removeDecorator('DtDdWrapper');
|
||||
$formWhen->removeDecorator('DtDdWrapper');
|
||||
$formRepeats->removeDecorator('DtDdWrapper');
|
||||
$formStyle->removeDecorator('DtDdWrapper');
|
||||
$formWhat->removeDecorator('DtDdWrapper');
|
||||
$formWho->removeDecorator('DtDdWrapper');
|
||||
$formWhen->removeDecorator('DtDdWrapper');
|
||||
$formRepeats->removeDecorator('DtDdWrapper');
|
||||
$formStyle->removeDecorator('DtDdWrapper');
|
||||
|
||||
$this->view->what = $formWhat;
|
||||
$this->view->when = $formWhen;
|
||||
$this->view->repeats = $formRepeats;
|
||||
$this->view->who = $formWho;
|
||||
$this->view->style = $formStyle;
|
||||
$this->view->live = $formLive;
|
||||
$this->view->when = $formWhen;
|
||||
$this->view->repeats = $formRepeats;
|
||||
$this->view->who = $formWho;
|
||||
$this->view->style = $formStyle;
|
||||
$this->view->live = $formLive;
|
||||
$this->view->addNewShow = false;
|
||||
|
||||
$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"),
|
||||
'add_show_start_time' => $starts_datetime->format("H:i"),
|
||||
'add_show_end_date_no_repeat' => $ends_datetime->format("Y-m-d"),
|
||||
'add_show_end_time' => $ends_datetime->format("H:i"),
|
||||
'add_show_end_date_no_repeat' => $ends_datetime->format("Y-m-d"),
|
||||
'add_show_end_time' => $ends_datetime->format("H:i"),
|
||||
'add_show_duration' => $instance_duration->format("%h")));
|
||||
|
||||
$formWhat->disable();
|
||||
|
@ -548,24 +548,24 @@ class ScheduleController extends Zend_Controller_Action
|
|||
}
|
||||
|
||||
$formWhat = new Application_Form_AddShowWhat();
|
||||
$formWho = new Application_Form_AddShowWho();
|
||||
$formWhen = new Application_Form_AddShowWhen();
|
||||
$formRepeats = new Application_Form_AddShowRepeats();
|
||||
$formStyle = new Application_Form_AddShowStyle();
|
||||
$formLive = new Application_Form_AddShowLiveStream();
|
||||
$formWho = new Application_Form_AddShowWho();
|
||||
$formWhen = new Application_Form_AddShowWhen();
|
||||
$formRepeats = new Application_Form_AddShowRepeats();
|
||||
$formStyle = new Application_Form_AddShowStyle();
|
||||
$formLive = new Application_Form_AddShowLiveStream();
|
||||
|
||||
$formWhat->removeDecorator('DtDdWrapper');
|
||||
$formWho->removeDecorator('DtDdWrapper');
|
||||
$formWhen->removeDecorator('DtDdWrapper');
|
||||
$formRepeats->removeDecorator('DtDdWrapper');
|
||||
$formStyle->removeDecorator('DtDdWrapper');
|
||||
$formWhat->removeDecorator('DtDdWrapper');
|
||||
$formWho->removeDecorator('DtDdWrapper');
|
||||
$formWhen->removeDecorator('DtDdWrapper');
|
||||
$formRepeats->removeDecorator('DtDdWrapper');
|
||||
$formStyle->removeDecorator('DtDdWrapper');
|
||||
|
||||
$this->view->what = $formWhat;
|
||||
$this->view->when = $formWhen;
|
||||
$this->view->repeats = $formRepeats;
|
||||
$this->view->who = $formWho;
|
||||
$this->view->style = $formStyle;
|
||||
$this->view->live = $formLive;
|
||||
$this->view->when = $formWhen;
|
||||
$this->view->repeats = $formRepeats;
|
||||
$this->view->who = $formWho;
|
||||
$this->view->style = $formStyle;
|
||||
$this->view->live = $formLive;
|
||||
$this->view->addNewShow = false;
|
||||
|
||||
$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"),
|
||||
'add_show_start_time' => $startsDateTime->format("H:i"),
|
||||
'add_show_end_date_no_repeat' => $endsDateTime->format("Y-m-d"),
|
||||
'add_show_end_time' => $endsDateTime->format("H:i"),
|
||||
'add_show_end_date_no_repeat' => $endsDateTime->format("Y-m-d"),
|
||||
'add_show_end_time' => $endsDateTime->format("H:i"),
|
||||
'add_show_duration' => $show->getDuration(true),
|
||||
'add_show_repeats' => $show->isRepeating() ? 1 : 0));
|
||||
|
||||
|
@ -689,7 +689,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
public function getFormAction() {
|
||||
|
||||
$user = Application_Model_User::GetCurrentUser();
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
|
||||
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))){
|
||||
Application_Model_Schedule::createNewFormSections($this->view);
|
||||
|
@ -822,14 +822,14 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
public function cancelShowAction()
|
||||
{
|
||||
$user = Application_Model_User::GetCurrentUser();
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
|
||||
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);
|
||||
} catch(Exception $e) {
|
||||
} catch(Exception $e) {
|
||||
$this->view->show_error = true;
|
||||
return false;
|
||||
}
|
||||
|
@ -842,7 +842,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
public function cancelCurrentShowAction()
|
||||
{
|
||||
$user = Application_Model_User::GetCurrentUser();
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
|
||||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||
$id = $this->_getParam('id');
|
||||
|
@ -864,9 +864,9 @@ class ScheduleController extends Zend_Controller_Action
|
|||
}
|
||||
|
||||
public function contentContextMenuAction(){
|
||||
global $CC_CONFIG;
|
||||
global $CC_CONFIG;
|
||||
|
||||
$id = $this->_getParam('id');
|
||||
$id = $this->_getParam('id');
|
||||
|
||||
$params = '/format/json/id/#id#/';
|
||||
|
||||
|
@ -881,7 +881,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$baseUrl = $this->getRequest()->getBaseUrl();
|
||||
$url = $file->getRelativeFileUrl($baseUrl).'/download/true';
|
||||
$menu[] = array('action' => array('type' => 'gourl', 'url' => $url),
|
||||
'title' => 'Download');
|
||||
'title' => 'Download');
|
||||
|
||||
//returns format jjmenu is looking for.
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
public function setTimeIntervalAction() {
|
||||
Application_Model_Preference::SetCalendarTimeInterval($this->_getParam('timeInterval'));
|
||||
Application_Model_Preference::SetCalendarTimeInterval($this->_getParam('timeInterval'));
|
||||
}
|
||||
|
||||
public function calculateDurationAction() {
|
||||
|
|
|
@ -22,12 +22,12 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
$user = Application_Model_User::GetCurrentUser();
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
|
||||
$userType = $user->getType();
|
||||
$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 != "") {
|
||||
$libraryTable = json_encode(unserialize($data));
|
||||
$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', '' );");
|
||||
}
|
||||
|
||||
$data = Application_Model_Preference::GetValue("timeline_datatable", true);
|
||||
$data = Application_Model_Preference::getValue("timeline_datatable", true);
|
||||
if ($data != "") {
|
||||
$timelineTable = json_encode(unserialize($data));
|
||||
$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');
|
||||
|
||||
if ($request->isPost()) {
|
||||
$form = new Application_Form_RegisterAirtime();
|
||||
$form = new Application_Form_RegisterAirtime();
|
||||
|
||||
$values = $request->getPost();
|
||||
if ($values["Publicise"] != 1 && $form->isValid($values)) {
|
||||
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
|
||||
$values = $request->getPost();
|
||||
if ($values["Publicise"] != 1 && $form->isValid($values)) {
|
||||
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
|
||||
|
||||
if (isset($values["Privacy"])) {
|
||||
Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]);
|
||||
}
|
||||
// unset session
|
||||
Zend_Session::namespaceUnset('referrer');
|
||||
}
|
||||
else if ($values["Publicise"] == '1' && $form->isValid($values)) {
|
||||
Application_Model_Preference::SetHeadTitle($values["stnName"], $this->view);
|
||||
Application_Model_Preference::SetPhone($values["Phone"]);
|
||||
Application_Model_Preference::SetEmail($values["Email"]);
|
||||
Application_Model_Preference::SetStationWebSite($values["StationWebSite"]);
|
||||
Application_Model_Preference::SetPublicise($values["Publicise"]);
|
||||
if (isset($values["Privacy"])) {
|
||||
Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]);
|
||||
}
|
||||
// unset session
|
||||
Zend_Session::namespaceUnset('referrer');
|
||||
}
|
||||
else if ($values["Publicise"] == '1' && $form->isValid($values)) {
|
||||
Application_Model_Preference::SetHeadTitle($values["stnName"], $this->view);
|
||||
Application_Model_Preference::SetPhone($values["Phone"]);
|
||||
Application_Model_Preference::SetEmail($values["Email"]);
|
||||
Application_Model_Preference::SetStationWebSite($values["StationWebSite"]);
|
||||
Application_Model_Preference::SetPublicise($values["Publicise"]);
|
||||
|
||||
$form->Logo->receive();
|
||||
$imagePath = $form->Logo->getFileName();
|
||||
$form->Logo->receive();
|
||||
$imagePath = $form->Logo->getFileName();
|
||||
|
||||
Application_Model_Preference::SetStationCountry($values["Country"]);
|
||||
Application_Model_Preference::SetStationCity($values["City"]);
|
||||
Application_Model_Preference::SetStationDescription($values["Description"]);
|
||||
Application_Model_Preference::SetStationLogo($imagePath);
|
||||
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
|
||||
Application_Model_Preference::SetStationCountry($values["Country"]);
|
||||
Application_Model_Preference::SetStationCity($values["City"]);
|
||||
Application_Model_Preference::SetStationDescription($values["Description"]);
|
||||
Application_Model_Preference::SetStationLogo($imagePath);
|
||||
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
|
||||
|
||||
if (isset($values["Privacy"])){
|
||||
Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]);
|
||||
}
|
||||
// unset session
|
||||
Zend_Session::namespaceUnset('referrer');
|
||||
}
|
||||
else {
|
||||
$logo = Application_Model_Preference::GetStationLogo();
|
||||
if ($logo) {
|
||||
$this->view->logoImg = $logo;
|
||||
}
|
||||
$this->view->dialog = $form;
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/register.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
}
|
||||
if (isset($values["Privacy"])){
|
||||
Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]);
|
||||
}
|
||||
// unset session
|
||||
Zend_Session::namespaceUnset('referrer');
|
||||
}
|
||||
else {
|
||||
$logo = Application_Model_Preference::GetStationLogo();
|
||||
if ($logo) {
|
||||
$this->view->logoImg = $logo;
|
||||
}
|
||||
$this->view->dialog = $form;
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/register.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
}
|
||||
}
|
||||
|
||||
//popup if previous page was login
|
||||
if ($refer_sses->referrer == 'login' && Application_Model_Preference::ShouldShowPopUp()
|
||||
&& !Application_Model_Preference::GetSupportFeedback() && $user->isAdmin()){
|
||||
//popup if previous page was login
|
||||
if ($refer_sses->referrer == 'login' && Application_Model_Preference::ShouldShowPopUp()
|
||||
&& !Application_Model_Preference::GetSupportFeedback() && $user->isAdmin()){
|
||||
|
||||
$form = new Application_Form_RegisterAirtime();
|
||||
$form = new Application_Form_RegisterAirtime();
|
||||
|
||||
$logo = Application_Model_Preference::GetStationLogo();
|
||||
if ($logo) {
|
||||
$this->view->logoImg = $logo;
|
||||
}
|
||||
$this->view->dialog = $form;
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/register.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
}
|
||||
$logo = Application_Model_Preference::GetStationLogo();
|
||||
if ($logo) {
|
||||
$this->view->logoImg = $logo;
|
||||
}
|
||||
$this->view->dialog = $form;
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/register.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
}
|
||||
|
||||
//determine whether to remove/hide/display the library.
|
||||
$showLib = false;
|
||||
if (!$user->isGuest()) {
|
||||
$disableLib = false;
|
||||
$data = Application_Model_Preference::GetValue("nowplaying_screen", true);
|
||||
//determine whether to remove/hide/display the library.
|
||||
$showLib = false;
|
||||
if (!$user->isGuest()) {
|
||||
$disableLib = false;
|
||||
$data = Application_Model_Preference::getValue("nowplaying_screen", true);
|
||||
if ($data != "") {
|
||||
$settings = unserialize($data);
|
||||
|
||||
|
@ -138,12 +138,12 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
$showLib = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$disableLib = true;
|
||||
}
|
||||
$this->view->disableLib = $disableLib;
|
||||
$this->view->showLib = $showLib;
|
||||
}
|
||||
else {
|
||||
$disableLib = true;
|
||||
}
|
||||
$this->view->disableLib = $disableLib;
|
||||
$this->view->showLib = $showLib;
|
||||
|
||||
//populate date range form for show builder.
|
||||
$now = time();
|
||||
|
@ -184,7 +184,7 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
$baseUrl = $request->getBaseUrl();
|
||||
$menu = array();
|
||||
|
||||
$user = Application_Model_User::GetCurrentUser();
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
|
||||
$item = CcScheduleQuery::create()->findPK($id);
|
||||
$instance = $item->getCcShowInstances();
|
||||
|
|
|
@ -37,7 +37,7 @@ class UserController extends Zend_Controller_Action
|
|||
if ($request->isPost()) {
|
||||
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){
|
||||
$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");
|
||||
|
||||
$data = serialize($settings);
|
||||
Application_Model_Preference::SetValue("nowplaying_screen", $data, true);
|
||||
Application_Model_Preference::setValue("nowplaying_screen", $data, true);
|
||||
}
|
||||
|
||||
public function getNowPlayingScreenSettingsAction() {
|
||||
|
||||
$data = Application_Model_Preference::GetValue("nowplaying_screen", true);
|
||||
$data = Application_Model_Preference::getValue("nowplaying_screen", true);
|
||||
if ($data != "") {
|
||||
$this->view->settings = unserialize($data);
|
||||
}
|
||||
|
@ -40,12 +40,12 @@ class UsersettingsController extends Zend_Controller_Action
|
|||
$settings = $request->getParam("settings");
|
||||
|
||||
$data = serialize($settings);
|
||||
Application_Model_Preference::SetValue("library_datatable", $data, true);
|
||||
Application_Model_Preference::setValue("library_datatable", $data, true);
|
||||
}
|
||||
|
||||
public function getLibraryDatatableAction() {
|
||||
|
||||
$data = Application_Model_Preference::GetValue("library_datatable", true);
|
||||
$data = Application_Model_Preference::getValue("library_datatable", true);
|
||||
if ($data != "") {
|
||||
$this->view->settings = unserialize($data);
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ class UsersettingsController extends Zend_Controller_Action
|
|||
$settings = $request->getParam("settings");
|
||||
|
||||
$data = serialize($settings);
|
||||
Application_Model_Preference::SetValue("timeline_datatable", $data, true);
|
||||
Application_Model_Preference::setValue("timeline_datatable", $data, true);
|
||||
|
||||
$end = microtime(true);
|
||||
|
||||
|
@ -71,7 +71,7 @@ class UsersettingsController extends Zend_Controller_Action
|
|||
|
||||
$start = microtime(true);
|
||||
|
||||
$data = Application_Model_Preference::GetValue("timeline_datatable", true);
|
||||
$data = Application_Model_Preference::getValue("timeline_datatable", true);
|
||||
if ($data != "") {
|
||||
$this->view->settings = unserialize($data);
|
||||
}
|
||||
|
|
|
@ -69,10 +69,10 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
|
|||
return $this->_roleName;
|
||||
}
|
||||
|
||||
public function setRoleName($type)
|
||||
{
|
||||
$this->_roleName = $type;
|
||||
}
|
||||
public function setRoleName($type)
|
||||
{
|
||||
$this->_roleName = $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
$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()){
|
||||
|
||||
if ($controller !== 'login') {
|
||||
if ($controller !== 'login') {
|
||||
|
||||
if ($request->isXmlHttpRequest()) {
|
||||
if ($request->isXmlHttpRequest()) {
|
||||
|
||||
$url = 'http://'.$request->getHttpHost().'/login';
|
||||
$json = Zend_Json::encode(array('auth' => false, 'url' => $url));
|
||||
$url = 'http://'.$request->getHttpHost().'/login';
|
||||
$json = Zend_Json::encode(array('auth' => false, 'url' => $url));
|
||||
|
||||
// Prepare response
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(401)
|
||||
->setBody($json)
|
||||
->sendResponse();
|
||||
// Prepare response
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(401)
|
||||
->setBody($json)
|
||||
->sendResponse();
|
||||
|
||||
//redirectAndExit() cleans up, sends the headers and stops the script
|
||||
Zend_Controller_Action_HelperBroker::getStaticHelper('redirector')->redirectAndExit();
|
||||
}
|
||||
else {
|
||||
$r = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
|
||||
$r->gotoSimpleAndExit('index', 'login', $request->getModuleName());
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
//redirectAndExit() cleans up, sends the headers and stops the script
|
||||
Zend_Controller_Action_HelperBroker::getStaticHelper('redirector')->redirectAndExit();
|
||||
}
|
||||
else {
|
||||
$r = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
|
||||
$r->gotoSimpleAndExit('index', 'login', $request->getModuleName());
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$this->setRoleName($userInfo->type);
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$this->setRoleName($userInfo->type);
|
||||
|
||||
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') {
|
||||
$resourceName .= strtolower($request->getModuleName()) . ':';
|
||||
}
|
||||
if ($request->getModuleName() != 'default') {
|
||||
$resourceName .= strtolower($request->getModuleName()) . ':';
|
||||
}
|
||||
|
||||
$resourceName .= $controller;
|
||||
$resourceName .= $controller;
|
||||
|
||||
/** Check if the controller/action can be accessed by the current user */
|
||||
if (!$this->getAcl()->isAllowed($this->_roleName, $resourceName, $request->getActionName())) {
|
||||
/** Redirect to access denied page */
|
||||
$this->denyAccess();
|
||||
}
|
||||
}
|
||||
/** Check if the controller/action can be accessed by the current user */
|
||||
if (!$this->getAcl()->isAllowed($this->_roleName, $resourceName, $request->getActionName())) {
|
||||
/** Redirect to access denied page */
|
||||
$this->denyAccess();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,16 +6,16 @@ class Application_Form_AddShowRR extends Zend_Form_SubForm
|
|||
public function init()
|
||||
{
|
||||
// Add record element
|
||||
$this->addElement('checkbox', 'add_show_record', array(
|
||||
$this->addElement('checkbox', 'add_show_record', array(
|
||||
'label' => 'Record from Line In?',
|
||||
'required' => false,
|
||||
));
|
||||
));
|
||||
|
||||
// Add record element
|
||||
$this->addElement('checkbox', 'add_show_rebroadcast', array(
|
||||
$this->addElement('checkbox', 'add_show_rebroadcast', array(
|
||||
'label' => 'Rebroadcast?',
|
||||
'required' => false,
|
||||
));
|
||||
));
|
||||
}
|
||||
|
||||
public function disable(){
|
||||
|
|
|
@ -6,54 +6,54 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm
|
|||
public function init()
|
||||
{
|
||||
//Add type select
|
||||
$this->addElement('select', 'add_show_repeat_type', array(
|
||||
$this->addElement('select', 'add_show_repeat_type', array(
|
||||
'required' => true,
|
||||
'label' => 'Repeat Type:',
|
||||
'class' => ' input_select',
|
||||
'multiOptions' => array(
|
||||
"0" => "weekly",
|
||||
"0" => "weekly",
|
||||
"1" => "bi-weekly",
|
||||
"2" => "monthly"
|
||||
),
|
||||
));
|
||||
|
||||
// Add days checkboxes
|
||||
$this->addElement(
|
||||
$this->addElement(
|
||||
'multiCheckbox',
|
||||
'add_show_day_check',
|
||||
array(
|
||||
'label' => 'Select Days:',
|
||||
'label' => 'Select Days:',
|
||||
'required' => false,
|
||||
'multiOptions' => array(
|
||||
"0" => "Sun",
|
||||
"1" => "Mon",
|
||||
"2" => "Tue",
|
||||
"3" => "Wed",
|
||||
"4" => "Thu",
|
||||
"5" => "Fri",
|
||||
"6" => "Sat",
|
||||
"0" => "Sun",
|
||||
"1" => "Mon",
|
||||
"2" => "Tue",
|
||||
"3" => "Wed",
|
||||
"4" => "Thu",
|
||||
"5" => "Fri",
|
||||
"6" => "Sat",
|
||||
),
|
||||
));
|
||||
|
||||
// Add end date element
|
||||
// Add end date element
|
||||
$this->addElement('text', 'add_show_end_date', array(
|
||||
'label' => 'Date End:',
|
||||
'class' => 'input_text',
|
||||
'value' => date("Y-m-d"),
|
||||
'required' => false,
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array(
|
||||
'NotEmpty',
|
||||
array('date', false, array('YYYY-MM-DD'))
|
||||
)
|
||||
'validators' => array(
|
||||
'NotEmpty',
|
||||
array('date', false, array('YYYY-MM-DD'))
|
||||
)
|
||||
));
|
||||
|
||||
// Add no end element
|
||||
$this->addElement('checkbox', 'add_show_no_end', array(
|
||||
// Add no end element
|
||||
$this->addElement('checkbox', 'add_show_no_end', array(
|
||||
'label' => 'No End?',
|
||||
'required' => false,
|
||||
'checked' => true,
|
||||
));
|
||||
));
|
||||
}
|
||||
|
||||
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(
|
||||
'label' => 'Text Colour:',
|
||||
'class' => 'input_text',
|
||||
|
|
|
@ -4,9 +4,9 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
|
|||
{
|
||||
public function init()
|
||||
{
|
||||
// retrieves the length limit for each char field
|
||||
// and store to assoc array
|
||||
$maxLens = Application_Model_Show::GetMaxLengths();
|
||||
// retrieves the length limit for each char field
|
||||
// and store to assoc array
|
||||
$maxLens = Application_Model_Show::getMaxLengths();
|
||||
|
||||
// Hidden element to indicate whether the show is new or
|
||||
// whether we are updating an existing show.
|
||||
|
@ -27,8 +27,8 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
|
|||
'required' => true,
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array('NotEmpty'),
|
||||
'value' => 'Untitled Show',
|
||||
'validators' => array(array('StringLength', false, array(0, $maxLens['name'])))
|
||||
'value' => 'Untitled Show',
|
||||
'validators' => array(array('StringLength', false, array(0, $maxLens['name'])))
|
||||
));
|
||||
|
||||
// Add URL element
|
||||
|
@ -46,16 +46,16 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
|
|||
'class' => 'input_text',
|
||||
'required' => false,
|
||||
'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(
|
||||
'label' => 'Description:',
|
||||
'required' => false,
|
||||
'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');
|
||||
|
||||
|
|
|
@ -86,6 +86,9 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
|||
public function checkReliantFields($formData, $validateStartDate, $originalStartDate=null, $update=false, $instanceId=null) {
|
||||
$valid = true;
|
||||
|
||||
$hours;
|
||||
$minutes;
|
||||
|
||||
$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'];
|
||||
|
||||
|
@ -148,10 +151,112 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
|||
$show_end = new DateTime($end_time);
|
||||
$show_end->setTimezone(new DateTimeZone('UTC'));
|
||||
|
||||
$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;
|
||||
if ($formData["add_show_repeats"]) {
|
||||
|
||||
//get repeating show end date
|
||||
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:',
|
||||
'class' => 'input_text ui-autocomplete-input',
|
||||
'required' => false
|
||||
));
|
||||
));
|
||||
|
||||
$options = array();
|
||||
$hosts = Application_Model_User::getHosts();
|
||||
$options = array();
|
||||
$hosts = Application_Model_User::getHosts();
|
||||
|
||||
foreach ($hosts as $host) {
|
||||
$options[$host['index']] = $host['label'];
|
||||
}
|
||||
foreach ($hosts as $host) {
|
||||
$options[$host['index']] = $host['label'];
|
||||
}
|
||||
|
||||
//Add hosts selection
|
||||
$hosts = new Zend_Form_Element_MultiCheckbox('add_show_hosts');
|
||||
$hosts->setLabel('DJs:')
|
||||
->setMultiOptions($options);
|
||||
//Add hosts selection
|
||||
$hosts = new Zend_Form_Element_MultiCheckbox('add_show_hosts');
|
||||
$hosts->setLabel('DJs:')
|
||||
->setMultiOptions($options);
|
||||
|
||||
$this->addElement($hosts);
|
||||
$this->addElement($hosts);
|
||||
}
|
||||
|
||||
public function disable(){
|
||||
|
|
|
@ -79,7 +79,7 @@ class Application_Form_AddUser extends Zend_Form
|
|||
$select->setMultiOptions(array(
|
||||
"G" => "Guest",
|
||||
"H" => "DJ",
|
||||
"P" => "Program Manager",
|
||||
"P" => "Program Manager",
|
||||
"A" => "Admin"
|
||||
));
|
||||
$select->setRequired(true);
|
||||
|
|
|
@ -7,21 +7,21 @@ class Application_Form_EditAudioMD extends Zend_Form
|
|||
// Set the method for the display form to POST
|
||||
$this->setMethod('post');
|
||||
|
||||
// Add title field
|
||||
// Add title field
|
||||
$this->addElement('text', 'track_title', array(
|
||||
'label' => 'Title:',
|
||||
'class' => 'input_text',
|
||||
'filters' => array('StringTrim'),
|
||||
));
|
||||
|
||||
// Add artist field
|
||||
// Add artist field
|
||||
$this->addElement('text', 'artist_name', array(
|
||||
'label' => 'Creator:',
|
||||
'class' => 'input_text',
|
||||
'filters' => array('StringTrim'),
|
||||
));
|
||||
|
||||
// Add album field
|
||||
// Add album field
|
||||
$this->addElement('text', 'album_title', array(
|
||||
'label' => 'Album:',
|
||||
'class' => 'input_text',
|
||||
|
@ -37,33 +37,33 @@ class Application_Form_EditAudioMD extends Zend_Form
|
|||
'required' => true
|
||||
));
|
||||
|
||||
// Add genre field
|
||||
// Add genre field
|
||||
$this->addElement('text', 'genre', array(
|
||||
'label' => 'Genre:',
|
||||
'class' => 'input_text',
|
||||
'filters' => array('StringTrim')
|
||||
));
|
||||
|
||||
// Add year field
|
||||
// Add year field
|
||||
$this->addElement('text', 'year', array(
|
||||
'label' => 'Year:',
|
||||
'class' => 'input_text',
|
||||
'filters' => array('StringTrim'),
|
||||
'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'))
|
||||
)
|
||||
array('date', false, array('YYYY'))
|
||||
)
|
||||
));
|
||||
|
||||
// Add label field
|
||||
// Add label field
|
||||
$this->addElement('text', 'label', array(
|
||||
'label' => 'Label:',
|
||||
'class' => 'input_text',
|
||||
'filters' => array('StringTrim')
|
||||
));
|
||||
|
||||
// Add composer field
|
||||
// Add composer field
|
||||
$this->addElement('text', 'composer', array(
|
||||
'label' => 'Composer:',
|
||||
'class' => 'input_text',
|
||||
|
@ -77,7 +77,7 @@ class Application_Form_EditAudioMD extends Zend_Form
|
|||
'filters' => array('StringTrim')
|
||||
));
|
||||
|
||||
// Add mood field
|
||||
// Add mood field
|
||||
$this->addElement('text', 'mood', array(
|
||||
'label' => 'Mood:',
|
||||
'class' => 'input_text',
|
||||
|
@ -122,7 +122,7 @@ class Application_Form_EditAudioMD extends Zend_Form
|
|||
'filters' => array('StringTrim')
|
||||
));
|
||||
|
||||
// Add the submit button
|
||||
// Add the submit button
|
||||
$this->addElement('submit', 'submit', array(
|
||||
'ignore' => true,
|
||||
'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(
|
||||
'ignore' => true,
|
||||
'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',
|
||||
'required' => false,
|
||||
'filters' => array('StringTrim'),
|
||||
'value' => Application_Model_Preference::GetValue("station_name"),
|
||||
'value' => Application_Model_Preference::getValue("station_name"),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
|
@ -98,16 +98,16 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
|
|||
|
||||
|
||||
private function getWeekStartDays() {
|
||||
$days = array(
|
||||
'Sunday',
|
||||
'Monday',
|
||||
'Tuesday',
|
||||
'Wednesday',
|
||||
'Thursday',
|
||||
'Friday',
|
||||
'Saturday'
|
||||
);
|
||||
return $days;
|
||||
$days = array(
|
||||
'Sunday',
|
||||
'Monday',
|
||||
'Tuesday',
|
||||
'Wednesday',
|
||||
'Thursday',
|
||||
'Friday',
|
||||
'Saturday'
|
||||
);
|
||||
return $days;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
|||
|
||||
//liquidsoap harbor.input port
|
||||
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->setLabel("Master Source Port")
|
||||
->setValue($m_port)
|
||||
|
@ -92,7 +92,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
|||
->setDecorators(array('ViewHelper'));
|
||||
$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->setLabel("Master Source Mount Point")
|
||||
->setValue($m_mount)
|
||||
|
@ -102,7 +102,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
|||
$this->addElement($master_dj_mount);
|
||||
|
||||
//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->setLabel("Show Source Port")
|
||||
->setValue($l_port)
|
||||
|
@ -111,7 +111,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
|||
->setDecorators(array('ViewHelper'));
|
||||
$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->setLabel("Show Source Mount Point")
|
||||
->setValue($l_mount)
|
||||
|
@ -159,7 +159,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
|||
}
|
||||
if($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);
|
||||
$res = socket_bind($sock, 0, $master_harbor_input_port);
|
||||
if(!$res){
|
||||
|
@ -175,7 +175,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
|||
}
|
||||
if($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);
|
||||
$res = socket_bind($sock, 0, $dj_harbor_input_port);
|
||||
if(!$res){
|
||||
|
|
|
@ -7,14 +7,14 @@ class Application_Form_Login extends Zend_Form
|
|||
{
|
||||
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->setDecorators(array(
|
||||
array('ViewScript', array('viewScript' => 'form/login.phtml'))
|
||||
));
|
||||
|
||||
// Add username element
|
||||
// Add username element
|
||||
$this->addElement('text', 'username', array(
|
||||
'label' => 'Username:',
|
||||
'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(
|
||||
'label' => 'Password:',
|
||||
'class' => 'input_text',
|
||||
|
@ -53,7 +53,7 @@ class Application_Form_Login extends Zend_Form
|
|||
$this->addRecaptcha();
|
||||
}
|
||||
|
||||
// Add the submit button
|
||||
// Add the submit button
|
||||
$this->addElement('submit', 'submit', array(
|
||||
'ignore' => true,
|
||||
'label' => 'Login',
|
||||
|
|
|
@ -63,20 +63,20 @@ class Application_Form_RegisterAirtime extends Zend_Form
|
|||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
));
|
||||
|
||||
// county list dropdown
|
||||
$this->addElement('select', 'Country', array(
|
||||
'label' => 'Country:',
|
||||
'required' => false,
|
||||
'value' => Application_Model_Preference::GetStationCountry(),
|
||||
'multiOptions' => $country_list,
|
||||
'decorators' => array(
|
||||
// county list dropdown
|
||||
$this->addElement('select', 'Country', array(
|
||||
'label' => 'Country:',
|
||||
'required' => false,
|
||||
'value' => Application_Model_Preference::GetStationCountry(),
|
||||
'multiOptions' => $country_list,
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
));
|
||||
|
||||
// Station city
|
||||
// Station city
|
||||
$this->addElement('text', 'City', array(
|
||||
'label' => 'City:',
|
||||
'required' => false,
|
||||
|
@ -85,28 +85,28 @@ class Application_Form_RegisterAirtime extends Zend_Form
|
|||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
));
|
||||
|
||||
// Station Description
|
||||
$description = new Zend_Form_Element_Textarea('Description');
|
||||
$description->class = 'input_text_area';
|
||||
$description->setLabel('Station Description:')
|
||||
->setRequired(false)
|
||||
->setValue(Application_Model_Preference::GetStationDescription())
|
||||
->setDecorators(array('ViewHelper'))
|
||||
->setAttrib('ROWS','2')
|
||||
->setAttrib('COLS','58');
|
||||
$this->addElement($description);
|
||||
// Station Description
|
||||
$description = new Zend_Form_Element_Textarea('Description');
|
||||
$description->class = 'input_text_area';
|
||||
$description->setLabel('Station Description:')
|
||||
->setRequired(false)
|
||||
->setValue(Application_Model_Preference::GetStationDescription())
|
||||
->setDecorators(array('ViewHelper'))
|
||||
->setAttrib('ROWS','2')
|
||||
->setAttrib('COLS','58');
|
||||
$this->addElement($description);
|
||||
|
||||
// Station Logo
|
||||
$upload = new Zend_Form_Element_File('Logo');
|
||||
$upload->setLabel('Station Logo:')
|
||||
->setRequired(false)
|
||||
->setDecorators(array('File'))
|
||||
->addValidator('Count', false, 1)
|
||||
->addValidator('Extension', false, 'jpg,jpeg,png,gif')
|
||||
->addFilter('ImageSize');
|
||||
$this->addElement($upload);
|
||||
// Station Logo
|
||||
$upload = new Zend_Form_Element_File('Logo');
|
||||
$upload->setLabel('Station Logo:')
|
||||
->setRequired(false)
|
||||
->setDecorators(array('File'))
|
||||
->addValidator('Count', false, 1)
|
||||
->addValidator('Extension', false, 'jpg,jpeg,png,gif')
|
||||
->addFilter('ImageSize');
|
||||
$this->addElement($upload);
|
||||
|
||||
//enable support feedback
|
||||
$this->addElement('checkbox', 'SupportFeedback', array(
|
||||
|
@ -116,23 +116,23 @@ class Application_Form_RegisterAirtime extends Zend_Form
|
|||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
));
|
||||
|
||||
// checkbox for publicise
|
||||
$checkboxPublicise = new Zend_Form_Element_Checkbox("Publicise");
|
||||
// checkbox for publicise
|
||||
$checkboxPublicise = new Zend_Form_Element_Checkbox("Publicise");
|
||||
$checkboxPublicise->setLabel('Promote my station on Sourcefabric.org')
|
||||
->setRequired(false)
|
||||
->setDecorators(array('ViewHelper'))
|
||||
->setValue(Application_Model_Preference::GetPublicise());
|
||||
$this->addElement($checkboxPublicise);
|
||||
|
||||
// text area for sending detail
|
||||
// text area for sending detail
|
||||
$this->addElement('textarea', 'SendInfo', array(
|
||||
'class' => 'sending_textarea',
|
||||
'required' => false,
|
||||
'class' => 'sending_textarea',
|
||||
'required' => false,
|
||||
'filters' => array('StringTrim'),
|
||||
'readonly' => true,
|
||||
'rows' => 5,
|
||||
'readonly' => true,
|
||||
'rows' => 5,
|
||||
'cols' => 61,
|
||||
'value' => Application_Model_Preference::GetSystemInfo(false, true),
|
||||
'decorators' => array(
|
||||
|
|
|
@ -5,7 +5,7 @@ class Application_Form_ShowBuilder extends Zend_Form_SubForm
|
|||
|
||||
public function init()
|
||||
{
|
||||
$user = Application_Model_User::GetCurrentUser();
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
|
||||
$this->setDecorators(array(
|
||||
array('ViewScript', array('viewScript' => 'form/showbuilder.phtml'))
|
||||
|
|
|
@ -91,7 +91,7 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
|
|||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
));
|
||||
|
||||
//SoundCloud default genre
|
||||
$this->addElement('text', 'SoundCloudGenre', array(
|
||||
|
|
|
@ -24,7 +24,7 @@ class Application_Form_SupportSettings extends Zend_Form
|
|||
'required' => true,
|
||||
'filters' => array('StringTrim'),
|
||||
'validator' => array('NotEmpty'),
|
||||
'value' => Application_Model_Preference::GetValue("station_name"),
|
||||
'value' => Application_Model_Preference::getValue("station_name"),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
|
@ -63,20 +63,20 @@ class Application_Form_SupportSettings extends Zend_Form
|
|||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
));
|
||||
|
||||
// county list dropdown
|
||||
$this->addElement('select', 'Country', array(
|
||||
'label' => 'Country:',
|
||||
'required' => false,
|
||||
'value' => Application_Model_Preference::GetStationCountry(),
|
||||
'multiOptions' => $country_list,
|
||||
'decorators' => array(
|
||||
// county list dropdown
|
||||
$this->addElement('select', 'Country', array(
|
||||
'label' => 'Country:',
|
||||
'required' => false,
|
||||
'value' => Application_Model_Preference::GetStationCountry(),
|
||||
'multiOptions' => $country_list,
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
));
|
||||
|
||||
// Station city
|
||||
// Station city
|
||||
$this->addElement('text', 'City', array(
|
||||
'label' => 'City:',
|
||||
'required' => false,
|
||||
|
@ -85,31 +85,31 @@ class Application_Form_SupportSettings extends Zend_Form
|
|||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
));
|
||||
|
||||
// Station Description
|
||||
$description = new Zend_Form_Element_Textarea('Description');
|
||||
$description->class = 'input_text_area';
|
||||
$description->setLabel('Station Description:')
|
||||
->setRequired(false)
|
||||
->setValue(Application_Model_Preference::GetStationDescription())
|
||||
->setDecorators(array('ViewHelper'))
|
||||
->setAttrib('ROWS','2')
|
||||
->setAttrib('COLS','58');
|
||||
$this->addElement($description);
|
||||
// Station Description
|
||||
$description = new Zend_Form_Element_Textarea('Description');
|
||||
$description->class = 'input_text_area';
|
||||
$description->setLabel('Station Description:')
|
||||
->setRequired(false)
|
||||
->setValue(Application_Model_Preference::GetStationDescription())
|
||||
->setDecorators(array('ViewHelper'))
|
||||
->setAttrib('ROWS','2')
|
||||
->setAttrib('COLS','58');
|
||||
$this->addElement($description);
|
||||
|
||||
// Station Logo
|
||||
$upload = new Zend_Form_Element_File('Logo');
|
||||
$upload->setLabel('Station Logo:')
|
||||
->setRequired(false)
|
||||
->setDecorators(array('File'))
|
||||
->addValidator('Count', false, 1)
|
||||
->addValidator('Extension', false, 'jpg,jpeg,png,gif')
|
||||
->addFilter('ImageSize');
|
||||
$upload->setAttrib('accept', 'image/*');
|
||||
$this->addElement($upload);
|
||||
// Station Logo
|
||||
$upload = new Zend_Form_Element_File('Logo');
|
||||
$upload->setLabel('Station Logo:')
|
||||
->setRequired(false)
|
||||
->setDecorators(array('File'))
|
||||
->addValidator('Count', false, 1)
|
||||
->addValidator('Extension', false, 'jpg,jpeg,png,gif')
|
||||
->addFilter('ImageSize');
|
||||
$upload->setAttrib('accept', 'image/*');
|
||||
$this->addElement($upload);
|
||||
|
||||
if(!$isSass){
|
||||
if(!$isSass){
|
||||
//enable support feedback
|
||||
$this->addElement('checkbox', 'SupportFeedback', array(
|
||||
'label' => 'Send support feedback',
|
||||
|
@ -118,9 +118,9 @@ class Application_Form_SupportSettings extends Zend_Form
|
|||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
));
|
||||
|
||||
// checkbox for publicise
|
||||
// checkbox for publicise
|
||||
$checkboxPublicise = new Zend_Form_Element_Checkbox("Publicise");
|
||||
$checkboxPublicise->setLabel('Promote my station on Sourcefabric.org')
|
||||
->setRequired(false)
|
||||
|
@ -131,14 +131,14 @@ class Application_Form_SupportSettings extends Zend_Form
|
|||
}
|
||||
$this->addElement($checkboxPublicise);
|
||||
|
||||
// text area for sending detail
|
||||
// text area for sending detail
|
||||
$this->addElement('textarea', 'SendInfo', array(
|
||||
'class' => 'sending_textarea',
|
||||
'required' => false,
|
||||
'class' => 'sending_textarea',
|
||||
'required' => false,
|
||||
'filters' => array('StringTrim'),
|
||||
'readonly' => true,
|
||||
'cols' => 61,
|
||||
'rows' => 5,
|
||||
'readonly' => true,
|
||||
'cols' => 61,
|
||||
'rows' => 5,
|
||||
'value' => Application_Model_Preference::GetSystemInfo(false, true),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
|
|
|
@ -2,27 +2,27 @@
|
|||
|
||||
class Application_Model_Auth {
|
||||
|
||||
const TOKEN_LIFETIME = 'P2D'; // DateInterval syntax
|
||||
const TOKEN_LIFETIME = 'P2D'; // DateInterval syntax
|
||||
|
||||
private function generateToken($action, $user_id)
|
||||
{
|
||||
$salt = md5("pro");
|
||||
$token = self::generateRandomString();
|
||||
private function generateToken($action, $user_id)
|
||||
{
|
||||
$salt = md5("pro");
|
||||
$token = self::generateRandomString();
|
||||
|
||||
$info = new CcSubjsToken();
|
||||
$info->setDbUserId($user_id);
|
||||
$info->setDbAction($action);
|
||||
$info->setDbToken(sha1($token.$salt));
|
||||
$info->setDbCreated(gmdate('Y-m-d H:i:s'));
|
||||
$info->save();
|
||||
$info = new CcSubjsToken();
|
||||
$info->setDbUserId($user_id);
|
||||
$info->setDbAction($action);
|
||||
$info->setDbToken(sha1($token.$salt));
|
||||
$info->setDbCreated(gmdate('Y-m-d H:i:s'));
|
||||
$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());
|
||||
|
||||
$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}";
|
||||
|
||||
$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)
|
||||
{
|
||||
CcSubjsTokenQuery::create()
|
||||
->filterByDbAction($action)
|
||||
->filterByDbUserId($user->getDbId())
|
||||
->delete();
|
||||
}
|
||||
public function invalidateTokens($user, $action)
|
||||
{
|
||||
CcSubjsTokenQuery::create()
|
||||
->filterByDbAction($action)
|
||||
->filterByDbUserId($user->getDbId())
|
||||
->delete();
|
||||
}
|
||||
|
||||
public function checkToken($user_id, $token, $action)
|
||||
{
|
||||
$salt = md5("pro");
|
||||
$salt = md5("pro");
|
||||
|
||||
$token_info = CcSubjsTokenQuery::create()
|
||||
->filterByDbAction($action)
|
||||
|
|
|
@ -2,103 +2,103 @@
|
|||
|
||||
class Application_Model_Datatables {
|
||||
|
||||
/*
|
||||
* query used to return data for a paginated/searchable datatable.
|
||||
*/
|
||||
public static function findEntries($con, $displayColumns, $fromTable, $data, $dataProp = "aaData")
|
||||
{
|
||||
$where = array();
|
||||
/*
|
||||
* query used to return data for a paginated/searchable datatable.
|
||||
*/
|
||||
public static function findEntries($con, $displayColumns, $fromTable, $data, $dataProp = "aaData")
|
||||
{
|
||||
$where = array();
|
||||
|
||||
if ($data["sSearch"] !== "") {
|
||||
$searchTerms = explode(" ", $data["sSearch"]);
|
||||
}
|
||||
if ($data["sSearch"] !== "") {
|
||||
$searchTerms = explode(" ", $data["sSearch"]);
|
||||
}
|
||||
|
||||
$selectorCount = "SELECT COUNT(*) ";
|
||||
$selectorRows = "SELECT ".join(",", $displayColumns)." ";
|
||||
$selectorCount = "SELECT COUNT(*) ";
|
||||
$selectorRows = "SELECT ".join(",", $displayColumns)." ";
|
||||
|
||||
$sql = $selectorCount." FROM ".$fromTable;
|
||||
$sqlTotalRows = $sql;
|
||||
$sql = $selectorCount." FROM ".$fromTable;
|
||||
$sqlTotalRows = $sql;
|
||||
|
||||
if (isset($searchTerms)) {
|
||||
$searchCols = array();
|
||||
for ($i = 0; $i < $data["iColumns"]; $i++) {
|
||||
if ($data["bSearchable_".$i] == "true") {
|
||||
$searchCols[] = $data["mDataProp_{$i}"];
|
||||
}
|
||||
}
|
||||
if (isset($searchTerms)) {
|
||||
$searchCols = array();
|
||||
for ($i = 0; $i < $data["iColumns"]; $i++) {
|
||||
if ($data["bSearchable_".$i] == "true") {
|
||||
$searchCols[] = $data["mDataProp_{$i}"];
|
||||
}
|
||||
}
|
||||
|
||||
$outerCond = array();
|
||||
$outerCond = array();
|
||||
|
||||
foreach ($searchTerms as $term) {
|
||||
$innerCond = array();
|
||||
foreach ($searchTerms as $term) {
|
||||
$innerCond = array();
|
||||
|
||||
foreach ($searchCols as $col) {
|
||||
$escapedTerm = pg_escape_string($term);
|
||||
$innerCond[] = "{$col}::text ILIKE '%{$escapedTerm}%'";
|
||||
}
|
||||
$outerCond[] = "(".join(" OR ", $innerCond).")";
|
||||
}
|
||||
$where[] = "(".join(" AND ", $outerCond).")";
|
||||
}
|
||||
// End Where clause
|
||||
foreach ($searchCols as $col) {
|
||||
$escapedTerm = pg_escape_string($term);
|
||||
$innerCond[] = "{$col}::text ILIKE '%{$escapedTerm}%'";
|
||||
}
|
||||
$outerCond[] = "(".join(" OR ", $innerCond).")";
|
||||
}
|
||||
$where[] = "(".join(" AND ", $outerCond).")";
|
||||
}
|
||||
// End Where clause
|
||||
|
||||
// Order By clause
|
||||
$orderby = array();
|
||||
for ($i = 0; $i < $data["iSortingCols"]; $i++){
|
||||
$num = $data["iSortCol_".$i];
|
||||
$orderby[] = $data["mDataProp_{$num}"]." ".$data["sSortDir_".$i];
|
||||
}
|
||||
$orderby[] = "id";
|
||||
$orderby = join("," , $orderby);
|
||||
// End Order By clause
|
||||
// Order By clause
|
||||
$orderby = array();
|
||||
for ($i = 0; $i < $data["iSortingCols"]; $i++){
|
||||
$num = $data["iSortCol_".$i];
|
||||
$orderby[] = $data["mDataProp_{$num}"]." ".$data["sSortDir_".$i];
|
||||
}
|
||||
$orderby[] = "id";
|
||||
$orderby = join("," , $orderby);
|
||||
// End Order By clause
|
||||
|
||||
$displayLength = intval($data["iDisplayLength"]);
|
||||
if (count($where) > 0) {
|
||||
$where = join(" AND ", $where);
|
||||
$sql = $selectorCount." FROM ".$fromTable." WHERE ".$where;
|
||||
$sqlTotalDisplayRows = $sql;
|
||||
$displayLength = intval($data["iDisplayLength"]);
|
||||
if (count($where) > 0) {
|
||||
$where = join(" AND ", $where);
|
||||
$sql = $selectorCount." FROM ".$fromTable." WHERE ".$where;
|
||||
$sqlTotalDisplayRows = $sql;
|
||||
|
||||
$sql = $selectorRows." FROM ".$fromTable." WHERE ".$where." ORDER BY ".$orderby;
|
||||
$sql = $selectorRows." FROM ".$fromTable." WHERE ".$where." ORDER BY ".$orderby;
|
||||
|
||||
//limit the results returned.
|
||||
if ($displayLength !== -1) {
|
||||
$sql .= " OFFSET ".$data["iDisplayStart"]." LIMIT ".$displayLength;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$sql = $selectorRows." FROM ".$fromTable." ORDER BY ".$orderby;
|
||||
//limit the results returned.
|
||||
if ($displayLength !== -1) {
|
||||
$sql .= " OFFSET ".$data["iDisplayStart"]." LIMIT ".$displayLength;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$sql = $selectorRows." FROM ".$fromTable." ORDER BY ".$orderby;
|
||||
|
||||
//limit the results returned.
|
||||
if ($displayLength !== -1) {
|
||||
$sql .= " OFFSET ".$data["iDisplayStart"]." LIMIT ".$displayLength;
|
||||
}
|
||||
}
|
||||
//limit the results returned.
|
||||
if ($displayLength !== -1) {
|
||||
$sql .= " OFFSET ".$data["iDisplayStart"]." LIMIT ".$displayLength;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$r = $con->query($sqlTotalRows);
|
||||
$totalRows = $r->fetchColumn(0);
|
||||
try {
|
||||
$r = $con->query($sqlTotalRows);
|
||||
$totalRows = $r->fetchColumn(0);
|
||||
|
||||
if (isset($sqlTotalDisplayRows)) {
|
||||
$r = $con->query($sqlTotalDisplayRows);
|
||||
$totalDisplayRows = $r->fetchColumn(0);
|
||||
}
|
||||
else {
|
||||
$totalDisplayRows = $totalRows;
|
||||
}
|
||||
if (isset($sqlTotalDisplayRows)) {
|
||||
$r = $con->query($sqlTotalDisplayRows);
|
||||
$totalDisplayRows = $r->fetchColumn(0);
|
||||
}
|
||||
else {
|
||||
$totalDisplayRows = $totalRows;
|
||||
}
|
||||
|
||||
$r = $con->query($sql);
|
||||
$r->setFetchMode(PDO::FETCH_ASSOC);
|
||||
$results = $r->fetchAll();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::debug($e->getMessage());
|
||||
}
|
||||
$r = $con->query($sql);
|
||||
$r->setFetchMode(PDO::FETCH_ASSOC);
|
||||
$results = $r->fetchAll();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::debug($e->getMessage());
|
||||
}
|
||||
|
||||
return array(
|
||||
"sEcho" => intval($data["sEcho"]),
|
||||
"iTotalDisplayRecords" => intval($totalDisplayRows),
|
||||
"iTotalRecords" => intval($totalRows),
|
||||
$dataProp => $results
|
||||
);
|
||||
}
|
||||
return array(
|
||||
"sEcho" => intval($data["sEcho"]),
|
||||
"iTotalDisplayRecords" => intval($totalDisplayRows),
|
||||
"iTotalRecords" => intval($totalRows),
|
||||
$dataProp => $results
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,17 +20,17 @@ class Application_Model_Playlist {
|
|||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
/**
|
||||
* propel object for this playlist.
|
||||
*/
|
||||
private $pl;
|
||||
private $pl;
|
||||
|
||||
/**
|
||||
/**
|
||||
* info needed to insert a new playlist element.
|
||||
*/
|
||||
private $plItem = array(
|
||||
private $plItem = array(
|
||||
"id" => "",
|
||||
"pos" => "",
|
||||
"pos" => "",
|
||||
"cliplength" => "",
|
||||
"cuein" => "00:00:00",
|
||||
"cueout" => "00:00:00",
|
||||
|
@ -38,13 +38,13 @@ class Application_Model_Playlist {
|
|||
"fadeout" => "0.0",
|
||||
);
|
||||
|
||||
//using propel's phpNames.
|
||||
private $categories = array(
|
||||
"dc:title" => "Name",
|
||||
"dc:creator" => "Creator",
|
||||
"dc:description" => "Description",
|
||||
"dcterms:extent" => "Length"
|
||||
);
|
||||
//using propel's phpNames.
|
||||
private $categories = array(
|
||||
"dc:title" => "Name",
|
||||
"dc:creator" => "Creator",
|
||||
"dc:description" => "Description",
|
||||
"dcterms:extent" => "Length"
|
||||
);
|
||||
|
||||
|
||||
public function __construct($id=null, $con=null)
|
||||
|
@ -90,12 +90,12 @@ class Application_Model_Playlist {
|
|||
*/
|
||||
public function setName($p_newname)
|
||||
{
|
||||
$this->pl->setDbName($p_newname);
|
||||
$this->pl->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
|
||||
$this->pl->save($this->con);
|
||||
$this->pl->setDbName($p_newname);
|
||||
$this->pl->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
|
||||
$this->pl->save($this->con);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Get mnemonic playlist name
|
||||
*
|
||||
* @return string
|
||||
|
@ -107,9 +107,9 @@ class Application_Model_Playlist {
|
|||
|
||||
public function setDescription($p_description)
|
||||
{
|
||||
$this->pl->setDbDescription($p_description);
|
||||
$this->pl->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
|
||||
$this->pl->save($this->con);
|
||||
$this->pl->setDbDescription($p_description);
|
||||
$this->pl->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
|
||||
$this->pl->save($this->con);
|
||||
}
|
||||
|
||||
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.
|
||||
* @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
|
||||
*/
|
||||
public function getContents($filterFiles=false) {
|
||||
|
@ -416,7 +416,7 @@ class Application_Model_Playlist {
|
|||
* Remove audioClip from playlist
|
||||
*
|
||||
* @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)
|
||||
{
|
||||
|
@ -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)
|
||||
->filterByDbPlaylistId($this->id)
|
||||
->filterByDbPosition($pos)
|
||||
|
@ -466,24 +466,24 @@ class Application_Model_Playlist {
|
|||
$fadeIn = $row->getDbFadein();
|
||||
$fadeOut = $row->getDbFadeout();
|
||||
return array($fadeIn, $fadeOut);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Change fadeIn and fadeOut values for playlist Element
|
||||
*
|
||||
* @param int $pos
|
||||
* position of audioclip in playlist
|
||||
* position of audioclip in playlist
|
||||
* @param string $fadeIn
|
||||
* new value in ss.ssssss or extent format
|
||||
* new value in ss.ssssss or extent format
|
||||
* @param string $fadeOut
|
||||
* new value in ss.ssssss or extent format
|
||||
* new value in ss.ssssss or extent format
|
||||
* @return boolean
|
||||
*/
|
||||
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
|
||||
//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;
|
||||
$fadeOut = $fadeOut?'00:00:'.$fadeOut:$fadeOut;
|
||||
|
||||
|
@ -502,8 +502,8 @@ class Application_Model_Playlist {
|
|||
|
||||
if (!is_null($fadeIn)) {
|
||||
|
||||
$sql = "SELECT INTERVAL '{$fadeIn}' > INTERVAL '{$clipLength}'";
|
||||
$r = $this->con->query($sql);
|
||||
$sql = "SELECT INTERVAL '{$fadeIn}' > INTERVAL '{$clipLength}'";
|
||||
$r = $this->con->query($sql);
|
||||
if ($r->fetchColumn(0)) {
|
||||
//"Fade In can't be larger than overall playlength.";
|
||||
$fadeIn = $clipLength;
|
||||
|
@ -512,8 +512,8 @@ class Application_Model_Playlist {
|
|||
}
|
||||
if (!is_null($fadeOut)){
|
||||
|
||||
$sql = "SELECT INTERVAL '{$fadeOut}' > INTERVAL '{$clipLength}'";
|
||||
$r = $this->con->query($sql);
|
||||
$sql = "SELECT INTERVAL '{$fadeOut}' > INTERVAL '{$clipLength}'";
|
||||
$r = $this->con->query($sql);
|
||||
if ($r->fetchColumn(0)) {
|
||||
//Fade Out can't be larger than overall playlength.";
|
||||
$fadeOut = $clipLength;
|
||||
|
@ -562,11 +562,11 @@ class Application_Model_Playlist {
|
|||
* Change cueIn/cueOut values for playlist element
|
||||
*
|
||||
* @param int $pos
|
||||
* position of audioclip in playlist
|
||||
* position of audioclip in playlist
|
||||
* @param string $cueIn
|
||||
* new value in ss.ssssss or extent format
|
||||
* new value in ss.ssssss or extent format
|
||||
* @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
|
||||
*/
|
||||
public function changeClipLength($id, $cueIn, $cueOut)
|
||||
|
@ -604,23 +604,23 @@ class Application_Model_Playlist {
|
|||
$cueOut = $origLength;
|
||||
}
|
||||
|
||||
$sql = "SELECT INTERVAL '{$cueIn}' > INTERVAL '{$cueOut}'";
|
||||
$r = $this->con->query($sql);
|
||||
$sql = "SELECT INTERVAL '{$cueIn}' > INTERVAL '{$cueOut}'";
|
||||
$r = $this->con->query($sql);
|
||||
if ($r->fetchColumn(0)) {
|
||||
$errArray["error"] = "Can't set cue in to be larger than cue out.";
|
||||
return $errArray;
|
||||
}
|
||||
|
||||
$sql = "SELECT INTERVAL '{$cueOut}' > INTERVAL '{$origLength}'";
|
||||
$r = $this->con->query($sql);
|
||||
$sql = "SELECT INTERVAL '{$cueOut}' > INTERVAL '{$origLength}'";
|
||||
$r = $this->con->query($sql);
|
||||
if ($r->fetchColumn(0)){
|
||||
$errArray["error"] = "Can't set cue out to be greater than file length.";
|
||||
return $errArray;
|
||||
}
|
||||
|
||||
$sql = "SELECT INTERVAL '{$cueOut}' - INTERVAL '{$cueIn}'";
|
||||
$r = $this->con->query($sql);
|
||||
$cliplength = $r->fetchColumn(0);
|
||||
$sql = "SELECT INTERVAL '{$cueOut}' - INTERVAL '{$cueIn}'";
|
||||
$r = $this->con->query($sql);
|
||||
$cliplength = $r->fetchColumn(0);
|
||||
|
||||
$row->setDbCuein($cueIn);
|
||||
$row->setDbCueout($cueOut);
|
||||
|
@ -629,16 +629,16 @@ class Application_Model_Playlist {
|
|||
}
|
||||
else if (!is_null($cueIn)) {
|
||||
|
||||
$sql = "SELECT INTERVAL '{$cueIn}' > INTERVAL '{$oldCueOut}'";
|
||||
$r = $this->con->query($sql);
|
||||
$sql = "SELECT INTERVAL '{$cueIn}' > INTERVAL '{$oldCueOut}'";
|
||||
$r = $this->con->query($sql);
|
||||
if ($r->fetchColumn(0)) {
|
||||
$errArray["error"] = "Can't set cue in to be larger than cue out.";
|
||||
return $errArray;
|
||||
}
|
||||
|
||||
$sql = "SELECT INTERVAL '{$oldCueOut}' - INTERVAL '{$cueIn}'";
|
||||
$r = $this->con->query($sql);
|
||||
$cliplength = $r->fetchColumn(0);
|
||||
$r = $this->con->query($sql);
|
||||
$cliplength = $r->fetchColumn(0);
|
||||
|
||||
$row->setDbCuein($cueIn);
|
||||
$row->setDBCliplength($cliplength);
|
||||
|
@ -649,23 +649,23 @@ class Application_Model_Playlist {
|
|||
$cueOut = $origLength;
|
||||
}
|
||||
|
||||
$sql = "SELECT INTERVAL '{$cueOut}' < INTERVAL '{$oldCueIn}'";
|
||||
$r = $this->con->query($sql);
|
||||
$sql = "SELECT INTERVAL '{$cueOut}' < INTERVAL '{$oldCueIn}'";
|
||||
$r = $this->con->query($sql);
|
||||
if ($r->fetchColumn(0)) {
|
||||
$errArray["error"] = "Can't set cue out to be smaller than cue in.";
|
||||
return $errArray;
|
||||
}
|
||||
|
||||
$sql = "SELECT INTERVAL '{$cueOut}' > INTERVAL '{$origLength}'";
|
||||
$r = $this->con->query($sql);
|
||||
$sql = "SELECT INTERVAL '{$cueOut}' > INTERVAL '{$origLength}'";
|
||||
$r = $this->con->query($sql);
|
||||
if ($r->fetchColumn(0)){
|
||||
$errArray["error"] = "Can't set cue out to be greater than file length.";
|
||||
return $errArray;
|
||||
}
|
||||
|
||||
$sql = "SELECT INTERVAL '{$cueOut}' - INTERVAL '{$oldCueIn}'";
|
||||
$r = $this->con->query($sql);
|
||||
$cliplength = $r->fetchColumn(0);
|
||||
$r = $this->con->query($sql);
|
||||
$cliplength = $r->fetchColumn(0);
|
||||
|
||||
$row->setDbCueout($cueOut);
|
||||
$row->setDBCliplength($cliplength);
|
||||
|
@ -673,15 +673,15 @@ class Application_Model_Playlist {
|
|||
|
||||
$cliplength = $row->getDbCliplength();
|
||||
|
||||
$sql = "SELECT INTERVAL '{$fadeIn}' > INTERVAL '{$cliplength}'";
|
||||
$r = $this->con->query($sql);
|
||||
$sql = "SELECT INTERVAL '{$fadeIn}' > INTERVAL '{$cliplength}'";
|
||||
$r = $this->con->query($sql);
|
||||
if ($r->fetchColumn(0)){
|
||||
$fadeIn = $cliplength;
|
||||
$row->setDbFadein($fadeIn);
|
||||
}
|
||||
|
||||
$sql = "SELECT INTERVAL '{$fadeOut}' > INTERVAL '{$cliplength}'";
|
||||
$r = $this->con->query($sql);
|
||||
$sql = "SELECT INTERVAL '{$fadeOut}' > INTERVAL '{$cliplength}'";
|
||||
$r = $this->con->query($sql);
|
||||
if ($r->fetchColumn(0)){
|
||||
$fadeOut = $cliplength;
|
||||
$row->setDbFadein($fadeOut);
|
||||
|
|
|
@ -4,80 +4,80 @@ require_once 'formatters/LengthFormatter.php';
|
|||
|
||||
class Application_Model_PlayoutHistory {
|
||||
|
||||
private $con;
|
||||
private $timezone;
|
||||
private $con;
|
||||
private $timezone;
|
||||
|
||||
//in UTC timezone
|
||||
private $startDT;
|
||||
//in UTC timezone
|
||||
private $endDT;
|
||||
//in UTC timezone
|
||||
private $startDT;
|
||||
//in UTC timezone
|
||||
private $endDT;
|
||||
|
||||
private $epoch_now;
|
||||
private $opts;
|
||||
private $epoch_now;
|
||||
private $opts;
|
||||
|
||||
private $mDataPropMap = array(
|
||||
"artist" => "file.artist_name",
|
||||
"title" => "file.track_title",
|
||||
"played" => "playout.played",
|
||||
"length" => "file.length",
|
||||
"composer" => "file.composer",
|
||||
"copyright" => "file.copyright",
|
||||
);
|
||||
private $mDataPropMap = array(
|
||||
"artist" => "file.artist_name",
|
||||
"title" => "file.track_title",
|
||||
"played" => "playout.played",
|
||||
"length" => "file.length",
|
||||
"composer" => "file.composer",
|
||||
"copyright" => "file.copyright",
|
||||
);
|
||||
|
||||
public function __construct($p_startDT, $p_endDT, $p_opts) {
|
||||
public function __construct($p_startDT, $p_endDT, $p_opts) {
|
||||
|
||||
$this->con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
|
||||
$this->startDT = $p_startDT;
|
||||
$this->endDT = $p_endDT;
|
||||
$this->timezone = date_default_timezone_get();
|
||||
$this->epoch_now = time();
|
||||
$this->opts = $p_opts;
|
||||
}
|
||||
$this->con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
|
||||
$this->startDT = $p_startDT;
|
||||
$this->endDT = $p_endDT;
|
||||
$this->timezone = date_default_timezone_get();
|
||||
$this->epoch_now = time();
|
||||
$this->opts = $p_opts;
|
||||
}
|
||||
|
||||
/*
|
||||
* map front end mDataProp labels to proper column names for searching etc.
|
||||
*/
|
||||
private function translateColumns() {
|
||||
/*
|
||||
* map front end mDataProp labels to proper column names for searching etc.
|
||||
*/
|
||||
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(
|
||||
"file.track_title as title",
|
||||
"file.artist_name as artist",
|
||||
"playout.played",
|
||||
"playout.file_id",
|
||||
"file.composer",
|
||||
"file.copyright",
|
||||
"file.length"
|
||||
);
|
||||
$select = array(
|
||||
"file.track_title as title",
|
||||
"file.artist_name as artist",
|
||||
"playout.played",
|
||||
"playout.file_id",
|
||||
"file.composer",
|
||||
"file.copyright",
|
||||
"file.length"
|
||||
);
|
||||
|
||||
$start = $this->startDT->format("Y-m-d H:i:s");
|
||||
$end = $this->endDT->format("Y-m-d H:i:s");
|
||||
$start = $this->startDT->format("Y-m-d H:i:s");
|
||||
$end = $this->endDT->format("Y-m-d H:i:s");
|
||||
|
||||
$historyTable = "(
|
||||
select count(schedule.file_id) as played, schedule.file_id as file_id
|
||||
from cc_schedule as schedule
|
||||
where schedule.starts >= '{$start}' and schedule.starts < '{$end}'
|
||||
and schedule.playout_status > 0 and schedule.media_item_played != FALSE and schedule.broadcasted = 1
|
||||
group by schedule.file_id
|
||||
)
|
||||
AS playout left join cc_files as file on (file.id = playout.file_id)";
|
||||
$historyTable = "(
|
||||
select count(schedule.file_id) as played, schedule.file_id as file_id
|
||||
from cc_schedule as schedule
|
||||
where schedule.starts >= '{$start}' and schedule.starts < '{$end}'
|
||||
and schedule.playout_status > 0 and schedule.media_item_played != FALSE and schedule.broadcasted = 1
|
||||
group by schedule.file_id
|
||||
)
|
||||
AS playout left join cc_files as file on (file.id = playout.file_id)";
|
||||
|
||||
$results = Application_Model_Datatables::findEntries($this->con, $select, $historyTable, $this->opts, "history");
|
||||
$results = Application_Model_Datatables::findEntries($this->con, $select, $historyTable, $this->opts, "history");
|
||||
|
||||
foreach ($results["history"] as &$row) {
|
||||
$formatter = new LengthFormatter($row['length']);
|
||||
$row['length'] = $formatter->format();
|
||||
}
|
||||
foreach ($results["history"] as &$row) {
|
||||
$formatter = new LengthFormatter($row['length']);
|
||||
$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;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* @param DateTime $p_startDateTime
|
||||
*
|
||||
* @param DateTime $p_endDateTime
|
||||
*
|
||||
* @return array $scheduledItems
|
||||
*
|
||||
*/
|
||||
/*
|
||||
*
|
||||
* @param DateTime $p_startDateTime
|
||||
*
|
||||
* @param DateTime $p_endDateTime
|
||||
*
|
||||
* @return array $scheduledItems
|
||||
*
|
||||
*/
|
||||
public static function GetScheduleDetailItems($p_start, $p_end, $p_shows)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
@ -626,18 +626,18 @@ class Application_Model_Schedule {
|
|||
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
||||
|
||||
$formWhat = new Application_Form_AddShowWhat();
|
||||
$formWho = new Application_Form_AddShowWho();
|
||||
$formWhen = new Application_Form_AddShowWhen();
|
||||
$formRepeats = new Application_Form_AddShowRepeats();
|
||||
$formStyle = new Application_Form_AddShowStyle();
|
||||
$formLive = new Application_Form_AddShowLiveStream();
|
||||
$formWho = new Application_Form_AddShowWho();
|
||||
$formWhen = new Application_Form_AddShowWhen();
|
||||
$formRepeats = new Application_Form_AddShowRepeats();
|
||||
$formStyle = new Application_Form_AddShowStyle();
|
||||
$formLive = new Application_Form_AddShowLiveStream();
|
||||
|
||||
$formWhat->removeDecorator('DtDdWrapper');
|
||||
$formWho->removeDecorator('DtDdWrapper');
|
||||
$formWhen->removeDecorator('DtDdWrapper');
|
||||
$formRepeats->removeDecorator('DtDdWrapper');
|
||||
$formStyle->removeDecorator('DtDdWrapper');
|
||||
$formLive->removeDecorator('DtDdWrapper');
|
||||
$formWhat->removeDecorator('DtDdWrapper');
|
||||
$formWho->removeDecorator('DtDdWrapper');
|
||||
$formWhen->removeDecorator('DtDdWrapper');
|
||||
$formRepeats->removeDecorator('DtDdWrapper');
|
||||
$formStyle->removeDecorator('DtDdWrapper');
|
||||
$formLive->removeDecorator('DtDdWrapper');
|
||||
|
||||
$p_view->what = $formWhat;
|
||||
$p_view->when = $formWhen;
|
||||
|
@ -681,18 +681,18 @@ class Application_Model_Schedule {
|
|||
$isSaas = (Application_Model_Preference::GetPlanLevel() != 'disabled');
|
||||
|
||||
$formWhat = new Application_Form_AddShowWhat();
|
||||
$formWhen = new Application_Form_AddShowWhen();
|
||||
$formRepeats = new Application_Form_AddShowRepeats();
|
||||
$formWho = new Application_Form_AddShowWho();
|
||||
$formStyle = new Application_Form_AddShowStyle();
|
||||
$formLive = new Application_Form_AddShowLiveStream();
|
||||
$formWhen = new Application_Form_AddShowWhen();
|
||||
$formRepeats = new Application_Form_AddShowRepeats();
|
||||
$formWho = new Application_Form_AddShowWho();
|
||||
$formStyle = new Application_Form_AddShowStyle();
|
||||
$formLive = new Application_Form_AddShowLiveStream();
|
||||
|
||||
$formWhat->removeDecorator('DtDdWrapper');
|
||||
$formWhen->removeDecorator('DtDdWrapper');
|
||||
$formRepeats->removeDecorator('DtDdWrapper');
|
||||
$formWho->removeDecorator('DtDdWrapper');
|
||||
$formStyle->removeDecorator('DtDdWrapper');
|
||||
$formLive->removeDecorator('DtDdWrapper');
|
||||
$formWhat->removeDecorator('DtDdWrapper');
|
||||
$formWhen->removeDecorator('DtDdWrapper');
|
||||
$formRepeats->removeDecorator('DtDdWrapper');
|
||||
$formWho->removeDecorator('DtDdWrapper');
|
||||
$formStyle->removeDecorator('DtDdWrapper');
|
||||
$formLive->removeDecorator('DtDdWrapper');
|
||||
|
||||
if(!$isSaas){
|
||||
$formRecord = new Application_Form_AddShowRR();
|
||||
|
@ -765,22 +765,22 @@ class Application_Model_Schedule {
|
|||
$record = false;
|
||||
|
||||
$formWhat = new Application_Form_AddShowWhat();
|
||||
$formWho = new Application_Form_AddShowWho();
|
||||
$formWhen = new Application_Form_AddShowWhen();
|
||||
$formRepeats = new Application_Form_AddShowRepeats();
|
||||
$formStyle = new Application_Form_AddShowStyle();
|
||||
$formLive = new Application_Form_AddShowLiveStream();
|
||||
$formWho = new Application_Form_AddShowWho();
|
||||
$formWhen = new Application_Form_AddShowWhen();
|
||||
$formRepeats = new Application_Form_AddShowRepeats();
|
||||
$formStyle = new Application_Form_AddShowStyle();
|
||||
$formLive = new Application_Form_AddShowLiveStream();
|
||||
|
||||
$formWhat->removeDecorator('DtDdWrapper');
|
||||
$formWho->removeDecorator('DtDdWrapper');
|
||||
$formWhen->removeDecorator('DtDdWrapper');
|
||||
$formRepeats->removeDecorator('DtDdWrapper');
|
||||
$formStyle->removeDecorator('DtDdWrapper');
|
||||
$formLive->removeDecorator('DtDdWrapper');
|
||||
$formWhat->removeDecorator('DtDdWrapper');
|
||||
$formWho->removeDecorator('DtDdWrapper');
|
||||
$formWhen->removeDecorator('DtDdWrapper');
|
||||
$formRepeats->removeDecorator('DtDdWrapper');
|
||||
$formStyle->removeDecorator('DtDdWrapper');
|
||||
$formLive->removeDecorator('DtDdWrapper');
|
||||
|
||||
$what = $formWhat->isValid($data);
|
||||
$when = $formWhen->isValid($data);
|
||||
$live = $formLive->isValid($data);
|
||||
$what = $formWhat->isValid($data);
|
||||
$when = $formWhen->isValid($data);
|
||||
$live = $formLive->isValid($data);
|
||||
if($when) {
|
||||
$when = $formWhen->checkReliantFields($data, $validateStartDate, $originalStartDate, $update, $instanceId);
|
||||
}
|
||||
|
@ -798,11 +798,11 @@ class Application_Model_Schedule {
|
|||
$mValue = 0;
|
||||
|
||||
if($hPos !== false){
|
||||
$hValue = trim(substr($data["add_show_duration"], 0, $hPos));
|
||||
$hValue = trim(substr($data["add_show_duration"], 0, $hPos));
|
||||
}
|
||||
if($mPos !== false){
|
||||
$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;
|
||||
|
@ -821,7 +821,7 @@ class Application_Model_Schedule {
|
|||
}
|
||||
|
||||
if($data["add_show_repeats"]) {
|
||||
$repeats = $formRepeats->isValid($data);
|
||||
$repeats = $formRepeats->isValid($data);
|
||||
if($repeats) {
|
||||
$repeats = $formRepeats->checkReliantFields($data);
|
||||
}
|
||||
|
@ -857,8 +857,8 @@ class Application_Model_Schedule {
|
|||
}
|
||||
}
|
||||
|
||||
$who = $formWho->isValid($data);
|
||||
$style = $formStyle->isValid($data);
|
||||
$who = $formWho->isValid($data);
|
||||
$style = $formStyle->isValid($data);
|
||||
if ($what && $when && $repeats && $who && $style && $live) {
|
||||
if(!$isSaas){
|
||||
if($record && $rebroadAb && $rebroad){
|
||||
|
@ -898,7 +898,7 @@ class Application_Model_Schedule {
|
|||
//$controller->view->newForm = $controller->view->render('schedule/add-show-form.phtml');
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
$controller->view->what = $formWhat;
|
||||
$controller->view->when = $formWhen;
|
||||
$controller->view->repeats = $formRepeats;
|
||||
|
|
|
@ -32,7 +32,7 @@ class Application_Model_Scheduler {
|
|||
$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) {
|
||||
|
|
|
@ -303,8 +303,6 @@ class Application_Model_Show {
|
|||
." AND starts > TIMESTAMP '$timestamp'"
|
||||
." AND show_id = $showId";
|
||||
|
||||
//Logging::log($sql);
|
||||
|
||||
$con->exec($sql);
|
||||
}
|
||||
|
||||
|
@ -594,8 +592,8 @@ class Application_Model_Show {
|
|||
* The start date in the format YYYY-MM-DD
|
||||
*/
|
||||
public function getStartDate(){
|
||||
list($date,) = explode(" ", $this->getStartDateAndTime());
|
||||
return $date;
|
||||
list($date,) = explode(" ", $this->getStartDateAndTime());
|
||||
return $date;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -606,8 +604,8 @@ class Application_Model_Show {
|
|||
*/
|
||||
|
||||
public function getStartTime(){
|
||||
list(,$time) = explode(" ", $this->getStartDateAndTime());
|
||||
return $time;
|
||||
list(,$time) = explode(" ", $this->getStartDateAndTime());
|
||||
return $time;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1251,8 +1249,8 @@ class Application_Model_Show {
|
|||
$rebroadcasts = $con->query($sql)->fetchAll();
|
||||
|
||||
if ($showInstance->isRecorded()){
|
||||
$showInstance->deleteRebroadcasts();
|
||||
self::createRebroadcastInstances($rebroadcasts, $currentUtcTimestamp, $show_id, $show_instance_id, $start, $duration, $timezone);
|
||||
$showInstance->deleteRebroadcasts();
|
||||
self::createRebroadcastInstances($rebroadcasts, $currentUtcTimestamp, $show_id, $show_instance_id, $start, $duration, $timezone);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1733,7 +1731,8 @@ class Application_Model_Show {
|
|||
$timeNow = $date->getUtcTimestamp();
|
||||
}
|
||||
//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"
|
||||
." WHERE si.show_id = s.id"
|
||||
." 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)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
//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"
|
||||
." WHERE si.show_id = s.id"
|
||||
." AND si.starts > TIMESTAMP '$p_timeNow' - INTERVAL '2 days'"
|
||||
|
@ -1770,10 +1771,11 @@ class Application_Model_Show {
|
|||
|
||||
$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.
|
||||
if ((strtotime($rows[$i]['starts']) <= $timeNowAsMillis) && (strtotime($rows[$i]['ends']) > $timeNowAsMillis)){
|
||||
if ( $i - 1 >= 0){
|
||||
if ((strtotime($rows[$i]['starts']) <= $timeNowAsMillis)
|
||||
&& (strtotime($rows[$i]['ends']) > $timeNowAsMillis)) {
|
||||
if ($i-1 >= 0) {
|
||||
$results['previousShow'][0] = array(
|
||||
"id"=>$rows[$i-1]['id'],
|
||||
"instance_id"=>$rows[$i-1]['instance_id'],
|
||||
|
@ -1789,7 +1791,7 @@ class Application_Model_Show {
|
|||
|
||||
$results['currentShow'][0] = $rows[$i];
|
||||
|
||||
if ( isset($rows[$i+1])){
|
||||
if (isset($rows[$i+1])) {
|
||||
$results['nextShow'][0] = array(
|
||||
"id"=>$rows[$i+1]['id'],
|
||||
"instance_id"=>$rows[$i+1]['instance_id'],
|
||||
|
@ -1801,7 +1803,6 @@ class Application_Model_Show {
|
|||
"ends"=>$rows[$i+1]['ends'],
|
||||
"record"=>$rows[$i+1]['record'],
|
||||
"type"=>"show");
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1855,7 +1856,7 @@ class Application_Model_Show {
|
|||
* @param String $timeEnd - interval end time (in UTC)
|
||||
* @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;
|
||||
$con = Propel::getConnection();
|
||||
|
@ -1878,7 +1879,7 @@ class Application_Model_Show {
|
|||
." ORDER BY si.starts";
|
||||
|
||||
// defaults to retrieve all shows within the interval if $limit not set
|
||||
if($limit != "0") {
|
||||
if ($limit != "0") {
|
||||
$sql = $sql . " LIMIT $limit";
|
||||
}
|
||||
|
||||
|
@ -1893,20 +1894,22 @@ class Application_Model_Show {
|
|||
* @param type $rows arrays of arrays containing database query result
|
||||
* @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();
|
||||
|
||||
if (!is_array($rows)) {
|
||||
return;
|
||||
}
|
||||
foreach($rows as &$row) {
|
||||
foreach($columnsToConvert as $column) {
|
||||
foreach ($rows as &$row) {
|
||||
foreach ($columnsToConvert as $column) {
|
||||
$row[$column] = Application_Common_DateHelper::ConvertToLocalDateTimeString($row[$column]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function GetMaxLengths() {
|
||||
public static function getMaxLengths()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ class Application_Model_ShowBuilder {
|
|||
$this->startDT = $p_startDT;
|
||||
$this->endDT = $p_endDT;
|
||||
$this->timezone = date_default_timezone_get();
|
||||
$this->user = Application_Model_User::GetCurrentUser();
|
||||
$this->user = Application_Model_User::getCurrentUser();
|
||||
$this->opts = $p_opts;
|
||||
$this->epoch_now = floatval(microtime(true));
|
||||
$this->currentShow = false;
|
||||
|
|
|
@ -670,30 +670,30 @@ class Application_Model_ShowInstance {
|
|||
|
||||
public function getLastAudioItemEnd()
|
||||
{
|
||||
$con = Propel::getConnection();
|
||||
$con = Propel::getConnection();
|
||||
|
||||
$sql = "SELECT ends FROM cc_schedule "
|
||||
."WHERE instance_id = {$this->_instanceId} "
|
||||
."ORDER BY ends DESC "
|
||||
."LIMIT 1";
|
||||
$sql = "SELECT ends FROM cc_schedule "
|
||||
."WHERE instance_id = {$this->_instanceId} "
|
||||
."ORDER BY ends DESC "
|
||||
."LIMIT 1";
|
||||
|
||||
$query = $con->query($sql)->fetchColumn(0);
|
||||
$query = $con->query($sql)->fetchColumn(0);
|
||||
return ($query !== false) ? $query : NULL;
|
||||
}
|
||||
}
|
||||
|
||||
public function getShowEndGapTime(){
|
||||
$showEnd = $this->getShowInstanceEnd();
|
||||
$lastItemEnd = $this->getLastAudioItemEnd();
|
||||
$showEnd = $this->getShowInstanceEnd();
|
||||
$lastItemEnd = $this->getLastAudioItemEnd();
|
||||
|
||||
if (is_null($lastItemEnd)){
|
||||
$lastItemEnd = $this->getShowInstanceStart();
|
||||
}
|
||||
if (is_null($lastItemEnd)){
|
||||
$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){
|
||||
global $CC_CONFIG;
|
||||
|
@ -777,10 +777,10 @@ class Application_Model_ShowInstance {
|
|||
$con = Propel::getConnection();
|
||||
|
||||
$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
|
||||
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";
|
||||
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";
|
||||
|
||||
return $con->query($sql)->fetchAll();
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ class Application_Model_Soundcloud {
|
|||
|
||||
private $_soundcloud;
|
||||
|
||||
public function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
|
|
|
@ -161,9 +161,9 @@ class Application_Model_StoredFile {
|
|||
* Set metadata element value
|
||||
*
|
||||
* @param string $category
|
||||
* Metadata element by metadata constant
|
||||
* Metadata element by metadata constant
|
||||
* @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)
|
||||
{
|
||||
|
@ -176,9 +176,9 @@ class Application_Model_StoredFile {
|
|||
* Set metadata element value
|
||||
*
|
||||
* @param string $category
|
||||
* Metadata element by db column
|
||||
* Metadata element by db column
|
||||
* @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)
|
||||
{
|
||||
|
@ -273,9 +273,9 @@ class Application_Model_StoredFile {
|
|||
* Set state of virtual file
|
||||
*
|
||||
* @param string $p_state
|
||||
* 'empty'|'incomplete'|'ready'|'edited'
|
||||
* 'empty'|'incomplete'|'ready'|'edited'
|
||||
* @param int $p_editedby
|
||||
* user id | 'NULL' for clear editedBy field
|
||||
* user id | 'NULL' for clear editedBy field
|
||||
* @return TRUE
|
||||
*/
|
||||
public function setState($p_state, $p_editedby=NULL)
|
||||
|
@ -367,7 +367,7 @@ class Application_Model_StoredFile {
|
|||
* Return suitable extension.
|
||||
*
|
||||
* @return string
|
||||
* file extension without a dot
|
||||
* file extension without a dot
|
||||
*/
|
||||
public function getFileExtension()
|
||||
{
|
||||
|
@ -500,9 +500,9 @@ Logging::log("getting media! - 2");
|
|||
* be NULL.
|
||||
*
|
||||
* @param int $p_id
|
||||
* local id
|
||||
* local id
|
||||
* @param string $p_gunid
|
||||
* global unique id of file
|
||||
* global unique id of file
|
||||
* @param string $p_md5sum
|
||||
* MD5 sum of the file
|
||||
* @param boolean $exist
|
||||
|
@ -570,7 +570,7 @@ Logging::log("getting media! - 2");
|
|||
* by gunid.
|
||||
*
|
||||
* @param string $p_gunid
|
||||
* global unique id of file
|
||||
* global unique id of file
|
||||
* @return Application_Model_StoredFile|NULL
|
||||
*/
|
||||
public static function RecallByGunid($p_gunid)
|
||||
|
@ -624,7 +624,7 @@ Logging::log("getting media! - 2");
|
|||
|
||||
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",
|
||||
"year", "utime", "mtime", "ftype", "track_number", "mood", "bpm", "composer", "info_url",
|
||||
|
@ -967,9 +967,9 @@ Logging::log("getting media! - 2");
|
|||
public static function getSoundCloudUploads()
|
||||
{
|
||||
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"
|
||||
." WHERE (id != -2 and id != -3) and"
|
||||
." (soundcloud_upload_time >= (now() - (INTERVAL '1 day')))";
|
||||
|
@ -1023,8 +1023,8 @@ Logging::log("getting media! - 2");
|
|||
}
|
||||
|
||||
public function getDirectory(){
|
||||
return $this->_file->getDbDirectory();
|
||||
}
|
||||
return $this->_file->getDbDirectory();
|
||||
}
|
||||
|
||||
public function setFileExistsFlag($flag){
|
||||
$this->_file->setDbFileExists($flag)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
class Application_Model_StreamSetting {
|
||||
|
||||
public static function SetValue($key, $value, $type)
|
||||
public static function setValue($key, $value, $type)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
|
@ -27,7 +27,7 @@ class Application_Model_StreamSetting {
|
|||
return $con->exec($sql);
|
||||
}
|
||||
|
||||
public static function GetValue($key)
|
||||
public static function getValue($key)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
|
@ -37,14 +37,14 @@ class Application_Model_StreamSetting {
|
|||
." WHERE keyname = '$key'";
|
||||
$result = $con->query($sql)->fetchColumn(0);
|
||||
|
||||
if ($result == 0)
|
||||
if ($result == 0) {
|
||||
return "";
|
||||
else {
|
||||
} else {
|
||||
$sql = "SELECT value FROM cc_stream_setting"
|
||||
." WHERE keyname = '$key'";
|
||||
|
||||
$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"])) {
|
||||
$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"])) {
|
||||
$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"])) {
|
||||
$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"])) {
|
||||
$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;
|
||||
}
|
||||
|
@ -155,7 +163,7 @@ class Application_Model_StreamSetting {
|
|||
{
|
||||
$con = Propel::getConnection();
|
||||
|
||||
foreach ($data as $key=>$d) {
|
||||
foreach ($data as $key => $d) {
|
||||
if ($key == "output_sound_device" || $key == "icecast_vorbis_metadata") {
|
||||
$v = $d == 1?"true":"false";
|
||||
$sql = "UPDATE cc_stream_setting SET value='$v' WHERE keyname='$key'";
|
||||
|
@ -166,7 +174,7 @@ class Application_Model_StreamSetting {
|
|||
} else if (is_array($d)) {
|
||||
$temp = explode('_', $key);
|
||||
$prefix = $temp[0];
|
||||
foreach ($d as $k=>$v) {
|
||||
foreach ($d as $k => $v) {
|
||||
$keyname = $prefix . "_" . $k;
|
||||
if ($k == 'enable') {
|
||||
$v = $d['enable'] == 1 ? 'true' : 'false';
|
||||
|
@ -233,7 +241,7 @@ class Application_Model_StreamSetting {
|
|||
." WHERE keyname = '$keyname'";
|
||||
$result = $con->query($sql)->fetchColumn(0);
|
||||
|
||||
return ($result !== false) ? $result : NULL;
|
||||
return ($result !== false) ? $result : null;
|
||||
}
|
||||
|
||||
public static function getStreamEnabled($stream_id)
|
||||
|
@ -264,7 +272,8 @@ class Application_Model_StreamSetting {
|
|||
$enabled_stream = self::getEnabledStreamIds();
|
||||
|
||||
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"
|
||||
." WHERE keyname IN ($keys)";
|
||||
|
@ -280,35 +289,43 @@ class Application_Model_StreamSetting {
|
|||
return $out;
|
||||
}
|
||||
|
||||
public static function SetMasterLiveSteamPort($value){
|
||||
self::SetValue("master_live_stream_port", $value, "integer");
|
||||
public static function setMasterLiveStreamPort($value)
|
||||
{
|
||||
self::setValue("master_live_stream_port", $value, "integer");
|
||||
}
|
||||
|
||||
public static function GetMasterLiveSteamPort(){
|
||||
return self::GetValue("master_live_stream_port");
|
||||
public static function getMasterLiveStreamPort()
|
||||
{
|
||||
return self::getValue("master_live_stream_port");
|
||||
}
|
||||
|
||||
public static function SetMasterLiveSteamMountPoint($value){
|
||||
self::SetValue("master_live_stream_mp", $value, "string");
|
||||
public static function setMasterLiveStreamMountPoint($value)
|
||||
{
|
||||
self::setValue("master_live_stream_mp", $value, "string");
|
||||
}
|
||||
|
||||
public static function GetMasterLiveSteamMountPoint(){
|
||||
return self::GetValue("master_live_stream_mp");
|
||||
public static function getMasterLiveStreamMountPoint()
|
||||
{
|
||||
return self::getValue("master_live_stream_mp");
|
||||
}
|
||||
|
||||
public static function SetDJLiveSteamPort($value){
|
||||
self::SetValue("dj_live_stream_port", $value, "integer");
|
||||
public static function setDjLiveStreamPort($value)
|
||||
{
|
||||
self::setValue("dj_live_stream_port", $value, "integer");
|
||||
}
|
||||
|
||||
public static function GetDJLiveSteamPort(){
|
||||
return self::GetValue("dj_live_stream_port");
|
||||
public static function getDjLiveStreamPort()
|
||||
{
|
||||
return self::getValue("dj_live_stream_port");
|
||||
}
|
||||
|
||||
public static function SetDJLiveSteamMountPoint($value){
|
||||
self::SetValue("dj_live_stream_mp", $value, "string");
|
||||
public static function setDjLiveStreamMountPoint($value)
|
||||
{
|
||||
self::setValue("dj_live_stream_mp", $value, "string");
|
||||
}
|
||||
|
||||
public static function GetDJLiveSteamMountPoint(){
|
||||
return self::GetValue("dj_live_stream_mp");
|
||||
public static function getDjLiveStreamMountPoint()
|
||||
{
|
||||
return self::getValue("dj_live_stream_mp");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,102 +18,6 @@ class Application_Model_Subjects {
|
|||
|
||||
/* ======================================================= 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)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
@ -131,7 +35,7 @@ class Application_Model_Subjects {
|
|||
$sql = "UPDATE ".$CC_CONFIG['subjTable']." SET login_attempts = '0'"
|
||||
." WHERE login='$login'";
|
||||
$res = $con->exec($sql);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function getLoginAttempts($login)
|
||||
|
|
|
@ -11,191 +11,220 @@ class Application_Model_User {
|
|||
|
||||
public function __construct($userId)
|
||||
{
|
||||
if (empty($userId)){
|
||||
if (empty($userId)) {
|
||||
$this->_userInstance = $this->createUser();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$this->_userInstance = CcSubjsQuery::create()->findPK($userId);
|
||||
|
||||
if (is_null($this->_userInstance)){
|
||||
if (is_null($this->_userInstance)) {
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getId() {
|
||||
public function getId()
|
||||
{
|
||||
return $this->_userInstance->getDbId();
|
||||
}
|
||||
|
||||
public function isGuest() {
|
||||
public function isGuest()
|
||||
{
|
||||
return $this->getType() == UTYPE_GUEST;
|
||||
}
|
||||
|
||||
public function isHost($showId) {
|
||||
return $this->isUserType(UTYPE_HOST, $showId);
|
||||
public function isHost($showId)
|
||||
{
|
||||
return $this->isUserType(UTYPE_HOST, $showId);
|
||||
}
|
||||
|
||||
public function isPM() {
|
||||
public function isPM()
|
||||
{
|
||||
return $this->isUserType(UTYPE_PROGRAM_MANAGER);
|
||||
}
|
||||
|
||||
public function isAdmin() {
|
||||
public function isAdmin()
|
||||
{
|
||||
return $this->isUserType(UTYPE_ADMIN);
|
||||
}
|
||||
|
||||
public function canSchedule($p_showId) {
|
||||
$type = $this->getType();
|
||||
$result = false;
|
||||
public function canSchedule($p_showId)
|
||||
{
|
||||
$type = $this->getType();
|
||||
$result = false;
|
||||
|
||||
if ( $type === UTYPE_ADMIN ||
|
||||
if ($type === UTYPE_ADMIN ||
|
||||
$type === UTYPE_PROGRAM_MANAGER ||
|
||||
CcShowHostsQuery::create()->filterByDbShow($p_showId)->filterByDbHost($this->getId())->count() > 0 )
|
||||
{
|
||||
$result = true;
|
||||
}
|
||||
CcShowHostsQuery::create()->filterByDbShow($p_showId)->filterByDbHost($this->getId())->count() > 0) {
|
||||
$result = true;
|
||||
}
|
||||
|
||||
return $result;
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function isUserType($type, $showId=''){
|
||||
if(is_array($type)){
|
||||
$result = false;
|
||||
foreach($type as $t){
|
||||
switch($t){
|
||||
case UTYPE_ADMIN:
|
||||
$result = $this->_userInstance->getDbType() === 'A';
|
||||
break;
|
||||
case UTYPE_HOST:
|
||||
$userId = $this->_userInstance->getDbId();
|
||||
$result = CcShowHostsQuery::create()->filterByDbShow($showId)->filterByDbHost($userId)->count() > 0;
|
||||
break;
|
||||
case UTYPE_PROGRAM_MANAGER:
|
||||
$result = $this->_userInstance->getDbType() === 'P';
|
||||
break;
|
||||
}
|
||||
if($result){
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
switch($type){
|
||||
case UTYPE_ADMIN:
|
||||
return $this->_userInstance->getDbType() === 'A';
|
||||
case UTYPE_HOST:
|
||||
$userId = $this->_userInstance->getDbId();
|
||||
return CcShowHostsQuery::create()->filterByDbShow($showId)->filterByDbHost($userId)->count() > 0;
|
||||
case UTYPE_PROGRAM_MANAGER:
|
||||
return $this->_userInstance->getDbType() === 'P';
|
||||
}
|
||||
}
|
||||
public function isUserType($type, $showId='')
|
||||
{
|
||||
if (is_array($type)) {
|
||||
$result = false;
|
||||
foreach ($type as $t) {
|
||||
switch($t){
|
||||
case UTYPE_ADMIN:
|
||||
$result = $this->_userInstance->getDbType() === 'A';
|
||||
break;
|
||||
case UTYPE_HOST:
|
||||
$userId = $this->_userInstance->getDbId();
|
||||
$result = CcShowHostsQuery::create()
|
||||
->filterByDbShow($showId)
|
||||
->filterByDbHost($userId)->count() > 0;
|
||||
break;
|
||||
case UTYPE_PROGRAM_MANAGER:
|
||||
$result = $this->_userInstance->getDbType() === 'P';
|
||||
break;
|
||||
}
|
||||
if ($result) {
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
switch($type) {
|
||||
case UTYPE_ADMIN:
|
||||
return $this->_userInstance->getDbType() === 'A';
|
||||
case UTYPE_HOST:
|
||||
$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->setDbLogin($login);
|
||||
}
|
||||
|
||||
public function setPassword($password){
|
||||
public function setPassword($password)
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
$user->setDbPass(md5($password));
|
||||
}
|
||||
|
||||
public function setFirstName($firstName){
|
||||
public function setFirstName($firstName)
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
$user->setDbFirstName($firstName);
|
||||
}
|
||||
|
||||
public function setLastName($lastName){
|
||||
public function setLastName($lastName)
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
$user->setDbLastName($lastName);
|
||||
}
|
||||
|
||||
public function setType($type){
|
||||
public function setType($type)
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
$user->setDbType($type);
|
||||
}
|
||||
|
||||
public function setEmail($email){
|
||||
public function setEmail($email)
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
$user->setDbEmail(strtolower($email));
|
||||
}
|
||||
|
||||
public function setCellPhone($cellPhone){
|
||||
public function setCellPhone($cellPhone)
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
$user->setDbCellPhone($cellPhone);
|
||||
}
|
||||
|
||||
public function setSkype($skype){
|
||||
public function setSkype($skype)
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
$user->setDbSkypeContact($skype);
|
||||
}
|
||||
|
||||
public function setJabber($jabber){
|
||||
public function setJabber($jabber)
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
$user->setDbJabberContact($jabber);
|
||||
}
|
||||
|
||||
public function getLogin(){
|
||||
public function getLogin()
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
return $user->getDbLogin();
|
||||
}
|
||||
|
||||
public function getPassword(){
|
||||
public function getPassword()
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
return $user->getDbPass();
|
||||
}
|
||||
|
||||
public function getFirstName(){
|
||||
public function getFirstName()
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
return $user->getDbFirstName();
|
||||
}
|
||||
|
||||
public function getLastName(){
|
||||
public function getLastName()
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
return $user->getDbLastName();
|
||||
}
|
||||
|
||||
public function getType(){
|
||||
public function getType()
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
return $user->getDbType();
|
||||
}
|
||||
|
||||
public function getEmail(){
|
||||
public function getEmail()
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
return $user->getDbEmail();
|
||||
}
|
||||
|
||||
public function getCellPhone(){
|
||||
public function getCellPhone()
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
return $user->getDbCellPhone();
|
||||
}
|
||||
|
||||
public function getSkype(){
|
||||
public function getSkype()
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
return $user->getDbSkypeContact();
|
||||
}
|
||||
|
||||
public function getJabber(){
|
||||
public function getJabber()
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
return $user->getDbJabberContact();
|
||||
|
||||
}
|
||||
|
||||
public function save(){
|
||||
public function save()
|
||||
{
|
||||
$this->_userInstance->save();
|
||||
}
|
||||
|
||||
public function delete(){
|
||||
if (!$this->_userInstance->isDeleted())
|
||||
public function delete()
|
||||
{
|
||||
if (!$this->_userInstance->isDeleted()) {
|
||||
$this->_userInstance->delete();
|
||||
}
|
||||
}
|
||||
|
||||
private function createUser() {
|
||||
private function createUser()
|
||||
{
|
||||
$user = new CcSubjs();
|
||||
return $user;
|
||||
}
|
||||
|
||||
public static function getUsers($type, $search=NULL)
|
||||
public static function getUsers($type, $search=null)
|
||||
{
|
||||
$con = Propel::getConnection();
|
||||
|
||||
|
@ -203,12 +232,11 @@ class Application_Model_User {
|
|||
$sql = $sql_gen;
|
||||
|
||||
if (is_array($type)) {
|
||||
for($i=0; $i<count($type); $i++) {
|
||||
for ($i=0; $i<count($type); $i++) {
|
||||
$type[$i] = "type = '{$type[$i]}'";
|
||||
}
|
||||
$sql_type = join(" OR ", $type);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$sql_type = "type = {$type}";
|
||||
}
|
||||
|
||||
|
@ -225,39 +253,40 @@ class Application_Model_User {
|
|||
return $con->query($sql)->fetchAll();;
|
||||
}
|
||||
|
||||
public static function getUserCount($type=NULL){
|
||||
public static function getUserCount($type=null)
|
||||
{
|
||||
$con = Propel::getConnection();
|
||||
$sql = '';
|
||||
$sql_gen = "SELECT count(*) AS cnt FROM cc_subjs ";
|
||||
|
||||
if (!isset($type)) {
|
||||
$sql = $sql_gen;
|
||||
}
|
||||
else{
|
||||
if (is_array($type)) {
|
||||
for ($i=0; $i<count($type); $i++) {
|
||||
$type[$i] = "type = '{$type[$i]}'";
|
||||
}
|
||||
$sql_type = join(" OR ", $type);
|
||||
}
|
||||
else {
|
||||
$sql_type = "type = {$type}";
|
||||
}
|
||||
$sql = $sql_gen;
|
||||
} else {
|
||||
if (is_array($type)) {
|
||||
for ($i=0; $i<count($type); $i++) {
|
||||
$type[$i] = "type = '{$type[$i]}'";
|
||||
}
|
||||
$sql_type = join(" OR ", $type);
|
||||
} else {
|
||||
$sql_type = "type = {$type}";
|
||||
}
|
||||
|
||||
$sql = $sql_gen ." WHERE (". $sql_type.") ";
|
||||
$sql = $sql_gen ." WHERE (". $sql_type.") ";
|
||||
}
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
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");
|
||||
$fromTable = "cc_subjs";
|
||||
|
@ -273,8 +302,8 @@ class Application_Model_User {
|
|||
$res = Application_Model_Datatables::findEntries($con, $displayColumns, $fromTable, $datatables);
|
||||
|
||||
// mark record which is for the current user
|
||||
foreach($res['aaData'] as &$record){
|
||||
if($record['login'] == $username){
|
||||
foreach ($res['aaData'] as &$record) {
|
||||
if ($record['login'] == $username) {
|
||||
$record['delete'] = "self";
|
||||
} else {
|
||||
$record['delete'] = "";
|
||||
|
@ -284,7 +313,8 @@ class Application_Model_User {
|
|||
return $res;
|
||||
}
|
||||
|
||||
public static function getUserData($id){
|
||||
public static function getUserData($id)
|
||||
{
|
||||
$con = Propel::getConnection();
|
||||
|
||||
$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();
|
||||
}
|
||||
|
||||
public static function GetUserID($login){
|
||||
$user = CcSubjsQuery::create()->findOneByDbLogin($login);
|
||||
if (is_null($user)){
|
||||
return -1;
|
||||
} else {
|
||||
return $user->getDbId();
|
||||
}
|
||||
}
|
||||
|
||||
public static function GetCurrentUser() {
|
||||
public static function getCurrentUser()
|
||||
{
|
||||
$userinfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
|
||||
if (is_null($userinfo)){
|
||||
if (is_null($userinfo)) {
|
||||
return null;
|
||||
} else {
|
||||
try {
|
||||
return new self($userinfo->id);
|
||||
} catch (Exception $e){
|
||||
} catch (Exception $e) {
|
||||
//we get here if $userinfo->id is defined, but doesn't exist
|
||||
//in the database anymore.
|
||||
Zend_Auth::getInstance()->clearIdentity();
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*/
|
||||
class CcFiles extends BaseCcFiles {
|
||||
|
||||
public function getDbLength($format = "H:i:s.u")
|
||||
public function getDbLength($format = "H:i:s.u")
|
||||
{
|
||||
return parent::getDbLength($format);
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
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);
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@ class StoredFileTest extends PHPUnit_TestCase {
|
|||
|| ($metadata["audio"]["dataformat"] != "mp3")
|
||||
|| ($metadata["dc:type"] != "Speech")) {
|
||||
$str = " [dc:description] = " . $metadata["dc:description"] ."\n"
|
||||
. " [audio][dataformat] = " . $metadata["audio"]["dataformat"]."\n"
|
||||
. " [dc:type] = ".$metadata["dc:type"]."\n";
|
||||
. " [audio][dataformat] = " . $metadata["audio"]["dataformat"]."\n"
|
||||
. " [dc:type] = ".$metadata["dc:type"]."\n";
|
||||
$this->fail("Metadata has unexpected values:\n".$str);
|
||||
}
|
||||
//var_dump($metadata);
|
||||
|
|
|
@ -51,7 +51,7 @@ class MediaMonitorCommon:
|
|||
|
||||
def is_audio_file(self, filename):
|
||||
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
|
||||
|
||||
#check if file is readable by "nobody"
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 492242f4bb7367afebbf2f096067cb5a5d3c0449
|
||||
Subproject commit 0653ec0b89362921f075af96ee8772538b801a7c
|
Loading…
Reference in New Issue