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


PHP PKPRequest类代码示例

本文整理汇总了PHP中PKPRequest的典型用法代码示例。如果您正苦于以下问题:PHP PKPRequest类的具体用法?PHP PKPRequest怎么用?PHP PKPRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: import

 /**
  * Upload the file in an app-specific manner.
  * @param PKPRequest $request
  * @param PKPUser $user
  * @param $uploaderUserGroupId int
  * @param $revisedFileId int
  * @param $fileGenre int
  * @param $assocType int
  * @param $assocType int
  * @return SubmissionFile
  */
 function _uploadFile($request, $user, $uploaderUserGroupId, $revisedFileId, $fileGenre, $assocType, $assocId)
 {
     $context = $request->getContext();
     import('lib.pkp.classes.file.SubmissionFileManager');
     $articleFileManager = new SubmissionFileManager($context->getId(), $this->getData('submissionId'));
     $fileStage = $this->getData('fileStage');
     $submissionFile = $articleFileManager->uploadSubmissionFile('uploadedFile', $fileStage, $user->getId(), $uploaderUserGroupId, $revisedFileId, $fileGenre, $assocType, $assocId);
     return $submissionFile;
 }
开发者ID:jalperin,项目名称:ojs,代码行数:20,代码来源:SubmissionFilesUploadForm.inc.php

示例2: allowedToCreateUser

 /**
  * Determines whether the current user can create user accounts from authors present
  * in the grid.
  * @param PKPRequest $request
  * @return boolean
  */
 function allowedToCreateUser($request)
 {
     $submission = $this->getSubmission();
     $user = $request->getUser();
     $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO');
     $userGroupDao = DAORegistry::getDAO('UserGroupDAO');
     $stageAssignments = $stageAssignmentDao->getBySubmissionAndStageId($submission->getId(), $submission->getStageId(), null, $user->getId());
     while ($stageAssignment = $stageAssignments->next()) {
         $userGroup = $userGroupDao->getById($stageAssignment->getUserGroupId());
         if (in_array($userGroup->getRoleId(), array(ROLE_ID_MANAGER, ROLE_ID_EDITOR))) {
             return true;
             break;
         }
     }
     return false;
 }
开发者ID:jalperin,项目名称:ojs,代码行数:22,代码来源:AuthorGridRow.inc.php

示例3: view

 /**
  * View announcement details.
  * @param $args array optional, first parameter is the ID of the announcement to display
  */
 function view($args = array())
 {
     $this->validate();
     $this->setupTemplate();
     $announcementId = !isset($args) || empty($args) ? null : (int) $args[0];
     $announcementDao =& DAORegistry::getDAO('AnnouncementDAO');
     if ($this->_getAnnouncementsEnabled() && $this->_announcementIsValid($announcementId)) {
         $announcement =& $announcementDao->getAnnouncement($announcementId);
         if ($announcement->getDateExpire() == null || strtotime($announcement->getDateExpire()) > time()) {
             $templateMgr =& TemplateManager::getManager();
             $templateMgr->assign('announcement', $announcement);
             if ($announcement->getTypeId() == null) {
                 $templateMgr->assign('announcementTitle', $announcement->getLocalizedTitle());
             } else {
                 $templateMgr->assign('announcementTitle', $announcement->getAnnouncementTypeName() . ": " . $announcement->getLocalizedTitle());
             }
             $templateMgr->append('pageHierarchy', array(PKPRequest::url(null, 'announcement'), 'announcement.announcements'));
             $templateMgr->display('announcement/view.tpl');
         } else {
             Request::redirect(null, null, 'announcement');
         }
     } else {
         Request::redirect(null, null, 'announcement');
     }
 }
开发者ID:anorton,项目名称:pkp-lib,代码行数:29,代码来源:PKPAnnouncementHandler.inc.php

