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-29 00:25:46 +02:00
|
|
|
->addActionContext('show-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-08-20 23:23:15 +02:00
|
|
|
->addActionContext('delete-list-items', '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')
|
2022-01-23 19:15:55 +01:00
|
|
|
->initContext();
|
2014-03-11 18:24:22 +01:00
|
|
|
}
|
2021-10-11 16:10:47 +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();
|
2022-07-07 23:27:28 +02:00
|
|
|
$baseUrl = Config::getBasePath();
|
2012-03-12 11:47:25 +01:00
|
|
|
|
2015-08-17 18:46:32 +02:00
|
|
|
Zend_Layout::getMvcInstance()->assign('parent_page', 'Analytics');
|
|
|
|
|
Feature: Support php7.4 (#1354)
* Run CI tests against php 7.4
* Sort composer dependencies
* Remove unused Aws S3 php library
* Pin simplepie dependency to ^1.5
* Pin getid3 dependency to ^1.9
* Pin composer semver to ^3.2
* Pin php-amqplib to ^2.12
* Drop sentry logging support
* Update composer dependencies
* Move propel regenerate to Makefile
* Regenerate propel files with v1.7.0
* Pin propel orm to ^1.7
* Regenerate propel files with v1.7.2
* fix: generator_version in airtime-conf-production.php
* Replace propel/propel1 with jooola/propel1
* Regenerate propel files with v1.7.3-dev
* Fix php7.4 compatibility
Using php-cs-fixer:
'@PhpCsFixer' => true,
'concat_space' => ['spacing' => 'one'],
'ordered_class_elements' => false,
'yoda_style' => false,
'@PHP74Migration' => true,
'assign_null_coalescing_to_coalesce_equal' => false,
'ternary_to_null_coalescing' => false,
'heredoc_indentation' => false,
'@PHP74Migration:risky' => true,
'declare_strict_types' => false,
'void_return' => false,
'use_arrow_functions' => false,
* Fix pre-commit
2021-10-17 17:19:53 +02:00
|
|
|
[$startsDT, $endsDT] = Application_Common_HTTPHelper::getStartEndFromRequest($this->getRequest());
|
2021-10-11 16:10:47 +02:00
|
|
|
|
2014-03-11 18:24:22 +01:00
|
|
|
$userTimezone = new DateTimeZone(Application_Model_Preference::GetUserTimezone());
|
|
|
|
$startsDT->setTimezone($userTimezone);
|
|
|
|
$endsDT->setTimezone($userTimezone);
|
2012-03-12 11:47:25 +01:00
|
|
|
|
|
|
|
$form = new Application_Form_DateRange();
|
2021-10-11 16:10:47 +02:00
|
|
|
$form->populate([
|
|
|
|
'his_date_start' => $startsDT->format('Y-m-d'),
|
|
|
|
'his_time_start' => $startsDT->format('H:i'),
|
|
|
|
'his_date_end' => $endsDT->format('Y-m-d'),
|
|
|
|
'his_time_end' => $endsDT->format('H:i'),
|
|
|
|
]);
|
2012-03-12 11:47:25 +01:00
|
|
|
|
2012-07-16 03:17:13 +02:00
|
|
|
$this->view->date_form = $form;
|
|
|
|
|
2022-09-19 11:58:31 +02:00
|
|
|
$this->view->headScript()->appendFile(Assets::url('js/contextmenu/jquery.contextMenu.js'), 'text/javascript');
|
|
|
|
$this->view->headScript()->appendFile(Assets::url('js/datatables/js/jquery.dataTables.js'), 'text/javascript');
|
|
|
|
$this->view->headScript()->appendFile(Assets::url('js/datatables/plugin/dataTables.pluginAPI.js'), 'text/javascript');
|
|
|
|
$this->view->headScript()->appendFile(Assets::url('js/datatables/plugin/dataTables.fnSetFilteringDelay.js'), 'text/javascript');
|
2021-10-11 16:10:47 +02:00
|
|
|
|
2022-09-19 11:58:31 +02:00
|
|
|
$this->view->headScript()->appendFile(Assets::url('js/timepicker/jquery.ui.timepicker.js'), 'text/javascript');
|
|
|
|
$this->view->headScript()->appendFile(Assets::url('js/bootstrap-datetime/bootstrap-datetimepicker.js'), 'text/javascript');
|
|
|
|
$this->view->headScript()->appendFile(Assets::url('js/airtime/buttons/buttons.js'), 'text/javascript');
|
|
|
|
$this->view->headScript()->appendFile(Assets::url('js/airtime/utilities/utilities.js'), 'text/javascript');
|
|
|
|
$this->view->headScript()->appendFile(Assets::url('js/libs/CSVexport.js'), 'text/javascript');
|
|
|
|
$this->view->headScript()->appendFile(Assets::url('js/libs/pdfmake.min.js'), 'text/javascript');
|
|
|
|
$this->view->headScript()->appendFile(Assets::url('js/libs/vfs_fonts.min.js'), 'text/javascript');
|
|
|
|
$this->view->headScript()->appendFile(Assets::url('js/airtime/playouthistory/historytable.js'), 'text/javascript');
|
2021-10-11 16:10:47 +02:00
|
|
|
|
2022-09-19 11:58:31 +02:00
|
|
|
$this->view->headLink()->appendStylesheet(Assets::url('css/bootstrap-datetimepicker.min.css'));
|
|
|
|
$this->view->headLink()->appendStylesheet(Assets::url('css/jquery.ui.timepicker.css'));
|
|
|
|
$this->view->headLink()->appendStylesheet(Assets::url('css/playouthistory.css'));
|
|
|
|
$this->view->headLink()->appendStylesheet(Assets::url('css/history_styles.css'));
|
|
|
|
$this->view->headLink()->appendStylesheet(Assets::url('css/jquery.contextMenu.css'));
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2022-03-14 11:15:04 +01:00
|
|
|
// set datatables columns for display of data.
|
2013-07-31 23:38:48 +02:00
|
|
|
$historyService = new Application_Service_HistoryService();
|
2013-08-02 21:29:39 +02:00
|
|
|
$columns = json_encode($historyService->getDatatablesLogSheetColumns());
|
2021-10-11 16:10:47 +02:00
|
|
|
$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());
|
2021-10-11 16:10:47 +02:00
|
|
|
$script .= "localStorage.setItem( 'datatables-historyfile-aoColumns', JSON.stringify({$columns}) );";
|
2013-07-31 23:38:48 +02:00
|
|
|
$this->view->headScript()->appendScript($script);
|
2013-08-29 05:30:15 +02:00
|
|
|
|
2013-08-29 00:25:46 +02:00
|
|
|
$user = Application_Model_User::getCurrentUser();
|
|
|
|
$this->view->userType = $user->getType();
|
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
|
|
|
{
|
2021-10-11 16:10:47 +02:00
|
|
|
try {
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$params = $request->getParams();
|
|
|
|
$instance = $request->getParam('instance_id', null);
|
|
|
|
|
Feature: Support php7.4 (#1354)
* Run CI tests against php 7.4
* Sort composer dependencies
* Remove unused Aws S3 php library
* Pin simplepie dependency to ^1.5
* Pin getid3 dependency to ^1.9
* Pin composer semver to ^3.2
* Pin php-amqplib to ^2.12
* Drop sentry logging support
* Update composer dependencies
* Move propel regenerate to Makefile
* Regenerate propel files with v1.7.0
* Pin propel orm to ^1.7
* Regenerate propel files with v1.7.2
* fix: generator_version in airtime-conf-production.php
* Replace propel/propel1 with jooola/propel1
* Regenerate propel files with v1.7.3-dev
* Fix php7.4 compatibility
Using php-cs-fixer:
'@PhpCsFixer' => true,
'concat_space' => ['spacing' => 'one'],
'ordered_class_elements' => false,
'yoda_style' => false,
'@PHP74Migration' => true,
'assign_null_coalescing_to_coalesce_equal' => false,
'ternary_to_null_coalescing' => false,
'heredoc_indentation' => false,
'@PHP74Migration:risky' => true,
'declare_strict_types' => false,
'void_return' => false,
'use_arrow_functions' => false,
* Fix pre-commit
2021-10-17 17:19:53 +02:00
|
|
|
[$startsDT, $endsDT] = Application_Common_HTTPHelper::getStartEndFromRequest($request);
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$historyService = new Application_Service_HistoryService();
|
|
|
|
$r = $historyService->getFileSummaryData($startsDT, $endsDT, $params);
|
2013-08-16 21:12:00 +02:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$this->view->sEcho = $r['sEcho'];
|
|
|
|
$this->view->iTotalDisplayRecords = $r['iTotalDisplayRecords'];
|
|
|
|
$this->view->iTotalRecords = $r['iTotalRecords'];
|
|
|
|
$this->view->history = $r['history'];
|
2015-06-12 19:48:54 +02:00
|
|
|
$this->view->history = SecurityHelper::htmlescape_recursive($this->view->history);
|
2021-10-11 16:10:47 +02:00
|
|
|
} catch (Exception $e) {
|
|
|
|
Logging::info($e);
|
|
|
|
Logging::info($e->getMessage());
|
2013-08-03 00:16:23 +02:00
|
|
|
}
|
2013-07-18 07:31:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function itemHistoryFeedAction()
|
|
|
|
{
|
2021-10-11 16:10:47 +02:00
|
|
|
try {
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$params = $request->getParams();
|
|
|
|
$instance = $request->getParam('instance_id', null);
|
|
|
|
|
Feature: Support php7.4 (#1354)
* Run CI tests against php 7.4
* Sort composer dependencies
* Remove unused Aws S3 php library
* Pin simplepie dependency to ^1.5
* Pin getid3 dependency to ^1.9
* Pin composer semver to ^3.2
* Pin php-amqplib to ^2.12
* Drop sentry logging support
* Update composer dependencies
* Move propel regenerate to Makefile
* Regenerate propel files with v1.7.0
* Pin propel orm to ^1.7
* Regenerate propel files with v1.7.2
* fix: generator_version in airtime-conf-production.php
* Replace propel/propel1 with jooola/propel1
* Regenerate propel files with v1.7.3-dev
* Fix php7.4 compatibility
Using php-cs-fixer:
'@PhpCsFixer' => true,
'concat_space' => ['spacing' => 'one'],
'ordered_class_elements' => false,
'yoda_style' => false,
'@PHP74Migration' => true,
'assign_null_coalescing_to_coalesce_equal' => false,
'ternary_to_null_coalescing' => false,
'heredoc_indentation' => false,
'@PHP74Migration:risky' => true,
'declare_strict_types' => false,
'void_return' => false,
'use_arrow_functions' => false,
* Fix pre-commit
2021-10-17 17:19:53 +02:00
|
|
|
[$startsDT, $endsDT] = Application_Common_HTTPHelper::getStartEndFromRequest($request);
|
2015-06-12 19:48:54 +02:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$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'];
|
|
|
|
$this->view->history = SecurityHelper::htmlescape_recursive($this->view->history);
|
|
|
|
} catch (Exception $e) {
|
|
|
|
Logging::info($e);
|
|
|
|
Logging::info($e->getMessage());
|
2015-06-12 19:48:54 +02:00
|
|
|
}
|
2012-07-11 00:53:06 +02:00
|
|
|
}
|
2013-08-29 05:30:15 +02:00
|
|
|
|
2013-08-29 01:37:46 +02:00
|
|
|
public function showHistoryFeedAction()
|
|
|
|
{
|
2021-10-11 16:10:47 +02:00
|
|
|
try {
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$params = $request->getParams();
|
|
|
|
$instance = $request->getParam('instance_id', null);
|
|
|
|
|
Feature: Support php7.4 (#1354)
* Run CI tests against php 7.4
* Sort composer dependencies
* Remove unused Aws S3 php library
* Pin simplepie dependency to ^1.5
* Pin getid3 dependency to ^1.9
* Pin composer semver to ^3.2
* Pin php-amqplib to ^2.12
* Drop sentry logging support
* Update composer dependencies
* Move propel regenerate to Makefile
* Regenerate propel files with v1.7.0
* Pin propel orm to ^1.7
* Regenerate propel files with v1.7.2
* fix: generator_version in airtime-conf-production.php
* Replace propel/propel1 with jooola/propel1
* Regenerate propel files with v1.7.3-dev
* Fix php7.4 compatibility
Using php-cs-fixer:
'@PhpCsFixer' => true,
'concat_space' => ['spacing' => 'one'],
'ordered_class_elements' => false,
'yoda_style' => false,
'@PHP74Migration' => true,
'assign_null_coalescing_to_coalesce_equal' => false,
'ternary_to_null_coalescing' => false,
'heredoc_indentation' => false,
'@PHP74Migration:risky' => true,
'declare_strict_types' => false,
'void_return' => false,
'use_arrow_functions' => false,
* Fix pre-commit
2021-10-17 17:19:53 +02:00
|
|
|
[$startsDT, $endsDT] = Application_Common_HTTPHelper::getStartEndFromRequest($request);
|
2013-08-29 05:30:15 +02:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$historyService = new Application_Service_HistoryService();
|
|
|
|
$shows = $historyService->getShowList($startsDT, $endsDT);
|
2015-06-12 19:48:54 +02:00
|
|
|
$shows = SecurityHelper::htmlescape_recursive($shows);
|
2013-08-29 05:30:15 +02:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$this->_helper->json->sendJson($shows);
|
|
|
|
} catch (Exception $e) {
|
|
|
|
Logging::info($e);
|
|
|
|
Logging::info($e->getMessage());
|
|
|
|
}
|
2013-08-29 00:25:46 +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
|
|
|
{
|
2021-10-11 16:10:47 +02:00
|
|
|
$file_id = $this->_getParam('id');
|
2013-07-18 07:31:20 +02:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$historyService = new Application_Service_HistoryService();
|
|
|
|
$form = $historyService->makeHistoryFileForm($file_id);
|
2013-07-18 07:31:20 +02:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$this->view->form = $form;
|
|
|
|
$this->view->dialog = $this->view->render('playouthistory/dialog.phtml');
|
2013-07-18 07:31:20 +02:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
unset($this->view->form);
|
2013-07-09 00:00:02 +02:00
|
|
|
}
|
|
|
|
|
2013-07-22 16:47:11 +02:00
|
|
|
public function createListItemAction()
|
|
|
|
{
|
2021-10-11 16:10:47 +02:00
|
|
|
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());
|
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-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()
|
|
|
|
{
|
2021-10-11 16:10:47 +02:00
|
|
|
$history_id = $this->_getParam('id');
|
2013-07-29 14:57:31 +02:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$historyService = new Application_Service_HistoryService();
|
|
|
|
$historyService->deletePlayedItem($history_id);
|
2013-07-24 00:01:43 +02:00
|
|
|
}
|
2013-08-23 02:23:17 +02:00
|
|
|
|
2013-08-20 23:23:48 +02:00
|
|
|
public function deleteListItemsAction()
|
|
|
|
{
|
2021-10-11 16:10:47 +02:00
|
|
|
$history_ids = $this->_getParam('ids');
|
2013-08-23 02:23:17 +02:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$historyService = new Application_Service_HistoryService();
|
|
|
|
$historyService->deletePlayedItems($history_ids);
|
2013-08-20 23:23:15 +02:00
|
|
|
}
|
2013-07-29 14:57:31 +02:00
|
|
|
|
2013-07-23 00:11:44 +02:00
|
|
|
public function updateListItemAction()
|
|
|
|
{
|
2021-10-11 16:10:47 +02:00
|
|
|
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());
|
|
|
|
}
|
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);
|
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$historyService = new Application_Service_HistoryService();
|
|
|
|
$json = $historyService->editPlayedFile($params);
|
2012-10-19 17:09:34 +02:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$this->_helper->json->sendJson($json);
|
2013-07-18 07:31:20 +02:00
|
|
|
}
|
2012-07-16 03:17:13 +02:00
|
|
|
}
|