/** * Display form to edit a time block. * @param $args array * @param $request PKPRequest */ function editTimeBlock($args, &$request) { parent::validate(); $this->setupTemplate($request, true); $schedConf =& $request->getSchedConf(); $timeBlockId = !isset($args) || empty($args) ? null : (int) $args[0]; $timeBlockDao = DAORegistry::getDAO('TimeBlockDAO'); // Ensure time block is valid and for this conference if ($timeBlockId != null && $timeBlockDao->getTimeBlockSchedConfId($timeBlockId) == $schedConf->getId() || $timeBlockId == null) { import('classes.manager.form.scheduler.TimeBlockForm'); $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.createTimeBlockShort'); } else { $templateMgr->assign('timeBlockTitle', 'manager.scheduler.timeBlock.editTimeBlockShort'); } $timeBlockForm = new TimeBlockForm($timeBlockId); if ($timeBlockForm->isLocaleResubmit()) { $timeBlockForm->readInputData(); } else { $timeBlockForm->initData(); } $timeBlockForm->display(); } else { $request->redirect(null, null, null, 'timeBlocks'); } }
/** * Display form to edit a time block. * @param $args array optional, first parameter is the ID of the time block to edit */ function editTimeBlock($args = array()) { parent::validate(); SchedulerHandler::setupTemplate(true); $schedConf =& Request::getSchedConf(); $timeBlockId = !isset($args) || empty($args) ? null : (int) $args[0]; $timeBlockDao =& DAORegistry::getDAO('TimeBlockDAO'); // Ensure time block is valid and for this conference if ($timeBlockId != null && $timeBlockDao->getTimeBlockSchedConfId($timeBlockId) == $schedConf->getId() || $timeBlockId == null) { import('manager.form.scheduler.TimeBlockForm'); $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.createTimeBlockShort'); } else { $templateMgr->assign('timeBlockTitle', 'manager.scheduler.timeBlock.editTimeBlockShort'); } if (checkPhpVersion('5.0.0')) { // WARNING: This form needs $this in constructor $timeBlockForm = new TimeBlockForm($timeBlockId); } else { $timeBlockForm =& new TimeBlockForm($timeBlockId); } if ($timeBlockForm->isLocaleResubmit()) { $timeBlockForm->readInputData(); } else { $timeBlockForm->initData(); } $timeBlockForm->display(); } else { Request::redirect(null, null, null, 'timeBlocks'); } }