示例4: getMockRequest

 /**
  * Instantiate a mock request to the given operation.
  * @param $requestedOp string the requested operation
  * @param $context mixed a request context to be returned
  *  by the router.
  * @param $user User a user to be put into the registry.
  * @return PKPRequest
  */
 protected function getMockRequest($requestedOp, $context = null, $user = null)
 {
     // Mock a request to the permitted operation.
     $request = new PKPRequest();
     // Mock a router.
     $router = $this->getMock('PKPRouter', array('getRequestedOp', 'getContext'));
     // Mock the getRequestedOp() method.
     $router->expects($this->any())->method('getRequestedOp')->will($this->returnValue($requestedOp));
     // Mock the getContext() method.
     $router->expects($this->any())->method('getContext')->will($this->returnValue($context));
     // Put a user into the registry if one has been
     // passed in.
     if ($user instanceof User) {
         Registry::set('user', $user);
     }
     $request->setRouter($router);
     return $request;
 }
开发者ID:ramonsodoma,项目名称:pkp-lib,代码行数:26,代码来源:PolicyTestCase.inc.php

示例5: canAdminister

 /**
  * Determines whether the current user can create user accounts from authors present
  * in the grid.
  * @param PKPRequest $request
  * @return boolean
  */
 function canAdminister($request)
 {
     $submission = $this->getSubmission();
     $user = $request->getUser();
     $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO');
     $userGroupDao = DAORegistry::getDAO('UserGroupDAO');
     // If the submission hasn't been finalized, allow.
     if (!$submission->getDateSubmitted()) {
         return true;
     }
     $stageAssignments = $stageAssignmentDao->getBySubmissionAndStageId($submission->getId(), $submission->getStageId(), null, $user->getId());
     while ($stageAssignment = $stageAssignments->next()) {
         $userGroup = $userGroupDao->getById($stageAssignment->getUserGroupId());
         if (in_array($userGroup->getRoleId(), array(ROLE_ID_MANAGER))) {
             return true;
         }
     }
     return false;
 }
开发者ID:mosvits,项目名称:ojs,代码行数:25,代码来源:AuthorGridRow.inc.php

示例6: upgrade

 /**
  * Display upgrade form.
  */
 function upgrade()
 {
     $this->validate();
     $this->setupTemplate();
     if (($setLocale = PKPRequest::getUserVar('setLocale')) != null && AppLocale::isLocaleValid($setLocale)) {
         PKPRequest::setCookieVar('currentLocale', $setLocale);
     }
     $installForm = new UpgradeForm();
     $installForm->initData();
     $installForm->display();
 }
开发者ID:sedici,项目名称:ocs,代码行数:14,代码来源:PKPInstallHandler.inc.php

示例7: effect

 /**
  * @see AuthorizationPolicy::effect()
  */
 function effect()
 {
     // Get the user
     $user = $this->_request->getUser();
     if (!is_a($user, 'PKPUser')) {
         return AUTHORIZATION_DENY;
     }
     // Get the press
     $router = $this->_request->getRouter();
     $press = $router->getContext($this->_request);
     if (!is_a($press, 'Press')) {
         return AUTHORIZATION_DENY;
     }
     // Get the monograph
     $monograph = $this->getAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH);
     if (!is_a($monograph, 'Monograph')) {
         return AUTHORIZATION_DENY;
     }
     import('classes.security.authorization.internal.SeriesAssignmentRule');
     if (SeriesAssignmentRule::effect($press->getId(), $monograph->getSeriesId(), $user->getId())) {
         return AUTHORIZATION_PERMIT;
     } else {
         return AUTHORIZATION_DENY;
     }
 }
开发者ID:austinvernsonger,项目名称:omp,代码行数:28,代码来源:SeriesAssignmentPolicy.inc.php

