Merge branch 'CC-3174' into devel

This commit is contained in:
Naomi Aro 2012-02-23 22:24:17 +01:00
commit 9c6bd4bf4d
3 changed files with 41 additions and 0 deletions

View file

@ -114,6 +114,29 @@ class Application_Model_ShowBuilder {
}
}
private function getItemStatus($p_item, &$row) {
$showEndDT = new DateTime($p_item["si_ends"]);
$schedStartDT = new DateTime($p_item["sched_starts"]);
$schedEndDT = new DateTime($p_item["sched_ends"]);
$showEndEpoch = intval($showEndDT->format("U"));
$schedStartEpoch = intval($schedStartDT->format("U"));
$schedEndEpoch = intval($schedEndDT->format("U"));
if ($schedEndEpoch < $showEndEpoch) {
$status = 0; //item will playout in full
}
else if ($schedStartEpoch < $showEndEpoch && $schedEndEpoch > $showEndEpoch) {
$status = 1; //item is on boundry
}
else {
$status = 2; //item is overscheduled won't play.
}
$row["status"] = $status;
}
private function getRowTimestamp($p_item, &$row) {
if (is_null($p_item["si_last_scheduled"])) {
@ -163,6 +186,8 @@ class Application_Model_ShowBuilder {
$schedEndDT = new DateTime($p_item["sched_ends"], new DateTimeZone("UTC"));
$schedEndDT->setTimezone(new DateTimeZone($this->timezone));
$this->getItemStatus($p_item, $row);
$runtime = $schedStartDT->diff($schedEndDT);
$row["id"] = intval($p_item["sched_id"]);