IM-629
-filter by using instance id instead of show id Conflicts: airtime_mvc/application/models/Schedule.php
This commit is contained in:
parent
af7b2d5347
commit
bb36556bb9
|
@ -269,7 +269,9 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
$startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC"));
|
||||
$endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC"));
|
||||
|
||||
$opts = array("myShows" => $my_shows, "showFilter" => $show_filter);
|
||||
$opts = array("myShows" => $my_shows,
|
||||
"showFilter" => $show_filter,
|
||||
"showInstanceFilter" => $show_filter);
|
||||
$showBuilder = new Application_Model_ShowBuilder($startsDT, $endsDT, $opts);
|
||||
|
||||
$data = $showBuilder->getItems();
|
||||
|
|
|
@ -309,13 +309,11 @@ SQL;
|
|||
* @return array $scheduledItems
|
||||
*
|
||||
*/
|
||||
public static function GetScheduleDetailItems($p_start, $p_end, $p_shows)
|
||||
public static function GetScheduleDetailItems($p_start, $p_end, $p_shows, $p_show_instances)
|
||||
{
|
||||
$p_start_str = $p_start->format("Y-m-d H:i:s");
|
||||
$p_end_str = $p_end->format("Y-m-d H:i:s");
|
||||
|
||||
$paramMap = array();
|
||||
|
||||
//We need to search 24 hours before and after the show times so that that we
|
||||
//capture all of the show's contents.
|
||||
$p_track_start= $p_start->sub(new DateInterval("PT24H"))->format("Y-m-d H:i:s");
|
||||
|
@ -355,7 +353,7 @@ SQL;
|
|||
AND sched.ends >= :fj_ts_6))
|
||||
)
|
||||
SQL;
|
||||
$map = array(
|
||||
$paramMap = array(
|
||||
":fj_ts_1" => $p_track_start,
|
||||
":fj_ts_2" => $p_track_end,
|
||||
":fj_ts_3" => $p_track_start,
|
||||
|
@ -363,8 +361,6 @@ SQL;
|
|||
":fj_ts_5" => $p_track_start,
|
||||
":fj_ts_6" => $p_track_end,
|
||||
);
|
||||
$paramMap = $paramMap + $map;
|
||||
|
||||
|
||||
$filesSql = str_replace("%%columns%%",
|
||||
$filesColumns,
|
||||
|
@ -426,6 +422,8 @@ SQL;
|
|||
|
||||
$showPredicate = " AND show_id IN (".implode(",", $params).")";
|
||||
$paramMap = $paramMap + $map;
|
||||
} else if (count($p_show_instances) > 0) {
|
||||
$showPredicate = " AND si_id IN (".implode(",", $p_show_instances).")";
|
||||
}
|
||||
|
||||
$sql = <<<SQL
|
||||
|
|
|
@ -437,15 +437,18 @@ class Application_Model_ShowBuilder
|
|||
$display_items = array();
|
||||
|
||||
$shows = array();
|
||||
$showInstance = array();
|
||||
if ($this->opts["myShows"] === 1) {
|
||||
|
||||
$shows = $this->getUsersShows();
|
||||
} elseif ($this->opts["showFilter"] !== 0) {
|
||||
$shows[] = $this->opts["showFilter"];
|
||||
} elseif ($this->opts["showInstanceFilter"] !== 0) {
|
||||
$showInstance[] = $this->opts["showInstanceFilter"];
|
||||
}
|
||||
|
||||
$scheduled_items = Application_Model_Schedule::GetScheduleDetailItems(
|
||||
$this->startDT, $this->endDT, $shows);
|
||||
$this->startDT, $this->endDT, $shows, $showInstance);
|
||||
|
||||
for ($i = 0, $rows = count($scheduled_items); $i < $rows; $i++) {
|
||||
|
||||
|
|
|
@ -180,7 +180,8 @@ function buildScheduleDialog (json, instance_id) {
|
|||
fnServer.start = json.start;
|
||||
fnServer.end = json.end;
|
||||
fnServer.ops = {};
|
||||
fnServer.ops.showFilter = instance_id;
|
||||
fnServer.ops.showFilter = 0;
|
||||
fnServer.ops.showInstanceFilter = instance_id;
|
||||
fnServer.ops.myShows = 0;
|
||||
|
||||
AIRTIME.library.libraryInit();
|
||||
|
@ -354,8 +355,8 @@ $(document).ready(function() {
|
|||
|
||||
callback = function() {
|
||||
|
||||
$.post(oItems.schedule.url, {format: "json", id: data.showId}, function(json){
|
||||
buildScheduleDialog(json, data.showId);
|
||||
$.post(oItems.schedule.url, {format: "json", id: data.id}, function(json){
|
||||
buildScheduleDialog(json, data.id);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -359,6 +359,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
if (mod.fnServerData.hasOwnProperty("ops")) {
|
||||
aoData.push( { name: "myShows", value: mod.fnServerData.ops.myShows} );
|
||||
aoData.push( { name: "showFilter", value: mod.fnServerData.ops.showFilter} );
|
||||
aoData.push( { name: "showInstanceFilter", value: mod.fnServerData.ops.showInstanceFilter} );
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
|
|
|
@ -266,6 +266,7 @@ AIRTIME = (function(AIRTIME) {
|
|||
if (fn.hasOwnProperty("ops")) {
|
||||
data["myShows"] = fn.ops.myShows;
|
||||
data["showFilter"] = fn.ops.showFilter;
|
||||
data["showFilter"] = fn.ops.showInstanceFilter;
|
||||
}
|
||||
|
||||
$.ajax( {
|
||||
|
|
Loading…
Reference in New Issue