示例8: effect

 /**
  * @see AuthorizationPolicy::effect()
  */
 function effect()
 {
     // Get the user
     $user =& $this->_request->getUser();
     if (!is_a($user, 'PKPUser')) {
         return AUTHORIZATION_DENY;
     }
     // Get the section editor submission.
     $sectionEditorSubmission =& $this->getAuthorizedContextObject(ASSOC_TYPE_ARTICLE);
     if (!is_a($sectionEditorSubmission, 'SectionEditorSubmission')) {
         return AUTHORIZATION_DENY;
     }
     // Section editors can only access submissions in their series
     // that they have been explicitly assigned to.
     $sectionEditorsDao =& DAORegistry::getDAO('SectionEditorsDAO');
     $sectionEditors =& $sectionEditorsDao->getEditorsBySectionId($sectionEditorSubmission->getJournalId(), $sectionEditorSubmission->getSectionId());
     $foundAssignment = false;
     foreach ($sectionEditors as $sectionEditor) {
         if ($sectionEditor->getId() == $user->getId()) {
             $foundAssignment = true;
         }
     }
     if ($foundAssignment) {
         return AUTHORIZATION_PERMIT;
     } else {
         return AUTHORIZATION_DENY;
     }
 }
开发者ID:JovanyJeff,项目名称:hrp,代码行数:31,代码来源:SectionSubmissionAssignmentPolicy.inc.php

示例9: effect

 /**
  * @copydoc AuthorizationPolicy::effect()
  */
 function effect()
 {
     // Get the user
     $user = $this->_request->getUser();
     if (!is_a($user, 'PKPUser')) {
         return AUTHORIZATION_DENY;
     }
     // Get the journal
     $router = $this->_request->getRouter();
     $context = $router->getContext($this->_request);
     if (!is_a($context, 'Journal')) {
         return AUTHORIZATION_DENY;
     }
     // Get the article
     $article = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION);
     if (!is_a($article, 'Article')) {
         return AUTHORIZATION_DENY;
     }
     import('classes.security.authorization.internal.SectionAssignmentRule');
     if (SectionAssignmentRule::effect($context->getId(), $article->getSectionId(), $user->getId())) {
         return AUTHORIZATION_PERMIT;
     } else {
         return AUTHORIZATION_DENY;
     }
 }
开发者ID:jalperin,项目名称:ojs,代码行数:28,代码来源:SectionAssignmentPolicy.inc.php

示例10: getSubmissionId

 /**
  * Identifies a submission id in the request.
  * @return integer|false returns false if no valid submission id could be found.
  */
 function getSubmissionId()
 {
     // Identify the submission id.
     $router =& $this->_request->getRouter();
     switch (true) {
         case is_a($router, 'PKPPageRouter'):
             if (is_numeric($this->_request->getUserVar($this->_submissionParameterName))) {
                 // We may expect a submission id in the user vars
                 return (int) $this->_request->getUserVar($this->_submissionParameterName);
             } else {
                 if (isset($this->_args[0]) && is_numeric($this->_args[0])) {
                     // Or the submission id can be expected as the first path in the argument list
                     return (int) $this->_args[0];
                 }
             }
             break;
         case is_a($router, 'PKPComponentRouter'):
             // We expect a named submission id argument.
             if (isset($this->_args[$this->_submissionParameterName]) && is_numeric($this->_args[$this->_submissionParameterName])) {
                 return (int) $this->_args[$this->_submissionParameterName];
             }
             break;
         default:
             assert(false);
     }
     return false;
 }
开发者ID:master3395,项目名称:CBPPlatform,代码行数:31,代码来源:SubmissionRequiredPolicy.inc.php

示例11: effect

 /**
  * @see AuthorizationPolicy::effect()
  */
 function effect()
 {
     // Get the user
     $user =& $this->_request->getUser();
     if (!is_a($user, 'PKPUser')) {
         return AUTHORIZATION_DENY;
     }
     // Get the press
     $router =& $this->_request->getRouter();
     $press =& $router->getContext($this->_request);
     if (!is_a($press, 'Press')) {
         return AUTHORIZATION_DENY;
     }
     // Get the monograph
     $monograph =& $this->getAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH);
     if (!is_a($monograph, 'Monograph')) {
         return AUTHORIZATION_DENY;
     }
     // Series editors can access all submissions in their series.
     // Even those they've not been explicitly assigned to.
     $seriesEditorsDao =& DAORegistry::getDAO('SeriesEditorsDAO');
     if ($seriesEditorDao->editorExists($press->getId(), $monograph->getSeriesId(), $user->getId())) {
         return AUTHORIZATION_PERMIT;
     } else {
         return AUTHORIZATION_DENY;
     }
 }
