AnonSec Shell
Server IP : 54.36.91.62  /  Your IP : 216.73.217.111
Web Server : Apache
System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User : coopiak ( 151928)
PHP Version : 8.3.23
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/coopiak/amisdesseniors-fr/modules/mod_djc2producercategories/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/coopiak/amisdesseniors-fr/modules/mod_djc2producercategories/helper.php
<?php
/**
 * @package DJ-Catalog2
 * @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_BASE.'/components/com_djcatalog2/helpers/route.php');
require_once(JPATH_ADMINISTRATOR.'/components/com_djcatalog2/lib/producercategories.php');

class DJC2ProducerCategoriesModuleHelper {
	
	static $topRoot = null;
	
	public static function getHtml($cid, $expand, $params, $root_id, $moduleId) {
		$user	= JFactory::getUser();
		$groups	= $user->getAuthorisedViewLevels();
		
		$categories = Djc2ProducerCategories::getInstance(array('state'=>'1', 'access' => $groups));
		
		$show_count = (bool)$params->get('display_counter', false);
		$layout = $params->get('category_layout', 'list');
		$class_sfx	= htmlspecialchars($params->get('moduleclass_sfx', ''));
		
		static::$topRoot = $categories->get((int)$params->get('parent_category',0));
		
		$root = $categories->get(0);
		$current = $categories->get($cid);
		
		$path = array();
		if (!empty($current)) {
			foreach ($current->getPath() as $item) {
				$path[] = (int)$item;
			}
		}
		
		$follow = false;
		$rootParent = $root;
		if ($params->get('go_deeper', 0) && $layout == 'list' && $current->id > 0) {
			if ( count($current->getChildren()) > 0 || true) {
				$root = $current;
				$follow = true;
				$rootParent = $categories->get($current->parent_id);
			} else {
				$parent = $categories->get($current->parent_id);
				if ($parent && $parent->id > 0) {
					$root = $parent;
					$follow = true;
					$rootParent = $categories->get($parent->parent_id);
				}
			}
		}
		
		if ((int)$root_id > 0) {
			if ($new_root = $categories->get($root_id)) {
				$root = $new_root;
			}
		}
		
		$html = '';
		if ($layout == 'list') {
			$html = '';
			if ($follow) {
				$upLink = JRoute::_(DJCatalog2HelperRoute::getProducerCategoryRoute($rootParent->catslug));
				
				$html .= '<h4>';
				$html .= $root->name;
				$html .= '<a href="'.$upLink.'" class="pull-right btn btn-mini">'.JText::_('MOD_DJC2PRODUCERCATEGORIES_LEVELUP').'</a>';
				$html .= '</h4>';
			}
			$html .= '<ul class="menu'.$class_sfx.' nav mod_djc2categories_list">';
			self::makeList($html, $root, $path, $expand, $cid, 0, $show_count);
			$html .= '</ul>';
		} else {
			$html = '<form class="mod_djc2producercategories_form" name="mod_djc2producercategories_form" id="mod_djc2producercategories_form-'.$moduleId.'" method="post" action="'.JRoute::_('index.php?option=com_djcatalog2&task=filterproducers').'">';
			
			$category_options = $categories->getOptionList('- '.JText::_('MOD_DJC2PRODUCERCATEGORIES_SELECT_CATEGORY').' -');
			if ((int)$root_id > 0) {
				$category_path = $current->getPath();
				$parent_category = null;
				$parent_id = (count($category_path) || (int)$cid == 0) ? $root_id : 0;
				
				$parent_category = $categories->get($parent_id);
				
				if ($parent_category) {
					$childrenList = array($parent_category->id);
					$parent_category->makeChildrenList($childrenList);
					foreach ($category_options as $key => $option) {
						if (!in_array($option->value, $childrenList)) {
							unset($category_options[$key]);
						}
						if ($option->value == $parent_category->id) {
							$category_options[$key]->text = '- '.JText::_('MOD_DJC2PRODUCERCATEGORIES_SELECT_CATEGORY').' -';
						}
					}
				}
			}
			$html .= Joomla\CMS\HTML\HTMLHelper::_('select.genericlist', $category_options, 'pcid', 'class="input form-control mod_djc2categories_list" onchange="this.form.submit();"', 'value', 'text', $cid, 'mod_djc2categories_list-'.$moduleId);
			$html .= '<noscript><input type="submit" /></noscript>';
			$html .= '</form>';
		}
		return $html;
	}
	private static function makeList(&$html, &$root, $path, $expand, $cid, $level = 0, $show_count = false) {
		$children = $root->getChildren();
		foreach($children as $child) {
			$current = (($child->id == $cid)) ? true:false;
			$parent = (count($child->getChildren())) ? true:false;
			$active = (($current || in_array($child->id, $path))) ? true:false;
			$deeper = ($parent && $expand) ? true:false;
			
			$class = 'djc_catid-'.$child->id.' level'.$level;
			$class .= ( $current ) ? ' current':'';
			$class .= ( $active ) ? ' active':'';
			$class .= ( $parent ) ? ' parent':'';
			$class .= ( $deeper ) ? ' deeper':'';
			
			$display_name = $child->name;
			if ($show_count) {
				if (($count = $child->getProductCount()) !== false) {
					$display_name = $child->name.' <small class="djc_category_counter">['.$count.']</small>';
				}
			}
			
			$html.= '<li class="'.$class.'"><a href="'.JRoute::_(DJCatalogHelperRoute::getProducerCategoryRoute($child->id.':'.$child->alias), true).'">'.$display_name.'</a>';
			if (($active || $expand) && count($child->getChildren())) {
				$html .= '<ul class="nav-child unstyled small">';
				$level++;
				self::makeList($html, $child, $path, $expand, $cid, $level, $show_count);
				$level--;
				$html .= '</ul>';
			}
			$html .= '</li>';
		}
	}
}
?>

Anon7 - 2022
AnonSec Team