reschedules a show's content when it is successfully moved on the schedule.

This commit is contained in:
naomiaro 2011-02-05 20:04:24 -05:00
parent 3bbc84365e
commit 258157d92c
2 changed files with 30 additions and 11 deletions

View file

@ -317,8 +317,6 @@ class ScheduleController extends Zend_Controller_Action
$this->view->dialog = $this->view->render('schedule/show-content-dialog.phtml');
unset($this->view->showContent);
}
}

View file

@ -389,6 +389,30 @@ class ShowInstance {
return $showInstance->getDbEnds();
}
public function setShowStart($start) {
$showInstance = CcShowInstancesQuery::create()->findPK($this->_instanceId);
$showInstance->setDbStarts($start)
->save();
}
public function setShowEnd($end) {
$showInstance = CcShowInstancesQuery::create()->findPK($this->_instanceId);
$showInstance->setDbEnds($end)
->save();
}
public function moveScheduledShowContent($deltaDay, $deltaHours, $deltaMin) {
global $CC_DBC;
$sql = "UPDATE cc_schedule
SET starts = (starts + interval '{$deltaDay} days' + interval '{$deltaHours}:{$deltaMin}'),
ends = (ends + interval '{$deltaDay} days' + interval '{$deltaHours}:{$deltaMin}')
WHERE (starts >= '{$this->getShowStart()}')
AND (ends <= '{$this->getShowEnd()}')";
$CC_DBC->query($sql);
}
public function moveShow($deltaDay, $deltaMin){
global $CC_DBC;
@ -420,10 +444,9 @@ class ShowInstance {
return $overlap;
}
$showInstance
->setDbStarts($new_starts)
->setDbEnds($new_ends)
->save();
$this->moveScheduledShowContent($deltaDay, $hours, $mins);
$this->setShowStart($new_starts);
$this->setShowEnd($new_ends);
}
public function resizeShow($deltaDay, $deltaMin){
@ -452,10 +475,8 @@ class ShowInstance {
}
}
$showInstance
->setDbEnds($new_ends)
->save();
$this->setShowStart($new_starts);
$this->setShowEnd($new_ends);
}
private function getNextPos() {