Esempio n. 1
0
 /**
  * Import registrations and registration types.
  */
 function importRegistrations()
 {
     if ($this->hasOption('verbose')) {
         printf("Importing registrations\n");
     }
     $registrationTypeDao =& DAORegistry::getDAO('RegistrationTypeDAO');
     $registrationDao =& DAORegistry::getDAO('RegistrationDAO');
     $userDao =& DAORegistry::getDAO('UserDAO');
     $registrationTypes = array();
     foreach ($this->conferenceInfo as $conferenceId => $conferenceInfo) {
         $levels = array_map('trim', split("\n", Core::cleanVar($conferenceInfo['reg_levels'])));
         $fees = array_map('trim', split("\n", Core::cleanVar($conferenceInfo['reg_fees'])));
         $levelsLate = array_map('trim', split("\n", Core::cleanVar($conferenceInfo['reg_levels_late'])));
         $feesLate = array_map('trim', split("\n", Core::cleanVar($conferenceInfo['reg_fees_late'])));
         $lateDate = Core::cleanVar($conferenceInfo['reg_late_date']);
         $schedConf =& $this->schedConfMap[$conferenceId];
         foreach ($levels as $key => $level) {
             $fee = $fees[$key];
             $registrationType = new RegistrationType();
             $registrationType->setSchedConfId($schedConf->getId());
             $registrationType->setName($level, Locale::getLocale());
             $registrationType->setCost($fee);
             $registrationType->setCurrencyCodeAlpha('USD');
             // FIXME?
             $registrationType->setOpeningDate(Core::cleanVar($conferenceInfo['accept_deadline']));
             $registrationType->setClosingDate($lateDate);
             $registrationType->setAccess(REGISTRATION_TYPE_ACCESS_ONLINE);
             $registrationType->setPublic(0);
             $registrationType->setInstitutional(0);
             $registrationType->setMembership(0);
             $registrationType->setSequence($key);
             $registrationTypeDao->insertRegistrationType($registrationType);
             $registrationTypes[substr($level, 0, 60)] =& $registrationType;
             // Truncated in 1.x DB
             unset($registrationType);
         }
         foreach ($levelsLate as $key => $level) {
             $fee = $feesLate[$key];
             $registrationType = new RegistrationType();
             $registrationType->setSchedConfId($schedConf->getId());
             $registrationType->setName($level . ' (Late)', Locale::getLocale());
             $registrationType->setCost($fee);
             $registrationType->setCurrencyCodeAlpha('USD');
             // FIXME?
             $registrationType->setOpeningDate($lateDate);
             $registrationType->setClosingDate(Core::cleanVar($conferenceInfo['start_date']));
             $registrationType->setAccess(REGISTRATION_TYPE_ACCESS_ONLINE);
             $registrationType->setPublic(0);
             $registrationType->setInstitutional(0);
             $registrationType->setMembership(0);
             $registrationType->setSequence($key);
             $registrationTypeDao->insertRegistrationType($registrationType);
             $registrationTypes[substr($level, 0, 60) . ' (Late)'] =& $registrationType;
             // Truncated in 1.x DB
             unset($registrationType);
         }
     }
     $result =& $this->importDao->retrieve('SELECT * FROM registrants ORDER BY cf, id');
     while (!$result->EOF) {
         $row =& $result->fields;
         $schedConf =& $this->schedConfMap[$row['cf']];
         $email = Core::cleanVar($row['email']);
         if (!($user =& $userDao->getUserByEmail($email))) {
             // The user doesn't exist by email; create one.
             $name = Core::cleanVar($row['name']);
             $nameParts = split(' ', $name);
             $lastName = array_pop($nameParts);
             $firstName = join(' ', $nameParts);
             $user = new User();
             $user->setEmail($email);
             $user->setFirstName($firstName);
             $user->setLastName($lastName);
             $user->setPhone(Core::cleanVar($row['phone']));
             $user->setFax(Core::cleanVar($row['fax']));
             $user->setMailingAddress(Core::cleanVar($row['address']));
             $i = "";
             while ($userDao->userExistsByUsername($lastName . $i)) {
                 $i++;
             }
             $user->setUsername($lastName . $i);
             $user->setDateRegistered($row['date_registered']);
             $user->setDateLastLogin(null);
             $user->setMustChangePassword(1);
             $password = Validation::generatePassword();
             $user->setPassword(Validation::encryptCredentials($user->getUsername(), $password));
             $userDao->insertUser($user);
             if ($this->hasOption('emailUsers')) {
                 import('classes.mail.MailTemplate');
                 $mail = new MailTemplate('USER_REGISTER');
                 $mail->setFrom($schedConf->getSetting('contactEmail'), $schedConf->getSetting('contactName'));
                 $mail->assignParams(array('username' => $user->getUsername(), 'password' => $password, 'conferenceName' => $schedConf->getFullTitle()));
                 $mail->addRecipient($user->getEmail(), $user->getFullName());
                 $mail->send();
             }
         }
         $regLevel = trim(Core::cleanVar($row['reg_level']));
         $regFee = Core::cleanVar($row['reg_fee']);
         $conferenceInfo =& $this->conferenceInfo[$row['cf']];
         $seekingRegLevel = $regLevel . (strtotime($row['date_registered']) > strtotime($conferenceInfo['reg_late_date']) ? ' (Late)' : '');
         $registrationType =& $registrationTypes[$seekingRegLevel];
         if (!$registrationType || $registrationType->getCost() != $regFee) {
             if (!$registrationType) {
                 $this->errors[] = "Registration data inconsistency: Registration type \"{$seekingRegLevel}\" not found for user with email {$email}.";
             } else {
                 $this->errors[] = "Registration data inconsistency: Paid registration fee {$regFee} does not match registration type cost for \"{$seekingRegLevel}\" (" . $registrationType->getCost() . ") for user with email {$email}.";
                 unset($registrationType);
             }
             unset($user);
             unset($schedConf);
             $result->MoveNext();
             continue;
         }
         if ($registrationDao->registrationExistsByUser($user->getId(), $schedConf->getId())) {
             $this->errors[] = "A duplicate registration (level \"{$seekingRegLevel}\") was skipped for user with email {$email}.";
         } else {
             $registration = new Registration();
             $registration->setSchedConfId($schedConf->getId());
             $registration->setUserId($user->getId());
             $registration->setTypeId($registrationType->getTypeId());
             if ($row['has_paid'] == 'paid') {
                 $registration->setDatePaid(Core::cleanVar($row['date_paid']));
             }
             $registration->setSpecialRequests(Core::cleanVar($row['special_requests']));
             $registration->setDateRegistered($row['date_registered']);
             $registrationDao->insertRegistration($registration);
             unset($registration);
         }
         unset($user);
         unset($registrationType);
         unset($conferenceInfo);
         unset($schedConf);
         $result->MoveNext();
     }
     $result->Close();
 }
