From a514e3b60aa243da13f8d389d41972b5c947c04e Mon Sep 17 00:00:00 2001 From: Naomi Aro Date: Mon, 7 May 2012 18:19:18 +0200 Subject: [PATCH] CC-3776 : Current Recorded show is resizeable on the calendar (by dragging) --- airtime_mvc/application/models/Show.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php index 8d9645c00..6794fe756 100644 --- a/airtime_mvc/application/models/Show.php +++ b/airtime_mvc/application/models/Show.php @@ -1583,7 +1583,7 @@ class Application_Model_Show { $interval = $p_start->diff($p_end); $days = $interval->format('%a'); $shows = Application_Model_Show::getShows($p_start, $p_end); - $today_timestamp = gmdate("Y-m-d H:i:s"); + $nowEpoch = time(); foreach ($shows as $show) { $options = array(); @@ -1593,8 +1593,17 @@ class Application_Model_Show { if (intval($days) <= 7) { $options["percent"] = Application_Model_Show::getPercentScheduled($show["starts"], $show["ends"], $show["time_filled"]); } + + $startsDT = new DateTime($show["starts"], new DateTimeZone("UTC")); + $endsDT = new DateTime($show["ends"], new DateTimeZone("UTC")); + + $startsEpoch = intval($startsDT->format("U")); + $endsEpoch = intval($endsDT->format("U")); - if ($p_editable && (strtotime($today_timestamp) < strtotime($show["ends"]))) { + if ($p_editable && $show["record"] && $nowEpoch < $endsEpoch) { + $options["editable"] = false; + } + else if ($p_editable && $nowEpoch < $endsEpoch) { $options["editable"] = true; } $events[] = Application_Model_Show::makeFullCalendarEvent($show, $options);