/** * Internal function to return a RegistrationOption object from a row. * @param $row array * @return RegistrationOption */ function &_returnRegistrationOptionFromRow(&$row) { $registrationOption = new RegistrationOption(); $registrationOption->setOptionId($row['option_id']); $registrationOption->setSchedConfId($row['sched_conf_id']); $registrationOption->setCode($row['code']); $registrationOption->setOpeningDate($this->dateFromDB($row['opening_date'])); $registrationOption->setClosingDate($this->dateFromDB($row['closing_date'])); $registrationOption->setSequence($row['seq']); $registrationOption->setPublic($row['pub']); $this->getDataObjectSettings('registration_option_settings', 'option_id', $row['option_id'], $registrationOption); HookRegistry::call('RegistrationOptionDAO::_returnRegistrationOptionFromRow', array(&$registrationOption, &$row)); return $registrationOption; }
/** * 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()); } }