CC-3373 : Timeline: only lock the currently playing track and the one after

This commit is contained in:
Naomi Aro 2012-03-02 14:01:02 +01:00
parent 6c749075ac
commit f61afb0216
3 changed files with 15 additions and 7 deletions

View file

@ -222,7 +222,7 @@ class Application_Model_Schedule {
* @return array $scheduledItems
*
*/
public static function GetScheduleDetailItems($p_startDateTime, $p_endDateTime, $p_shows)
public static function GetScheduleDetailItems($p_start, $p_end, $p_shows)
{
global $CC_CONFIG, $CC_DBC;
@ -250,8 +250,11 @@ class Application_Model_Schedule {
WHERE si.modified_instance = false AND
si.starts >= '{$p_startDateTime}' AND si.starts < '{$p_endDateTime}'";
((si.starts >= '{$p_start}' AND si.starts < '{$p_end}')
OR (si.ends > '{$p_start}' AND si.ends <= '{$p_end}')
OR (si.starts <= '{$p_start}' AND si.ends >= '{$p_end}'))";
if (count($p_shows) > 0) {
$sql .= " AND show_id IN (".implode(",", $p_shows).")";
}

View file

@ -58,9 +58,14 @@ class Application_Model_ShowBuilder {
}
$showStartDT = new DateTime($p_item["si_starts"], new DateTimeZone("UTC"));
$schedStartDT = new DateTime($p_item["sched_starts"], new DateTimeZone("UTC"));
$showStartEpoch = intval($showStartDT->format('U'));
$schedStartEpoch = intval($schedStartDT->format('U'));
//can only schedule the show if it hasn't started and you are allowed.
if ($this->epoch_now < $showStartDT->format('U') && $this->user->canSchedule($p_item["show_id"]) == true) {
//can only schedule the show if item hasn't started and you are allowed.
if ($this->epoch_now < max($showStartEpoch, $schedStartEpoch)
&& $this->user->canSchedule($p_item["show_id"]) == true) {
$row["allowed"] = true;
}
}