Пример #1
0
 /**
  * Save registration type. 
  */
 function execute()
 {
     $schedConf =& Request::getSchedConf();
     if (isset($this->typeId)) {
         $registrationType =& $this->registrationTypeDao->getRegistrationType($this->typeId);
         //echo 1212;
     }
     if (!isset($registrationType)) {
         $registrationType = new RegistrationType();
     }
     $registrationType->setSchedConfId($schedConf->getId());
     $registrationType->setName($this->getData('name'), null);
     // Localized
     $registrationType->setDescription($this->getData('description'), null);
     // Localized
     $registrationType->setApplicationForm($this->getData('applicationForm'), null);
     // Localized
     $registrationType->setSurvey($this->getData('survey'), null);
     // Localized
     //$registrationType->setData("survey", array("zh_TW"=>"1ccc"));
     //print_r($registrationType->getData("survey"));
     //print_r($registrationType->getData("description"));
     //$registrationType->setDescription(array("zh_TW"=>"1aaaa"), null); // Localized
     $registrationType->setCost(round($this->getData('cost'), 2));
     $registrationType->setCurrencyCodeAlpha($this->getData('currency'));
     $registrationType->setOpeningDate($this->getData('openDate'));
     $registrationType->setClosingDate($this->getData('closeDate'));
     $registrationType->setExpiryDate($this->getData('expiryDate'));
     $registrationType->setAccess($this->getData('access'));
     $registrationType->setInstitutional($this->getData('institutional') ? 1 : 0);
     $registrationType->setMembership($this->getData('membership') ? 1 : 0);
     $registrationType->setPublic($this->getData('notPublic') ? 0 : 1);
     $registrationType->setCode($this->getData('code'));
     // Update or insert registration type
     if ($registrationType->getTypeId() != null) {
         $this->registrationTypeDao->updateRegistrationType($registrationType);
         $this->registrationTypeDao->deleteRegistrationOptionCosts($registrationType->getTypeId());
     } else {
         $registrationType->setSequence(REALLY_BIG_NUMBER);
         $this->registrationTypeDao->insertRegistrationType($registrationType);
         // Re-order the registration types so the new one is at the end of the list.
         $this->registrationTypeDao->resequenceRegistrationTypes($registrationType->getSchedConfId());
     }
     $registrationOptionCosts = (array) $this->getData('registrationOptionCosts');
     foreach ($registrationOptionCosts as $optionId => $cost) {
         $this->registrationTypeDao->insertRegistrationOptionCost($registrationType->getTypeId(), $optionId, $cost);
     }
     //print_r($registrationType->getData("survey"));
     //$this->registrationTypeDao->updateRegistrationType($registrationType);
     //exit;
 }