/**
  * Public view book for review details.
  */
 function viewBookForReview($args = array(), &$request)
 {
     $this->setupTemplate(true);
     $journal =& $request->getJournal();
     $journalId = $journal->getId();
     $bfrPlugin =& PluginRegistry::getPlugin('generic', BOOKS_FOR_REVIEW_PLUGIN_NAME);
     $bookId = !isset($args) || empty($args) ? null : (int) $args[0];
     $bfrDao =& DAORegistry::getDAO('BookForReviewDAO');
     // Ensure book for review is valid and for this journal
     if ($bfrDao->getBookForReviewJournalId($bookId) == $journalId) {
         $book =& $bfrDao->getBookForReview($bookId);
         $bfrPlugin->import('classes.BookForReview');
         // Ensure book is still available
         if ($book->getStatus() == BFR_STATUS_AVAILABLE) {
             $isAuthor = Validation::isAuthor();
             import('classes.file.PublicFileManager');
             $publicFileManager = new PublicFileManager();
             $coverPagePath = $request->getBaseUrl() . '/';
             $coverPagePath .= $publicFileManager->getJournalFilesPath($journalId) . '/';
             $templateMgr =& TemplateManager::getManager();
             $templateMgr->assign('coverPagePath', $coverPagePath);
             $templateMgr->assign('locale', AppLocale::getLocale());
             $templateMgr->assign_by_ref('bookForReview', $book);
             $templateMgr->assign('isAuthor', $isAuthor);
             $templateMgr->display($bfrPlugin->getTemplatePath() . 'bookForReview.tpl');
         }
     }
     $request->redirect(null, 'booksForReview');
 }
 /**
  * Validate that user has author permissions in the selected journal.
  * Redirects to user index page if not properly authenticated.
  */
 function validate($reason = null)
 {
     parent::validate();
     $journal =& Request::getJournal();
     if (!isset($journal) || !Validation::isAuthor($journal->getJournalId())) {
         Validation::redirectLogin($reason);
     }
     return array(&$journal);
 }
Beispiel #3
0
 /**
  * Checks if this user is granted reader access to pre-publication articles
  * based on their roles in the journal (i.e. Manager, Editor, etc).
  * @param $journal object
  * @param $article object
  * @return bool
  */
 function allowedPrePublicationAccess(&$journal, &$article)
 {
     if (IssueAction::_roleAllowedPrePublicationAccess($journal)) {
         return true;
     }
     $user =& Request::getUser();
     if ($user && $journal) {
         $journalId = $journal->getId();
         $userId = $user->getId();
         if (Validation::isAuthor($journalId)) {
             if ($article && $article->getUserId() == $userId) {
                 return true;
             }
             $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
             if ($article) {
                 $publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($article->getId(), null, true);
             }
             if (isset($publishedArticle) && $publishedArticle && $publishedArticle->getUserId() == $userId) {
                 return true;
             }
         }
     }
     return false;
 }
