2012-03-08 18:30:56 +01:00
|
|
|
<?php
|
|
|
|
|
2012-07-16 03:17:13 +02:00
|
|
|
class PlayouthistoryController extends Zend_Controller_Action
|
2012-03-08 18:30:56 +01:00
|
|
|
{
|
2012-07-16 03:17:13 +02:00
|
|
|
public function init()
|
|
|
|
{
|
|
|
|
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
2012-07-11 00:53:06 +02:00
|
|
|
$ajaxContext
|
2013-08-12 21:06:26 +02:00
|
|
|
->addActionContext('file-history-feed', 'json')
|
2013-07-18 07:31:20 +02:00
|
|
|
->addActionContext('item-history-feed', 'json')
|
2013-08-12 21:06:26 +02:00
|
|
|
->addActionContext('edit-file-item', 'json')
|
2013-07-22 16:45:39 +02:00
|
|
|
->addActionContext('create-list-item', 'json')
|
2013-07-18 07:31:20 +02:00
|
|
|
->addActionContext('edit-list-item', 'json')
|
2013-07-24 00:01:43 +02:00
|
|
|
->addActionContext('delete-list-item', 'json')
|
2013-07-23 00:11:44 +02:00
|
|
|
->addActionContext('update-list-item', 'json')
|
2013-08-12 21:06:26 +02:00
|
|
|
->addActionContext('update-file-item', 'json')
|
2013-07-23 00:11:44 +02:00
|
|
|
->addActionContext('create-template', 'json')
|
2013-08-01 22:36:18 +02:00
|
|
|
->addActionContext('update-template', 'json')
|
2013-07-23 00:11:44 +02:00
|
|
|
->addActionContext('delete-template', 'json')
|
2013-08-02 21:29:39 +02:00
|
|
|
->addActionContext('set-template-default', 'json')
|
2012-07-16 03:17:13 +02:00
|
|
|
->initContext();
|
2012-10-19 17:09:34 +02:00
|
|
|
}
|
2012-07-16 03:17:13 +02:00
|
|
|
|
|
|
|
public function indexAction()
|
2012-07-11 00:53:06 +02:00
|
|
|
{
|
2013-01-14 22:16:14 +01:00
|
|
|
$CC_CONFIG = Config::getConfig();
|
2012-07-16 03:17:13 +02:00
|
|
|
|
2012-07-11 00:53:06 +02:00
|
|
|
$request = $this->getRequest();
|
2012-10-19 17:09:34 +02:00
|
|
|
|
|
|
|
$baseUrl = Application_Common_OsPath::getBaseDir();
|
2012-03-12 11:47:25 +01:00
|
|
|
|
|
|
|
//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"),
|
|
|
|
'his_time_start' => $start->format("H:i"),
|
|
|
|
'his_date_end' => $end->format("Y-m-d"),
|
|
|
|
'his_time_end' => $end->format("H:i")
|
|
|
|
));
|
|
|
|
|
2012-07-16 03:17:13 +02:00
|
|
|
$this->view->date_form = $form;
|
|
|
|
|
2013-01-14 22:00:38 +01:00
|
|
|
$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');
|
2013-08-13 00:18:33 +02:00
|
|
|
$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');
|
2013-08-16 21:12:00 +02:00
|
|
|
$this->view->headScript()->appendFile($baseUrl.'js/timepicker/jquery-ui-timepicker-addon.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
2012-07-16 03:17:13 +02:00
|
|
|
|
|
|
|
$offset = date("Z") * -1;
|
|
|
|
$this->view->headScript()->appendScript("var serverTimezoneOffset = {$offset}; //in seconds");
|
2013-01-14 22:00:38 +01:00
|
|
|
$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');
|
|
|
|
|
2013-08-13 00:18:33 +02:00
|
|
|
$this->view->headLink()->appendStylesheet($baseUrl.'js/datatables/plugin/TableTools-2.1.5/css/TableTools.css?'.$CC_CONFIG['airtime_version']);
|
2013-01-14 22:00:38 +01:00
|
|
|
$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']);
|
2013-08-20 05:19:13 +02:00
|
|
|
$this->view->headLink()->appendStylesheet($baseUrl.'css/history_styles.css?'.$CC_CONFIG['airtime_version']);
|
2013-08-16 21:12:00 +02:00
|
|
|
$this->view->headLink()->appendStylesheet($baseUrl.'css/jquery-ui-timepicker-addon.css?'.$CC_CONFIG['airtime_version']);
|
2013-08-20 05:19:13 +02:00
|
|
|
$this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']);
|
2013-08-16 21:12:00 +02:00
|
|
|
|
|
|
|
|
2013-07-31 23:38:48 +02:00
|
|
|
//set datatables columns for display of data.
|
|
|
|
$historyService = new Application_Service_HistoryService();
|
2013-08-02 21:29:39 +02:00
|
|
|
$columns = json_encode($historyService->getDatatablesLogSheetColumns());
|
|
|
|
$script = "localStorage.setItem( 'datatables-historyitem-aoColumns', JSON.stringify($columns) ); ";
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-08-02 21:30:35 +02:00
|
|
|
$columns = json_encode($historyService->getDatatablesFileSummaryColumns());
|
|
|
|
$script.= "localStorage.setItem( 'datatables-historyfile-aoColumns', JSON.stringify($columns) );";
|
2013-07-31 23:38:48 +02:00
|
|
|
$this->view->headScript()->appendScript($script);
|
2012-07-11 00:53:06 +02:00
|
|
|
}
|
2012-07-16 03:17:13 +02:00
|
|
|
|
2013-08-12 21:06:26 +02:00
|
|
|
public function fileHistoryFeedAction()
|
2012-07-11 00:53:06 +02:00
|
|
|
{
|
2013-08-03 00:16:23 +02:00
|
|
|
try {
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$current_time = time();
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-08-03 00:16:23 +02:00
|
|
|
$params = $request->getParams();
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-08-03 00:16:23 +02:00
|
|
|
$starts_epoch = $request->getParam("start", $current_time - (60*60*24));
|
|
|
|
$ends_epoch = $request->getParam("end", $current_time);
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-08-03 00:16:23 +02:00
|
|
|
$startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC"));
|
|
|
|
$endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC"));
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-08-03 00:16:23 +02:00
|
|
|
$historyService = new Application_Service_HistoryService();
|
|
|
|
$r = $historyService->getFileSummaryData($startsDT, $endsDT, $params);
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-08-03 00:16:23 +02:00
|
|
|
$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());
|
|
|
|
}
|
2013-07-18 07:31:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function itemHistoryFeedAction()
|
|
|
|
{
|
2013-08-03 00:16:23 +02:00
|
|
|
try {
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$current_time = time();
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-08-03 00:16:23 +02:00
|
|
|
$params = $request->getParams();
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-08-03 00:16:23 +02:00
|
|
|
$starts_epoch = $request->getParam("start", $current_time - (60*60*24));
|
|
|
|
$ends_epoch = $request->getParam("end", $current_time);
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-08-03 00:16:23 +02:00
|
|
|
$startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC"));
|
|
|
|
$endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC"));
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-08-03 00:16:23 +02:00
|
|
|
$historyService = new Application_Service_HistoryService();
|
|
|
|
$r = $historyService->getPlayedItemData($startsDT, $endsDT, $params);
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-08-03 00:16:23 +02:00
|
|
|
$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());
|
|
|
|
}
|
2012-07-11 00:53:06 +02:00
|
|
|
}
|
2013-07-18 07:31:20 +02:00
|
|
|
|
2013-08-12 21:06:26 +02:00
|
|
|
public function editFileItemAction()
|
2013-07-09 00:00:02 +02:00
|
|
|
{
|
|
|
|
$file_id = $this->_getParam('id');
|
2013-07-18 07:31:20 +02:00
|
|
|
|
2013-07-09 00:00:02 +02:00
|
|
|
$historyService = new Application_Service_HistoryService();
|
|
|
|
$form = $historyService->makeHistoryFileForm($file_id);
|
2013-07-18 07:31:20 +02:00
|
|
|
|
2013-07-09 00:00:02 +02:00
|
|
|
$this->view->form = $form;
|
2013-07-26 23:33:17 +02:00
|
|
|
$this->view->dialog = $this->view->render('playouthistory/dialog.phtml');
|
2013-07-18 07:31:20 +02:00
|
|
|
|
2013-07-09 00:00:02 +02:00
|
|
|
unset($this->view->form);
|
|
|
|
}
|
|
|
|
|
2013-07-22 16:47:11 +02:00
|
|
|
public function createListItemAction()
|
|
|
|
{
|
2013-07-31 01:24:05 +02:00
|
|
|
try {
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$params = $request->getPost();
|
|
|
|
Logging::info($params);
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-07-31 01:24:05 +02:00
|
|
|
$historyService = new Application_Service_HistoryService();
|
2013-08-05 21:05:26 +02:00
|
|
|
$json = $historyService->createPlayedItem($params);
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-08-05 21:05:26 +02:00
|
|
|
$this->_helper->json->sendJson($json);
|
2013-07-31 01:24:05 +02:00
|
|
|
}
|
2013-07-31 01:25:06 +02:00
|
|
|
catch (Exception $e) {
|
|
|
|
Logging::info($e);
|
|
|
|
Logging::info($e->getMessage());
|
2013-07-31 01:24:05 +02:00
|
|
|
}
|
2013-07-22 16:45:39 +02:00
|
|
|
}
|
|
|
|
|
2013-07-18 07:37:39 +02:00
|
|
|
public function editListItemAction()
|
|
|
|
{
|
2013-08-03 00:16:23 +02:00
|
|
|
$id = $this->_getParam('id', null);
|
2013-08-05 21:05:26 +02:00
|
|
|
Logging::info("Id is: $id");
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-08-05 21:05:26 +02:00
|
|
|
$populate = isset($id) ? true : false;
|
2013-07-18 07:37:39 +02:00
|
|
|
|
|
|
|
$historyService = new Application_Service_HistoryService();
|
2013-08-05 21:05:26 +02:00
|
|
|
$form = $historyService->makeHistoryItemForm($id, $populate);
|
2013-07-18 07:37:39 +02:00
|
|
|
|
|
|
|
$this->view->form = $form;
|
2013-07-26 23:33:17 +02:00
|
|
|
$this->view->dialog = $this->view->render('playouthistory/dialog.phtml');
|
2013-07-18 07:37:39 +02:00
|
|
|
|
|
|
|
unset($this->view->form);
|
2013-07-18 07:31:20 +02:00
|
|
|
}
|
2013-07-29 14:57:31 +02:00
|
|
|
|
2013-07-24 00:01:43 +02:00
|
|
|
public function deleteListItemAction()
|
|
|
|
{
|
|
|
|
$history_id = $this->_getParam('id');
|
2013-07-29 14:57:31 +02:00
|
|
|
|
2013-07-24 00:01:43 +02:00
|
|
|
$historyService = new Application_Service_HistoryService();
|
2013-07-29 14:57:31 +02:00
|
|
|
$historyService->deletePlayedItem($history_id);
|
2013-07-24 00:01:43 +02:00
|
|
|
}
|
2013-07-29 14:57:31 +02:00
|
|
|
|
2013-07-23 00:11:44 +02:00
|
|
|
public function updateListItemAction()
|
|
|
|
{
|
2013-08-05 21:05:26 +02:00
|
|
|
try {
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$params = $request->getPost();
|
|
|
|
Logging::info($params);
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-08-05 21:05:26 +02:00
|
|
|
$historyService = new Application_Service_HistoryService();
|
|
|
|
$json = $historyService->editPlayedItem($params);
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-08-05 21:05:26 +02:00
|
|
|
$this->_helper->json->sendJson($json);
|
|
|
|
}
|
|
|
|
catch (Exception $e) {
|
|
|
|
Logging::info($e);
|
|
|
|
Logging::info($e->getMessage());
|
|
|
|
}
|
2013-07-23 00:11:44 +02:00
|
|
|
}
|
2013-07-18 07:31:20 +02:00
|
|
|
|
2013-08-12 21:06:26 +02:00
|
|
|
public function updateFileItemAction()
|
2013-07-09 00:00:02 +02:00
|
|
|
{
|
2013-07-18 07:31:20 +02:00
|
|
|
$request = $this->getRequest();
|
|
|
|
$params = $request->getPost();
|
|
|
|
Logging::info($params);
|
|
|
|
|
2013-07-09 00:00:02 +02:00
|
|
|
$historyService = new Application_Service_HistoryService();
|
2013-07-18 07:31:20 +02:00
|
|
|
$json = $historyService->editPlayedFile($params);
|
2012-10-19 17:09:34 +02:00
|
|
|
|
2013-08-05 21:05:26 +02:00
|
|
|
$this->_helper->json->sendJson($json);
|
2013-07-18 07:31:20 +02:00
|
|
|
}
|
2013-07-29 14:57:31 +02:00
|
|
|
|
2013-07-23 00:11:44 +02:00
|
|
|
public function templateAction()
|
|
|
|
{
|
2013-08-01 22:37:10 +02:00
|
|
|
$CC_CONFIG = Config::getConfig();
|
|
|
|
$baseUrl = Application_Common_OsPath::getBaseDir();
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-08-01 22:36:18 +02:00
|
|
|
$this->view->headScript()->appendFile($baseUrl.'js/airtime/playouthistory/template.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
2013-08-20 05:19:13 +02:00
|
|
|
$this->view->headLink()->appendStylesheet($baseUrl.'css/history_styles.css?'.$CC_CONFIG['airtime_version']);
|
2013-07-29 14:57:31 +02:00
|
|
|
|
2013-08-01 22:36:18 +02:00
|
|
|
$historyService = new Application_Service_HistoryService();
|
|
|
|
$this->view->template_list = $historyService->getListItemTemplates();
|
2013-08-02 21:29:39 +02:00
|
|
|
$this->view->template_file = $historyService->getFileTemplates();
|
2013-08-01 22:36:18 +02:00
|
|
|
$this->view->configured = $historyService->getConfiguredTemplateIds();
|
2013-07-29 14:57:31 +02:00
|
|
|
}
|
|
|
|
|
2013-08-02 21:29:39 +02:00
|
|
|
public function configureTemplateAction() {
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-08-02 21:30:35 +02:00
|
|
|
$CC_CONFIG = Config::getConfig();
|
|
|
|
$baseUrl = Application_Common_OsPath::getBaseDir();
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-08-02 21:29:39 +02:00
|
|
|
$this->view->headScript()->appendFile($baseUrl.'js/airtime/playouthistory/configuretemplate.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
2013-08-20 05:19:13 +02:00
|
|
|
$this->view->headLink()->appendStylesheet($baseUrl.'css/history_styles.css?'.$CC_CONFIG['airtime_version']);
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-07-31 01:24:05 +02:00
|
|
|
try {
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-08-02 21:29:39 +02:00
|
|
|
$templateId = $this->_getParam('id');
|
2013-08-16 21:12:00 +02:00
|
|
|
|
|
|
|
$historyService = new Application_Service_HistoryService();
|
2013-08-02 21:29:39 +02:00
|
|
|
$template = $historyService->loadTemplate($templateId);
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-08-02 21:29:39 +02:00
|
|
|
$templateType = $template["type"];
|
2013-08-02 21:30:35 +02:00
|
|
|
$supportedTypes = $historyService->getSupportedTemplateTypes();
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-08-02 21:30:35 +02:00
|
|
|
if (!in_array($templateType, $supportedTypes)) {
|
|
|
|
throw new Exception("Error: $templateType is not supported.");
|
2013-08-02 21:29:39 +02:00
|
|
|
}
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-08-02 21:29:39 +02:00
|
|
|
$getMandatoryFields = "mandatory".ucfirst($templateType)."Fields";
|
|
|
|
$mandatoryFields = $historyService->$getMandatoryFields();
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-08-02 21:29:39 +02:00
|
|
|
$this->view->template_id = $templateId;
|
2013-07-31 01:24:05 +02:00
|
|
|
$this->view->template_name = $template["name"];
|
|
|
|
$this->view->template_fields = $template["fields"];
|
2013-08-02 21:29:39 +02:00
|
|
|
$this->view->template_type = $templateType;
|
2013-07-31 01:24:05 +02:00
|
|
|
$this->view->fileMD = $historyService->getFileMetadataTypes();
|
|
|
|
$this->view->fields = $historyService->getFieldTypes();
|
|
|
|
$this->view->required_fields = $mandatoryFields;
|
2013-08-01 22:36:18 +02:00
|
|
|
$this->view->configured = $historyService->getConfiguredTemplateIds();
|
2013-07-31 01:25:06 +02:00
|
|
|
}
|
|
|
|
catch (Exception $e) {
|
2013-08-02 21:29:39 +02:00
|
|
|
Logging::info("Error?");
|
2013-07-31 01:25:06 +02:00
|
|
|
Logging::info($e);
|
|
|
|
Logging::info($e->getMessage());
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-08-02 21:29:39 +02:00
|
|
|
$this->_forward('template', 'playouthistory');
|
2013-07-31 01:24:05 +02:00
|
|
|
}
|
2013-07-23 00:11:44 +02:00
|
|
|
}
|
2013-07-29 14:57:31 +02:00
|
|
|
|
2013-07-23 00:11:44 +02:00
|
|
|
public function createTemplateAction()
|
|
|
|
{
|
2013-08-02 21:29:39 +02:00
|
|
|
$templateType = $this->_getParam('type', null);
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-08-02 22:16:04 +02:00
|
|
|
$request = $this->getRequest();
|
2013-08-02 22:15:32 +02:00
|
|
|
$params = $request->getPost();
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-07-31 01:24:05 +02:00
|
|
|
try {
|
|
|
|
$historyService = new Application_Service_HistoryService();
|
2013-08-02 21:29:39 +02:00
|
|
|
$supportedTypes = $historyService->getSupportedTemplateTypes();
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-08-02 21:29:39 +02:00
|
|
|
if (!in_array($templateType, $supportedTypes)) {
|
|
|
|
throw new Exception("Error: $templateType is not supported.");
|
|
|
|
}
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-08-02 21:29:39 +02:00
|
|
|
$id = $historyService->createTemplate($params);
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-08-02 21:29:39 +02:00
|
|
|
$this->view->url = $this->view->baseUrl("Playouthistory/configure-template/id/{$id}");
|
2013-07-31 01:24:05 +02:00
|
|
|
}
|
|
|
|
catch (Exception $e) {
|
|
|
|
Logging::info($e);
|
|
|
|
Logging::info($e->getMessage());
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-08-01 22:36:18 +02:00
|
|
|
$this->view->error = $e->getMessage();
|
2013-07-31 01:24:05 +02:00
|
|
|
}
|
|
|
|
}
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-08-02 21:29:39 +02:00
|
|
|
public function setTemplateDefaultAction()
|
2013-07-31 01:25:06 +02:00
|
|
|
{
|
2013-08-02 21:29:39 +02:00
|
|
|
$templateId = $this->_getParam('id', null);
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-07-31 01:25:06 +02:00
|
|
|
try {
|
|
|
|
$historyService = new Application_Service_HistoryService();
|
2013-08-02 21:29:39 +02:00
|
|
|
$historyService->setConfiguredTemplate($templateId);
|
2013-07-31 01:25:06 +02:00
|
|
|
}
|
|
|
|
catch (Exception $e) {
|
|
|
|
Logging::info($e);
|
|
|
|
Logging::info($e->getMessage());
|
|
|
|
}
|
2013-07-23 00:11:44 +02:00
|
|
|
}
|
2013-07-29 14:57:31 +02:00
|
|
|
|
2013-08-01 22:36:18 +02:00
|
|
|
public function updateTemplateAction()
|
2013-08-16 21:12:00 +02:00
|
|
|
{
|
2013-08-02 21:29:39 +02:00
|
|
|
$templateId = $this->_getParam('id', null);
|
2013-08-01 22:36:18 +02:00
|
|
|
$name = $this->_getParam('name', null);
|
2013-08-01 22:37:10 +02:00
|
|
|
$fields = $this->_getParam('fields', array());
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-08-01 22:37:10 +02:00
|
|
|
try {
|
|
|
|
$historyService = new Application_Service_HistoryService();
|
2013-08-02 21:29:39 +02:00
|
|
|
$historyService->updateItemTemplate($templateId, $name, $fields);
|
2013-08-01 22:37:10 +02:00
|
|
|
}
|
|
|
|
catch (Exception $e) {
|
|
|
|
Logging::info($e);
|
|
|
|
Logging::info($e->getMessage());
|
2013-08-01 22:36:18 +02:00
|
|
|
}
|
2013-07-23 00:11:44 +02:00
|
|
|
}
|
2013-07-29 14:57:31 +02:00
|
|
|
|
2013-07-23 00:11:44 +02:00
|
|
|
public function deleteTemplateAction()
|
|
|
|
{
|
2013-08-02 21:29:39 +02:00
|
|
|
$templateId = $this->_getParam('id');
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2013-08-01 22:37:10 +02:00
|
|
|
try {
|
|
|
|
$historyService = new Application_Service_HistoryService();
|
2013-08-02 21:29:39 +02:00
|
|
|
$historyService->deleteTemplate($templateId);
|
2013-08-01 22:37:10 +02:00
|
|
|
}
|
|
|
|
catch (Exception $e) {
|
|
|
|
Logging::info($e);
|
|
|
|
Logging::info($e->getMessage());
|
2013-08-01 22:36:18 +02:00
|
|
|
}
|
2013-07-23 00:11:44 +02:00
|
|
|
}
|
2012-07-16 03:17:13 +02:00
|
|
|
}
|