Пример #1
0
 /**
  * Save registration type. 
  */
 function execute()
 {
     $schedConf =& Request::getSchedConf();
     if (isset($this->typeId)) {
         $registrationType =& $this->registrationTypeDao->getRegistrationType($this->typeId);
     }
     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->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);
     }
 }
Пример #2
0
 /**
  * Internal function to return a RegistrationType object from a row.
  * @param $row array
  * @return RegistrationType
  */
 function &_returnRegistrationTypeFromRow(&$row)
 {
     $registrationType = new RegistrationType();
     $registrationType->setTypeId($row['type_id']);
     $registrationType->setSchedConfId($row['sched_conf_id']);
     $registrationType->setCode($row['code']);
     $registrationType->setCost($row['cost']);
     $registrationType->setCurrencyCodeAlpha($row['currency_code_alpha']);
     $registrationType->setOpeningDate($this->dateFromDB($row['opening_date']));
     $registrationType->setClosingDate($this->datetimeFromDB($row['closing_date']));
     $registrationType->setExpiryDate($this->datetimeFromDB($row['expiry_date']));
     $registrationType->setAccess($row['access']);
     $registrationType->setInstitutional($row['institutional']);
     $registrationType->setMembership($row['membership']);
     $registrationType->setPublic($row['pub']);
     $registrationType->setSequence($row['seq']);
     $this->getDataObjectSettings('registration_type_settings', 'type_id', $row['type_id'], $registrationType);
     HookRegistry::call('RegistrationTypeDAO::_returnRegistrationTypeFromRow', array(&$registrationType, &$row));
     return $registrationType;
 }