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'); } }