Esempio n. 2
0
 /**
  * Save registration. 
  */
 function execute()
 {
     $registrationDao =& DAORegistry::getDAO('RegistrationDAO');
     $schedConf =& Request::getSchedConf();
     if (isset($this->registrationId)) {
         $registration =& $registrationDao->getRegistration($this->registrationId);
     }
     if (!isset($registration)) {
         $registration = new Registration();
         $registration->setDateRegistered(time());
     }
     $registration->setSchedConfId($schedConf->getId());
     $registration->setUserId($this->getData('userId'));
     $registration->setTypeId($this->getData('typeId'));
     $registration->setApplicationForm($this->getData('applicationForm'));
     $registration->setSurvey($this->getData('survey'));
     $registration->setMembership($this->getData('membership') ? $this->getData('membership') : null);
     $registration->setDomain($this->getData('domain') ? $this->getData('domain') : null);
     $registration->setIPRange($this->getData('ipRange') ? $this->getData('ipRange') : null);
     $registration->setSpecialRequests($this->getData('specialRequests') ? $this->getData('specialRequests') : null);
     // Send an email to the registrant informing them that their payment was received
     if ($this->getData('notifyPaymentEmail')) {
         $userDao =& DAORegistry::getDAO('UserDAO');
         $schedConfName = $schedConf->getSchedConfTitle();
         $schedConfId = $schedConf->getId();
         $user =& $userDao->getUser($this->getData('userId'));
         list($registrationEmail, $registrationName, $registrationContactSignature) = $this->getRegistrationContactInformation($schedConfId);
         $paramArray = array('registrantName' => $user->getFullName(), 'schedConfName' => $schedConfName, 'registrationContactSignature' => $registrationContactSignature);
         import('mail.MailTemplate');
         $mail = new MailTemplate('MANUAL_PAYMENT_RECEIVED');
         $mail->setFrom($registrationEmail, $registrationName);
         $mail->assignParams($paramArray);
         $mail->addRecipient($user->getEmail(), $user->getFullName());
         $mail->send();
     }
     $registration->setDatePaid($this->getData('datePaid'));
     // Update or insert registration
     if ($registration->getId() != null) {
         $registrationDao->updateRegistration($registration);
     } else {
         $registrationDao->insertRegistration($registration);
     }
     $registrationOptionDao =& DAORegistry::getDAO('RegistrationOptionDAO');
     $registrationOptions =& $registrationOptionDao->getRegistrationOptionsBySchedConfId($schedConf->getId());
     $registrationOptionIds = (array) $this->getData('registrationOptionIds');
     $registrationOptionDao->deleteRegistrationOptionAssocByRegistrationId($this->registrationId);
     while ($registrationOption =& $registrationOptions->next()) {
         $optionId = (int) $registrationOption->getOptionId();
         if (in_array($optionId, $registrationOptionIds)) {
             $registrationOptionDao->insertRegistrationOptionAssoc($this->registrationId, $registrationOption->getOptionId());
         }
         unset($registrationOption);
     }
     if ($this->getData('notifyEmail')) {
         // Send user registration notification email
         $userDao =& DAORegistry::getDAO('UserDAO');
         $registrationTypeDao =& DAORegistry::getDAO('RegistrationTypeDAO');
         $schedConfName = $schedConf->getSchedConfTitle();
         $schedConfId = $schedConf->getId();
         $user =& $userDao->getUser($this->getData('userId'));
         $registrationType =& $registrationTypeDao->getRegistrationType($this->getData('typeId'));
         list($registrationEmail, $registrationName, $registrationContactSignature) = $this->getRegistrationContactInformation($schedConfId);
         $paramArray = array('registrantName' => $user->getFullName(), 'schedConfName' => $schedConfName, 'registrationType' => $registrationType->getSummaryString(), 'username' => $user->getEmail(), 'registrationContactSignature' => $registrationContactSignature);
         import('mail.MailTemplate');
         $mail = new MailTemplate('REGISTRATION_NOTIFY', null, null, null, null, false);
         $mail->setFrom($registrationEmail, $registrationName);
         $mail->assignParams($paramArray);
         $mail->addRecipient($user->getEmail(), $user->getFullName());
         $mail->send();
     }
 }
