SAAS-877 - Fix errors

This commit is contained in:
Duncan Sommerville 2015-06-24 13:07:13 -04:00
parent fd8194e7d8
commit ef957fe0aa
1 changed files with 22 additions and 15 deletions

View File

@ -195,8 +195,19 @@ SQL;
$rows = Application_Common_Database::prepareAndExecute($sql, $params); $rows = Application_Common_Database::prepareAndExecute($sql, $params);
if ((count($rows) < 1 || $rows[0]["show_ends"] < $utcNow->format(DEFAULT_TIMESTAMP_FORMAT) if ($source != self::SCHEDULED_SOURCE_NAME) {
&& ($source == self::SCHEDULED_SOURCE_NAME))) { // Only return if the show is using scheduled playback $show = Application_Model_Show::getCurrentShow();
$results["current"] = array(
"starts" => $show[0]["starts"],
"ends" => $show[0]["ends"],
"type" => _($source . " Stream"),
"name" => (isset($show[0])?$show[0]["name"]:"") . " - " . _($source . " Stream"),
"media_item_played" => false,
"record" => "0"
);
}
if (count($rows) < 1 || $rows[0]["show_ends"] < $utcNow->format(DEFAULT_TIMESTAMP_FORMAT)) {
return $results; return $results;
} }
@ -231,21 +242,17 @@ SQL;
$currentMediaType = null; $currentMediaType = null;
} }
if ($source != self::SCHEDULED_SOURCE_NAME) { if (is_null($results["current"])) {
$show = Application_Model_Show::getCurrentShow(); $results["current"] = array(
$currentMediaName = isset($show[0])?$show[0]["name"]:""; "starts" => $currentMedia["starts"],
$currentMediaName .= " - " . _($source . " Stream"); "ends" => $currentMedia["ends"],
"type" => $currentMediaType,
"name" => $currentMediaName,
"media_item_played" => $currentMedia["media_item_played"],
"record" => "0"
);
} }
$results["current"] = array(
"starts" => $currentMedia["starts"],
"ends" => $currentMedia["ends"],
"type" => $currentMediaType,
"name" => $currentMediaName,
"media_item_played" => $currentMedia["media_item_played"],
"record" => "0"
);
$previousMedia = CcScheduleQuery::create() $previousMedia = CcScheduleQuery::create()
->filterByDbStarts($currentMedia["starts"], Criteria::LESS_THAN) ->filterByDbStarts($currentMedia["starts"], Criteria::LESS_THAN)
->filterByDbId($currentMedia["id"], Criteria::NOT_EQUAL) ->filterByDbId($currentMedia["id"], Criteria::NOT_EQUAL)