Revert "Merge branch 'ryerson-history'"
This reverts commita554c6f72c
, reversing changes made to2a0c9769aa
.
This commit is contained in:
parent
a554c6f72c
commit
c8b73850b9
200 changed files with 5491 additions and 41784 deletions
|
@ -209,43 +209,6 @@ class ApiController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
|
||||
public function onAirLightAction()
|
||||
{
|
||||
$this->view->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$result = array();
|
||||
$result["on_air_light"] = false;
|
||||
$result["on_air_light_expected_status"] = false;
|
||||
$result["station_down"] = false;
|
||||
|
||||
$range = Application_Model_Schedule::GetPlayOrderRange();
|
||||
|
||||
$isItemCurrentlyScheduled = !is_null($range["current"]) && count($range["currentShow"]) > 0 ? true : false;
|
||||
|
||||
$isCurrentItemPlaying = $range["current"]["media_item_played"] ? true : false;
|
||||
|
||||
if ($isItemCurrentlyScheduled ||
|
||||
Application_Model_Preference::GetSourceSwitchStatus("live_dj") == "on" ||
|
||||
Application_Model_Preference::GetSourceSwitchStatus("master_dj") == "on")
|
||||
{
|
||||
$result["on_air_light_expected_status"] = true;
|
||||
}
|
||||
|
||||
if (($isItemCurrentlyScheduled && $isCurrentItemPlaying) ||
|
||||
Application_Model_Preference::GetSourceSwitchStatus("live_dj") == "on" ||
|
||||
Application_Model_Preference::GetSourceSwitchStatus("master_dj") == "on")
|
||||
{
|
||||
$result["on_air_light"] = true;
|
||||
}
|
||||
|
||||
if ($result["on_air_light_expected_status"] != $result["on_air_light"]) {
|
||||
$result["station_down"] = true;
|
||||
}
|
||||
|
||||
echo isset($_GET['callback']) ? $_GET['callback'].'('.json_encode($result).')' : json_encode($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the currently playing show as well as upcoming shows.
|
||||
* Number of shows returned and the time interval in which to
|
||||
|
@ -400,9 +363,6 @@ class ApiController extends Zend_Controller_Action
|
|||
$media_id = $this->_getParam("media_id");
|
||||
Logging::debug("Received notification of new media item start: $media_id");
|
||||
Application_Model_Schedule::UpdateMediaPlayedStatus($media_id);
|
||||
|
||||
$historyService = new Application_Service_HistoryService();
|
||||
$historyService->insertPlayedItem($media_id);
|
||||
|
||||
//set a 'last played' timestamp for media item
|
||||
//needed for smart blocks
|
||||
|
@ -1009,30 +969,23 @@ class ApiController extends Zend_Controller_Action
|
|||
//calculated with silan by actually scanning the entire file. This
|
||||
//process takes a really long time, and so we only do it in the background
|
||||
//after the file has already been imported -MK
|
||||
try {
|
||||
$length = $file->getDbLength();
|
||||
if (isset($info['length'])) {
|
||||
$length = $info['length'];
|
||||
//length decimal number in seconds. Need to convert it to format
|
||||
//HH:mm:ss to get around silly PHP limitations.
|
||||
$length = Application_Common_DateHelper::secondsToPlaylistTime($length);
|
||||
$file->setDbLength($length);
|
||||
}
|
||||
$length = $file->getDbLength();
|
||||
if (isset($info['length'])) {
|
||||
$length = $info['length'];
|
||||
//length decimal number in seconds. Need to convert it to format
|
||||
//HH:mm:ss to get around silly PHP limitations.
|
||||
$length = Application_Common_DateHelper::secondsToPlaylistTime($length);
|
||||
|
||||
$cuein = isset($info['cuein']) ? $info['cuein'] : 0;
|
||||
$cueout = isset($info['cueout']) ? $info['cueout'] : $length;
|
||||
|
||||
$file->setDbCuein($cuein);
|
||||
$file->setDbCueout($cueout);
|
||||
$file->setDbSilanCheck(true);
|
||||
$file->save();
|
||||
} catch (Exception $e) {
|
||||
Logging::info("Failed to update silan values for ".$file->getDbTrackTitle());
|
||||
Logging::info("File length analyzed by Silan is: ".$length);
|
||||
//set silan_check to true so we don't attempt to re-anaylze again
|
||||
$file->setDbSilanCheck(true);
|
||||
$file->save();
|
||||
$file->setDbLength($length);
|
||||
}
|
||||
|
||||
$cuein = isset($info['cuein']) ? $info['cuein'] : 0;
|
||||
$cueout = isset($info['cueout']) ? $info['cueout'] : $length;
|
||||
|
||||
$file->setDbCuein($cuein);
|
||||
$file->setDbCueout($cueout);
|
||||
$file->setDbSilanCheck(true);
|
||||
$file->save();
|
||||
}
|
||||
|
||||
$this->_helper->json->sendJson(array());
|
||||
|
|
|
@ -53,7 +53,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/spl.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/playlist/smart_blockbuilder.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
||||
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/observer/observer.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/config.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/curves.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
||||
|
@ -68,9 +68,9 @@ class LibraryController extends Zend_Controller_Action
|
|||
|
||||
//arbitrary attributes need to be allowed to set an id for the templates.
|
||||
$this->view->headScript()->setAllowArbitraryAttributes(true);
|
||||
//$this->view->headScript()->appendScript(file_get_contents(APPLICATION_PATH.'/../public/js/waveformplaylist/templates/bottombar.tpl'),
|
||||
//$this->view->headScript()->appendScript(file_get_contents(APPLICATION_PATH.'/../public/js/waveformplaylist/templates/bottombar.tpl'),
|
||||
// 'text/template', array('id' => 'tpl_playlist_cues', 'noescape' => true));
|
||||
|
||||
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/playlist_builder.css?'.$CC_CONFIG['airtime_version']);
|
||||
|
||||
try {
|
||||
|
@ -179,7 +179,9 @@ class LibraryController extends Zend_Controller_Action
|
|||
$type = $this->_getParam('type');
|
||||
//playlist||timeline
|
||||
$screen = $this->_getParam('screen');
|
||||
|
||||
|
||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||
|
||||
$menu = array();
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
|
@ -248,7 +250,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
} elseif ($type == "stream") {
|
||||
$webstream = CcWebstreamQuery::create()->findPK($id);
|
||||
$obj = new Application_Model_Webstream($webstream);
|
||||
|
||||
|
||||
$menu["play"]["mime"] = $webstream->getDbMime();
|
||||
|
||||
if (isset($obj_sess->id) && $screen == "playlist") {
|
||||
|
@ -371,15 +373,15 @@ class LibraryController extends Zend_Controller_Action
|
|||
$this->view->message = $message;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// duplicate playlist
|
||||
public function duplicateAction(){
|
||||
$params = $this->getRequest()->getParams();
|
||||
$id = $params['id'];
|
||||
|
||||
|
||||
$originalPl = new Application_Model_Playlist($id);
|
||||
$newPl = new Application_Model_Playlist();
|
||||
|
||||
|
||||
$contents = $originalPl->getContents();
|
||||
foreach ($contents as &$c) {
|
||||
if ($c['type'] == '0') {
|
||||
|
@ -391,15 +393,15 @@ class LibraryController extends Zend_Controller_Action
|
|||
}
|
||||
$c[0] = $c['item_id'];
|
||||
}
|
||||
|
||||
|
||||
$newPl->addAudioClips($contents, null, 'before');
|
||||
|
||||
|
||||
$newPl->setCreator(Application_Model_User::getCurrentUser()->getId());
|
||||
$newPl->setDescription($originalPl->getDescription());
|
||||
|
||||
|
||||
list($plFadeIn, ) = $originalPl->getFadeInfo(0);
|
||||
list(, $plFadeOut) = $originalPl->getFadeInfo($originalPl->getSize()-1);
|
||||
|
||||
|
||||
$newPl->setfades($plFadeIn, $plFadeOut);
|
||||
$newPl->setName(sprintf(_("Copy of %s"), $originalPl->getName()));
|
||||
}
|
||||
|
@ -547,7 +549,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
$id = $this->_getParam('id');
|
||||
Application_Model_Soundcloud::uploadSoundcloud($id);
|
||||
// we should die with ui info
|
||||
$this->_helper->json->sendJson(null);
|
||||
$this->_helper->json->sendJson(null);
|
||||
}
|
||||
|
||||
public function getUploadToSoundcloudStatusAction()
|
||||
|
|
|
@ -9,36 +9,36 @@ class ListenerstatController extends Zend_Controller_Action
|
|||
->addActionContext('get-data', 'json')
|
||||
->initContext();
|
||||
}
|
||||
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
$CC_CONFIG = Config::getConfig();
|
||||
|
||||
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/flot/jquery.flot.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/flot/jquery.flot.crosshair.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/listenerstat/listenerstat.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->headLink()->appendStylesheet($baseUrl.'css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']);
|
||||
|
||||
|
||||
//default time is the last 24 hours.
|
||||
$now = time();
|
||||
$from = $request->getParam("from", $now - (24*60*60));
|
||||
$to = $request->getParam("to", $now);
|
||||
|
||||
|
||||
$start = DateTime::createFromFormat("U", $from, new DateTimeZone("UTC"));
|
||||
$start->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||
$end = DateTime::createFromFormat("U", $to, new DateTimeZone("UTC"));
|
||||
$end->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||
|
||||
|
||||
$form = new Application_Form_DateRange();
|
||||
$form->populate(array(
|
||||
'his_date_start' => $start->format("Y-m-d"),
|
||||
|
@ -46,7 +46,7 @@ class ListenerstatController extends Zend_Controller_Action
|
|||
'his_date_end' => $end->format("Y-m-d"),
|
||||
'his_time_end' => $end->format("H:i")
|
||||
));
|
||||
|
||||
|
||||
$errorStatus = Application_Model_StreamSetting::GetAllListenerStatErrors();
|
||||
Logging::info($errorStatus);
|
||||
$out = array();
|
||||
|
@ -57,24 +57,25 @@ class ListenerstatController extends Zend_Controller_Action
|
|||
}
|
||||
$out[$key[0]] = $v['value'];
|
||||
}
|
||||
|
||||
|
||||
$this->view->errorStatus = $out;
|
||||
$this->view->date_form = $form;
|
||||
}
|
||||
|
||||
|
||||
public function getDataAction(){
|
||||
$request = $this->getRequest();
|
||||
$current_time = time();
|
||||
|
||||
|
||||
$params = $request->getParams();
|
||||
|
||||
|
||||
$starts_epoch = $request->getParam("startTimestamp", $current_time - (60*60*24));
|
||||
$ends_epoch = $request->getParam("endTimestamp", $current_time);
|
||||
|
||||
$mountName = $request->getParam("mountName", null);
|
||||
|
||||
$startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC"));
|
||||
$endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC"));
|
||||
|
||||
$data = Application_Model_ListenerStat::getDataPointsWithinRange($startsDT->format("Y-m-d H:i:s"), $endsDT->format("Y-m-d H:i:s"));
|
||||
$this->_helper->json->sendJson($data);
|
||||
|
||||
$data = Application_Model_ListenerStat::getDataPointsWithinRange($startsDT->format("Y-m-d H:i:s"), $endsDT->format("Y-m-d H:i:s"), $mountName);
|
||||
$this->_helper->json->sendJson($data);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,16 +6,7 @@ class PlayouthistoryController extends Zend_Controller_Action
|
|||
{
|
||||
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
||||
$ajaxContext
|
||||
->addActionContext('file-history-feed', 'json')
|
||||
->addActionContext('item-history-feed', 'json')
|
||||
->addActionContext('show-history-feed', 'json')
|
||||
->addActionContext('edit-file-item', 'json')
|
||||
->addActionContext('create-list-item', 'json')
|
||||
->addActionContext('edit-list-item', 'json')
|
||||
->addActionContext('delete-list-item', 'json')
|
||||
->addActionContext('delete-list-items', 'json')
|
||||
->addActionContext('update-list-item', 'json')
|
||||
->addActionContext('update-file-item', 'json')
|
||||
->addActionContext('playout-history-feed', 'json')
|
||||
->initContext();
|
||||
}
|
||||
|
||||
|
@ -51,219 +42,45 @@ class PlayouthistoryController extends Zend_Controller_Action
|
|||
$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-2.1.5/js/ZeroClipboard.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/TableTools-2.1.5/js/TableTools.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/bootstrap-datetime/bootstrap-datetimepicker.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.'css/bootstrap-datetimepicker.min.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'js/datatables/plugin/TableTools-2.1.5/css/TableTools.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'js/datatables/plugin/TableTools/css/TableTools.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/playouthistory.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/history_styles.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']);
|
||||
|
||||
//set datatables columns for display of data.
|
||||
$historyService = new Application_Service_HistoryService();
|
||||
$columns = json_encode($historyService->getDatatablesLogSheetColumns());
|
||||
$script = "localStorage.setItem( 'datatables-historyitem-aoColumns', JSON.stringify($columns) ); ";
|
||||
|
||||
$columns = json_encode($historyService->getDatatablesFileSummaryColumns());
|
||||
$script.= "localStorage.setItem( 'datatables-historyfile-aoColumns', JSON.stringify($columns) );";
|
||||
$this->view->headScript()->appendScript($script);
|
||||
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
$this->view->userType = $user->getType();
|
||||
}
|
||||
|
||||
public function fileHistoryFeedAction()
|
||||
{
|
||||
try {
|
||||
$request = $this->getRequest();
|
||||
$current_time = time();
|
||||
|
||||
$params = $request->getParams();
|
||||
|
||||
$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"));
|
||||
|
||||
$historyService = new Application_Service_HistoryService();
|
||||
$r = $historyService->getFileSummaryData($startsDT, $endsDT, $params);
|
||||
|
||||
$this->view->sEcho = $r["sEcho"];
|
||||
$this->view->iTotalDisplayRecords = $r["iTotalDisplayRecords"];
|
||||
$this->view->iTotalRecords = $r["iTotalRecords"];
|
||||
$this->view->history = $r["history"];
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::info($e);
|
||||
Logging::info($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function itemHistoryFeedAction()
|
||||
{
|
||||
try {
|
||||
$request = $this->getRequest();
|
||||
$current_time = time();
|
||||
|
||||
$params = $request->getParams();
|
||||
|
||||
$starts_epoch = $request->getParam("start", $current_time - (60*60*24));
|
||||
$ends_epoch = $request->getParam("end", $current_time);
|
||||
$instance = $request->getParam("instance_id", null);
|
||||
|
||||
$startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC"));
|
||||
$endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC"));
|
||||
|
||||
$historyService = new Application_Service_HistoryService();
|
||||
$r = $historyService->getPlayedItemData($startsDT, $endsDT, $params, $instance);
|
||||
|
||||
$this->view->sEcho = $r["sEcho"];
|
||||
$this->view->iTotalDisplayRecords = $r["iTotalDisplayRecords"];
|
||||
$this->view->iTotalRecords = $r["iTotalRecords"];
|
||||
$this->view->history = $r["history"];
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::info($e);
|
||||
Logging::info($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function showHistoryFeedAction()
|
||||
{
|
||||
try {
|
||||
$request = $this->getRequest();
|
||||
$current_time = 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"));
|
||||
|
||||
$historyService = new Application_Service_HistoryService();
|
||||
$shows = $historyService->getShowList($startsDT, $endsDT);
|
||||
|
||||
$this->_helper->json->sendJson($shows);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::info($e);
|
||||
Logging::info($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function editFileItemAction()
|
||||
{
|
||||
$file_id = $this->_getParam('id');
|
||||
|
||||
$historyService = new Application_Service_HistoryService();
|
||||
$form = $historyService->makeHistoryFileForm($file_id);
|
||||
|
||||
$this->view->form = $form;
|
||||
$this->view->dialog = $this->view->render('playouthistory/dialog.phtml');
|
||||
|
||||
unset($this->view->form);
|
||||
}
|
||||
|
||||
public function createListItemAction()
|
||||
{
|
||||
try {
|
||||
$request = $this->getRequest();
|
||||
$params = $request->getPost();
|
||||
Logging::info($params);
|
||||
|
||||
$historyService = new Application_Service_HistoryService();
|
||||
$json = $historyService->createPlayedItem($params);
|
||||
|
||||
if (isset($json["form"])) {
|
||||
$this->view->form = $json["form"];
|
||||
$json["form"] = $this->view->render('playouthistory/dialog.phtml');
|
||||
|
||||
unset($this->view->form);
|
||||
}
|
||||
|
||||
$this->_helper->json->sendJson($json);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::info($e);
|
||||
Logging::info($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function editListItemAction()
|
||||
{
|
||||
$id = $this->_getParam('id', null);
|
||||
|
||||
$populate = isset($id) ? true : false;
|
||||
|
||||
$historyService = new Application_Service_HistoryService();
|
||||
$form = $historyService->makeHistoryItemForm($id, $populate);
|
||||
|
||||
$this->view->form = $form;
|
||||
$this->view->dialog = $this->view->render('playouthistory/dialog.phtml');
|
||||
|
||||
unset($this->view->form);
|
||||
}
|
||||
|
||||
public function deleteListItemAction()
|
||||
{
|
||||
$history_id = $this->_getParam('id');
|
||||
|
||||
$historyService = new Application_Service_HistoryService();
|
||||
$historyService->deletePlayedItem($history_id);
|
||||
}
|
||||
|
||||
public function deleteListItemsAction()
|
||||
{
|
||||
$history_ids = $this->_getParam('ids');
|
||||
|
||||
$historyService = new Application_Service_HistoryService();
|
||||
$historyService->deletePlayedItems($history_ids);
|
||||
}
|
||||
|
||||
public function updateListItemAction()
|
||||
{
|
||||
try {
|
||||
$request = $this->getRequest();
|
||||
$params = $request->getPost();
|
||||
Logging::info($params);
|
||||
|
||||
$historyService = new Application_Service_HistoryService();
|
||||
$json = $historyService->editPlayedItem($params);
|
||||
|
||||
if (isset($json["form"])) {
|
||||
$this->view->form = $json["form"];
|
||||
$json["form"] = $this->view->render('playouthistory/dialog.phtml');
|
||||
|
||||
unset($this->view->form);
|
||||
}
|
||||
|
||||
$this->_helper->json->sendJson($json);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::info($e);
|
||||
Logging::info($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function updateFileItemAction()
|
||||
public function playoutHistoryFeedAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$params = $request->getPost();
|
||||
Logging::info($params);
|
||||
$current_time = time();
|
||||
|
||||
$historyService = new Application_Service_HistoryService();
|
||||
$json = $historyService->editPlayedFile($params);
|
||||
$params = $request->getParams();
|
||||
|
||||
$this->_helper->json->sendJson($json);
|
||||
$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"));
|
||||
|
||||
Logging::info("history starts {$startsDT->format("Y-m-d H:i:s")}");
|
||||
Logging::info("history ends {$endsDT->format("Y-m-d H:i:s")}");
|
||||
|
||||
$history = new Application_Model_PlayoutHistory($startsDT, $endsDT, $params);
|
||||
|
||||
$r = $history->getItems();
|
||||
|
||||
$this->view->sEcho = $r["sEcho"];
|
||||
$this->view->iTotalDisplayRecords = $r["iTotalDisplayRecords"];
|
||||
$this->view->iTotalRecords = $r["iTotalRecords"];
|
||||
$this->view->history = $r["history"];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,143 +0,0 @@
|
|||
<?php
|
||||
|
||||
class PlayouthistorytemplateController extends Zend_Controller_Action
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
||||
$ajaxContext
|
||||
->addActionContext('create-template', 'json')
|
||||
->addActionContext('update-template', 'json')
|
||||
->addActionContext('delete-template', 'json')
|
||||
->addActionContext('set-template-default', 'json')
|
||||
->initContext();
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
$CC_CONFIG = Config::getConfig();
|
||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/playouthistory/template.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/history_styles.css?'.$CC_CONFIG['airtime_version']);
|
||||
|
||||
$historyService = new Application_Service_HistoryService();
|
||||
$this->view->template_list = $historyService->getListItemTemplates();
|
||||
$this->view->template_file = $historyService->getFileTemplates();
|
||||
$this->view->configured = $historyService->getConfiguredTemplateIds();
|
||||
}
|
||||
|
||||
public function configureTemplateAction() {
|
||||
|
||||
$CC_CONFIG = Config::getConfig();
|
||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/playouthistory/configuretemplate.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/history_styles.css?'.$CC_CONFIG['airtime_version']);
|
||||
|
||||
try {
|
||||
|
||||
$templateId = $this->_getParam('id');
|
||||
|
||||
$historyService = new Application_Service_HistoryService();
|
||||
$template = $historyService->loadTemplate($templateId);
|
||||
|
||||
$templateType = $template["type"];
|
||||
$supportedTypes = $historyService->getSupportedTemplateTypes();
|
||||
|
||||
if (!in_array($templateType, $supportedTypes)) {
|
||||
throw new Exception("Error: $templateType is not supported.");
|
||||
}
|
||||
|
||||
$getMandatoryFields = "mandatory".ucfirst($templateType)."Fields";
|
||||
$mandatoryFields = $historyService->$getMandatoryFields();
|
||||
|
||||
$this->view->template_id = $templateId;
|
||||
$this->view->template_name = $template["name"];
|
||||
$this->view->template_fields = $template["fields"];
|
||||
$this->view->template_type = $templateType;
|
||||
$this->view->fileMD = $historyService->getFileMetadataTypes();
|
||||
$this->view->fields = $historyService->getFieldTypes();
|
||||
$this->view->required_fields = $mandatoryFields;
|
||||
$this->view->configured = $historyService->getConfiguredTemplateIds();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::info("Error?");
|
||||
Logging::info($e);
|
||||
Logging::info($e->getMessage());
|
||||
|
||||
$this->_forward('index', 'playouthistorytemplate');
|
||||
}
|
||||
}
|
||||
|
||||
public function createTemplateAction()
|
||||
{
|
||||
$templateType = $this->_getParam('type', null);
|
||||
|
||||
$request = $this->getRequest();
|
||||
$params = $request->getPost();
|
||||
|
||||
try {
|
||||
$historyService = new Application_Service_HistoryService();
|
||||
$supportedTypes = $historyService->getSupportedTemplateTypes();
|
||||
|
||||
if (!in_array($templateType, $supportedTypes)) {
|
||||
throw new Exception("Error: $templateType is not supported.");
|
||||
}
|
||||
|
||||
$id = $historyService->createTemplate($params);
|
||||
|
||||
$this->view->url = $this->view->baseUrl("Playouthistorytemplate/configure-template/id/{$id}");
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::info($e);
|
||||
Logging::info($e->getMessage());
|
||||
|
||||
$this->view->error = $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
public function setTemplateDefaultAction()
|
||||
{
|
||||
$templateId = $this->_getParam('id', null);
|
||||
|
||||
try {
|
||||
$historyService = new Application_Service_HistoryService();
|
||||
$historyService->setConfiguredTemplate($templateId);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::info($e);
|
||||
Logging::info($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function updateTemplateAction()
|
||||
{
|
||||
$templateId = $this->_getParam('id', null);
|
||||
$name = $this->_getParam('name', null);
|
||||
$fields = $this->_getParam('fields', array());
|
||||
|
||||
try {
|
||||
$historyService = new Application_Service_HistoryService();
|
||||
$historyService->updateItemTemplate($templateId, $name, $fields);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::info($e);
|
||||
Logging::info($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteTemplateAction()
|
||||
{
|
||||
$templateId = $this->_getParam('id');
|
||||
|
||||
try {
|
||||
$historyService = new Application_Service_HistoryService();
|
||||
$historyService->deleteTemplate($templateId);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::info($e);
|
||||
Logging::info($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -46,17 +46,6 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||
|
||||
$this->view->headScript()->appendScript(
|
||||
"var calendarPref = {};\n".
|
||||
"calendarPref.weekStart = ".Application_Model_Preference::GetWeekStartDay().";\n".
|
||||
"calendarPref.timestamp = ".time().";\n".
|
||||
"calendarPref.timezoneOffset = ".date("Z").";\n".
|
||||
"calendarPref.timeScale = '".Application_Model_Preference::GetCalendarTimeScale()."';\n".
|
||||
"calendarPref.timeInterval = ".Application_Model_Preference::GetCalendarTimeInterval().";\n".
|
||||
"calendarPref.weekStartDay = ".Application_Model_Preference::GetWeekStartDay().";\n".
|
||||
"var calendarEvents = null;"
|
||||
);
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
||||
//full-calendar-functions.js requires this variable, so that datePicker widget can be offset to server time instead of client time
|
||||
|
@ -85,6 +74,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.ColVis.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.ColReorder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.FixedColumns.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.TableTools.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.columnFilter.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
@ -96,6 +86,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/TableTools.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/showbuilder.css?'.$CC_CONFIG['airtime_version']);
|
||||
//End Show builder JS/CSS requirements
|
||||
|
||||
|
@ -107,6 +98,16 @@ class ScheduleController extends Zend_Controller_Action
|
|||
}
|
||||
|
||||
$this->view->addNewShow = true;
|
||||
$this->view->headScript()->appendScript(
|
||||
"var calendarPref = {};\n".
|
||||
"calendarPref.weekStart = ".Application_Model_Preference::GetWeekStartDay().";\n".
|
||||
"calendarPref.timestamp = ".time().";\n".
|
||||
"calendarPref.timezoneOffset = ".date("Z").";\n".
|
||||
"calendarPref.timeScale = '".Application_Model_Preference::GetCalendarTimeScale()."';\n".
|
||||
"calendarPref.timeInterval = ".Application_Model_Preference::GetCalendarTimeInterval().";\n".
|
||||
"calendarPref.weekStartDay = ".Application_Model_Preference::GetWeekStartDay().";\n".
|
||||
"var calendarEvents = null;"
|
||||
);
|
||||
}
|
||||
|
||||
public function eventFeedAction()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue