当前位置: 首页>>代码示例>>PHP>>正文


PHP Validation::isAuthor方法代码示例

本文整理汇总了PHP中Validation::isAuthor方法的典型用法代码示例。如果您正苦于以下问题:PHP Validation::isAuthor方法的具体用法?PHP Validation::isAuthor怎么用?PHP Validation::isAuthor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Validation的用法示例。


在下文中一共展示了Validation::isAuthor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: viewBookForReview

 /**
  * 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');
 }
开发者ID:yuricampos,项目名称:ojs,代码行数:32,代码来源:BooksForReviewHandler.inc.php

示例2: validate

 /**
  * 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);
 }
开发者ID:LiteratimBi,项目名称:jupitertfn,代码行数:13,代码来源:AuthorHandler.inc.php

示例3: allowedPrePublicationAccess

 /**
  * 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;
 }
开发者ID:ramonsodoma,项目名称:ojs,代码行数:31,代码来源:IssueAction.inc.php

示例4: submit

 /**
  * 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();
 }
开发者ID:ramonsodoma,项目名称:ocs,代码行数:29,代码来源:SubmitHandler.inc.php

示例5: 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'), 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)) {
//.........这里部分代码省略.........
开发者ID:master3395,项目名称:CBPPlatform,代码行数:101,代码来源:ProfileForm.inc.php

示例6: authorize

 /**
  * 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);
 }
开发者ID:utlib,项目名称:ojs,代码行数:21,代码来源:BooksForReviewAuthorHandler.inc.php

示例7: allowedPrePublicationAccess

 /**
  * 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;
 }
开发者ID:ingmarschuster,项目名称:MindResearchRepository,代码行数:36,代码来源:IssueAction.inc.php

示例8: _getRoleDataForJournal

 /**
  * 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;
     }
 }
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:52,代码来源:UserHandler.inc.php

示例9: 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);
 }
开发者ID:artkuo,项目名称:ocs,代码行数:66,代码来源:ProfileForm.inc.php

示例10: TemplateManager

 /**
  * 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;
 }
开发者ID:pulipulichen,项目名称:ocs,代码行数:37,代码来源:PKPTemplateManager.inc.php

示例11: viewObjectForReview

 /**
  * 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');
     }
 }
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:62,代码来源:ObjectsForReviewHandler.inc.php

示例12: 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);
//.........这里部分代码省略.........
开发者ID:jmacgreg,项目名称:ocs,代码行数:101,代码来源:ProfileForm.inc.php

示例13: allowedPrePublicationAccess

 /**
  * 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;
 }
开发者ID:mariojp,项目名称:ojs,代码行数:27,代码来源:IssueAction.inc.php

示例14: execute

 /**
  * 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');
//.........这里部分代码省略.........
开发者ID:alenoosh,项目名称:ojs,代码行数:101,代码来源:ProfileForm.inc.php

示例15: getRoleDataForConference

 /**
  * 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;
     }
 }
开发者ID:pulipulichen,项目名称:ocs,代码行数:34,代码来源:UserHandler.inc.php


注:本文中的Validation::isAuthor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。