本文整理汇总了PHP中Role::setSchedConfId方法的典型用法代码示例。如果您正苦于以下问题:PHP Role::setSchedConfId方法的具体用法?PHP Role::setSchedConfId怎么用?PHP Role::setSchedConfId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Role
的用法示例。
在下文中一共展示了Role::setSchedConfId方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Role
/**
* Internal function to return a Role object from a row.
* @param $row array
* @return Role
*/
function &_returnRoleFromRow(&$row)
{
$role = new Role();
$role->setConferenceId($row['conference_id']);
$role->setSchedConfId($row['sched_conf_id']);
$role->setUserId($row['user_id']);
$role->setRoleId($row['role_id']);
HookRegistry::call('RoleDAO::_returnRoleFromRow', array(&$role, &$row));
return $role;
}
示例2: execute
/**
* Save conference settings.
*/
function execute()
{
$conferenceDao =& DAORegistry::getDAO('ConferenceDAO');
if (isset($this->conferenceId)) {
$conference =& $conferenceDao->getConference($this->conferenceId);
}
if (!isset($conference)) {
$conference = new Conference();
}
$conference->setPath($this->getData('conferencePath'));
$conference->setEnabled($this->getData('enabled'));
if ($conference->getId() != null) {
$conferenceDao->updateConference($conference);
} else {
$site =& Request::getSite();
// Give it a default primary locale.
$conference->setPrimaryLocale($site->getPrimaryLocale());
$conferenceId = $conferenceDao->insertConference($conference);
$conferenceDao->resequenceConferences();
// Make the site administrator the conference manager
$sessionManager =& SessionManager::getManager();
$userSession =& $sessionManager->getUserSession();
if ($userSession->getUserId() != null && $userSession->getUserId() != 0 && !empty($conferenceId)) {
$roleDao =& DAORegistry::getDAO('RoleDAO');
$role = new Role();
$role->setConferenceId($conferenceId);
$role->setSchedConfId(0);
$role->setUserId($userSession->getUserId());
$role->setRoleId(ROLE_ID_CONFERENCE_MANAGER);
$roleDao->insertRole($role);
}
// Make the file directories for the conference
import('file.FileManager');
FileManager::mkdir(Config::getVar('files', 'files_dir') . '/conferences/' . $conferenceId);
FileManager::mkdir(Config::getVar('files', 'files_dir') . '/conferences/' . $conferenceId . '/schedConfs');
FileManager::mkdir(Config::getVar('files', 'public_files_dir') . '/conferences/' . $conferenceId);
FileManager::mkdir(Config::getVar('files', 'public_files_dir') . '/conferences/' . $conferenceId . '/schedConfs');
// Install default conference settings
$conferenceSettingsDao =& DAORegistry::getDAO('ConferenceSettingsDAO');
$titles = $this->getData('title');
AppLocale::requireComponents(array(LOCALE_COMPONENT_OCS_DEFAULT));
$conferenceSettingsDao->installSettings($conferenceId, Config::getVar('general', 'registry_dir') . '/conferenceSettings.xml', array('privacyStatementUrl' => Request::url($this->getData('conferencePath'), 'index', 'about', 'submissions', null, null, 'privacyStatement'), 'loginUrl' => Request::url('index', 'index', 'login'), 'conferenceUrl' => Request::url($this->getData('conferencePath'), null), 'conferencePath' => $this->getData('conferencePath'), 'primaryLocale' => $site->getPrimaryLocale(), 'aboutUrl' => Request::url($this->getData('conferencePath'), 'index', 'about', null), 'accountUrl' => Request::url($this->getData('conferencePath'), 'index', 'user', 'register'), 'conferenceName' => $titles[$site->getPrimaryLocale()]));
// Install the default RT versions.
import('rt.ocs.ConferenceRTAdmin');
$conferenceRtAdmin = new ConferenceRTAdmin($conferenceId);
$conferenceRtAdmin->restoreVersions(false);
}
$conference->updateSetting('title', $this->getData('title'), 'string', true);
$conference->updateSetting('description', $this->getData('description'), 'string', true);
// Make sure all plugins are loaded for settings preload
PluginRegistry::loadAllPlugins();
HookRegistry::call('ConferenceSiteSettingsForm::execute', array(&$this, &$conference));
}
示例3: become
/**
* Become a given role.
*/
function become($args)
{
$this->addCheck(new HandlerValidatorConference($this));
$this->addCheck(new HandlerValidatorSchedConf($this));
$this->validate();
$schedConf =& Request::getSchedConf();
import('schedConf.SchedConfAction');
$user =& Request::getUser();
if (!$user) {
Request::redirect(null, null, 'index');
}
$schedConfAction = new SchedConfAction();
switch (array_shift($args)) {
case 'author':
$roleId = ROLE_ID_AUTHOR;
$func = 'allowRegAuthor';
$deniedKey = 'author.submit.authorRegistrationClosed';
break;
case 'reviewer':
$roleId = ROLE_ID_REVIEWER;
$func = 'allowRegReviewer';
$deniedKey = 'user.noRoles.regReviewerClosed';
break;
default:
Request::redirect(null, null, 'index');
}
if ($schedConfAction->{$func}($schedConf)) {
$role = new Role();
$role->setSchedConfId($schedConf->getId());
$role->setConferenceId($schedConf->getConferenceId());
$role->setRoleId($roleId);
$role->setUserId($user->getId());
$roleDao =& DAORegistry::getDAO('RoleDAO');
$roleDao->insertRole($role);
Request::redirectUrl(Request::getUserVar('source'));
} else {
$this->setupTemplate();
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('message', $deniedKey);
return $templateMgr->display('common/message.tpl');
}
}
示例4: enroll
/**
* Enroll a user in a role.
*/
function enroll($args)
{
$this->validate();
$roleId = (int) (isset($args[0]) ? $args[0] : Request::getUserVar('roleId'));
// Get a list of users to enroll -- either from the
// submitted array 'users', or the single user ID in
// 'userId'
$users = Request::getUserVar('users');
if (!isset($users) && Request::getUserVar('userId') != null) {
$users = array(Request::getUserVar('userId'));
}
$conference =& Request::getConference();
$schedConf =& Request::getSchedConf();
$roleDao =& DAORegistry::getDAO('RoleDAO');
$rolePath = $roleDao->getRolePath($roleId);
$isConferenceManager = Validation::isConferenceManager($conference->getId()) || Validation::isSiteAdmin();
// Don't allow scheduled conference directors (who can end up here) to enroll
// conference managers or scheduled conference directors.
if ($users != null && is_array($users) && $rolePath != '' && $rolePath != ROLE_PATH_SITE_ADMIN && $isConferenceManager) {
$schedConfId = $schedConf ? $schedConf->getId() : 0;
for ($i = 0; $i < count($users); $i++) {
if (!$roleDao->userHasRole($conference->getId(), $schedConfId, $users[$i], $roleId)) {
if ($schedConfId == 0) {
// In case they're enrolled in individual scheduled conferences and we want to enrol
// them in the whole conference, ensure they don't have multiple roles
$roleDao->deleteRoleByUserId($users[$i], $conference->getId(), $roleId);
} else {
if ($roleDao->userHasRole($conference->getId(), 0, $users[$i], $roleId)) {
// If they're enrolled in the whole conference, this individual
// enrollment isn't valuable.
return;
}
}
$role = new Role();
$role->setConferenceId($conference->getId());
if ($schedConf && $rolePath != ROLE_PATH_CONFERENCE_MANAGER) {
$role->setSchedConfId($schedConfId);
} else {
$role->setSchedConfId(0);
}
$role->setUserId($users[$i]);
$role->setRoleId($roleId);
$roleDao->insertRole($role);
}
}
}
Request::redirect(null, null, null, 'people', empty($rolePath) ? null : $rolePath . 's');
}
示例5: execute
/**
* Register a new user.
* @return $userId int
*/
function execute()
{
$userDao =& DAORegistry::getDAO('UserDAO');
$user = new User();
$user->setSalutation($this->getData('salutation'));
$user->setFirstName($this->getData('firstName'));
$user->setMiddleName($this->getData('middleName'));
$user->setLastName($this->getData('lastName'));
$user->setGender($this->getData('gender'));
$user->setInitials($this->getData('initials'));
$user->setAffiliation($this->getData('affiliation'));
$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->setCountry($this->getData('country'));
$user->setBiography($this->getData('biography'), null);
// Localized
$user->setInterests($this->getData('interests'), null);
// Localized
$user->setGossip($this->getData('gossip'), null);
// Localized
$user->setMustChangePassword($this->getData('mustChangePassword') ? 1 : 0);
$authDao =& DAORegistry::getDAO('AuthSourceDAO');
$auth =& $authDao->getDefaultPlugin();
$user->setAuthId($auth ? $auth->getAuthId() : 0);
$site =& Request::getSite();
$availableLocales = $site->getSupportedLocales();
$locales = array();
foreach ($this->getData('userLocales') as $locale) {
if (AppLocale::isLocaleValid($locale) && in_array($locale, $availableLocales)) {
array_push($locales, $locale);
}
}
$user->setLocales($locales);
$user->setUsername($this->getData('username'));
$password = Validation::generatePassword();
$sendNotify = $this->getData('sendNotify');
if (isset($auth)) {
$user->setPassword($password);
// FIXME Check result and handle failures
$auth->doCreateUser($user);
$user->setAuthId($auth->authId);
$user->setPassword(Validation::encryptCredentials($user->getId(), Validation::generatePassword()));
// Used for PW reset hash only
} else {
$user->setPassword(Validation::encryptCredentials($this->getData('username'), $password));
}
$user->setDateRegistered(Core::getCurrentDate());
$userId = $userDao->insertUser($user);
$roleDao =& DAORegistry::getDAO('RoleDAO');
$schedConf =& Request::getSchedConf();
$role = new Role();
$role->setConferenceId($schedConf->getConferenceId());
$role->setSchedConfId($schedConf->getId());
$role->setUserId($userId);
$role->setRoleId(ROLE_ID_REVIEWER);
$roleDao->insertRole($role);
if ($sendNotify) {
// Send welcome email to user
import('mail.MailTemplate');
$mail = new MailTemplate('USER_REGISTER');
$mail->setFrom($schedConf->getSetting('contactEmail'), $schedConf->getSetting('contactName'));
$mail->assignParams(array('username' => $this->getData('username'), 'password' => $password));
$mail->addRecipient($user->getEmail(), $user->getFullName());
$mail->send();
}
return $userId;
}
示例6: importPapers
/**
* Import papers (including metadata and files).
*/
function importPapers()
{
if ($this->hasOption('verbose')) {
printf("Importing papers\n");
}
import('classes.file.PaperFileManager');
import('classes.search.PaperSearchIndex');
$userDao =& DAORegistry::getDAO('UserDAO');
$roleDao =& DAORegistry::getDAO('RoleDAO');
$trackDao =& DAORegistry::getDAO('TrackDAO');
$paperDao =& DAORegistry::getDAO('PaperDAO');
$publishedPaperDao =& DAORegistry::getDAO('PublishedPaperDAO');
$galleyDao =& DAORegistry::getDAO('PaperGalleyDAO');
$unassignedTrackId = null;
$result =& $this->importDao->retrieve('SELECT * FROM papers ORDER by id');
while (!$result->EOF) {
$row =& $result->fields;
$schedConf =& $this->schedConfMap[$row['cf']];
$schedConfId = $schedConf->getId();
// Bring in the primary user for this paper.
$user = $userDao->getUserByUsername(Core::cleanVar($row['login']));
if (!$user) {
unset($user);
$user = new User();
$user->setUsername(Core::cleanVar($row['login']));
$user->setFirstName(Core::cleanVar($row['first_name']));
$user->setLastName(Core::cleanVar($row['surname']));
$user->setAffiliation(Core::cleanVar($row['affiliation']), Locale::getLocale());
$user->setEmail(Core::cleanVar($row['email']));
$user->setUrl(Core::cleanVar($row['url']));
$user->setBiography(Core::cleanVar($row['bio']), Locale::getLocale());
$user->setLocales(array());
$user->setDateRegistered($row['created']);
$user->setDateLastLogin($row['created']);
$user->setMustChangePassword(1);
$password = Validation::generatePassword();
$user->setPassword(Validation::encryptCredentials($user->getUsername(), $password));
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();
}
$user->setDisabled(0);
$otherUser =& $userDao->getUserByEmail(Core::cleanVar($row['email']));
if ($otherUser !== null) {
// User exists with this email -- munge it to make unique
$user->setEmail('ocs-' . Core::cleanVar($row['login']) . '+' . Core::cleanVar($row['email']));
$this->conflicts[] = array(&$otherUser, &$user);
}
unset($otherUser);
$userDao->insertUser($user);
// Make this user a author
$role = new Role();
$role->setSchedConfId($schedConf->getId());
$role->setConferenceId($schedConf->getConferenceId());
$role->setUserId($user->getId());
$role->setRoleId(ROLE_ID_AUTHOR);
$roleDao->insertRole($role);
unset($role);
}
$userId = $user->getId();
// Bring in the basic entry for the paper
$paper = new Paper();
$paper->setUserId($userId);
$paper->setLocale(Locale::getPrimaryLocale());
$paper->setSchedConfId($schedConfId);
$oldTrackId = $row['primary_track_id'];
if (!$oldTrackId || !isset($this->trackMap[$oldTrackId])) {
$oldTrackId = $row['secondary_track_id'];
}
if (!$oldTrackId || !isset($this->trackMap[$oldTrackId])) {
if (!$unassignedTrackId) {
// Create an "Unassigned" track to use for submissions
// that didn't have a track in OCS 1.x.
$track = new Track();
$track->setSchedConfId($schedConf->getId());
$track->setTitle('UNASSIGNED', Locale::getLocale());
$track->setSequence(REALLY_BIG_NUMBER);
$track->setDirectorRestricted(1);
$track->setMetaReviewed(1);
$unassignedTrackId = $trackDao->insertTrack($track);
}
$newTrackId = $unassignedTrackId;
} else {
$newTrackId = $this->trackMap[$oldTrackId];
}
$paper->setTrackId($newTrackId);
$paper->setTitle(Core::cleanVar($row['title']), Locale::getLocale());
$paper->setAbstract(Core::cleanVar($row['abstract']), Locale::getLocale());
$paper->setDiscipline(Core::cleanVar($row['discipline']), Locale::getLocale());
$paper->setSponsor(Core::cleanVar($row['sponsor']), Locale::getLocale());
$paper->setSubject(Core::cleanVar($row['topic']), Locale::getLocale());
$paper->setLanguage(Core::cleanVar($row['language']));
$paper->setDateSubmitted($row['created']);
//.........这里部分代码省略.........
示例7: enroll
function enroll($args, $request)
{
$paperId = (int) array_shift($args);
$this->validate($request, $paperId, TRACK_DIRECTOR_ACCESS_REVIEW);
$conference =& $request->getConference();
$schedConf =& $request->getSchedConf();
$submission =& $this->submission;
$roleDao =& DAORegistry::getDAO('RoleDAO');
$roleId = $roleDao->getRoleIdFromPath('reviewer');
$users = $request->getUserVar('users');
if (!is_array($users) && $request->getUserVar('userId') != null) {
$users = array($request->getUserVar('userId'));
}
// Enroll reviewer
for ($i = 0; $i < count($users); $i++) {
if (!$roleDao->userHasRole($schedConf->getConferenceId(), $schedConf->getId(), $users[$i], $roleId)) {
$role = new Role();
$role->setConferenceId($schedConf->getConferenceId());
$role->setSchedConfId($schedConf->getId());
$role->setUserId($users[$i]);
$role->setRoleId($roleId);
$roleDao->insertRole($role);
}
}
$request->redirect(null, null, null, 'selectReviewer', $paperId);
}
示例8: execute
/**
* Register a new user.
*/
function execute()
{
$requireValidation = Config::getVar('email', 'require_validation');
if ($this->existingUser) {
// Existing user in the system
$userDao =& DAORegistry::getDAO('UserDAO');
$user =& $userDao->getUserByUsername($this->getData('username'));
if ($user == null) {
return false;
}
$userId = $user->getId();
} else {
// New user
$user = new User();
$user->setUsername($this->getData('username'));
$user->setSalutation($this->getData('salutation'));
$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'));
$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'));
$site =& Request::getSite();
$availableLocales = $site->getSupportedLocales();
$locales = array();
foreach ($this->getData('userLocales') as $locale) {
if (AppLocale::isLocaleValid($locale) && in_array($locale, $availableLocales)) {
array_push($locales, $locale);
}
}
$user->setLocales($locales);
if (isset($this->defaultAuth)) {
$user->setPassword($this->getData('password'));
// FIXME Check result and handle failures
$this->defaultAuth->doCreateUser($user);
$user->setAuthId($this->defaultAuth->authId);
}
$user->setPassword(Validation::encryptCredentials($this->getData('username'), $this->getData('password')));
if ($requireValidation) {
// The account should be created in a disabled
// state.
$user->setDisabled(true);
$user->setDisabledReason(__('user.login.accountNotValidated'));
}
$userDao =& DAORegistry::getDAO('UserDAO');
$userDao->insertUser($user);
$userId = $user->getId();
if (!$userId) {
return false;
}
$sessionManager =& SessionManager::getManager();
$session =& $sessionManager->getUserSession();
$session->setSessionVar('username', $user->getUsername());
}
$conference =& Request::getConference();
$schedConf =& Request::getSchedConf();
$roleDao =& DAORegistry::getDAO('RoleDAO');
// Roles users are allowed to register themselves in
$allowedRoles = array('reader' => 'createAsReader', 'author' => 'createAsAuthor', 'reviewer' => 'createAsReviewer');
import('schedConf.SchedConfAction');
if (!SchedConfAction::allowRegReader($schedConf)) {
unset($allowedRoles['reader']);
}
if (!SchedConfAction::allowRegAuthor($schedConf)) {
unset($allowedRoles['author']);
}
if (!SchedConfAction::allowRegReviewer($schedConf)) {
unset($allowedRoles['reviewer']);
}
foreach ($allowedRoles as $k => $v) {
$roleId = $roleDao->getRoleIdFromPath($k);
if ($this->getData($v) && !$roleDao->roleExists($conference->getId(), $schedConf->getId(), $userId, $roleId)) {
$role = new Role();
$role->setConferenceId($conference->getId());
$role->setSchedConfId($schedConf->getId());
$role->setUserId($userId);
$role->setRoleId($roleId);
$roleDao->insertRole($role);
}
}
if (!$this->existingUser) {
$this->sendConfirmationEmail($user, $this->getData('password'), $this->getData('sendPassword'));
}
if (isset($allowedRoles['reader']) && $this->getData('openAccessNotification')) {
//.........这里部分代码省略.........
示例9: execute
/**
* 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;
}
示例10: execute
/**
* Save profile settings.
*/
function execute()
{
$user =& Request::getUser();
$user->setSalutation($this->getData('salutation'));
$user->setFirstName($this->getData('firstName'));
$user->setMiddleName($this->getData('middleName'));
$user->setLastName($this->getData('lastName'));
$user->setGender($this->getData('gender'));
$user->setInitials($this->getData('initials'));
$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->setCountry($this->getData('country'));
$user->setTimeZone($this->getData('timeZone'));
$user->setBiography($this->getData('biography'), null);
// Localized
$user->setInterests($this->getData('interests'), null);
// Localized
$site =& Request::getSite();
$availableLocales = $site->getSupportedLocales();
$locales = array();
foreach ($this->getData('userLocales') as $locale) {
if (Locale::isLocaleValid($locale) && in_array($locale, $availableLocales)) {
array_push($locales, $locale);
}
}
$user->setLocales($locales);
$userDao =& DAORegistry::getDAO('UserDAO');
$userDao->updateObject($user);
$roleDao =& DAORegistry::getDAO('RoleDAO');
$schedConfDao =& DAORegistry::getDAO('SchedConfDAO');
// Roles
$schedConf =& Request::getSchedConf();
if ($schedConf) {
import('schedConf.SchedConfAction');
$role = new Role();
$role->setUserId($user->getId());
$role->setConferenceId($schedConf->getConferenceId());
$role->setSchedConfId($schedConf->getId());
if (SchedConfAction::allowRegReviewer($schedConf)) {
$role->setRoleId(ROLE_ID_REVIEWER);
$hasRole = Validation::isReviewer();
$wantsRole = Request::getUserVar('reviewerRole');
if ($hasRole && !$wantsRole) {
$roleDao->deleteRole($role);
}
if (!$hasRole && $wantsRole) {
$roleDao->insertRole($role);
}
}
if (SchedConfAction::allowRegAuthor($schedConf)) {
$role->setRoleId(ROLE_ID_AUTHOR);
$hasRole = Validation::isAuthor();
$wantsRole = Request::getUserVar('authorRole');
if ($hasRole && !$wantsRole) {
$roleDao->deleteRole($role);
}
if (!$hasRole && $wantsRole) {
$roleDao->insertRole($role);
}
}
if (SchedConfAction::allowRegReader($schedConf)) {
$role->setRoleId(ROLE_ID_READER);
$hasRole = Validation::isReader();
$wantsRole = Request::getUserVar('readerRole');
if ($hasRole && !$wantsRole) {
$roleDao->deleteRole($role);
}
if (!$hasRole && $wantsRole) {
$roleDao->insertRole($role);
}
}
}
$openAccessNotify = Request::getUserVar('openAccessNotify');
$userSettingsDao =& DAORegistry::getDAO('UserSettingsDAO');
$schedConfs =& $schedConfDao->getSchedConfs();
$schedConfs =& $schedConfs->toArray();
foreach ($schedConfs as $thisSchedConf) {
if ($thisSchedConf->getSetting('enableOpenAccessNotification') == true) {
$currentlyReceives = $user->getSetting('openAccessNotification', $thisSchedConf->getId());
$shouldReceive = !empty($openAccessNotify) && in_array($thisSchedConf->getId(), $openAccessNotify);
if ($currentlyReceives != $shouldReceive) {
$userSettingsDao->updateSetting($user->getId(), 'openAccessNotification', $shouldReceive, 'bool', $thisSchedConf->getId());
}
}
}
if ($user->getAuthId()) {
$authDao =& DAORegistry::getDAO('AuthSourceDAO');
$auth =& $authDao->getPlugin($user->getAuthId());
}
if (isset($auth)) {
$auth->doSetUserInfo($user);
//.........这里部分代码省略.........
示例11: execute
/**
* Save profile settings.
*/
function execute($request)
{
$user = $this->getUser();
$user->setTimeZone($this->getData('timeZone'));
$roleDao = DAORegistry::getDAO('RoleDAO');
$schedConfDao = DAORegistry::getDAO('SchedConfDAO');
// Roles
$schedConf = Request::getSchedConf();
if ($schedConf) {
import('classes.schedConf.SchedConfAction');
$role = new Role();
$role->setUserId($user->getId());
$role->setConferenceId($schedConf->getConferenceId());
$role->setSchedConfId($schedConf->getId());
if (SchedConfAction::allowRegReviewer($schedConf)) {
$role->setRoleId(ROLE_ID_REVIEWER);
$hasRole = Validation::isReviewer();
$wantsRole = Request::getUserVar('reviewerRole');
if ($hasRole && !$wantsRole) {
$roleDao->deleteRole($role);
}
if (!$hasRole && $wantsRole) {
$roleDao->insertRole($role);
}
}
if (SchedConfAction::allowRegAuthor($schedConf)) {
$role->setRoleId(ROLE_ID_AUTHOR);
$hasRole = Validation::isAuthor();
$wantsRole = Request::getUserVar('authorRole');
if ($hasRole && !$wantsRole) {
$roleDao->deleteRole($role);
}
if (!$hasRole && $wantsRole) {
$roleDao->insertRole($role);
}
}
if (SchedConfAction::allowRegReader($schedConf)) {
$role->setRoleId(ROLE_ID_READER);
$hasRole = Validation::isReader();
$wantsRole = Request::getUserVar('readerRole');
if ($hasRole && !$wantsRole) {
$roleDao->deleteRole($role);
}
if (!$hasRole && $wantsRole) {
$roleDao->insertRole($role);
}
}
}
$openAccessNotify = Request::getUserVar('openAccessNotify');
$userSettingsDao = DAORegistry::getDAO('UserSettingsDAO');
$schedConfs = $schedConfDao->getAll();
$schedConfs = $schedConfs->toArray();
foreach ($schedConfs as $thisSchedConf) {
if ($thisSchedConf->getSetting('enableOpenAccessNotification') == true) {
$currentlyReceives = $user->getSetting('openAccessNotification', $thisSchedConf->getId());
$shouldReceive = !empty($openAccessNotify) && in_array($thisSchedConf->getId(), $openAccessNotify);
if ($currentlyReceives != $shouldReceive) {
$userSettingsDao->updateSetting($user->getId(), 'openAccessNotification', $shouldReceive, 'bool', $thisSchedConf->getId());
}
}
}
parent::execute($request);
}
示例12: execute
/**
* 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());
//.........这里部分代码省略.........
示例13: execute
/**
* Register a new user.
*/
function execute()
{
$userDao =& DAORegistry::getDAO('UserDAO');
$conference =& Request::getConference();
$schedConf =& Request::getSchedConf();
if (isset($this->userId)) {
$user =& $userDao->getUser($this->userId);
}
if (!isset($user)) {
$user = new User();
}
$user->setSalutation($this->getData('salutation'));
$user->setFirstName($this->getData('firstName'));
$user->setMiddleName($this->getData('middleName'));
$user->setLastName($this->getData('lastName'));
$user->setInitials($this->getData('initials'));
$user->setGender($this->getData('gender'));
$user->setAffiliation($this->getData('affiliation'), 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->setCountry($this->getData('country'));
$user->setBiography($this->getData('biography'), null);
// Localized
$user->setGossip($this->getData('gossip'), null);
// Localized
$user->setSignature($this->getData('signature'), null);
// Localized
$user->setMustChangePassword($this->getData('mustChangePassword') ? 1 : 0);
$user->setAuthId((int) $this->getData('authId'));
$site =& Request::getSite();
$availableLocales = $site->getSupportedLocales();
$locales = array();
foreach ($this->getData('userLocales') as $locale) {
if (Locale::isLocaleValid($locale) && in_array($locale, $availableLocales)) {
array_push($locales, $locale);
}
}
$user->setLocales($locales);
if ($user->getAuthId()) {
$authDao =& DAORegistry::getDAO('AuthSourceDAO');
$auth =& $authDao->getPlugin($user->getAuthId());
}
if ($user->getId() != null) {
$userId = $user->getId();
if ($this->getData('password') !== '') {
if (isset($auth)) {
$auth->doSetUserPassword($user->getUsername(), $this->getData('password'));
$user->setPassword(Validation::encryptCredentials($userId, Validation::generatePassword()));
// Used for PW reset hash only
} else {
$user->setPassword(Validation::encryptCredentials($user->getUsername(), $this->getData('password')));
}
}
if (isset($auth)) {
// FIXME Should try to create user here too?
$auth->doSetUserInfo($user);
}
$userDao->updateObject($user);
} else {
$user->setUsername($this->getData('username'));
if ($this->getData('generatePassword')) {
$password = Validation::generatePassword();
$sendNotify = true;
} else {
$password = $this->getData('password');
$sendNotify = $this->getData('sendNotify');
}
if (isset($auth)) {
$user->setPassword($password);
// FIXME Check result and handle failures
$auth->doCreateUser($user);
$user->setAuthId($auth->authId);
$user->setPassword(Validation::encryptCredentials($user->getId(), Validation::generatePassword()));
// Used for PW reset hash only
} else {
$user->setPassword(Validation::encryptCredentials($this->getData('username'), $password));
}
$user->setDateRegistered(Core::getCurrentDate());
$userId = $userDao->insertUser($user);
if (!empty($this->_data['enrollAs'])) {
foreach ($this->getData('enrollAs') as $roleName) {
// Enroll new user into an initial role
$roleDao =& DAORegistry::getDAO('RoleDAO');
$roleId = $roleDao->getRoleIdFromPath($roleName);
if ($roleId != null) {
$role = new Role();
$role->setConferenceId($conference->getId());
$role->setSchedConfId($schedConf ? $schedConf->getId() : 0);
$role->setUserId($userId);
$role->setRoleId($roleId);
$roleDao->insertRole($role);
}
//.........这里部分代码省略.........