Esempio n. 3
0
 /**
  * Internal function to return a Registration object from a row.
  * @param $row array
  * @return Registration
  */
 function &_returnRegistrationFromRow(&$row)
 {
     $registration = new Registration();
     $registration->setId($row['registration_id']);
     $registration->setSchedConfId($row['sched_conf_id']);
     $registration->setUserId($row['user_id']);
     $registration->setTypeId($row['type_id']);
     $registration->setDateRegistered($this->dateFromDB($row['date_registered']));
     $registration->setDatePaid($this->dateFromDB($row['date_paid']));
     $registration->setMembership($row['membership']);
     $registration->setDomain($row['domain']);
     $registration->setIPRange($row['ip_range']);
     $registration->setSpecialRequests($row['special_requests']);
     $registration->setSurvey($row['survey']);
     $registration->setApplicationForm($row['application_form']);
     HookRegistry::call('RegistrationDAO::_returnRegistrationFromRow', array(&$registration, &$row));
     return $registration;
 }
Esempio n. 4
0
 /**
  * Save registration.
  */
 function execute()
 {
     $schedConf =& Request::getSchedConf();
     $user =& Request::getUser();
     if (!$user) {
         // New user
         $user = new User();
         $user->setUsername($this->getData('username'));
         $user->setFirstName($this->getData('firstName'));
         $user->setMiddleName($this->getData('middleName'));
         $user->setInitials($this->getData('initials'));
         $user->setLastName($this->getData('lastName'));
         $user->setAffiliation($this->getData('affiliation'));
         $user->setSignature($this->getData('signature'), null);
         // Localized
         $user->setEmail($this->getData('email'));
         $user->setUrl($this->getData('userUrl'));
         $user->setPhone($this->getData('phone'));
         $user->setFax($this->getData('fax'));
         $user->setMailingAddress($this->getData('mailingAddress'));
         $user->setBiography($this->getData('biography'), null);
         // Localized
         $user->setInterests($this->getData('interests'), null);
         // Localized
         $user->setDateRegistered(Core::getCurrentDate());
         $user->setCountry($this->getData('country'));
         $user->setPassword(Validation::encryptCredentials($this->getData('username'), $this->getData('password')));
         $userDao =& DAORegistry::getDAO('UserDAO');
         $userId = $userDao->insertUser($user);
         if (!$userId) {
             return REGISTRATION_FAILED;
         }
         $conference =& Request::getConference();
         $roleDao =& DAORegistry::getDAO('RoleDAO');
         $role = new Role();
         $role->setRoleId(ROLE_ID_READER);
         $role->setSchedConfId($schedConf->getId());
         $role->setConferenceId($conference->getId());
         $role->setUserId($user->getId());
         $roleDao->insertRole($role);
         $sessionManager =& SessionManager::getManager();
         $session =& $sessionManager->getUserSession();
         $session->setSessionVar('username', $user->getUsername());
         // Make sure subsequent requests to Request::getUser work
         Validation::login($this->getData('username'), $this->getData('password'), $reason);
         import('user.form.CreateAccountForm');
         CreateAccountForm::sendConfirmationEmail($user, $this->getData('password'), true);
     }
     // Get the registration type
     $registrationTypeDao =& DAORegistry::getDAO('RegistrationTypeDAO');
     $registrationType =& $registrationTypeDao->getRegistrationType($this->getData('registrationTypeId'));
     if (!$registrationType || $registrationType->getSchedConfId() != $schedConf->getId()) {
         Request::redirect('index');
     }
     import('payment.ocs.OCSPaymentManager');
     $paymentManager =& OCSPaymentManager::getManager();
     if (!$paymentManager->isConfigured()) {
         return REGISTRATION_NO_PAYMENT;
     }
     import('registration.Registration');
     $registration = new Registration();
     $registration->setSchedConfId($schedConf->getId());
     $registration->setUserId($user->getId());
     $registration->setTypeId($this->getData('registrationTypeId'));
     $registration->setSpecialRequests($this->getData('specialRequests') ? $this->getData('specialRequests') : null);
     $registration->setDateRegistered(time());
     $registrationDao =& DAORegistry::getDAO('RegistrationDAO');
     $registrationId = $registrationDao->insertRegistration($registration);
     $registrationOptionDao =& DAORegistry::getDAO('RegistrationOptionDAO');
     $registrationOptions =& $registrationOptionDao->getRegistrationOptionsBySchedConfId($schedConf->getId());
     $registrationOptionIds = (array) $this->getData('registrationOptionId');
     $cost = $registrationType->getCost();
     $registrationOptionCosts = $registrationTypeDao->getRegistrationOptionCosts($this->getData('registrationTypeId'));
     while ($registrationOption =& $registrationOptions->next()) {
         if (in_array($registrationOption->getOptionId(), $registrationOptionIds) && strtotime($registrationOption->getOpeningDate()) < time() && strtotime($registrationOption->getClosingDate()) > time() && $registrationOption->getPublic()) {
             $registrationOptionDao->insertRegistrationOptionAssoc($registrationId, $registrationOption->getOptionId());
             $cost += $registrationOptionCosts[$registrationOption->getOptionId()];
         }
         unset($registrationOption);
     }
     $queuedPayment =& $paymentManager->createQueuedPayment($schedConf->getConferenceId(), $schedConf->getId(), QUEUED_PAYMENT_TYPE_REGISTRATION, $user->getId(), $registrationId, $cost, $registrationType->getCurrencyCodeAlpha());
     $queuedPaymentId = $paymentManager->queuePayment($queuedPayment, time() + 60 * 60 * 24 * 30);
     // 30 days to complete
     if ($cost == 0) {
         $paymentManager->fulfillQueuedPayment($queuedPaymentId, $queuedPayment);
         return REGISTRATION_FREE;
     } else {
         $paymentManager->displayPaymentForm($queuedPaymentId, $queuedPayment);
     }
     return REGISTRATION_SUCCESSFUL;
 }
 /**
  * Save registration.
  */
 function execute()
 {
     $schedConf =& Request::getSchedConf();
     $user =& Request::getUser();
     $registrationOptionIds = (array) $this->getData('registrationOptionId');
     if (!$user) {
         // New user
         $user = new User();
         $user->setUsername($this->getData('username'));
         $user->setFirstName($this->getData('firstName'));
         $user->setMiddleName($this->getData('middleName'));
         $user->setInitials($this->getData('initials'));
         $user->setLastName($this->getData('lastName'));
         $user->setGender($this->getData('gender'));
         $user->setAffiliation($this->getData('affiliation'), null);
         // Localized
         $user->setSignature($this->getData('signature'), null);
         // Localized
         $user->setEmail($this->getData('email'));
         $user->setUrl($this->getData('userUrl'));
         $user->setPhone($this->getData('phone'));
         $user->setFax($this->getData('fax'));
         $user->setMailingAddress($this->getData('mailingAddress'));
         $user->setBillingAddress($this->getData('billingAddress'));
         $user->setBiography($this->getData('biography'), null);
         // Localized
         $user->setDateRegistered(Core::getCurrentDate());
         $user->setCountry($this->getData('country'));
         $user->setPassword(Validation::encryptCredentials($this->getData('username'), $this->getData('password')));
         $userDao =& DAORegistry::getDAO('UserDAO');
         $userId = $userDao->insertUser($user);
         if (!$userId) {
             return REGISTRATION_FAILED;
         }
         $conference =& Request::getConference();
         $roleDao =& DAORegistry::getDAO('RoleDAO');
         $role = new Role();
         $role->setRoleId(ROLE_ID_READER);
         $role->setSchedConfId($schedConf->getId());
         $role->setConferenceId($conference->getId());
         $role->setUserId($user->getId());
         $roleDao->insertRole($role);
         $sessionManager =& SessionManager::getManager();
         $session =& $sessionManager->getUserSession();
         $session->setSessionVar('username', $user->getUsername());
         // Make sure subsequent requests to Request::getUser work
         Validation::login($this->getData('username'), $this->getData('password'), $reason);
         import('classes.user.form.CreateAccountForm');
         CreateAccountForm::sendConfirmationEmail($user, $this->getData('password'), true);
     }
     // Get the registration type
     $registrationDao =& DAORegistry::getDAO('RegistrationDAO');
     $registrationTypeDao =& DAORegistry::getDAO('RegistrationTypeDAO');
     $registrationType =& $registrationTypeDao->getRegistrationType($this->getData('registrationTypeId'));
     if (!$registrationType || $registrationType->getSchedConfId() != $schedConf->getId()) {
         Request::redirect('index');
     }
     import('classes.payment.ocs.OCSPaymentManager');
     $paymentManager =& OCSPaymentManager::getManager();
     if (!$paymentManager->isConfigured()) {
         return REGISTRATION_NO_PAYMENT;
     }
     if ($this->_registration) {
         // An existing registration was already in place. Compare and notify someone.
         $oldRegistration =& $this->_registration;
         $oldRegistrationType =& $registrationTypeDao->getRegistrationType($oldRegistration->getTypeId());
         unset($this->_registration);
         import('mail.MailTemplate');
         $mail = new MailTemplate('USER_REGISTRATION_CHANGE');
         $mail->setFrom($schedConf->getSetting('registrationEmail'), $schedConf->getSetting('registrationName'));
         $mail->addRecipient($schedConf->getSetting('registrationEmail'), $schedConf->getSetting('registrationName'));
         $optionsDiffer = '';
         $registrationOptionDao =& DAORegistry::getDAO('RegistrationOptionDAO');
         $registrationOptionIterator =& $registrationOptionDao->getRegistrationOptionsBySchedConfId($schedConf->getId());
         $oldRegistrationOptionIds = $registrationOptionDao->getRegistrationOptions($oldRegistration->getRegistrationId());
         while ($registrationOption =& $registrationOptionIterator->next()) {
             $optionId = $registrationOption->getOptionId();
             $previouslyChosen = in_array($optionId, $oldRegistrationOptionIds);
             $newlyChosen = in_array($optionId, $registrationOptionIds);
             if ($previouslyChosen && !$newlyChosen) {
                 $optionsDiffer .= Locale::translate('schedConf.registrationOptions.removed', array('option' => $registrationOption->getRegistrationOptionName())) . "\n";
             } elseif (!$previouslyChosen && $newlyChosen) {
                 $optionsDiffer .= Locale::translate('schedConf.registrationOptions.added', array('option' => $registrationOption->getRegistrationOptionName())) . "\n";
             }
             unset($registrationOption);
         }
         $mail->assignParams(array('managerName' => $schedConf->getSetting('registrationName'), 'registrationId' => $oldRegistration->getRegistrationId(), 'registrantName' => $user->getFullName(), 'oldRegistrationType' => $oldRegistrationType->getSummaryString(), 'newRegistrationType' => $registrationType->getSummaryString(), 'differingOptions' => $optionsDiffer, 'username' => $user->getUsername(), 'registrationContactSignature' => $schedConf->getSetting('registrationName')));
         $mail->send();
         $registrationDao->deleteRegistrationById($oldRegistration->getRegistrationId());
     }
     import('classes.registration.Registration');
     $registration = new Registration();
     $registration->setSchedConfId($schedConf->getId());
     $registration->setUserId($user->getId());
     $registration->setTypeId($this->getData('registrationTypeId'));
     $registration->setSpecialRequests($this->getData('specialRequests') ? $this->getData('specialRequests') : null);
     $registration->setDateRegistered(time());
     $registrationId = $registrationDao->insertRegistration($registration);
     $registrationOptionDao =& DAORegistry::getDAO('RegistrationOptionDAO');
     $registrationOptions =& $registrationOptionDao->getRegistrationOptionsBySchedConfId($schedConf->getId());
     $cost = $registrationType->getCost();
     $registrationOptionCosts = $registrationTypeDao->getRegistrationOptionCosts($this->getData('registrationTypeId'));
     while ($registrationOption =& $registrationOptions->next()) {
         if (in_array($registrationOption->getOptionId(), $registrationOptionIds) && strtotime($registrationOption->getOpeningDate()) < time() && strtotime($registrationOption->getClosingDate()) > time() && $registrationOption->getPublic()) {
             $registrationOptionDao->insertRegistrationOptionAssoc($registrationId, $registrationOption->getOptionId());
             $cost += $registrationOptionCosts[$registrationOption->getOptionId()];
         }
         unset($registrationOption);
     }
     $queuedPayment =& $paymentManager->createQueuedPayment($schedConf->getConferenceId(), $schedConf->getId(), QUEUED_PAYMENT_TYPE_REGISTRATION, $user->getId(), $registrationId, $cost, $registrationType->getCurrencyCodeAlpha());
     $queuedPaymentId = $paymentManager->queuePayment($queuedPayment, time() + 60 * 60 * 24 * 30);
     // 30 days to complete
     if ($cost == 0) {
         $paymentManager->fulfillQueuedPayment($queuedPaymentId, $queuedPayment);
         return REGISTRATION_FREE;
     } else {
         $paymentManager->displayPaymentForm($queuedPaymentId, $queuedPayment);
     }
     $this->_registration =& $registration;
     $this->_queuedPayment =& $queuedPayment;
     // Add reviewing interests to interests table
     $interestDao =& DAORegistry::getDAO('InterestDAO');
     $interests = Request::getUserVar('interestsKeywords');
     $interests = array_map('urldecode', $interests);
     // The interests are coming in encoded -- Decode them for DB storage
     $interestTextOnly = Request::getUserVar('interests');
     if (!empty($interestsTextOnly)) {
         // If JS is disabled, this will be the input to read
         $interestsTextOnly = explode(",", $interestTextOnly);
     } else {
         $interestsTextOnly = null;
     }
     if ($interestsTextOnly && !isset($interests)) {
         $interests = $interestsTextOnly;
     } elseif (isset($interests) && !is_array($interests)) {
         $interests = array($interests);
     }
     $interestDao->insertInterests($interests, $user->getId(), true);
     return REGISTRATION_SUCCESSFUL;
 }
Esempio n. 6
0
 /**
  * Save registration. 
  */
 function execute()
 {
     $registrationDao = DAORegistry::getDAO('RegistrationDAO');
     $schedConf =& Request::getSchedConf();
     if (isset($this->registrationId)) {
         $registration =& $registrationDao->getRegistration($this->registrationId);
     }
     if (!isset($registration)) {
         $registration = new Registration();
         $registration->setDateRegistered(time());
     }
     $registration->setSchedConfId($schedConf->getId());
     $registration->setUserId($this->getData('userId'));
     $registration->setTypeId($this->getData('typeId'));
     $registration->setMembership($this->getData('membership') ? $this->getData('membership') : null);
     $registration->setDomain($this->getData('domain') ? $this->getData('domain') : null);
     $registration->setIPRange($this->getData('ipRange') ? $this->getData('ipRange') : null);
     $registration->setSpecialRequests($this->getData('specialRequests') ? $this->getData('specialRequests') : null);
     // Send an email to the registrant informing them that their payment was received
     if ($this->getData('notifyPaymentEmail')) {
         $userDao = DAORegistry::getDAO('UserDAO');
         $schedConfName = $schedConf->getLocalizedName();
         $schedConfId = $schedConf->getId();
         $user =& $userDao->getById($this->getData('userId'));
         list($registrationEmail, $registrationName, $registrationContactSignature) = $this->getRegistrationContactInformation($schedConfId);
         $paramArray = array('registrantName' => $user->getFullName(), 'schedConfName' => $schedConfName, 'registrationContactSignature' => $registrationContactSignature);
         import('classes.mail.MailTemplate');
         $mail = new MailTemplate('MANUAL_PAYMENT_RECEIVED');
         $mail->setFrom($registrationEmail, $registrationName);
         $mail->assignParams($paramArray);
         $mail->addRecipient($user->getEmail(), $user->getFullName());
         $mail->send();
     }
     $registration->setDatePaid($this->getData('datePaid'));
     // Update or insert registration
     if ($registration->getId() != null) {
         $registrationDao->updateRegistration($registration);
     } else {
         $registrationDao->insertRegistration($registration);
     }
     $registrationOptionDao = DAORegistry::getDAO('RegistrationOptionDAO');
     $registrationOptions =& $registrationOptionDao->getRegistrationOptionsBySchedConfId($schedConf->getId());
     $registrationOptionIds = (array) $this->getData('registrationOptionIds');
     $registrationOptionDao->deleteRegistrationOptionAssocByRegistrationId($this->registrationId);
     $registrationTypeDao = DAORegistry::getDAO('RegistrationTypeDAO');
     $registrationType =& $registrationTypeDao->getRegistrationType($registration->getTypeId());
     // Present the itemized costs in the notification email
     $totalCost = $registrationType->getCost();
     $registrationOptionCosts = $registrationTypeDao->getRegistrationOptionCosts($registration->getTypeId());
     $registrationOptionText = '';
     // Record registration options (and tally up itemized costs for the email)
     while ($registrationOption =& $registrationOptions->next()) {
         $optionId = (int) $registrationOption->getOptionId();
         $optionCost = isset($registrationOptionCosts[$optionId]) ? $registrationOptionCosts[$optionId] : 0;
         if (in_array($optionId, $registrationOptionIds)) {
             $registrationOptionDao->insertRegistrationOptionAssoc($this->registrationId, $registrationOption->getOptionId());
             $registrationOptionText .= $registrationOption->getRegistrationOptionName() . ' - ' . sprintf('%.2f', $optionCost) . ' ' . $registrationType->getCurrencyCodeAlpha() . "\n";
             $totalCost += $optionCost;
         }
         unset($registrationOption);
     }
     if ($this->getData('notifyEmail')) {
         // Send user registration notification email
         $userDao = DAORegistry::getDAO('UserDAO');
         $registrationTypeDao = DAORegistry::getDAO('RegistrationTypeDAO');
         $schedConfName = $schedConf->getLocalizedName();
         $schedConfId = $schedConf->getId();
         $user =& $userDao->getById($this->getData('userId'));
         $registrationType =& $registrationTypeDao->getRegistrationType($this->getData('typeId'));
         list($registrationEmail, $registrationName, $registrationContactSignature) = $this->getRegistrationContactInformation($schedConfId);
         $paramArray = array('registrantName' => $user->getFullName(), 'schedConfName' => $schedConfName, 'registrationType' => $registrationType->getSummaryString(), 'registrationOptions' => $registrationOptionText, 'totalCost' => $totalCost, 'username' => $user->getUsername(), 'registrationContactSignature' => $registrationContactSignature);
         import('classes.mail.MailTemplate');
         $mail = new MailTemplate('REGISTRATION_NOTIFY', null, null, null, null, false);
         $mail->setFrom($registrationEmail, $registrationName);
         $mail->assignParams($paramArray);
         $mail->addRecipient($user->getEmail(), $user->getFullName());
         $mail->send();
     }
 }