Beispiel #1
0
 /**
  * Save changes to a registration type.
  */
 function updateRegistrationType($args, &$request)
 {
     $this->validate();
     $this->setupTemplate($request, true);
     import('classes.registration.form.RegistrationTypeForm');
     $schedConf =& $request->getSchedConf();
     $registrationTypeId = $request->getUserVar('typeId') == null ? null : (int) $request->getUserVar('typeId');
     $registrationTypeDao = DAORegistry::getDAO('RegistrationTypeDAO');
     if ($registrationTypeId != null && $registrationTypeDao->getRegistrationTypeSchedConfId($registrationTypeId) == $schedConf->getId() || $registrationTypeId == null) {
         $registrationTypeForm = new RegistrationTypeForm($registrationTypeId);
         $registrationTypeForm->readInputData();
         if ($registrationTypeForm->validate()) {
             $registrationTypeForm->execute();
             if ($request->getUserVar('createAnother')) {
                 $templateMgr =& TemplateManager::getManager($request);
                 $templateMgr->append('pageHierarchy', array($request->url(null, null, 'manager', 'registrationTypes'), 'manager.registrationTypes'));
                 $templateMgr->assign('registrationTypeTitle', 'manager.registrationTypes.createTitle');
                 $templateMgr->assign('registrationTypeCreated', '1');
                 unset($registrationTypeForm);
                 $registrationTypeForm = new RegistrationTypeForm($registrationTypeId);
                 $registrationTypeForm->initData();
                 $registrationTypeForm->display();
             } else {
                 $request->redirect(null, null, null, 'registrationTypes');
             }
         } else {
             $templateMgr =& TemplateManager::getManager($request);
             $templateMgr->append('pageHierarchy', array($request->url(null, null, 'manager', 'registrationTypes'), 'manager.registrationTypes'));
             if ($registrationTypeId == null) {
                 $templateMgr->assign('registrationTypeTitle', 'manager.registrationTypes.createTitle');
             } else {
                 $templateMgr->assign('registrationTypeTitle', 'manager.registrationTypes.editTitle');
             }
             $registrationTypeForm->display();
         }
     } else {
         $request->redirect(null, null, null, 'registrationTypes');
     }
 }
 /**
  * Save changes to a registration type.
  */
 function updateRegistrationType()
 {
     $this->validate();
     $this->setupTemplate(true);
     import('registration.form.RegistrationTypeForm');
     $schedConf =& Request::getSchedConf();
     $registrationTypeId = Request::getUserVar('typeId') == null ? null : (int) Request::getUserVar('typeId');
     $registrationTypeDao =& DAORegistry::getDAO('RegistrationTypeDAO');
     if ($registrationTypeId != null && $registrationTypeDao->getRegistrationTypeSchedConfId($registrationTypeId) == $schedConf->getId() || $registrationTypeId == null) {
         if (checkPhpVersion('5.0.0')) {
             // WARNING: This form needs $this in constructor
             $registrationTypeForm = new RegistrationTypeForm($registrationTypeId);
         } else {
             $registrationTypeForm =& new RegistrationTypeForm($registrationTypeId);
         }
         $registrationTypeForm->readInputData();
         if ($registrationTypeForm->validate()) {
             $registrationTypeForm->execute();
             //$registrationType =& $registrationTypeDao->getRegistrationType($registrationTypeId);
             //print_r($registrationType->getData("description"));
             //print_r($registrationType->getData("survey"));
             if (Request::getUserVar('createAnother')) {
                 $templateMgr =& TemplateManager::getManager();
                 $templateMgr->append('pageHierarchy', array(Request::url(null, null, 'manager', 'registrationTypes'), 'manager.registrationTypes'));
                 $templateMgr->assign('registrationTypeTitle', 'manager.registrationTypes.createTitle');
                 $templateMgr->assign('registrationTypeCreated', '1');
                 unset($registrationTypeForm);
                 if (checkPhpVersion('5.0.0')) {
                     // WARNING: This form needs $this in constructor
                     $registrationTypeForm = new RegistrationTypeForm($registrationTypeId);
                 } else {
                     $registrationTypeForm =& new RegistrationTypeForm($registrationTypeId);
                 }
                 $registrationTypeForm->initData();
                 $registrationTypeForm->display();
             } else {
                 //exit;
                 Request::redirect(null, null, null, 'registrationTypes');
             }
         } else {
             $templateMgr =& TemplateManager::getManager();
             $templateMgr->append('pageHierarchy', array(Request::url(null, null, 'manager', 'registrationTypes'), 'manager.registrationTypes'));
             if ($registrationTypeId == null) {
                 $templateMgr->assign('registrationTypeTitle', 'manager.registrationTypes.createTitle');
             } else {
                 $templateMgr->assign('registrationTypeTitle', 'manager.registrationTypes.editTitle');
             }
             $registrationTypeForm->display();
         }
     } else {
         Request::redirect(null, null, null, 'registrationTypes');
     }
 }