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


PHP XenForo_View::getParams方法代码示例

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


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

示例1: getTabs

 public function getTabs()
 {
     $allContentKeys = array('resource' => array('resource_id', 'resource'), 'thread' => array('thread_id', 'thread'), 'conversation' => array('conversation_id', 'conversation'), 'project' => array('project_id', 'freeagent_project'), 'media' => array('media_id', 'xengallery_media'), 'product' => array('product_id', 'xenproduct_product'));
     $contentKeys = array();
     $params = $this->_view->getParams();
     foreach ($allContentKeys as $contentKeyId => $contentTypeInfo) {
         if (isset($params[$contentKeyId])) {
             $contentTypes[] = $contentTypeInfo[1];
             $contentIdKeys[] = $contentTypeInfo[0];
             $contentKeys[] = $contentKeyId;
         }
     }
     /* @var $tabModel Waindigo_Tabs_Model_Tab */
     $tabModel = XenForo_Model::create('Waindigo_Tabs_Model_Tab');
     $canAddExistingContentToTab = false;
     for ($i = 0; $i < isset($contentKeys) ? count($contentKeys) : 0; $i++) {
         $content = $params[$contentKeys[$i]];
         if (!isset($content['tab_id']) || !$content['tab_id']) {
             continue;
         }
         if (!$canAddExistingContentToTab) {
             $canAddExistingContentToTab = $tabModel->canAddExistingContentToTab(array('tab_id' => $content['tab_id']));
         }
         $tabContents = $tabModel->getTabContentsByTabId($content['tab_id']);
         $tabContents = $tabModel->prepareTabContents($tabContents, $contentTypes[$i], $content[$contentIdKeys[$i]], $content);
         $this->_view->setParams(array('tabContents' => $tabContents));
         break;
     }
     if (!$canAddExistingContentToTab) {
         $canAddExistingContentToTab = $tabModel->canAddExistingContentToTab(array());
     }
     $this->_view->setParams(array('canAddExistingContentToTab' => $canAddExistingContentToTab));
 }
开发者ID:Sywooch,项目名称:forums,代码行数:33,代码来源:Tabs.php

示例2: prepareViewParams

 public static function prepareViewParams(XenForo_ViewRenderer_Abstract $viewRenderer, XenForo_View $view)
 {
     $params = $view->getParams();
     $jobs = array();
     if (!empty($params['jobs'])) {
         foreach ($params['jobs'] as $jobId => $job) {
             $preparedJob = array();
             if (empty($job['_job_result'])) {
                 continue;
             }
             $preparedJob['_job_result'] = $job['_job_result'];
             switch ($job['_job_result']) {
                 case 'error':
                     if (empty($job['_job_error'])) {
                         continue;
                     }
                     $preparedJob['_job_error'] = $job['_job_error'];
                     break;
                 case 'message':
                     if (empty($job['_job_message'])) {
                         continue;
                     }
                     $preparedJob['_job_message'] = $job['_job_message'];
                     break;
                 case 'ok':
                     if (empty($job['_job_response'])) {
                         continue;
                     }
                     /** @var XenForo_ControllerResponse_View $response */
                     $response = $job['_job_response'];
                     $viewOutput = $viewRenderer->renderViewObject($response->viewName, 'Json', $response->params, $response->templateName);
                     if (!is_array($viewOutput)) {
                         $viewOutput = @json_decode($viewOutput, true);
                     }
                     if (is_array($viewOutput)) {
                         $preparedJob = array_merge($preparedJob, $viewOutput);
                     } elseif ($viewOutput === null) {
                         $preparedJob = array_merge($preparedJob, $response->params);
                     }
                     break;
                 default:
                     continue;
             }
             $jobs[$jobId] = $preparedJob;
         }
     }
     return array('jobs' => $jobs);
 }
开发者ID:billyprice1,项目名称:bdApi,代码行数:48,代码来源:Batch.php


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