crlf
This commit is contained in:
parent
7ca28fe81d
commit
b33f33964a
|
@ -71,8 +71,8 @@ class PlayouthistoryController extends Zend_Controller_Action
|
|||
|
||||
//set datatables columns for display of data.
|
||||
$historyService = new Application_Service_HistoryService();
|
||||
$columns = json_encode($historyService->getDatatablesPlayedItemColumns());
|
||||
$script = "localStorage.setItem( 'datatables-historyitem-aoColumns', JSON.stringify($columns) );";
|
||||
$columns = json_encode($historyService->getDatatablesPlayedItemColumns());
|
||||
$script = "localStorage.setItem( 'datatables-historyitem-aoColumns', JSON.stringify($columns) );";
|
||||
$this->view->headScript()->appendScript($script);
|
||||
}
|
||||
|
||||
|
|
|
@ -43,10 +43,10 @@ class Application_Service_HistoryService
|
|||
//opts is from datatables.
|
||||
public function getPlayedItemData($startDT, $endDT, $opts)
|
||||
{
|
||||
$mainSqlQuery = "";
|
||||
$mainSqlQuery = "";
|
||||
$paramMap = array();
|
||||
|
||||
$start = $startDT->format("Y-m-d H:i:s");
|
||||
$start = $startDT->format("Y-m-d H:i:s");
|
||||
$end = $endDT->format("Y-m-d H:i:s");
|
||||
$paramMap["starts"] = $start;
|
||||
$paramMap["ends"] = $end;
|
||||
|
@ -72,17 +72,17 @@ class Application_Service_HistoryService
|
|||
}
|
||||
}
|
||||
|
||||
$historyRange = "(".
|
||||
"SELECT history.starts, history.ends, history.id AS history_id".
|
||||
" FROM cc_playout_history as history".
|
||||
" WHERE history.starts >= :starts and history.starts < :ends".
|
||||
") AS history_range";
|
||||
|
||||
$manualMeta = "(".
|
||||
"SELECT %KEY%.value AS %KEY%, %KEY%.history_id".
|
||||
" FROM (".
|
||||
" SELECT * from cc_playout_history_metadata AS phm WHERE phm.key = :meta_%KEY%".
|
||||
" ) AS %KEY%".
|
||||
$historyRange = "(".
|
||||
"SELECT history.starts, history.ends, history.id AS history_id".
|
||||
" FROM cc_playout_history as history".
|
||||
" WHERE history.starts >= :starts and history.starts < :ends".
|
||||
") AS history_range";
|
||||
|
||||
$manualMeta = "(".
|
||||
"SELECT %KEY%.value AS %KEY%, %KEY%.history_id".
|
||||
" FROM (".
|
||||
" SELECT * from cc_playout_history_metadata AS phm WHERE phm.key = :meta_%KEY%".
|
||||
" ) AS %KEY%".
|
||||
" ) AS %KEY%_filter";
|
||||
|
||||
$mainSelect = array("history_range.starts", "history_range.ends", "history_range.history_id");
|
||||
|
@ -114,25 +114,25 @@ class Application_Service_HistoryService
|
|||
$paramMap["meta_{$key}"] = $key;
|
||||
}
|
||||
|
||||
//the files associated with scheduled playback in Airtime.
|
||||
$historyFile = "(".
|
||||
"SELECT history.id AS history_id, history.file_id".
|
||||
" FROM cc_playout_history AS history".
|
||||
" WHERE history.file_id IS NOT NULL".
|
||||
") AS history_file";
|
||||
|
||||
$fileMd = "(".
|
||||
"SELECT %NON_NULL_FILE_SELECT%".
|
||||
" FROM cc_files AS file".
|
||||
//the files associated with scheduled playback in Airtime.
|
||||
$historyFile = "(".
|
||||
"SELECT history.id AS history_id, history.file_id".
|
||||
" FROM cc_playout_history AS history".
|
||||
" WHERE history.file_id IS NOT NULL".
|
||||
") AS history_file";
|
||||
|
||||
$fileMd = "(".
|
||||
"SELECT %NON_NULL_FILE_SELECT%".
|
||||
" FROM cc_files AS file".
|
||||
") AS file_md";
|
||||
|
||||
$fileMd = str_replace("%NON_NULL_FILE_SELECT%", join(", ", $nonNullFileSelect), $fileMd);
|
||||
|
||||
//null files are from manually added data (filling in webstream info etc)
|
||||
$nullFile = "(".
|
||||
"SELECT history.id AS history_id".
|
||||
" FROM cc_playout_history AS history".
|
||||
" WHERE history.file_id IS NULL".
|
||||
$fileMd = str_replace("%NON_NULL_FILE_SELECT%", join(", ", $nonNullFileSelect), $fileMd);
|
||||
|
||||
//null files are from manually added data (filling in webstream info etc)
|
||||
$nullFile = "(".
|
||||
"SELECT history.id AS history_id".
|
||||
" FROM cc_playout_history AS history".
|
||||
" WHERE history.file_id IS NULL".
|
||||
") AS null_file";
|
||||
|
||||
|
||||
|
@ -157,10 +157,10 @@ class Application_Service_HistoryService
|
|||
|
||||
for ($i = 0, $len = count($fields_general); $i < $len; $i++) {
|
||||
|
||||
$field = $fields_general[$i];
|
||||
$field = $fields_general[$i];
|
||||
$key = $field["name"];
|
||||
|
||||
$mdFilters[] = str_replace("%KEY%", $key, $manualMeta);
|
||||
$mdFilters[] = str_replace("%KEY%", $key, $manualMeta);
|
||||
$paramMap["meta_{$key}"] = $key;
|
||||
$mainSelect[] = "{$key}_filter.{$key}";
|
||||
}
|
||||
|
@ -175,17 +175,17 @@ class Application_Service_HistoryService
|
|||
" LEFT JOIN ( {$fileSqlQuery} ) as file_info USING(history_id)";
|
||||
}
|
||||
|
||||
foreach ($mdFilters as $filter) {
|
||||
|
||||
$mainSqlQuery.=
|
||||
" LEFT JOIN {$filter} USING(history_id)";
|
||||
foreach ($mdFilters as $filter) {
|
||||
|
||||
$mainSqlQuery.=
|
||||
" LEFT JOIN {$filter} USING(history_id)";
|
||||
}
|
||||
|
||||
Logging::info($mainSqlQuery);
|
||||
|
||||
$stmt = $this->con->prepare($mainSqlQuery);
|
||||
foreach ($paramMap as $param => $v) {
|
||||
$stmt->bindValue($param, $v);
|
||||
$stmt = $this->con->prepare($mainSqlQuery);
|
||||
foreach ($paramMap as $param => $v) {
|
||||
$stmt->bindValue($param, $v);
|
||||
}
|
||||
|
||||
$rows = array();
|
||||
|
@ -194,7 +194,7 @@ class Application_Service_HistoryService
|
|||
}
|
||||
else {
|
||||
$msg = implode(',', $stmt->errorInfo());
|
||||
Logging::info($msg);
|
||||
Logging::info($msg);
|
||||
throw new Exception("Error: $msg");
|
||||
}
|
||||
|
||||
|
@ -205,27 +205,27 @@ class Application_Service_HistoryService
|
|||
//-----------------------------------------------------------------------
|
||||
//processing results.
|
||||
|
||||
$timezoneUTC = new DateTimeZone("UTC");
|
||||
$timezoneLocal = new DateTimeZone($this->timezone);
|
||||
|
||||
//need to display the results in the station's timezone.
|
||||
foreach ($rows as $index => &$result) {
|
||||
|
||||
$dateTime = new DateTime($result["starts"], $timezoneUTC);
|
||||
$dateTime->setTimezone($timezoneLocal);
|
||||
$result["starts"] = $dateTime->format("Y-m-d H:i:s");
|
||||
|
||||
$dateTime = new DateTime($result["ends"], $timezoneUTC);
|
||||
$dateTime->setTimezone($timezoneLocal);
|
||||
$result["ends"] = $dateTime->format("Y-m-d H:i:s");
|
||||
$timezoneUTC = new DateTimeZone("UTC");
|
||||
$timezoneLocal = new DateTimeZone($this->timezone);
|
||||
|
||||
//need to display the results in the station's timezone.
|
||||
foreach ($rows as $index => &$result) {
|
||||
|
||||
$dateTime = new DateTime($result["starts"], $timezoneUTC);
|
||||
$dateTime->setTimezone($timezoneLocal);
|
||||
$result["starts"] = $dateTime->format("Y-m-d H:i:s");
|
||||
|
||||
$dateTime = new DateTime($result["ends"], $timezoneUTC);
|
||||
$dateTime->setTimezone($timezoneLocal);
|
||||
$result["ends"] = $dateTime->format("Y-m-d H:i:s");
|
||||
}
|
||||
|
||||
return array(
|
||||
"sEcho" => intval($opts["sEcho"]),
|
||||
return array(
|
||||
"sEcho" => intval($opts["sEcho"]),
|
||||
//"iTotalDisplayRecords" => intval($totalDisplayRows),
|
||||
"iTotalDisplayRecords" => intval($totalRows),
|
||||
"iTotalRecords" => intval($totalRows),
|
||||
"history" => $rows
|
||||
"iTotalDisplayRecords" => intval($totalRows),
|
||||
"iTotalRecords" => intval($totalRows),
|
||||
"history" => $rows
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -720,7 +720,7 @@ class Application_Service_HistoryService
|
|||
|
||||
try {
|
||||
//{"sTitle": $.i18n._("Start"), "mDataProp": "starts", "sClass": "his_starts"}
|
||||
|
||||
|
||||
$template = $this->getConfiguredItemTemplate();
|
||||
|
||||
$columns = array();
|
||||
|
@ -736,10 +736,10 @@ class Application_Service_HistoryService
|
|||
);
|
||||
}
|
||||
|
||||
return $columns;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
throw $e;
|
||||
return $columns;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue