filtering by a host's show so they can edit their own playout history.
This commit is contained in:
parent
653a6384b9
commit
429cdeeffb
6 changed files with 218 additions and 156 deletions
|
@ -138,25 +138,26 @@ class PlayouthistoryController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
|
||||
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();
|
||||
$r = $historyService->getShowList($startsDT, $endsDT);
|
||||
|
||||
}
|
||||
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()
|
||||
|
|
|
@ -13,131 +13,131 @@ class PlayouthistorytemplateController extends Zend_Controller_Action
|
|||
->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());
|
||||
}
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue