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


PHP PKPRequest::getContext方法代码示例

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


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

示例1: getCachedLessFilePath

 /**
  * Retrieve the file path for a cached LESS file
  *
  * @param $name string Unique name for the LESS file
  * @return $path string Path to the less file or false if not found
  */
 public function getCachedLessFilePath($name)
 {
     $cacheDirectory = CacheManager::getFileCachePath();
     $context = $this->_request->getContext();
     $contextId = is_a($context, 'Context') ? $context->getId() : 0;
     return $cacheDirectory . DIRECTORY_SEPARATOR . $contextId . '-' . $name . '.css';
 }
开发者ID:jprk,项目名称:pkp-lib,代码行数:13,代码来源:PKPTemplateManager.inc.php

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

示例3: getCompileId

 /**
  * Calculate a compile ID for a resource.
  * @param $resourceName string Resource name.
  * @return string
  */
 function getCompileId($resourceName)
 {
     if (Config::getVar('general', 'installed')) {
         $context = $this->_request->getContext();
         if (is_a($context, 'Context')) {
             $resourceName .= $context->getSetting('themePluginPath');
         }
     }
     return sha1($resourceName);
 }
开发者ID:jalperin,项目名称:pkp-lib,代码行数:15,代码来源:PKPTemplateManager.inc.php

示例4: initialize

 /**
  * Initialize the template manager.
  */
 function initialize()
 {
     // Retrieve the router
     $router = $this->_request->getRouter();
     assert(is_a($router, 'PKPRouter'));
     $this->assign('defaultCharset', Config::getVar('i18n', 'client_charset'));
     $this->assign('basePath', $this->_request->getBasePath());
     $this->assign('baseUrl', $this->_request->getBaseUrl());
     $this->assign('requiresFormRequest', $this->_request->isPost());
     if (is_a($router, 'PKPPageRouter')) {
         $this->assign('requestedPage', $router->getRequestedPage($this->_request));
     }
     $this->assign('currentUrl', $this->_request->getCompleteUrl());
     $this->assign('dateFormatTrunc', Config::getVar('general', 'date_format_trunc'));
     $this->assign('dateFormatShort', Config::getVar('general', 'date_format_short'));
     $this->assign('dateFormatLong', Config::getVar('general', 'date_format_long'));
     $this->assign('datetimeFormatShort', Config::getVar('general', 'datetime_format_short'));
     $this->assign('datetimeFormatLong', Config::getVar('general', 'datetime_format_long'));
     $this->assign('timeFormat', Config::getVar('general', 'time_format'));
     $this->assign('allowCDN', Config::getVar('general', 'enable_cdn'));
     $this->assign('useMinifiedJavaScript', Config::getVar('general', 'enable_minified'));
     $this->assign('toggleHelpOnText', __('help.toggleInlineHelpOn'));
     $this->assign('toggleHelpOffText', __('help.toggleInlineHelpOff'));
     $this->assign('currentContext', $this->_request->getContext());
     $locale = AppLocale::getLocale();
     $this->assign('currentLocale', $locale);
     // Add uncompilable styles
     $this->addStyleSheet($this->_request->getBaseUrl() . '/styles/lib.css', STYLE_SEQUENCE_CORE);
     $dispatcher = $this->_request->getDispatcher();
     if ($dispatcher) {
         $this->addStyleSheet($dispatcher->url($this->_request, ROUTE_COMPONENT, null, 'page.PageHandler', 'css'), STYLE_SEQUENCE_CORE);
     }
     // If there's a locale-specific stylesheet, add it.
     if (($localeStyleSheet = AppLocale::getLocaleStyleSheet($locale)) != null) {
         $this->addStyleSheet($this->_request->getBaseUrl() . '/' . $localeStyleSheet);
     }
     $application = PKPApplication::getApplication();
     $this->assign('pageTitle', $application->getNameKey());
     $this->assign('applicationName', __($application->getNameKey()));
     $this->assign('exposedConstants', $application->getExposedConstants());
     $this->assign('jsLocaleKeys', $application->getJSLocaleKeys());
     // Register custom functions
     $this->register_modifier('translate', array('AppLocale', 'translate'));
     $this->register_modifier('strip_unsafe_html', array('String', 'stripUnsafeHtml'));
     $this->register_modifier('String_substr', array('String', 'substr'));
     $this->register_modifier('to_array', array($this, 'smartyToArray'));
     $this->register_modifier('compare', array($this, 'smartyCompare'));
     $this->register_modifier('concat', array($this, 'smartyConcat'));
     $this->register_modifier('escape', array($this, 'smartyEscape'));
     $this->register_modifier('strtotime', array($this, 'smartyStrtotime'));
     $this->register_modifier('explode', array($this, 'smartyExplode'));
     $this->register_modifier('assign', array($this, 'smartyAssign'));
     $this->register_function('translate', array($this, 'smartyTranslate'));
     $this->register_function('null_link_action', array($this, 'smartyNullLinkAction'));
     $this->register_function('flush', array($this, 'smartyFlush'));
     $this->register_function('call_hook', array($this, 'smartyCallHook'));
     $this->register_function('html_options_translate', array($this, 'smartyHtmlOptionsTranslate'));
     $this->register_block('iterate', array($this, 'smartyIterate'));
     $this->register_function('page_links', array($this, 'smartyPageLinks'));
     $this->register_function('page_info', array($this, 'smartyPageInfo'));
     $this->register_function('icon', array($this, 'smartyIcon'));
     $this->register_modifier('truncate', array($this, 'smartyTruncate'));
     // Modified vocabulary for creating forms
     $fbv = $this->getFBV();
     $this->register_block('fbvFormSection', array($fbv, 'smartyFBVFormSection'));
     $this->register_block('fbvFormArea', array($fbv, 'smartyFBVFormArea'));
     $this->register_function('fbvFormButtons', array($fbv, 'smartyFBVFormButtons'));
     $this->register_function('fbvElement', array($fbv, 'smartyFBVElement'));
     $this->assign('fbvStyles', $fbv->getStyles());
     $this->register_function('fieldLabel', array($fbv, 'smartyFieldLabel'));
     // register the resource name "core"
     $this->register_resource('core', array(array($this, 'smartyResourceCoreGetTemplate'), array($this, 'smartyResourceCoreGetTimestamp'), array($this, 'smartyResourceCoreGetSecure'), array($this, 'smartyResourceCoreGetTrusted')));
     $this->register_function('url', array($this, 'smartyUrl'));
     // ajax load into a div
     $this->register_function('load_url_in_div', array($this, 'smartyLoadUrlInDiv'));
     if (!defined('SESSION_DISABLE_INIT')) {
         /**
          * Kludge to make sure no code that tries to connect to
          * the database is executed (e.g., when loading
          * installer pages).
          */
         $this->assign('isUserLoggedIn', Validation::isLoggedIn());
         $this->assign('isUserLoggedInAs', Validation::isLoggedInAs());
         $application = PKPApplication::getApplication();
         $currentVersion = $application->getCurrentVersion();
         $this->assign('currentVersionString', $currentVersion->getVersionString(false));
         $this->assign('itemsPerPage', Config::getVar('interface', 'items_per_page'));
         $this->assign('numPageLinks', Config::getVar('interface', 'page_links'));
     }
     // Load enabled block plugins.
     PluginRegistry::loadCategory('blocks', true);
     if (!defined('SESSION_DISABLE_INIT')) {
         $user = $this->_request->getUser();
         $hasSystemNotifications = false;
         if ($user) {
             // Assign the user name to be used in the sitenav
             $this->assign('loggedInUsername', $user->getUserName());
//.........这里部分代码省略.........
开发者ID:doana,项目名称:pkp-lib,代码行数:101,代码来源:PKPTemplateManager.inc.php

示例5: effect

 /**
  * @see AuthorizationPolicy::effect()
  */
 function effect()
 {
     // Check if the signoff exists
     $signoffDao = DAORegistry::getDAO('SignoffDAO');
     /* @var $signoffDao SignoffDAO */
     $signoff = $signoffDao->getById($this->_request->getUserVar('signoffId'));
     $baseSignoff =& $signoff;
     // Check that the signoff exists
     if (!is_a($signoff, 'Signoff')) {
         return AUTHORIZATION_DENY;
     }
     // Check that we know what the current context is
     $context = $this->_request->getContext();
     if (!is_a($context, 'Context')) {
         return AUTHORIZATION_DENY;
     }
     // Ensure that the signoff belongs to the current context
     $signoffDao = DAORegistry::getDAO('SignoffDAO');
     $submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
     $submissionDao = Application::getSubmissionDAO();
     while (true) {
         switch ($signoff->getAssocType()) {
             case ASSOC_TYPE_SIGNOFF:
                 // This signoff is attached to another signoff.
                 // We need to determine that the attached
                 // signoff belongs to the current context.
                 $newSignoff = $signoffDao->getById($signoff->getAssocId());
                 if (!is_a($newSignoff, 'Signoff')) {
                     return AUTHORIZATION_DENY;
                 }
                 // Flip the reference so that the new object
                 // gets authorized.
                 unset($signoff);
                 $signoff =& $newSignoff;
                 unset($newSignoff);
                 break;
             case ASSOC_TYPE_SUBMISSION_FILE:
                 // Get the submission file
                 $submissionFile =& $submissionFileDao->getLatestRevision($signoff->getAssocId());
                 if (!is_a($submissionFile, 'SubmissionFile')) {
                     return AUTHORIZATION_DENY;
                 }
                 // Get the submission
                 $submission = $submissionDao->getById($submissionFile->getSubmissionId(), $context->getId());
                 if (!is_a($submission, 'Submission')) {
                     return AUTHORIZATION_DENY;
                 }
                 // Integrity checks OK. Permit.
                 $this->addAuthorizedContextObject(ASSOC_TYPE_SIGNOFF, $baseSignoff);
                 return AUTHORIZATION_PERMIT;
             case ASSOC_TYPE_SUBMISSION:
                 $submission = $submissionDao->getById($signoff->getAssocId());
                 if (!is_a($submission, 'Submission')) {
                     return AUTHORIZATION_DENY;
                 }
                 if ($submission->getContextId() != $context->getId()) {
                     return AUTHORIZATION_DENY;
                 }
                 // Checks out OK. Permit.
                 $this->addAuthorizedContextObject(ASSOC_TYPE_SIGNOFF, $baseSignoff);
                 return AUTHORIZATION_PERMIT;
             default:
                 return AUTHORIZATION_DENY;
         }
     }
 }
开发者ID:mczirfusz,项目名称:pkp-lib,代码行数:69,代码来源:SignoffExistsAccessPolicy.inc.php

示例6: initialize

 /**
  * Initialize the template manager.
  */
 function initialize()
 {
     $locale = AppLocale::getLocale();
     $application = PKPApplication::getApplication();
     $router = $this->_request->getRouter();
     assert(is_a($router, 'PKPRouter'));
     $this->assign(array('defaultCharset' => Config::getVar('i18n', 'client_charset'), 'basePath' => $this->_request->getBasePath(), 'baseUrl' => $this->_request->getBaseUrl(), 'requiresFormRequest' => $this->_request->isPost(), 'currentUrl' => $this->_request->getCompleteUrl(), 'dateFormatTrunc' => Config::getVar('general', 'date_format_trunc'), 'dateFormatShort' => Config::getVar('general', 'date_format_short'), 'dateFormatLong' => Config::getVar('general', 'date_format_long'), 'datetimeFormatShort' => Config::getVar('general', 'datetime_format_short'), 'datetimeFormatLong' => Config::getVar('general', 'datetime_format_long'), 'timeFormat' => Config::getVar('general', 'time_format'), 'allowCDN' => Config::getVar('general', 'enable_cdn'), 'useMinifiedJavaScript' => Config::getVar('general', 'enable_minified'), 'currentContext' => $this->_request->getContext(), 'currentLocale' => $locale, 'pageTitle' => $application->getNameKey(), 'applicationName' => __($application->getNameKey()), 'exposedConstants' => $application->getExposedConstants(), 'jsLocaleKeys' => $application->getJSLocaleKeys()));
     if (is_a($router, 'PKPPageRouter')) {
         $this->assign(array('requestedPage' => $router->getRequestedPage($this->_request), 'requestedOp' => $router->getRequestedOp($this->_request)));
     }
     if ($dispatcher = $this->_request->getDispatcher()) {
         $this->addStyleSheet($dispatcher->url($this->_request, ROUTE_COMPONENT, null, 'page.PageHandler', 'css'), STYLE_SEQUENCE_CORE, 'backend');
     }
     // If there's a locale-specific stylesheet, add it.
     if (($localeStyleSheet = AppLocale::getLocaleStyleSheet($locale)) != null) {
         $this->addStyleSheet($this->_request->getBaseUrl() . '/' . $localeStyleSheet, 'backend');
     }
     // Register custom functions
     $this->register_modifier('translate', array('AppLocale', 'translate'));
     $this->register_modifier('strip_unsafe_html', array('PKPString', 'stripUnsafeHtml'));
     $this->register_modifier('String_substr', array('PKPString', 'substr'));
     $this->register_modifier('to_array', array($this, 'smartyToArray'));
     $this->register_modifier('compare', array($this, 'smartyCompare'));
     $this->register_modifier('concat', array($this, 'smartyConcat'));
     $this->register_modifier('strtotime', array($this, 'smartyStrtotime'));
     $this->register_modifier('explode', array($this, 'smartyExplode'));
     $this->register_modifier('assign', array($this, 'smartyAssign'));
     $this->register_function('translate', array($this, 'smartyTranslate'));
     $this->register_function('null_link_action', array($this, 'smartyNullLinkAction'));
     $this->register_function('help', array($this, 'smartyHelp'));
     $this->register_function('flush', array($this, 'smartyFlush'));
     $this->register_function('call_hook', array($this, 'smartyCallHook'));
     $this->register_function('html_options_translate', array($this, 'smartyHtmlOptionsTranslate'));
     $this->register_block('iterate', array($this, 'smartyIterate'));
     $this->register_function('page_links', array($this, 'smartyPageLinks'));
     $this->register_function('page_info', array($this, 'smartyPageInfo'));
     $this->register_function('pluck_files', array($this, 'smartyPluckFiles'));
     // Modified vocabulary for creating forms
     $fbv = $this->getFBV();
     $this->register_block('fbvFormSection', array($fbv, 'smartyFBVFormSection'));
     $this->register_block('fbvFormArea', array($fbv, 'smartyFBVFormArea'));
     $this->register_function('fbvFormButtons', array($fbv, 'smartyFBVFormButtons'));
     $this->register_function('fbvElement', array($fbv, 'smartyFBVElement'));
     $this->assign('fbvStyles', $fbv->getStyles());
     $this->register_function('fieldLabel', array($fbv, 'smartyFieldLabel'));
     // register the resource name "core"
     $coreResource = new PKPTemplateResource($this->core_template_dir);
     $this->register_resource('core', array(array($coreResource, 'fetch'), array($coreResource, 'fetchTimestamp'), array($coreResource, 'getSecure'), array($coreResource, 'getTrusted')));
     $appResource = new PKPTemplateResource($this->app_template_dir);
     $this->register_resource('app', array(array($appResource, 'fetch'), array($appResource, 'fetchTimestamp'), array($appResource, 'getSecure'), array($appResource, 'getTrusted')));
     $this->register_function('url', array($this, 'smartyUrl'));
     // ajax load into a div or any element
     $this->register_function('load_url_in_el', array($this, 'smartyLoadUrlInEl'));
     $this->register_function('load_url_in_div', array($this, 'smartyLoadUrlInDiv'));
     // load stylesheets from a given context
     $this->register_function('load_stylesheet', array($this, 'smartyLoadStylesheet'));
     /**
      * Kludge to make sure no code that tries to connect to the
      * database is executed (e.g., when loading installer pages).
      */
     if (!defined('SESSION_DISABLE_INIT')) {
         $application = PKPApplication::getApplication();
         $currentVersion = $application->getCurrentVersion();
         $this->assign(array('isUserLoggedIn' => Validation::isLoggedIn(), 'isUserLoggedInAs' => Validation::isLoggedInAs(), 'currentVersionString' => $currentVersion->getVersionString(false), 'itemsPerPage' => Config::getVar('interface', 'items_per_page'), 'numPageLinks' => Config::getVar('interface', 'page_links')));
         $user = $this->_request->getUser();
         $hasSystemNotifications = false;
         if ($user) {
             $notificationDao = DAORegistry::getDAO('NotificationDAO');
             $notifications = $notificationDao->getByUserId($user->getId(), NOTIFICATION_LEVEL_TRIVIAL);
             if ($notifications->getCount() > 0) {
                 $this->assign('hasSystemNotifications', true);
             }
             // Assign the user name to be used in the sitenav
             $this->assign(array('loggedInUsername' => $user->getUserName(), 'initialHelpState' => (int) $user->getInlineHelp()));
         }
     }
     // Load enabled block plugins and setup active sidebar variables
     PluginRegistry::loadCategory('blocks', true);
     $leftSidebarHooks = HookRegistry::getHooks('Templates::Common::LeftSidebar');
     $this->assign(array('hasLeftSidebar' => !empty($leftSidebarHooks)));
 }
开发者ID:selwyntcy,项目名称:pkp-lib,代码行数:84,代码来源:PKPTemplateManager.inc.php


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