filtering by a host's show so they can edit their own playout history.

This commit is contained in:
Naomi 2013-08-28 19:37:46 -04:00
parent 653a6384b9
commit 429cdeeffb
6 changed files with 218 additions and 156 deletions

View File

@ -150,8 +150,9 @@ class PlayouthistoryController extends Zend_Controller_Action
$endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC"));
$historyService = new Application_Service_HistoryService();
$r = $historyService->getShowList($startsDT, $endsDT);
$shows = $historyService->getShowList($startsDT, $endsDT);
$this->_helper->json->sendJson($shows);
}
catch (Exception $e) {
Logging::info($e);

View File

@ -426,15 +426,51 @@ class Application_Service_HistoryService
public function getShowList($startDT, $endDT)
{
$user = Application_Model_User::getCurrentUser();
$shows = Application_Model_Show::getShows($startDT, $endDT);
Loggin::info($shows);
Logging::info($startDT->format("Y-m-d H:i:s"));
Logging::info($endDT->format("Y-m-d H:i:s"));
Logging::info($shows);
//need to filter the list to only their shows
if ($user->isHost()) {
$showIds = array();
foreach ($shows as $show) {
$showIds[] = $show["show_id"];
}
$showIds = array_unique($showIds);
Logging::info($showIds);
$hostRecords = CcShowHostsQuery::create()
->filterByDbHost($user->getId())
->filterByDbShow($showIds)
->find($this->con);
$filteredShowIds = array();
foreach($hostRecords as $record) {
$filteredShowIds[] = $record->getDbShow();
}
Logging::info($filteredShowIds);
$filteredShows = array();
foreach($shows as $show) {
if (in_array($show["show_id"], $filteredShowIds)) {
$filteredShows[] = $show;
}
}
}
else {
$filteredShows = $shows;
}
return $filteredShows;
}
public function insertPlayedItem($schedId) {

View File

@ -18,7 +18,9 @@
</div>
<?php endif; ?>
<div id="his-tabs-3">
<span>Show Summary</span>
<ul id="history_show_summary">
<li>Show Summary</li>
</ul>
</div>
</div>

View File

@ -50,6 +50,11 @@ var AIRTIME = (function(AIRTIME) {
var selectedLogItems = {};
var dateStartId = "#his_date_start",
timeStartId = "#his_time_start",
dateEndId = "#his_date_end",
timeEndId = "#his_time_end";
function getSelectedLogItems() {
var items = Object.keys(selectedLogItems);
@ -303,16 +308,26 @@ var AIRTIME = (function(AIRTIME) {
return oTable;
}
function showSummaryList() {
var url = baseUrl+"playouthistory/show-history-feed",
oRange = AIRTIME.utilities.fnGetScheduleRange(dateStartId, timeStartId, dateEndId, timeEndId),
data = {
format: "json",
start: oRange.start,
end: oRange.end
};
$.post(url, data, function() {
var x;
});
}
mod.onReady = function() {
var oBaseDatePickerSettings,
oBaseTimePickerSettings,
oTableAgg,
oTableItem,
dateStartId = "#his_date_start",
timeStartId = "#his_time_start",
dateEndId = "#his_date_end",
timeEndId = "#his_time_end",
$hisDialogEl,
tabsInit = [
@ -327,6 +342,12 @@ var AIRTIME = (function(AIRTIME) {
initialize: function() {
oTableAgg = aggregateHistoryTable();
}
},
{
initialized: false,
initialize: function() {
showSummaryList();
}
}
];
@ -514,7 +535,9 @@ var AIRTIME = (function(AIRTIME) {
$historyContentDiv.find("#his-tabs").tabs({
show: function( event, ui ) {
var tab = tabsInit[ui.index];
var href = $(ui.tab).attr("href");
var index = href.split('-').pop();
var tab = tabsInit[index-1];
if (!tab.initialized) {
tab.initialize();