using an accordian to display per show logs.
This commit is contained in:
parent
429cdeeffb
commit
a4c97479b6
4 changed files with 139 additions and 44 deletions
|
@ -53,7 +53,7 @@ class PlayouthistoryController extends Zend_Controller_Action
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/TableTools-2.1.5/js/ZeroClipboard.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/TableTools-2.1.5/js/ZeroClipboard.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/TableTools-2.1.5/js/TableTools.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/TableTools-2.1.5/js/TableTools.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
|
|
||||||
$offset = date("Z") * -1;
|
$offset = date("Z") * -1;
|
||||||
$this->view->headScript()->appendScript("var serverTimezoneOffset = {$offset}; //in seconds");
|
$this->view->headScript()->appendScript("var serverTimezoneOffset = {$offset}; //in seconds");
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/timepicker/jquery.ui.timepicker.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'js/timepicker/jquery.ui.timepicker.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
|
@ -77,7 +77,7 @@ class PlayouthistoryController extends Zend_Controller_Action
|
||||||
$columns = json_encode($historyService->getDatatablesFileSummaryColumns());
|
$columns = json_encode($historyService->getDatatablesFileSummaryColumns());
|
||||||
$script.= "localStorage.setItem( 'datatables-historyfile-aoColumns', JSON.stringify($columns) );";
|
$script.= "localStorage.setItem( 'datatables-historyfile-aoColumns', JSON.stringify($columns) );";
|
||||||
$this->view->headScript()->appendScript($script);
|
$this->view->headScript()->appendScript($script);
|
||||||
|
|
||||||
$user = Application_Model_User::getCurrentUser();
|
$user = Application_Model_User::getCurrentUser();
|
||||||
$this->view->userType = $user->getType();
|
$this->view->userType = $user->getType();
|
||||||
}
|
}
|
||||||
|
@ -120,12 +120,13 @@ class PlayouthistoryController extends Zend_Controller_Action
|
||||||
|
|
||||||
$starts_epoch = $request->getParam("start", $current_time - (60*60*24));
|
$starts_epoch = $request->getParam("start", $current_time - (60*60*24));
|
||||||
$ends_epoch = $request->getParam("end", $current_time);
|
$ends_epoch = $request->getParam("end", $current_time);
|
||||||
|
$instance = $request->getParam("instance_id", null);
|
||||||
|
|
||||||
$startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC"));
|
$startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC"));
|
||||||
$endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC"));
|
$endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC"));
|
||||||
|
|
||||||
$historyService = new Application_Service_HistoryService();
|
$historyService = new Application_Service_HistoryService();
|
||||||
$r = $historyService->getPlayedItemData($startsDT, $endsDT, $params);
|
$r = $historyService->getPlayedItemData($startsDT, $endsDT, $params, $instance);
|
||||||
|
|
||||||
$this->view->sEcho = $r["sEcho"];
|
$this->view->sEcho = $r["sEcho"];
|
||||||
$this->view->iTotalDisplayRecords = $r["iTotalDisplayRecords"];
|
$this->view->iTotalDisplayRecords = $r["iTotalDisplayRecords"];
|
||||||
|
@ -137,7 +138,7 @@ class PlayouthistoryController extends Zend_Controller_Action
|
||||||
Logging::info($e->getMessage());
|
Logging::info($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function showHistoryFeedAction()
|
public function showHistoryFeedAction()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
@ -145,13 +146,13 @@ class PlayouthistoryController extends Zend_Controller_Action
|
||||||
$current_time = time();
|
$current_time = time();
|
||||||
$starts_epoch = $request->getParam("start", $current_time - (60*60*24));
|
$starts_epoch = $request->getParam("start", $current_time - (60*60*24));
|
||||||
$ends_epoch = $request->getParam("end", $current_time);
|
$ends_epoch = $request->getParam("end", $current_time);
|
||||||
|
|
||||||
$startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC"));
|
$startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC"));
|
||||||
$endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC"));
|
$endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC"));
|
||||||
|
|
||||||
$historyService = new Application_Service_HistoryService();
|
$historyService = new Application_Service_HistoryService();
|
||||||
$shows = $historyService->getShowList($startsDT, $endsDT);
|
$shows = $historyService->getShowList($startsDT, $endsDT);
|
||||||
|
|
||||||
$this->_helper->json->sendJson($shows);
|
$this->_helper->json->sendJson($shows);
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
|
@ -182,11 +183,11 @@ class PlayouthistoryController extends Zend_Controller_Action
|
||||||
|
|
||||||
$historyService = new Application_Service_HistoryService();
|
$historyService = new Application_Service_HistoryService();
|
||||||
$json = $historyService->createPlayedItem($params);
|
$json = $historyService->createPlayedItem($params);
|
||||||
|
|
||||||
if (isset($json["form"])) {
|
if (isset($json["form"])) {
|
||||||
$this->view->form = $json["form"];
|
$this->view->form = $json["form"];
|
||||||
$json["form"] = $this->view->render('playouthistory/dialog.phtml');
|
$json["form"] = $this->view->render('playouthistory/dialog.phtml');
|
||||||
|
|
||||||
unset($this->view->form);
|
unset($this->view->form);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,11 +240,11 @@ class PlayouthistoryController extends Zend_Controller_Action
|
||||||
|
|
||||||
$historyService = new Application_Service_HistoryService();
|
$historyService = new Application_Service_HistoryService();
|
||||||
$json = $historyService->editPlayedItem($params);
|
$json = $historyService->editPlayedItem($params);
|
||||||
|
|
||||||
if (isset($json["form"])) {
|
if (isset($json["form"])) {
|
||||||
$this->view->form = $json["form"];
|
$this->view->form = $json["form"];
|
||||||
$json["form"] = $this->view->render('playouthistory/dialog.phtml');
|
$json["form"] = $this->view->render('playouthistory/dialog.phtml');
|
||||||
|
|
||||||
unset($this->view->form);
|
unset($this->view->form);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ class Application_Service_HistoryService
|
||||||
}
|
}
|
||||||
|
|
||||||
//opts is from datatables.
|
//opts is from datatables.
|
||||||
public function getPlayedItemData($startDT, $endDT, $opts)
|
public function getPlayedItemData($startDT, $endDT, $opts, $instanceId=null)
|
||||||
{
|
{
|
||||||
$mainSqlQuery = "";
|
$mainSqlQuery = "";
|
||||||
$paramMap = array();
|
$paramMap = array();
|
||||||
|
@ -59,7 +59,7 @@ class Application_Service_HistoryService
|
||||||
}
|
}
|
||||||
|
|
||||||
$historyRange = "(".
|
$historyRange = "(".
|
||||||
"SELECT history.starts, history.ends, history.id AS history_id".
|
"SELECT history.starts, history.ends, history.id AS history_id, history.instance_id".
|
||||||
" FROM cc_playout_history as history".
|
" FROM cc_playout_history as history".
|
||||||
" WHERE history.starts >= :starts and history.starts < :ends".
|
" WHERE history.starts >= :starts and history.starts < :ends".
|
||||||
") AS history_range";
|
") AS history_range";
|
||||||
|
@ -71,7 +71,12 @@ class Application_Service_HistoryService
|
||||||
" ) AS %KEY%".
|
" ) AS %KEY%".
|
||||||
" ) AS %KEY%_filter";
|
" ) AS %KEY%_filter";
|
||||||
|
|
||||||
$mainSelect = array("history_range.starts", "history_range.ends", "history_range.history_id");
|
$mainSelect = array(
|
||||||
|
"history_range.starts",
|
||||||
|
"history_range.ends",
|
||||||
|
"history_range.history_id",
|
||||||
|
"history_range.instance_id"
|
||||||
|
);
|
||||||
$mdFilters = array();
|
$mdFilters = array();
|
||||||
|
|
||||||
$numFileMdFields = count($fields_filemd);
|
$numFileMdFields = count($fields_filemd);
|
||||||
|
@ -184,6 +189,17 @@ class Application_Service_HistoryService
|
||||||
throw new Exception("Error: $msg");
|
throw new Exception("Error: $msg");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
//Using the instance_id to filter the data.
|
||||||
|
|
||||||
|
if (isset($instanceId)) {
|
||||||
|
|
||||||
|
$mainSqlQuery.=
|
||||||
|
" WHERE history_range.instance_id = :instance";
|
||||||
|
|
||||||
|
$paramMap["instance"] = $instanceId;
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
//Using Datatables parameters to sort the data.
|
//Using Datatables parameters to sort the data.
|
||||||
|
|
||||||
|
@ -422,44 +438,44 @@ class Application_Service_HistoryService
|
||||||
"history" => $rows
|
"history" => $rows
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getShowList($startDT, $endDT)
|
public function getShowList($startDT, $endDT)
|
||||||
{
|
{
|
||||||
$user = Application_Model_User::getCurrentUser();
|
$user = Application_Model_User::getCurrentUser();
|
||||||
$shows = Application_Model_Show::getShows($startDT, $endDT);
|
$shows = Application_Model_Show::getShows($startDT, $endDT);
|
||||||
|
|
||||||
Logging::info($startDT->format("Y-m-d H:i:s"));
|
Logging::info($startDT->format("Y-m-d H:i:s"));
|
||||||
Logging::info($endDT->format("Y-m-d H:i:s"));
|
Logging::info($endDT->format("Y-m-d H:i:s"));
|
||||||
|
|
||||||
Logging::info($shows);
|
Logging::info($shows);
|
||||||
|
|
||||||
//need to filter the list to only their shows
|
//need to filter the list to only their shows
|
||||||
if ($user->isHost()) {
|
if ($user->isHost()) {
|
||||||
|
|
||||||
$showIds = array();
|
$showIds = array();
|
||||||
|
|
||||||
foreach ($shows as $show) {
|
foreach ($shows as $show) {
|
||||||
$showIds[] = $show["show_id"];
|
$showIds[] = $show["show_id"];
|
||||||
}
|
}
|
||||||
|
|
||||||
$showIds = array_unique($showIds);
|
$showIds = array_unique($showIds);
|
||||||
Logging::info($showIds);
|
Logging::info($showIds);
|
||||||
|
|
||||||
$hostRecords = CcShowHostsQuery::create()
|
$hostRecords = CcShowHostsQuery::create()
|
||||||
->filterByDbHost($user->getId())
|
->filterByDbHost($user->getId())
|
||||||
->filterByDbShow($showIds)
|
->filterByDbShow($showIds)
|
||||||
->find($this->con);
|
->find($this->con);
|
||||||
|
|
||||||
$filteredShowIds = array();
|
$filteredShowIds = array();
|
||||||
|
|
||||||
foreach($hostRecords as $record) {
|
foreach($hostRecords as $record) {
|
||||||
$filteredShowIds[] = $record->getDbShow();
|
$filteredShowIds[] = $record->getDbShow();
|
||||||
}
|
}
|
||||||
|
|
||||||
Logging::info($filteredShowIds);
|
Logging::info($filteredShowIds);
|
||||||
|
|
||||||
$filteredShows = array();
|
$filteredShows = array();
|
||||||
|
|
||||||
foreach($shows as $show) {
|
foreach($shows as $show) {
|
||||||
if (in_array($show["show_id"], $filteredShowIds)) {
|
if (in_array($show["show_id"], $filteredShowIds)) {
|
||||||
$filteredShows[] = $show;
|
$filteredShows[] = $show;
|
||||||
|
@ -469,7 +485,7 @@ class Application_Service_HistoryService
|
||||||
else {
|
else {
|
||||||
$filteredShows = $shows;
|
$filteredShows = $shows;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $filteredShows;
|
return $filteredShows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -878,17 +894,17 @@ class Application_Service_HistoryService
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* id is an id in cc_playout_history */
|
/* id is an id in cc_playout_history */
|
||||||
public function deletePlayedItems($ids) {
|
public function deletePlayedItems($ids) {
|
||||||
|
|
||||||
$this->con->beginTransaction();
|
$this->con->beginTransaction();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$records = CcPlayoutHistoryQuery::create()->findPks($ids, $this->con);
|
$records = CcPlayoutHistoryQuery::create()->findPks($ids, $this->con);
|
||||||
$records->delete($this->con);
|
$records->delete($this->con);
|
||||||
|
|
||||||
$this->con->commit();
|
$this->con->commit();
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
|
@ -915,9 +931,9 @@ class Application_Service_HistoryService
|
||||||
|
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getPhpCasts() {
|
private function getPhpCasts() {
|
||||||
|
|
||||||
$fields = array(
|
$fields = array(
|
||||||
TEMPLATE_DATE => "strval",
|
TEMPLATE_DATE => "strval",
|
||||||
TEMPLATE_TIME => "strval",
|
TEMPLATE_TIME => "strval",
|
||||||
|
@ -927,7 +943,7 @@ class Application_Service_HistoryService
|
||||||
TEMPLATE_INT => "intval",
|
TEMPLATE_INT => "intval",
|
||||||
TEMPLATE_FLOAT => "floatval",
|
TEMPLATE_FLOAT => "floatval",
|
||||||
);
|
);
|
||||||
|
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,9 +18,7 @@
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<div id="his-tabs-3">
|
<div id="his-tabs-3">
|
||||||
<ul id="history_show_summary">
|
<div id="history_show_summary"></div>
|
||||||
<li>Show Summary</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -153,6 +153,9 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
if (fnServerData.hasOwnProperty("end")) {
|
if (fnServerData.hasOwnProperty("end")) {
|
||||||
aoData.push( { name: "end", value: fnServerData.end} );
|
aoData.push( { name: "end", value: fnServerData.end} );
|
||||||
}
|
}
|
||||||
|
if (fnServerData.hasOwnProperty("instance")) {
|
||||||
|
aoData.push( { name: "instance_id", value: fnServerData.instance} );
|
||||||
|
}
|
||||||
|
|
||||||
aoData.push( { name: "format", value: "json"} );
|
aoData.push( { name: "format", value: "json"} );
|
||||||
|
|
||||||
|
@ -165,6 +168,83 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//config: name, type, filemd, required
|
||||||
|
function createShowAccordSection(config) {
|
||||||
|
var template,
|
||||||
|
$el;
|
||||||
|
|
||||||
|
/*
|
||||||
|
template =
|
||||||
|
"<li " +
|
||||||
|
"data-instance='<%= instance %>' " +
|
||||||
|
"data-starts='<%= starts %>' " +
|
||||||
|
"data-ends='<%= ends %>'" +
|
||||||
|
">" +
|
||||||
|
"<span><%= name %></span>" +
|
||||||
|
"<span><%= starts %></span>" +
|
||||||
|
"<span><%= ends %></span>" +
|
||||||
|
"</li>";
|
||||||
|
*/
|
||||||
|
|
||||||
|
template =
|
||||||
|
"<h3 " +
|
||||||
|
"data-instance='<%= instance %>' " +
|
||||||
|
"data-starts='<%= starts %>' " +
|
||||||
|
"data-ends='<%= ends %>'" +
|
||||||
|
">" +
|
||||||
|
"<a href='#'>" +
|
||||||
|
"<span><%= name %></span>" +
|
||||||
|
"<span><%= starts %></span>" +
|
||||||
|
"<span><%= ends %></span>" +
|
||||||
|
"</a>" +
|
||||||
|
"</h3>" +
|
||||||
|
"<div>First content panel</div>";
|
||||||
|
|
||||||
|
template = _.template(template);
|
||||||
|
$el = $(template(config));
|
||||||
|
|
||||||
|
return $el;
|
||||||
|
}
|
||||||
|
|
||||||
|
function drawShowList(oShows) {
|
||||||
|
var $showList = $historyContentDiv.find("#history_show_summary"),
|
||||||
|
i,
|
||||||
|
len,
|
||||||
|
$accordSection,
|
||||||
|
show;
|
||||||
|
|
||||||
|
$showList.empty();
|
||||||
|
|
||||||
|
for (i = 0, len = oShows.length; i < len; i++) {
|
||||||
|
show = oShows[i];
|
||||||
|
|
||||||
|
$accordSection = createShowAccordSection({
|
||||||
|
instance: show.instance_id,
|
||||||
|
name: show.name,
|
||||||
|
starts: show.starts,
|
||||||
|
ends: show.ends
|
||||||
|
});
|
||||||
|
|
||||||
|
$showList.append($accordSection);
|
||||||
|
}
|
||||||
|
|
||||||
|
$showList.accordion({
|
||||||
|
create: function( event, ui ) {
|
||||||
|
var $div = $showList.find(".ui-accordion-content-active");
|
||||||
|
},
|
||||||
|
change: function( event, ui ) {
|
||||||
|
var x;
|
||||||
|
},
|
||||||
|
changestart: function( event, ui ) {
|
||||||
|
var x;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function drawShowTable() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function createToolbarButtons ($el) {
|
function createToolbarButtons ($el) {
|
||||||
var $menu = $("<div class='btn-toolbar' />");
|
var $menu = $("<div class='btn-toolbar' />");
|
||||||
|
|
||||||
|
@ -234,9 +314,9 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
return oTable;
|
return oTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
function itemHistoryTable() {
|
function itemHistoryTable(id) {
|
||||||
var oTable,
|
var oTable,
|
||||||
$historyTableDiv = $historyContentDiv.find("#history_table_list"),
|
$historyTableDiv = $historyContentDiv.find("#"+id),
|
||||||
$toolbar,
|
$toolbar,
|
||||||
columns,
|
columns,
|
||||||
fnRowCallback,
|
fnRowCallback,
|
||||||
|
@ -317,8 +397,8 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
end: oRange.end
|
end: oRange.end
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(url, data, function() {
|
$.post(url, data, function(json) {
|
||||||
var x;
|
drawShowList(json);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -334,7 +414,7 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
{
|
{
|
||||||
initialized: false,
|
initialized: false,
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
oTableItem = itemHistoryTable();
|
oTableItem = itemHistoryTable("history_table_list");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue