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


PHP Validation::isReviewer方法代码示例

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


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

示例1: display

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

示例2: display

 /**
  * 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);
 }
开发者ID:EreminDm,项目名称:water-cao,代码行数:30,代码来源:NotificationSettingsForm.inc.php

示例3: validate

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

示例4: display

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

示例5: 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();
 }
开发者ID:ramonsodoma,项目名称:ocs,代码行数:22,代码来源:NotificationSettingsForm.inc.php

示例6: 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();
 }
开发者ID:jerico-dev,项目名称:omp,代码行数:23,代码来源:NotificationSettingsForm.inc.php

示例7: 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

示例8: 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

示例9: _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

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

示例11: 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

示例12: 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


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