Beispiel #4
0
 /**
  * Display conference author paper submission.
  * Displays author index page if a valid step is not specified.
  * @param $args array optional, if set the first parameter is the step to display
  */
 function submit($args, $request)
 {
     $user =& $request->getUser();
     $schedConf =& $request->getSchedConf();
     if ($user && $schedConf && !Validation::isAuthor()) {
         // The user is logged in but not a author. If
         // possible, enroll them as a author automatically.
         $request->redirect(null, null, 'user', 'become', array('author'), array('source' => $request->url(null, null, 'author', 'submit')));
     }
     $step = (int) array_shift($args);
     $paperId = $request->getUserVar('paperId');
     $this->validate($request, $paperId, $step);
     $this->setupTemplate($request, true);
     $paper =& $this->paper;
     $formClass = "AuthorSubmitStep{$step}Form";
     import("classes.author.form.submit.{$formClass}");
     $submitForm = new $formClass($paper);
     if ($submitForm->isLocaleResubmit()) {
         $submitForm->readInputData();
     } else {
         $submitForm->initData();
     }
     $submitForm->display();
 }
 /**
  * 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);
     }
 }
 /**
  * Ensure that we have a journal, plugin is enabled, and user is author.
  */
 function authorize($request, &$args, $roleAssignments)
 {
     $journal = $request->getJournal();
     if (!isset($journal)) {
         return false;
     }
     $bfrPlugin = PluginRegistry::getPlugin('generic', BOOKS_FOR_REVIEW_PLUGIN_NAME);
     if (!isset($bfrPlugin)) {
         return false;
     }
     if (!$bfrPlugin->getEnabled()) {
         return false;
     }
     if (!Validation::isAuthor($journal->getId())) {
         Validation::redirectLogin();
     }
     return parent::authorize($request, $args, $roleAssignments);
 }
 /**
  * Checks if this user is granted reader access to pre-publication articles
  * based on their roles in the journal (i.e. Manager, Editor, etc).
  * @param $journal object
  * @param $article object
  * @return bool
  */
 function allowedPrePublicationAccess(&$journal, &$article)
 {
     $roleDao =& DAORegistry::getDAO('RoleDAO');
     $user =& Request::getUser();
     if ($user && $journal) {
         $journalId = $journal->getId();
         $userId = $user->getId();
         $subscriptionAssumedRoles = array(ROLE_ID_JOURNAL_MANAGER, ROLE_ID_EDITOR, ROLE_ID_SECTION_EDITOR, ROLE_ID_LAYOUT_EDITOR, ROLE_ID_COPYEDITOR, ROLE_ID_PROOFREADER, ROLE_ID_SUBSCRIPTION_MANAGER);
         $roles =& $roleDao->getRolesByUserId($userId, $journalId);
         foreach ($roles as $role) {
             if (in_array($role->getRoleId(), $subscriptionAssumedRoles)) {
                 return true;
             }
         }
         if (Validation::isAuthor($journalId)) {
             if ($article && $article->getUserId() == $userId) {
                 return true;
             }
             $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
             if ($article) {
                 $publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($article->getId(), null, true);
             }
             if (isset($publishedArticle) && $publishedArticle && $publishedArticle->getUserId() == $userId) {
                 return true;
             }
         }
     }
     return false;
 }
 /**
  * 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;
     }
 }
Beispiel #9
0
 /**
  * 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);
 }
 /**
  * Return an instance of the template manager.
  * @param $request PKPRequest FIXME: is optional for backwards compatibility only - make mandatory
  * @return TemplateManager the template manager object
  */
 function &getManager($request = null)
 {
     $instance =& Registry::get('templateManager', true, null);
     if ($instance === null) {
         $instance = new TemplateManager($request);
     }
     $supportedLocales = AppLocale::getSupportedLocales();
     $instance->assign('supportedLocales', $supportedLocales);
     $instance->assign('localePrecedence', AppLocale::getLocalePrecedence());
     $instance->assign('requestedPage', Request::getRequestedPage());
     $instance->assign('requestedOp', Request::getRequestedOp());
     $conference =& Request::getConference();
     if (isset($conference)) {
         $instance->assign('conferenceId', $conference->getId());
         $instance->assign('isConferenceManager', Validation::isConferenceManager($conference->getId()));
         $instance->assign('analyticsTrackingID', $conference->getSetting('analyticsTrackingID'));
         $schedConf =& Request::getSchedConf();
         if (isset($schedConf)) {
             $instance->assign('isDirector', Validation::isDirector($conference->getId(), $schedConf->getId()));
             $instance->assign('isTrackDirector', Validation::isTrackDirector($conference->getId(), $schedConf->getId()));
             $instance->assign('isAuthor', Validation::isAuthor($conference->getId(), $schedConf->getId()));
             $registrationDao =& DAORegistry::getDAO('RegistrationDAO');
             $user = Request::getUser();
             if (isset($user)) {
                 $instance->assign('isRegistrationUser', $registrationDao->isValidRegistrationByUser($user->getUserId(), $schedConf->getId()));
             }
         }
     }
     AppLocale::requireComponents(array(LOCALE_COMPONENT_OCS_MANAGER, LOCALE_COMPONENT_OCS_ADMIN, LOCALE_COMPONENT_OCS_DIRECTOR, LOCALE_COMPONENT_PKP_MANAGER, LOCALE_COMPONENT_PKP_SUBMISSION));
     // FIXME: For timeline constants
     return $instance;
 }
 /**
  * Public view object for review details.
  * @param $args array
  * @param $request PKPRequest
  */
 function viewObjectForReview($args, &$request)
 {
     // Ensure the args (object ID) exists
     $objectId = array_shift($args);
     if (!$objectId) {
         $request->redirect(null, 'objectsForReview');
     }
     $journal =& $request->getJournal();
     $journalId = $journal->getId();
     // Ensure the object exists
     $ofrDao =& DAORegistry::getDAO('ObjectForReviewDAO');
     $objectForReview =& $ofrDao->getById($objectId, $journalId);
     if (!isset($objectForReview)) {
         $request->redirect(null, 'objectsForReview');
     }
     // If object is available
     if ($objectForReview->getAvailable()) {
         // Get all metadata for the objects for review
         $reviewObjectTypeDao =& DAORegistry::getDAO('ReviewObjectTypeDAO');
         $allTypes =& $reviewObjectTypeDao->getTypeIdsAlphabetizedByContext($journalId);
         $reviewObjectMetadataDao =& DAORegistry::getDAO('ReviewObjectMetadataDAO');
         $allReviewObjectsMetadata = array();
         foreach ($allTypes as $type) {
             $typeId = $type['typeId'];
             $typeMetadata = $reviewObjectMetadataDao->getArrayByReviewObjectTypeId($typeId);
             $allReviewObjectsMetadata[$typeId] = $typeMetadata;
         }
         // If the user is an author get her/his assignments
         $isAuthor = Validation::isAuthor();
         if ($isAuthor) {
             $user =& $request->getUser();
             $ofrAssignmentDao =& DAORegistry::getDAO('ObjectForReviewAssignmentDAO');
             $authorAssignments = $ofrAssignmentDao->getObjectIds($user->getId());
         }
         $this->setupTemplate($request, true);
         $templateMgr =& TemplateManager::getManager($request);
         $templateMgr->assign('objectForReview', $objectForReview);
         $templateMgr->assign('allReviewObjectsMetadata', $allReviewObjectsMetadata);
         $templateMgr->assign('isAuthor', $isAuthor);
         $templateMgr->assign('authorAssignments', $authorAssignments);
         // Cover page path
         import('classes.file.PublicFileManager');
         $publicFileManager = new PublicFileManager();
         $coverPagePath = $request->getBaseUrl() . '/';
         $coverPagePath .= $publicFileManager->getJournalFilesPath($journalId) . '/';
         $templateMgr->assign('coverPagePath', $coverPagePath);
         $ofrPlugin =& $this->_getObjectsForReviewPlugin();
         $ofrPlugin->import('classes.ReviewObjectMetadata');
         $templateMgr->assign('multipleOptionsTypes', ReviewObjectMetadata::getMultipleOptionsTypes());
         $templateMgr->assign('locale', AppLocale::getLocale());
         $templateMgr->assign('ofrListing', false);
         $templateMgr->assign('ofrTemplatePath', $ofrPlugin->getTemplatePath());
         $templateMgr->display($ofrPlugin->getTemplatePath() . 'objectForReview.tpl');
     } else {
         $request->redirect(null, 'objectsForReview');
     }
 }
