* Author Website: http://www.mintjoomla.com/ * @copyright Copyright (C) 2012 MintJoomla (http://www.mintjoomla.com). All rights reserved. * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html */ defined('_JEXEC') or die('Restricted access'); // Include the syndicate functions only once require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'helper.php'; $app = JFactory::getApplication(); $Itemid = $app->input->getInt('Itemid'); $headerText = trim($params->get('header_text')); $footerText = trim($params->get('footer_text')); JModelLegacy::addIncludePath(JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_cobalt' . DIRECTORY_SEPARATOR . 'models'); $cat_id = $app->input->getInt('cat_id'); $rid = 0; if ($app->input->get('option') == 'com_cobalt' && $app->input->get('view') == 'record') { $rid = $app->input->getInt('id'); } $categories = modCobaltCategoriesHelper::getList($params, $cat_id); $section = null; $section = modCobaltCategoriesHelper::getSection($params); $section->records = null; if ($params->get('records')) { if ($cat_id) { $section->records = modCobaltCategoriesHelper::getCatRecords($cat_id, $params); } else { $section->records = modCobaltCategoriesHelper::getSectionRecords($params); } } $parents = modCobaltCategoriesHelper::getParentsList($cat_id); $parents[] = $params->get('section_id'); require JModuleHelper::getLayoutPath('mod_cobalt_category', $params->get('layout', 'default'));
$i = 1; foreach ($levels as $level) { if ($i == $max_level) { $function = 'redirectToCategory(this.value);'; } else { $function = 'modJsc_getChilds_select(this.value, \'category_select' . ($i + 1) . '\', ' . $i . ');'; } $options = array(); $options[] = JHtml::_('select.option', '', '- Select -'); if ($i == 1) { foreach ($categories as $cat) { if (!$params->get('cat_empty', 1) && !$cat->records_num) { continue; } if ($params->get('cat_nums', 0)) { $cat->title .= ' (' . ($params->get('cat_nums', 'current') == 'current' ? modCobaltCategoriesHelper::getRecordsNum($section, $cat->id) : $cat->records_num) . ')'; } $options[] = JHtml::_('select.option', $cat->id, $cat->title); } ?> <div> <?php echo JText::_($level); ?> <br /> <?php echo JHtml::_('select.genericlist', $options, 'category_select1', 'class="catselect" onchange="' . $function . '"'); ?> </div> <?php
function mod_getChildsDrop($category, $params, $k = 1) { $category->records = modCobaltCategoriesHelper::getCatRecords($category->id, $params); ?> <?php if (count($category->children) || count($category->records)) { ?> <ul class="dropdown-menu"> <?php foreach ($category->children as $i => $cat) { if (!$params->get('tmpl_params.subcat_empty', 1) && !$cat->num_current && !$cat->num_all) { continue; } ?> <li class="dropdown<?php if ($cat->childs_num) { echo '-submenu'; } /*if(JRequest::getInt('cat_id') == $cat->id) echo ' open';*/ ?> "> <?php if ($params->get('tmpl_params.subcat_limit', 5) <= $i && count($category->children) > $params->get('tmpl_params.subcat_limit', 5)) { ?> <a href="<?php echo $category->link; ?> "><?php echo JText::_('CMORECATS') . '...'; ?> </a></li> <?php break; ?> <?php } else { ?> <a href="<?php echo JRoute::_($cat->link); ?> "> <?php echo $cat->title; ?> <?php if ($params->get('tmpl_params.subcat_nums', 0) && $cat->params->get('submission')) { ?> <span class="small">(<?php echo (int) $cat->records_num; ?> )</span> <?php } ?> </a> <?php if ($cat->childs_num) { ?> <?php mod_getChildsDrop($cat, $params, $k + 1); ?> <?php } ?> <?php } ?> </li> <?php } ?> <?php if ($params->get('records') && count($category->records)) { foreach ($category->records as $i => $rec) { if ($params->get('records_limit') && $i == $params->get('records_limit')) { $rec->title = JText::_('CMORERECORDS'); $rec->id = -1; $rec->url = $category->link; } ?> <li class="dropdown"> <a href="<?php echo JRoute::_($rec->url); ?> "> <?php echo $rec->title; ?> </a> </li> <?php } ?> <?php } ?> </ul> <?php } }