Ejemplo n.º 1
0
 /**
  * Save changes to a timeBlock.
  */
 function updateTimeBlock($args, &$request)
 {
     parent::validate();
     $this->setupTemplate($request, true);
     import('classes.manager.form.scheduler.TimeBlockForm');
     $schedConf =& $request->getSchedConf();
     $timeBlockId = $request->getUserVar('timeBlockId') == null ? null : (int) $request->getUserVar('timeBlockId');
     $timeBlockDao = DAORegistry::getDAO('TimeBlockDAO');
     if ($timeBlockId != null && $timeBlockDao->getTimeBlockSchedConfId($timeBlockId) == $schedConf->getId() || $timeBlockId == null) {
         $timeBlockForm = new TimeBlockForm($timeBlockId);
         $timeBlockForm->readInputData();
         if ($timeBlockForm->validate()) {
             $timeBlockForm->execute();
             if ($request->getUserVar('createAnother')) {
                 // Provide last block as template
                 return $timeBlockForm->display();
             } else {
                 $request->redirect(null, null, null, 'timeBlocks');
             }
         } else {
             $templateMgr =& TemplateManager::getManager($request);
             $templateMgr->append('pageHierarchy', array($request->url(null, null, 'manager', 'timeBlocks'), 'manager.scheduler.timeBlocks'));
             if ($timeBlockId == null) {
                 $templateMgr->assign('timeBlockTitle', 'manager.scheduler.timeBlock.createTimeBlock');
             } else {
                 $templateMgr->assign('timeBlockTitle', 'manager.scheduler.timeBlock.editTimeBlock');
             }
             $timeBlockForm->display();
         }
     } else {
         $request->redirect(null, null, null, 'timeBlocks');
     }
 }
Ejemplo n.º 2
0
 /**
  * Save changes to a timeBlock.
  */
 function updateTimeBlock()
 {
     parent::validate();
     SchedulerHandler::setupTemplate(true);
     import('manager.form.scheduler.TimeBlockForm');
     $schedConf =& Request::getSchedConf();
     $timeBlockId = Request::getUserVar('timeBlockId') == null ? null : (int) Request::getUserVar('timeBlockId');
     $timeBlockDao =& DAORegistry::getDAO('TimeBlockDAO');
     if ($timeBlockId != null && $timeBlockDao->getTimeBlockSchedConfId($timeBlockId) == $schedConf->getId() || $timeBlockId == null) {
         if (checkPhpVersion('5.0.0')) {
             // WARNING: This form needs $this in constructor
             $timeBlockForm = new TimeBlockForm($timeBlockId);
         } else {
             $timeBlockForm =& new TimeBlockForm($timeBlockId);
         }
         $timeBlockForm->readInputData();
         if ($timeBlockForm->validate()) {
             $timeBlockForm->execute();
             if (Request::getUserVar('createAnother')) {
                 // Provide last block as template
                 return $timeBlockForm->display();
             } else {
                 Request::redirect(null, null, null, 'timeBlocks');
             }
         } else {
             $templateMgr =& TemplateManager::getManager();
             $templateMgr->append('pageHierarchy', array(Request::url(null, null, 'manager', 'timeBlocks'), 'manager.scheduler.timeBlocks'));
             if ($timeBlockId == null) {
                 $templateMgr->assign('timeBlockTitle', 'manager.scheduler.timeBlock.createTimeBlock');
             } else {
                 $templateMgr->assign('timeBlockTitle', 'manager.scheduler.timeBlock.editTimeBlock');
             }
             $timeBlockForm->display();
         }
     } else {
         Request::redirect(null, null, null, 'timeBlocks');
     }
 }