Beispiel #12
0
 /**
  * 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);
     }
 }
Beispiel #13
0
 /**
  * Checks if this user is granted reader access to pre-publication articles
  * based on their roles in the journal (i.e. Manager, Editor, etc).
  * @param $journal object
  * @param $article object
  * @return bool
  */
 function allowedPrePublicationAccess($journal, $article)
 {
     if ($this->_roleAllowedPrePublicationAccess($journal)) {
         return true;
     }
     $user = Request::getUser();
     if ($user && $journal) {
         $journalId = $journal->getId();
         $userId = $user->getId();
         if (Validation::isAuthor($journalId)) {
             $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO');
             $stageAssignments = $stageAssignmentDao->getBySubmissionAndRoleId($article->getId(), ROLE_ID_AUTHOR, null, $userId);
             $stageAssignment = $stageAssignments->next();
             if ($stageAssignment) {
                 return true;
             }
         }
     }
     return false;
 }
Beispiel #14
0
 /**
  * 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);
     }
 }
Beispiel #15
0
 /**
  * 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;
     }
 }
 function checkRole(&$conference, &$schedConf)
 {
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('isConferenceManager', Validation::isConferenceManager($conference->getId()));
     $templateMgr->assign('isDirector', Validation::isDirector($conference->getId(), $schedConf->getId()));
     $templateMgr->assign('isTrackDirector', Validation::isTrackDirector($conference->getId(), $schedConf->getId()));
     $templateMgr->assign('isAuthor', Validation::isAuthor($conference->getId(), $schedConf->getId()));
 }
 /**
  * Ensure that we have a journal, plugin is enabled, and user is author.
  * @see PKPHandler::authorize()
  */
 function authorize(&$request, &$args, $roleAssignments)
 {
     $journal =& $request->getJournal();
     if (!isset($journal)) {
         return false;
     }
     $ofrPlugin =& $this->_getObjectsForReviewPlugin();
     if (!isset($ofrPlugin)) {
         return false;
     }
     if (!$ofrPlugin->getEnabled()) {
         return false;
     }
     if (!Validation::isAuthor($journal->getId())) {
         Validation::redirectLogin();
     }
     return parent::authorize($request, $args, $roleAssignments);
 }