Пример #1
0
 /**
  * Save registration option. 
  */
 function execute()
 {
     $registrationOptionDao = DAORegistry::getDAO('RegistrationOptionDAO');
     $schedConf =& Request::getSchedConf();
     if (isset($this->optionId)) {
         $registrationOption =& $registrationOptionDao->getRegistrationOption($this->optionId);
     }
     if (!isset($registrationOption)) {
         $registrationOption = new RegistrationOption();
     }
     $registrationOption->setSchedConfId($schedConf->getId());
     $registrationOption->setName($this->getData('name'), null);
     // Localized
     $registrationOption->setDescription($this->getData('description'), null);
     // Localized
     $registrationOption->setOpeningDate($this->getData('openDate'));
     $registrationOption->setClosingDate($this->getData('closeDate'));
     $registrationOption->setPublic($this->getData('notPublic') ? 0 : 1);
     $registrationOption->setCode($this->getData('code'));
     // Update or insert registration option
     if ($registrationOption->getOptionId() != null) {
         $registrationOptionDao->updateRegistrationOption($registrationOption);
     } else {
         $registrationOption->setSequence(REALLY_BIG_NUMBER);
         $registrationOptionDao->insertRegistrationOption($registrationOption);
         // Re-order the registration options so the new one is at the end of the list.
         $registrationOptionDao->resequenceRegistrationOptions($registrationOption->getSchedConfId());
     }
 }