CC-3035 : Should be able to resize a show, have it affect all future instances of the show

resizing is only working for single instance currently like the past.
This commit is contained in:
Naomi Aro 2011-11-15 18:22:21 +01:00
parent 63d0163f15
commit 4bdf866aca
3 changed files with 26 additions and 19 deletions

View file

@ -68,7 +68,9 @@ class ScheduleController extends Zend_Controller_Action
public function eventFeedAction() public function eventFeedAction()
{ {
$start = new DateTime($this->_getParam('start', null)); $start = new DateTime($this->_getParam('start', null));
$start->setTimezone(new DateTimeZone("UTC"));
$end = new DateTime($this->_getParam('end', null)); $end = new DateTime($this->_getParam('end', null));
$end->setTimezone(new DateTimeZone("UTC"));
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id); $user = new Application_Model_User($userInfo->id);
@ -113,7 +115,7 @@ class ScheduleController extends Zend_Controller_Action
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id); $user = new Application_Model_User($userInfo->id);
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) { if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
try{ try{
$show = new Application_Model_ShowInstance($showInstanceId); $show = new Application_Model_ShowInstance($showInstanceId);
}catch(Exception $e){ }catch(Exception $e){
@ -123,8 +125,9 @@ class ScheduleController extends Zend_Controller_Action
$error = $show->resizeShow($deltaDay, $deltaMin); $error = $show->resizeShow($deltaDay, $deltaMin);
} }
if(isset($error)) if (isset($error)) {
$this->view->error = $error; $this->view->error = $error;
}
} }
public function deleteShowAction() public function deleteShowAction()

View file

@ -1196,6 +1196,7 @@ class Application_Model_Show {
{ {
global $CC_DBC; global $CC_DBC;
//UTC DateTime object
$showsPopUntil = Application_Model_Preference::GetShowsPopulatedUntil(); $showsPopUntil = Application_Model_Preference::GetShowsPopulatedUntil();
//if application is requesting shows past our previous populated until date, generate shows up until this point. //if application is requesting shows past our previous populated until date, generate shows up until this point.

View file

@ -251,7 +251,7 @@ class Application_Model_ShowInstance {
$mins = abs($deltaMin%60); $mins = abs($deltaMin%60);
$today_timestamp = date("Y-m-d H:i:s"); $today_timestamp = Application_Model_DateHelper::ConvertToUtcDateTime(date("Y-m-d H:i:s"))->format("Y-m-d H:i:s");
$starts = $this->getShowInstanceStart(); $starts = $this->getShowInstanceStart();
$ends = $this->getShowInstanceEnd(); $ends = $this->getShowInstanceEnd();
@ -264,8 +264,11 @@ class Application_Model_ShowInstance {
//only need to check overlap if show increased in size. //only need to check overlap if show increased in size.
if(strtotime($new_ends) > strtotime($ends)) { if(strtotime($new_ends) > strtotime($ends)) {
//TODO --martin
$overlap = Application_Model_Show::getShows($ends, $new_ends); $utcStartDateTime = new DateTime($ends, new DateTimeZone("UTC"));
$utcEndDateTime = new DateTime($new_ends, new DateTimeZone("UTC"));
$overlap = Application_Model_Show::getShows($utcStartDateTime, $utcEndDateTime);
if(count($overlap) > 0) { if(count($overlap) > 0) {
return "Should not overlap shows"; return "Should not overlap shows";