CC-2365 Shows from the past can be dragged into the future

adding a backend check if the show has started in the past.
This commit is contained in:
Naomi Aro 2011-06-06 18:56:32 +02:00
parent 1de4777de3
commit 02e259c0ea
1 changed files with 16 additions and 7 deletions

View File

@ -312,9 +312,9 @@ class Show {
$CC_DBC->query($sql);
}
/**
* Deletes all future rebroadcast instances of the current
* Deletes all future rebroadcast instances of the current
* show object from the show_instances table.
*
*/
@ -587,11 +587,11 @@ class Show {
//duration has changed
$this->updateDurationTime($p_data);
}
if ($isRecorded){
//delete all rebroadcasts. They will simply be recreated later
//in the execution of this PHP script. This simplifies having to
//reason about whether we should keep individual rebroadcasts or
//in the execution of this PHP script. This simplifies having to
//reason about whether we should keep individual rebroadcasts or
//delete them or move them around etc.
$this->deleteAllRebroadcasts();
}
@ -1172,7 +1172,7 @@ class Show {
$options["percent"] = $show_instance->getPercentScheduled();
}
if ($editable && strtotime($today_timestamp) < strtotime($show["starts"])) {
if ($editable && (strtotime($today_timestamp) < strtotime($show["starts"]))) {
$options["editable"] = true;
$events[] = Show::makeFullCalendarEvent($show, $options);
}
@ -1382,16 +1382,20 @@ class ShowInstance {
$mins = abs($deltaMin%60);
$today_timestamp = date("Y-m-d H:i:s");
$starts = $this->getShowStart();
$ends = $this->getShowEnd();
if(strtotime($today_timestamp) > strtotime($starts)) {
return "can't move a past show";
}
$sql = "SELECT timestamp '{$starts}' + interval '{$deltaDay} days' + interval '{$hours}:{$mins}'";
$new_starts = $CC_DBC->GetOne($sql);
$sql = "SELECT timestamp '{$ends}' + interval '{$deltaDay} days' + interval '{$hours}:{$mins}'";
$new_ends = $CC_DBC->GetOne($sql);
$today_timestamp = date("Y-m-d H:i:s");
if(strtotime($today_timestamp) > strtotime($new_starts)) {
return "can't move show into past";
}
@ -1430,9 +1434,14 @@ class ShowInstance {
$mins = abs($deltaMin%60);
$today_timestamp = date("Y-m-d H:i:s");
$starts = $this->getShowStart();
$ends = $this->getShowEnd();
if(strtotime($today_timestamp) > strtotime($starts)) {
return "can't resize a past show";
}
$sql = "SELECT timestamp '{$ends}' + interval '{$deltaDay} days' + interval '{$hours}:{$mins}'";
$new_ends = $CC_DBC->GetOne($sql);