/** * Display the form. * @param $request Request */ function display($request) { $conferenceDao = DAORegistry::getDAO('ConferenceDAO'); $conferences =& $conferenceDao->getNames(); $canOnlyRead = true; $canOnlyReview = false; if (Validation::isReviewer()) { $canOnlyRead = false; $canOnlyReview = true; } if (Validation::isSiteAdmin() || Validation::isConferenceManager() || Validation::isDirector()) { $canOnlyRead = false; $canOnlyReview = false; } // Remove the notification setting categories that the user will not be receiving (to simplify the form) $notificationSettingCategories = $this->_getNotificationSettingCategories(); if ($canOnlyRead || $canOnlyReview) { unset($notificationSettingCategories['submissions']); } if ($canOnlyRead) { unset($notificationSettingCategories['reviewing']); } $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('notificationSettingCategories', $notificationSettingCategories); $templateMgr->assign('notificationSettings', $this->_getNotificationSettingsMap()); $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('canOnlyRead', $canOnlyRead); $templateMgr->assign('canOnlyReview', $canOnlyReview); return parent::display($request); }
/** * Display the form. * @param $request Request */ function display($request) { $canOnlyRead = true; $canOnlyReview = false; if (Validation::isReviewer()) { $canOnlyRead = false; $canOnlyReview = true; } if (Validation::isSiteAdmin() || Validation::isJournalManager() || Validation::isEditor() || Validation::isSectionEditor()) { $canOnlyRead = false; $canOnlyReview = false; } $templateMgr =& TemplateManager::getManager(); // Remove the notification setting categories that the user will not be receiving (to simplify the form) $notificationSettingCategories = $this->_getNotificationSettingCategories(); if ($canOnlyRead || $canOnlyReview) { unset($notificationSettingCategories['submissions']); } if ($canOnlyRead) { unset($notificationSettingCategories['reviewing']); } $templateMgr->assign('notificationSettingCategories', $notificationSettingCategories); $templateMgr->assign('notificationSettings', $this->_getNotificationSettingsMap()); $templateMgr->assign('titleVar', __('common.title')); return parent::display($request); }
/** * Validate that user is a reviewer in the selected journal. * Redirects to user index page if not properly authenticated. * Note that subclasses using access keys should not call this method. */ function validate() { parent::validate(); $journal =& Request::getJournal(); if (!isset($journal) || !Validation::isReviewer($journal->getJournalId())) { Validation::redirectLogin(); } }
/** * Display the form. */ function display() { $canOnlyRead = true; $canOnlyReview = false; if (Validation::isReviewer()) { $canOnlyRead = false; $canOnlyReview = true; } if (Validation::isSiteAdmin() || Validation::isJournalManager() || Validation::isEditor() || Validation::isSectionEditor()) { $canOnlyRead = false; $canOnlyReview = false; } $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('canOnlyRead', $canOnlyRead); $templateMgr->assign('canOnlyReview', $canOnlyReview); return parent::display(); }
/** * Display the form. */ function display() { $conferenceDao =& DAORegistry::getDAO('ConferenceDAO'); $conferences =& $conferenceDao->getConferenceTitles(); $canOnlyRead = true; $canOnlyReview = false; if (Validation::isReviewer()) { $canOnlyRead = false; $canOnlyReview = true; } if (Validation::isSiteAdmin() || Validation::isConferenceManager() || Validation::isDirector()) { $canOnlyRead = false; $canOnlyReview = false; } $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('canOnlyRead', $canOnlyRead); $templateMgr->assign('canOnlyReview', $canOnlyReview); return parent::display(); }
/** * Display the form. */ function display() { $canOnlyRead = true; $canOnlyReview = false; // FIXME: Bug #6538. These policies used to use several role checks // that are no longer appropriate / have been removed. The remaining // ones should be too. if (Validation::isReviewer()) { $canOnlyRead = false; $canOnlyReview = true; } if (Validation::isSiteAdmin()) { $canOnlyRead = false; $canOnlyReview = false; } $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('canOnlyRead', $canOnlyRead); $templateMgr->assign('canOnlyReview', $canOnlyReview); return parent::display(); }
/** * Gather information about a user's role within a conference. * @param $userId int * @param $conferenceId int * @param $submissionsCount array reference * @param $isValid array reference */ function getRoleDataForConference($userId, $conferenceId, $schedConfId, &$submissionsCount, &$isValid) { if (Validation::isConferenceManager($conferenceId)) { $conferenceDao =& DAORegistry::getDAO('ConferenceDAO'); $isValid["ConferenceManager"][$conferenceId][$schedConfId] = true; } if (Validation::isDirector($conferenceId, $schedConfId)) { $isValid["Director"][$conferenceId][$schedConfId] = true; $directorSubmissionDao =& DAORegistry::getDAO('DirectorSubmissionDAO'); $submissionsCount["Director"][$conferenceId][$schedConfId] = $directorSubmissionDao->getDirectorSubmissionsCount($schedConfId); } if (Validation::isTrackDirector($conferenceId, $schedConfId)) { $trackDirectorSubmissionDao =& DAORegistry::getDAO('TrackDirectorSubmissionDAO'); $submissionsCount["TrackDirector"][$conferenceId][$schedConfId] = $trackDirectorSubmissionDao->getTrackDirectorSubmissionsCount($userId, $schedConfId); $isValid["TrackDirector"][$conferenceId][$schedConfId] = true; } if (Validation::isReviewer($conferenceId, $schedConfId)) { $reviewerSubmissionDao =& DAORegistry::getDAO('ReviewerSubmissionDAO'); $submissionsCount["Reviewer"][$conferenceId][$schedConfId] = $reviewerSubmissionDao->getSubmissionsCount($userId, $schedConfId); $isValid["Reviewer"][$conferenceId][$schedConfId] = true; } if (Validation::isAuthor($conferenceId, $schedConfId)) { $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO'); $submissionsCount["Author"][$conferenceId][$schedConfId] = $authorSubmissionDao->getSubmissionsCount($userId, $schedConfId); $isValid["Author"][$conferenceId][$schedConfId] = true; } }
/** * 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'), 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->setCountry($this->getData('country')); $user->setBiography($this->getData('biography'), null); // Localized $userId = $user->getId(); // Insert the user interests import('lib.pkp.classes.user.InterestManager'); $interestManager = new InterestManager(); $interestManager->insertInterests($userId, $this->getData('interestsKeywords'), $this->getData('interests')); $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'); $journalDao =& DAORegistry::getDAO('JournalDAO'); // Roles $journal =& Request::getJournal(); if ($journal) { $role = new Role(); $role->setUserId($user->getId()); $role->setJournalId($journal->getId()); if ($journal->getSetting('allowRegReviewer')) { $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 ($journal->getSetting('allowRegAuthor')) { $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 ($journal->getSetting('allowRegReader')) { $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'); $journals =& $journalDao->getEnabledJournals(); $journals =& $journals->toArray(); foreach ($journals as $thisJournal) { if ($thisJournal->getSetting('publishingMode') == PUBLISHING_MODE_SUBSCRIPTION && $thisJournal->getSetting('enableOpenAccessNotification')) { $currentlyReceives = $user->getSetting('openAccessNotification', $thisJournal->getJournalId()); $shouldReceive = !empty($openAccessNotify) && in_array($thisJournal->getJournalId(), $openAccessNotify); if ($currentlyReceives != $shouldReceive) { $userSettingsDao->updateSetting($user->getId(), 'openAccessNotification', $shouldReceive, 'bool', $thisJournal->getJournalId()); } } } if ($user->getAuthId()) { $authDao =& DAORegistry::getDAO('AuthSourceDAO'); $auth =& $authDao->getPlugin($user->getAuthId()); } if (isset($auth)) { $auth->doSetUserInfo($user); } }
/** * Gather information about a user's role within a journal. * @param $userId int * @param $journalId int * @param $submissionsCount array reference * @param $isValid array reference */ function _getRoleDataForJournal($userId, $journalId, &$submissionsCount, &$isValid) { if (Validation::isJournalManager($journalId)) { $journalDao =& DAORegistry::getDAO('JournalDAO'); $isValid["JournalManager"][$journalId] = true; } if (Validation::isSubscriptionManager($journalId)) { $isValid["SubscriptionManager"][$journalId] = true; } if (Validation::isAuthor($journalId)) { $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO'); $submissionsCount["Author"][$journalId] = $authorSubmissionDao->getSubmissionsCount($userId, $journalId); $isValid["Author"][$journalId] = true; } if (Validation::isCopyeditor($journalId)) { $copyeditorSubmissionDao =& DAORegistry::getDAO('CopyeditorSubmissionDAO'); $submissionsCount["Copyeditor"][$journalId] = $copyeditorSubmissionDao->getSubmissionsCount($userId, $journalId); $isValid["Copyeditor"][$journalId] = true; } if (Validation::isLayoutEditor($journalId)) { $layoutEditorSubmissionDao =& DAORegistry::getDAO('LayoutEditorSubmissionDAO'); $submissionsCount["LayoutEditor"][$journalId] = $layoutEditorSubmissionDao->getSubmissionsCount($userId, $journalId); $isValid["LayoutEditor"][$journalId] = true; } if (Validation::isEditor($journalId)) { $editorSubmissionDao =& DAORegistry::getDAO('EditorSubmissionDAO'); $submissionsCount["Editor"][$journalId] = $editorSubmissionDao->getEditorSubmissionsCount($journalId); $isValid["Editor"][$journalId] = true; } if (Validation::isSectionEditor($journalId)) { $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO'); $submissionsCount["SectionEditor"][$journalId] = $sectionEditorSubmissionDao->getSectionEditorSubmissionsCount($userId, $journalId); $isValid["SectionEditor"][$journalId] = true; } if (Validation::isProofreader($journalId)) { $proofreaderSubmissionDao =& DAORegistry::getDAO('ProofreaderSubmissionDAO'); $submissionsCount["Proofreader"][$journalId] = $proofreaderSubmissionDao->getSubmissionsCount($userId, $journalId); $isValid["Proofreader"][$journalId] = true; } if (Validation::isReviewer($journalId)) { $reviewerSubmissionDao =& DAORegistry::getDAO('ReviewerSubmissionDAO'); $submissionsCount["Reviewer"][$journalId] = $reviewerSubmissionDao->getSubmissionsCount($userId, $journalId); $isValid["Reviewer"][$journalId] = true; } }
/** * 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); } }
/** * Save profile settings. */ function execute() { $user =& Request::getUser(); $user->setSalutation($this->getData('salutation'), null); // Opatan Inc. : Localized $user->setFirstName($this->getData('firstName'), null); // Opatan Inc. : Localized $user->setMiddleName($this->getData('middleName'), null); // Opatan Inc. : Localized $user->setLastName($this->getData('lastName'), null); // Opatan Inc. : Localized $user->setGender($this->getData('gender')); $user->setDiscipline($this->getData('discipline')); $user->setInitials($this->getData('initials')); $user->setAffiliation($this->getData('affiliation'), null); // Opatan Inc. : Localized $user->setSignature($this->getData('signature'), null); // Localized // Opatan Inc. : $this->getData('email') changed to $user->getUsername() $user->setEmail($user->getUsername()); $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 $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->updateUser($user); $roleDao =& DAORegistry::getDAO('RoleDAO'); $journalDao =& DAORegistry::getDAO('JournalDAO'); $notificationStatusDao =& DAORegistry::getDAO('NotificationStatusDAO'); // Roles $journal =& Request::getJournal(); if ($journal) { $role =& new Role(); $role->setUserId($user->getUserId()); $role->setJournalId($journal->getJournalId()); if ($journal->getSetting('allowRegReviewer')) { $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 ($journal->getSetting('allowRegAuthor')) { $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 ($journal->getSetting('allowRegReader')) { $role->setRoleId(ROLE_ID_READER); $hasRole = Validation::isReader(); $wantsRole = Request::getUserVar('readerRole'); if ($hasRole && !$wantsRole) { $roleDao->deleteRole($role); } if (!$hasRole && $wantsRole) { $roleDao->insertRole($role); } } } $journals =& $journalDao->getJournals(); $journals =& $journals->toArray(); $journalNotifications = $notificationStatusDao->getJournalNotifications($user->getUserId()); $readerNotify = Request::getUserVar('journalNotify'); foreach ($journals as $thisJournal) { $thisJournalId = $thisJournal->getJournalId(); $currentlyReceives = !empty($journalNotifications[$thisJournalId]); $shouldReceive = !empty($readerNotify) && in_array($thisJournal->getJournalId(), $readerNotify); if ($currentlyReceives != $shouldReceive) { $notificationStatusDao->setJournalNotifications($thisJournalId, $user->getUserId(), $shouldReceive); } } $openAccessNotify = Request::getUserVar('openAccessNotify'); $userSettingsDao =& DAORegistry::getDAO('UserSettingsDAO'); $journals =& $journalDao->getJournals(); $journals =& $journals->toArray(); foreach ($journals as $thisJournal) { if ($thisJournal->getSetting('enableSubscriptions') == true && $thisJournal->getSetting('enableOpenAccessNotification') == true) { $currentlyReceives = $user->getSetting('openAccessNotification', $thisJournal->getJournalId()); $shouldReceive = !empty($openAccessNotify) && in_array($thisJournal->getJournalId(), $openAccessNotify); if ($currentlyReceives != $shouldReceive) { $userSettingsDao->updateSetting($user->getUserId(), 'openAccessNotification', $shouldReceive, 'bool', $thisJournal->getJournalId()); } } } if ($user->getAuthId()) { $authDao =& DAORegistry::getDAO('AuthSourceDAO'); $auth =& $authDao->getPlugin($user->getAuthId()); } if (isset($auth)) { $auth->doSetUserInfo($user); } }
/** * 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); }