Пример #1
0
 /**
  * Save changes to a special event.
  */
 function updateSpecialEvent($args, &$request)
 {
     $this->validate();
     $this->setupTemplate($request, true);
     import('classes.manager.form.scheduler.SpecialEventForm');
     $schedConf =& $request->getSchedConf();
     $specialEventId = $request->getUserVar('specialEventId') == null ? null : (int) $request->getUserVar('specialEventId');
     $specialEventDao = DAORegistry::getDAO('SpecialEventDAO');
     if ($specialEventId != null && $specialEventDao->getSpecialEventSchedConfId($specialEventId) == $schedConf->getId() || $specialEventId == null) {
         $specialEventForm = new SpecialEventForm($specialEventId);
         $specialEventForm->readInputData();
         if ($specialEventForm->validate()) {
             $specialEventForm->execute();
             if ($request->getUserVar('createAnother')) {
                 $request->redirect(null, null, null, 'createSpecialEvent');
             } else {
                 $request->redirect(null, null, null, 'specialEvents');
             }
         } else {
             $templateMgr =& TemplateManager::getManager($request);
             $templateMgr->append('pageHierarchy', array($request->url(null, null, 'manager', 'specialEvents'), 'manager.scheduler.specialEvents'));
             if ($specialEventId == null) {
                 $templateMgr->assign('specialEventTitle', 'manager.scheduler.specialEvent.createSpecialEvent');
             } else {
                 $templateMgr->assign('specialEventTitle', 'manager.scheduler.specialEvent.editSpecialEvent');
             }
             $specialEventForm->display();
         }
     } else {
         $request->redirect(null, null, null, 'specialEvents');
     }
 }
Пример #2
0
 /**
  * Save changes to a special event.
  */
 function updateSpecialEvent()
 {
     $this->validate();
     $this->setupTemplate(true);
     import('manager.form.scheduler.SpecialEventForm');
     $schedConf =& Request::getSchedConf();
     $specialEventId = Request::getUserVar('specialEventId') == null ? null : (int) Request::getUserVar('specialEventId');
     $specialEventDao =& DAORegistry::getDAO('SpecialEventDAO');
     if ($specialEventId != null && $specialEventDao->getSpecialEventSchedConfId($specialEventId) == $schedConf->getId() || $specialEventId == null) {
         if (checkPhpVersion('5.0.0')) {
             // WARNING: This form needs $this in constructor
             $specialEventForm = new SpecialEventForm($specialEventId);
         } else {
             $specialEventForm =& new SpecialEventForm($specialEventId);
         }
         $specialEventForm->readInputData();
         if ($specialEventForm->validate()) {
             $specialEventForm->execute();
             if (Request::getUserVar('createAnother')) {
                 Request::redirect(null, null, null, 'createSpecialEvent');
             } else {
                 Request::redirect(null, null, null, 'specialEvents');
             }
         } else {
             $templateMgr =& TemplateManager::getManager();
             $templateMgr->append('pageHierarchy', array(Request::url(null, null, 'manager', 'specialEvents'), 'manager.scheduler.specialEvents'));
             if ($specialEventId == null) {
                 $templateMgr->assign('specialEventTitle', 'manager.scheduler.specialEvent.createSpecialEvent');
             } else {
                 $templateMgr->assign('specialEventTitle', 'manager.scheduler.specialEvent.editSpecialEvent');
             }
             $specialEventForm->display();
         }
     } else {
         Request::redirect(null, null, null, 'specialEvents');
     }
 }