本文整理汇总了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));
}
示例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);
}