This commit is contained in:
Naomi 2013-08-02 15:30:35 -04:00
parent c110b4b4df
commit 774027c9bd
3 changed files with 91 additions and 91 deletions

View file

@ -640,11 +640,11 @@ class Application_Service_HistoryService
return $fields;
}
public function mandatoryFileFields() {
$fields = array("played", MDATA_KEY_TITLE, MDATA_KEY_CREATOR);
return $fields;
public function mandatoryFileFields() {
$fields = array("played", MDATA_KEY_TITLE, MDATA_KEY_CREATOR);
return $fields;
}
private function defaultItemTemplate() {
@ -666,30 +666,30 @@ class Application_Service_HistoryService
/*
* Default File Summary Template. Taken from The Czech radio requirements (customer requested this in the past).
*/
private function defaultFileTemplate() {
$template = array();
$fields = array();
$fields[] = array("name" => MDATA_KEY_TITLE, "type" => TEMPLATE_STRING, "isFileMd" => true);
private function defaultFileTemplate() {
$template = array();
$fields = array();
$fields[] = array("name" => MDATA_KEY_TITLE, "type" => TEMPLATE_STRING, "isFileMd" => true);
$fields[] = array("name" => MDATA_KEY_CREATOR, "type" => TEMPLATE_STRING, "isFileMd" => true);
$fields[] = array("name" => "played", "type" => TEMPLATE_INT, "isFileMd" => false);
$fields[] = array("name" => MDATA_KEY_DURATION, "type" => TEMPLATE_STRING, "isFileMd" => true);
$fields[] = array("name" => MDATA_KEY_COMPOSER, "type" => TEMPLATE_STRING, "isFileMd" => true);
$fields[] = array("name" => MDATA_KEY_COPYRIGHT, "type" => TEMPLATE_STRING, "isFileMd" => true);
$template["name"] = "File Summary ".date("Y-m-d H:i:s")." Template";
$template["fields"] = $fields;
return $template;
$fields[] = array("name" => MDATA_KEY_COPYRIGHT, "type" => TEMPLATE_STRING, "isFileMd" => true);
$template["name"] = "File Summary ".date("Y-m-d H:i:s")." Template";
$template["fields"] = $fields;
return $template;
}
public function loadTemplate($id) {
try {
if (!is_numeric($id)) {
throw new Exception("Error: $id is not numeric.");
if (!is_numeric($id)) {
throw new Exception("Error: $id is not numeric.");
}
$template = CcPlayoutHistoryTemplateQuery::create()->findPk($id, $this->con);
@ -770,25 +770,25 @@ class Application_Service_HistoryService
return $this->getTemplates(self::TEMPLATE_TYPE_ITEM);
}
public function getFileTemplates() {
return $this->getTemplates(self::TEMPLATE_TYPE_FILE);
public function getFileTemplates() {
return $this->getTemplates(self::TEMPLATE_TYPE_FILE);
}
private function datatablesColumns($template) {
$columns = array();
foreach ($template["fields"] as $index=>$field) {
$key = $field["name"];
$columns[] = array(
"sTitle"=> $key,
"mDataProp"=> $key,
"sClass"=> "his_{$key}"
);
}
$columns = array();
foreach ($template["fields"] as $index=>$field) {
$key = $field["name"];
$columns[] = array(
"sTitle"=> $key,
"mDataProp"=> $key,
"sClass"=> "his_{$key}"
);
}
return $columns;
}
@ -803,15 +803,15 @@ class Application_Service_HistoryService
}
}
public function getDatatablesFileSummaryColumns() {
try {
$template = $this->getConfiguredFileTemplate();
return $this->datatablesColumns($template);
}
catch (Exception $e) {
throw $e;
}
public function getDatatablesFileSummaryColumns() {
try {
$template = $this->getConfiguredFileTemplate();
return $this->datatablesColumns($template);
}
catch (Exception $e) {
throw $e;
}
}
public function getConfiguredItemTemplate() {
@ -841,46 +841,46 @@ class Application_Service_HistoryService
}
}
public function getConfiguredFileTemplate() {
try {
$id = Application_Model_Preference::GetHistoryFileTemplate();
if (is_numeric($id)) {
$template = $this->loadTemplate($id);
}
else {
$template = $this->defaultFileTemplate();
}
return $template;
}
catch (Exception $e) {
throw $e;
}
public function getConfiguredFileTemplate() {
try {
$id = Application_Model_Preference::GetHistoryFileTemplate();
if (is_numeric($id)) {
$template = $this->loadTemplate($id);
}
else {
$template = $this->defaultFileTemplate();
}
return $template;
}
catch (Exception $e) {
throw $e;
}
}
public function setConfiguredFileTemplate($id) {
try {
Application_Model_Preference::SetHistoryFileTemplate($id);
}
catch (Exception $e) {
throw $e;
}
public function setConfiguredFileTemplate($id) {
try {
Application_Model_Preference::SetHistoryFileTemplate($id);
}
catch (Exception $e) {
throw $e;
}
}
public function setConfiguredTemplate($id) {
try {
public function setConfiguredTemplate($id) {
try {
$template = $this->loadTemplate($id);
$type = $template["type"];
$setTemplate = "setConfigured".ucfirst($type)."Template";
$this->$setTemplate($id);
}
catch (Exception $e) {
throw $e;
}
$this->$setTemplate($id);
}
catch (Exception $e) {
throw $e;
}
}
public function getConfiguredTemplateIds() {
@ -895,8 +895,8 @@ class Application_Service_HistoryService
$configured[] = $id;
}
if (is_numeric($id2)) {
$configured[] = $id2;
if (is_numeric($id2)) {
$configured[] = $id2;
}
return $configured;