CC-3444: Ability to edit currently playing show (end time and permissions

- fixed
This commit is contained in:
James 2012-04-16 16:48:04 -04:00
parent d219c78744
commit d11fca8ac8
2 changed files with 23 additions and 6 deletions

View File

@ -89,12 +89,12 @@ class ScheduleController extends Zend_Controller_Action
Application_Model_Schedule::createNewFormSections($this->view);
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id);
if($user->isUserType(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)){
$user = Application_Model_User::GetCurrentUser();
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))){
$this->view->preloadShowForm = true;
}
$this->view->headScript()->appendScript("var weekStart = ".Application_Model_Preference::GetWeekStartDay().";");
}
@ -586,7 +586,11 @@ class ScheduleController extends Zend_Controller_Action
'add_show_repeats' => $show->isRepeating() ? 1 : 0));
if ($show->isStartDateTimeInPast()){
$formWhen->getElement('add_show_start_date')->setOptions(array('disabled' => true));
if(!$showInstance->getShow()->isRepeating()){
$formWhen->disableStartDateAndTime();
}else{
$formWhen->getElement('add_show_start_date')->setOptions(array('disabled' => true));
}
}
//need to get the days of the week in the php timezone (for the front end).
@ -684,7 +688,7 @@ class ScheduleController extends Zend_Controller_Action
$user = Application_Model_User::GetCurrentUser();
if($user->isUserType(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)){
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))){
Application_Model_Schedule::createNewFormSections($this->view);
$this->view->form = $this->view->render('schedule/add-show-form.phtml');
}
@ -765,7 +769,9 @@ class ScheduleController extends Zend_Controller_Action
//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->getStartDate());
$startTime = Application_Common_DateHelper::ConvertToLocalDateTime($show->getStartTime());
$data['add_show_start_date'] = $dt->format("Y-m-d");
$data['add_show_start_time'] = $startTime->format("H:i");
$validateStartDate = false;
}

View File

@ -131,5 +131,16 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
$element->setAttrib('disabled','disabled');
}
}
public function disableStartDateAndTime(){
$elements = array($this->getElement('add_show_start_date'), $this->getElement('add_show_start_time'));
foreach ($elements as $element)
{
if ($element->getType() != 'Zend_Form_Element_Hidden')
{
$element->setAttrib('disabled','disabled');
}
}
}
}