Current File : /home/pacjaorg/www/km/modules/mod_djclassifieds_menu/mod_djclassifieds_menu.php |
<?php
/**
* @package DJ-Classifieds
* @copyright Copyright (C) DJ-Extensions.com, All rights reserved.
* @license http://www.gnu.org/licenses GNU/GPL
* @author url: http://dj-extensions.com
* @author email contact@dj-extensions.com
*/
defined ('_JEXEC') or die('Restricted access');
require_once(JPATH_ROOT.'/administrator/components/com_djclassifieds/lib/djcategory.php');
require_once(JPATH_ROOT.'/administrator/components/com_djclassifieds/lib/djseo.php');
require_once(JPATH_ROOT.'/administrator/components/com_djclassifieds/lib/djtheme.php');
$app = JFactory::getApplication();
if($app->input->get('option') != 'com_djclassifieds'){
DJClassifiedsTheme::includeCSSfiles();
}
if($app->input->get('option') == 'com_djclassifieds'){
$cid = $app->input->getInt('cid') ? $app->input->getInt('cid') : DJClassifiedsTheme::getIdFromTree($app->input->getVar('se_cats'));
}
if(empty($cid)){
$cid = 0;
}
if($params->get('only_current_level',0)==1 && $cid){
$category = DJClassifiedsCategory::getCategory($cid,1);
$ret = DJClassifiedsCategory::getMenuCategories($cid,1,$params->get('cat_ordering','ord'),$params->get('hide_empty','0'),$category->parent_id,1 );
}else if($params->get('only_current_level',0)==2 && $cid){
$category = DJClassifiedsCategory::getCategory($cid,1);
$ret = DJClassifiedsCategory::getMenuCategories($cid,1,$params->get('cat_ordering','ord'),$params->get('hide_empty','0'),$category->parent_id,0,1);
}else{
$ret = DJClassifiedsCategory::getMenuCategories($cid,1,$params->get('cat_ordering','ord'),$params->get('hide_empty','0'));
}
if($params->get('cat_id',0)){
$new_cats = array();
$cat_found = 0;
$cat_found_lvl = 0;
$cat_found_lvl_s= 0;
$cid_path = DJClassifiedsCategory::getParentPath(0,$cid,$params->get('cat_ordering','ord'),'1');
foreach($ret[2] as $cat){
if($cat_found){
if($cat_found_lvl<$cat->level){
if($params->get('expand_type','0')==1){
$new_cats[] = $cat;
}else{
if($cat_found_lvl_s==$cat->level || strstr($cid_path, ','.$cat->id.',') || strstr($cid_path, ','.$cat->parent_id.',')){
$new_cats[] = $cat;
}
}
}else{
break;
}
}
if($params->get('cat_id',0) == $cat->id){
$cat_found = 1;
$cat_found_lvl = $cat->level;
$cat_found_lvl_s= $cat->level + 1;
}
}
$cats = $new_cats;
}else if($params->get('expand_type','0')==1 && $params->get('only_current_level',0)==0){
$cats = $ret[2];
}else{
$cats = $ret[0];
}
$cat_path = $ret[1];
require(JModuleHelper::getLayoutPath('mod_djclassifieds_menu'));