开发者ID:jerico-dev,项目名称:omp,代码行数:30,代码来源:SeriesAssignmentPolicy.inc.php

示例12: effect

 /**
  * @copydoc AuthorizationPolicy::effect()
  */
 function effect()
 {
     // Get the user
     $user = $this->_request->getUser();
     if (!is_a($user, 'PKPUser')) {
         return AUTHORIZATION_DENY;
     }
     // Get the context
     $router = $this->_request->getRouter();
     $context = $router->getContext($this->_request);
     if (!is_a($context, 'Context')) {
         return AUTHORIZATION_DENY;
     }
     // Get the submission
     $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION);
     if (!is_a($submission, 'Submission')) {
         return AUTHORIZATION_DENY;
     }
     import('lib.pkp.classes.security.authorization.internal.SectionAssignmentRule');
     if (SectionAssignmentRule::effect($context->getId(), $submission->getSectionId(), $user->getId())) {
         return AUTHORIZATION_PERMIT;
     } else {
         return AUTHORIZATION_DENY;
     }
 }
开发者ID:PublishingWithoutWalls,项目名称:pkp-lib,代码行数:28,代码来源:SectionAssignmentPolicy.inc.php

示例13: assert

 /**
  * Check whether the requested operation is on
  * the list of permitted operations.
  * @return boolean
  */
 function _checkOperationWhitelist()
 {
     // Only permit if the requested operation has been whitelisted.
     $router =& $this->_request->getRouter();
     $requestedOperation = $router->getRequestedOp($this->_request);
     assert(!empty($requestedOperation));
     return in_array($requestedOperation, $this->_operations);
 }
开发者ID:JovanyJeff,项目名称:hrp,代码行数:13,代码来源:HandlerOperationPolicy.inc.php

示例14: effect

 /**
  * @see AuthorizationPolicy::effect()
  */
 function effect()
 {
     // Check the request protocol
     if ($this->_request->getProtocol() == 'https') {
         return AUTHORIZATION_PERMIT;
     } else {
         return AUTHORIZATION_DENY;
     }
 }
开发者ID:EreminDm,项目名称:water-cao,代码行数:12,代码来源:HttpsPolicy.inc.php

示例15: getDataObjectId

 /**
  * Identifies a submission id in the request.
  * @return integer|false returns false if no valid submission id could be found.
  */
 function getDataObjectId()
 {
     // Identify the data object id.
     $router = $this->_request->getRouter();
     switch (true) {
         case is_a($router, 'PKPPageRouter'):
             if (ctype_digit((string) $this->_request->getUserVar($this->_parameterName))) {
                 // We may expect a object id in the user vars
                 return (int) $this->_request->getUserVar($this->_parameterName);
             } else {
                 if (isset($this->_args[0]) && ctype_digit((string) $this->_args[0])) {
                     // Or the object id can be expected as the first path in the argument list
                     return (int) $this->_args[0];
                 }
             }
             break;
         case is_a($router, 'PKPComponentRouter'):
             // We expect a named object id argument.
             if (isset($this->_args[$this->_parameterName]) && ctype_digit((string) $this->_args[$this->_parameterName])) {
                 return (int) $this->_args[$this->_parameterName];
             }
             break;
         default:
             assert(false);
     }
     return false;
 }
开发者ID:jprk,项目名称:pkp-lib,代码行数:31,代码来源:DataObjectRequiredPolicy.inc.php


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