?> </div> </div> </div> <?php } ?> </div> <?php } else { ?> <?php if (!empty($categories)) { ?> <?php echo modEasyBlogCategoriesHelper::accessNestedCategories($categories, $selected, $params); ?> <?php } else { ?> <?php echo JText::_('MOD_EASYBLOGCATEGORIES_NO_CATEGORY'); ?> <?php } ?> <?php } ?> </div>
* other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. */ defined('_JEXEC') or die('Restricted access'); jimport('joomla.filesystem.file'); $engine = JPATH_ADMINISTRATOR . '/components/com_easyblog/includes/easyblog.php'; if (!JFile::exists($engine)) { return; } require_once $engine; require_once __DIR__ . '/helper.php'; // Ensure that all script are loaded EB::init('module'); // Attach modules stylesheet EB::stylesheet('module')->attach(); $categories = modEasyBlogCategoriesHelper::getCategories($params); $app = JFactory::getApplication(); $view = $app->input->get('view'); $layout = $app->input->get('layout'); $selected = ''; if ($view == 'categories' && $layout == 'listings') { $selected = $app->input->get('id'); } $layoutType = $params->get('layouttype'); // For toggle-able layout if ($layoutType == 'toggle') { $model = EB::model('Category'); $onlyTheseCatIds = $params->get('catid', ''); $filterCats = array(); if (!empty($onlyTheseCatIds)) { $filterStr = '';
?> <div class="mod-item"> <div<?php echo $params->get('layouttype') == 'tree' ? ' style="padding-left: ' . $padding . 'px;"' : ''; ?> > <?php if ($params->get('showcavatar', true)) { ?> <a href="<?php echo EasyBlogRouter::_('index.php?option=com_easyblog&view=categories&layout=listings&id=' . $category->id . $menuItemId); ?> " class="mod-avatar"> <img class="avatar" src="<?php echo modEasyBlogCategoriesHelper::getAvatar($category); ?> " width="40" alt="<?php echo $category->title; ?> " /> </a> <?php } ?> <div class="mod-category-detail"> <div class="mod-category-name"> <a href="<?php echo EasyBlogRouter::_('index.php?option=com_easyblog&view=categories&layout=listings&id=' . $category->id . $menuItemId); ?> "><?php
function accessNestedCategories(&$categories, $selected, $params, $level = null) { $menuItemId = modEasyBlogCategoriesHelper::_getMenuItemId($params); foreach ($categories as $category) { if (is_null($level)) { $level = 0; } $css = ''; if ($category->id == $selected) { $css = 'font-weight: bold;'; } if ($params->get('layouttype') == 'tree') { // $category->level -= 1; $padding = $level * 30; } require JModuleHelper::getLayoutPath('mod_easyblogcategories', 'item'); if ($params->get('layouttype') == 'tree' || $params->get('layouttype') == 'flat') { if (isset($category->childs) && is_array($category->childs)) { modEasyBlogCategoriesHelper::accessNestedCategories($category->childs, $selected, $params, $level + 1); } } } }
public static function accessNestedCategories(&$categories, $selected, $params, $level = null) { $showCategoryAvatar = $params->get('showcavatar', true); $width = $params->get('avatarwidth', '50'); $height = $params->get('avatarheight', '50'); foreach ($categories as $category) { if (is_null($level)) { $level = 0; } $css = ''; if ($category->id == $selected) { $css = 'font-weight: bold;'; } if ($params->get('layouttype') == 'tree') { // $category->level -= 1; $padding = $level * 30; } require JModuleHelper::getLayoutPath('mod_easyblogcategories', 'item'); if ($params->get('layouttype') == 'tree' || $params->get('layouttype') == 'flat') { if (isset($category->childs) && is_array($category->childs)) { modEasyBlogCategoriesHelper::accessNestedCategories($category->childs, $selected, $params, $level + 1); } } } }