Exemple #1
0
 public function renderJson()
 {
     $output = $this->_renderer->getDefaultOutputArray(get_class($this), $this->_params, $this->_templateName);
     if ($this->_params['isStatus']) {
         $output['statusHtml'] = XenForo_Template_Helper_Core::helperBodyText($this->_params['profilePost']['message']) . ' ' . XenForo_Template_Helper_Core::dateTimeHtml($this->_params['profilePost']['post_date']);
     }
     return XenForo_ViewRenderer_Json::jsonEncodeForOutput($output);
 }
    protected function _collapsibleNavigation($categories, $parentCategoryId = null)
    {
        $collapsible = $this->_params['collapsible'];
        $this->_params['loadCollapsible'] = strpos($collapsible, 'collapsible') !== false;
        $hasChildren = false;
        $outputHtml = '<ol class="categoryList%s" data-liststyle="' . $collapsible . '">%s</ol>';
        $childrenHtml = '';
        $jsClass = '';
        if ($parentCategoryId === null) {
            $jsClass = ' CategoryList';
        }
        foreach ($categories as $categoryId => $category) {
            $expanded = '';
            if (in_array($categoryId, array_keys($this->_params['categoryBreadcrumbs']))) {
                $expanded = ' sapling-expanded';
            }
            if ($category['parent_category_id'] == $parentCategoryId) {
                $hasChildren = true;
                $selected = '';
                if (!empty($this->_params['category']['category_id'])) {
                    if ($this->_params['category']['category_id'] == $categoryId) {
                        $selected = ' class="selected"';
                        $expanded = ' sapling-expanded';
                    }
                }
                $childrenHtml .= '<li class="_categoryDepth' . $category['depth'] . $expanded . '">
					<a href="' . XenForo_Link::buildPublicLink('xengallery/categories', $category) . '"' . $selected . '>' . XenForo_Template_Helper_Core::helperBodyText($category['category_title']) . '</a>';
                $childrenHtml .= $this->_collapsibleNavigation($categories, $category['category_id']);
                $childrenHtml .= '</li>';
            }
        }
        if (!$hasChildren) {
            $outputHtml = '';
        }
        return sprintf($outputHtml, $jsClass, $childrenHtml);
    }