public function editShowAction() { //1) Get add_show_start_date since it might not have been sent $js = $this->_getParam('data'); $data = array(); //need to convert from serialized jQuery array. foreach ($js as $j) { $data[$j["name"]] = $j["value"]; } $data['add_show_hosts'] = $this->_getParam('hosts'); $data['add_show_day_check'] = $this->_getParam('days'); if ($data['add_show_day_check'] == "") { $data['add_show_day_check'] = null; } $show = new Application_Model_Show($data['add_show_id']); $validateStartDate = true; $validateStartTime = true; if (!array_key_exists('add_show_start_date', $data)) { //Changing the start date was disabled, since the //array key does not exist. We need to repopulate this entry from the db. //The start date will be returned in UTC time, so lets convert it to local time. $dt = Application_Common_DateHelper::ConvertToLocalDateTime($show->getStartDateAndTime()); $data['add_show_start_date'] = $dt->format("Y-m-d"); if (!array_key_exists('add_show_start_time', $data)) { $data['add_show_start_time'] = $dt->format("H:i"); $validateStartTime = false; } $validateStartDate = false; } $data['add_show_record'] = $show->isRecorded(); $origianlShowStartDateTime = Application_Common_DateHelper::ConvertToLocalDateTime($show->getStartDateAndTime()); $success = Application_Model_Schedule::addUpdateShow($data, $this, $validateStartDate, $origianlShowStartDateTime, true, $data['add_show_instance_id']); if ($success) { $scheduler = new Application_Model_Scheduler(); $showInstances = CcShowInstancesQuery::create()->filterByDbShowId($data['add_show_id'])->find(); foreach ($showInstances as $si) { $scheduler->removeGaps($si->getDbId()); } $this->view->addNewShow = true; $this->view->newForm = $this->view->render('schedule/add-show-form.phtml'); } else { if (!$validateStartDate) { $this->view->when->getElement('add_show_start_date')->setOptions(array('disabled' => true)); } if (!$validateStartTime) { $this->view->when->getElement('add_show_start_time')->setOptions(array('disabled' => true)); } $this->view->rr->getElement('add_show_record')->setOptions(array('disabled' => true)); $this->view->addNewShow = false; $this->view->action = "edit-show"; $this->view->form = $this->view->render('schedule/add-show-form.phtml'); } }