當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。