| Server IP : 54.36.91.62 / Your IP : 216.73.217.112 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/catalog/components/com_djcatalog2/views/producers/ |
Upload File : |
<?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');
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;
jimport('joomla.application.component.view');
jimport('joomla.html.pagination');
class DJCatalog2ViewProducers extends HtmlView {
public function __construct($config = array())
{
parent::__construct($config);
$this->_addPath('template', JPATH_ROOT.'/components/com_djcatalog2'. '/themes/default/views/producers');
$theme = DJCatalog2ThemeHelper::getThemeName();
if ($theme && $theme != 'default') {
$this->_addPath('template', JPATH_ROOT.'/components/com_djcatalog2'. '/themes/'.$theme.'/views/producers');
}
}
function display($tpl = null) {
$app = Factory::getApplication();
$jinput = $app->input;
$view = $jinput->get('view');
$document= Factory::getDocument();
$model = $this->getModel();
$dispatcher = Joomla\CMS\Factory::getApplication()->getDispatcher();
$user = Factory::getUser();
$groups = $user->getAuthorisedViewLevels();
$menus = $app->getMenu('site');
$menu = $menus->getActive();
$mOption = (empty($menu->query['option'])) ? null : $menu->query['option'];
$mCatid = (empty($menu->query['cid'])) ? null : (int)$menu->query['cid'];
$mProdid = (empty($menu->query['pid'])) ? null : (int)$menu->query['pid'];
$filter_catid = $jinput->getInt('pcid', null);
if ($filter_catid === null && $mOption == 'com_djcatalog2' && $mCatid) {
$filter_catid = $mCatid;
$jinput->set('pcid', $filter_catid);
}
$search = urldecode($jinput->get( 'search','','string' ));
$search = \Joomla\String\StringHelper::strtolower( $search );
$params = Djcatalog2Helper::getParams();
$filter_order = $jinput->get( 'order',$params->get('producers_default_order','i.ordering'),'cmd' );
$filter_order_Dir = $jinput->get( 'dir', $params->get('producers_default_order_dir','asc'), 'word' );
$lists = array();
if (\Joomla\String\StringHelper::strlen($search) > 0 && (\Joomla\String\StringHelper::strlen($search)) < 1 || \Joomla\String\StringHelper::strlen($search) > 40) {
Factory::getApplication()->enqueueMessage(Text::_( 'COM_DJCATALOG2_SEARCH_RESTRICTION'), 'notice');
}
if ($filter_order_Dir == '' || $filter_order_Dir == 'desc') {
$lists['order_Dir'] = 'asc';
} else {
$lists['order_Dir'] = 'desc';
}
$lists['order'] = $filter_order;
$lists['search']= $search;
$limitstart = $jinput->getInt('limitstart', 0);
$limit_items_show = $params->get('producers_pagination_limit',10);
$jinput->set('limit', $limit_items_show);
$categories = Djc2ProducerCategories::getInstance(array('state'=>'1', 'access'=>$groups));
// current category
$this->category = $categories->get((int) $jinput->getInt('pcid',0));
$subcategories = null;
if (!empty($this->category)) {
$subcategories = $this->category->getChildren();
}
$this->categories = $categories;
$this->subcategories = $subcategories;
$category_options = $categories->getOptionList('- '.Text::_('COM_DJCATALOG2_SELECT_CATEGORY').' -');
$lists['categories'] = Joomla\CMS\HTML\HTMLHelper::_('select.genericlist', $category_options, 'pcid', 'class="input form-control ', 'value', 'text', $filter_catid);
$list = $model->getItems();
$total = $model->getTotal();
$pagination = $model->getPagination();
$this->document = $document;
$this->items = $list;
$this->total = $total;
$this->pagination = $pagination;
$this->params = $params;
$this->lists = $lists;
$this->attributes = $model->getAttributes();
$this->sortables = $model->getSortables();
$this->_prepareDocument();
parent::display($tpl);
}
protected function _prepareDocument() {
$app = Factory::getApplication();
$menus = $app->getMenu();
$pathway = $app->getPathway();
$title = null;
$heading = null;
$menu = $menus->getActive();
if ($menu) {
$this->params->def('page_heading', $this->params->get('page_title', $menu->title));
}
$title = $this->params->get('page_title', '');
if ($menu && ($menu->query['option'] != 'com_djcatalog2' || $menu->query['view'] != 'producers')) {
$title = Text::_('COM_DJCATALOG2_PRODUCERS_HEADING');
$path = array(array('title' => $title, 'link' => ''));
foreach ($path as $item)
{
$pathway->addItem($item['title'], $item['link']);
}
}
if (empty($title)) {
$title = $app->getCfg('sitename');
}
elseif ($app->getCfg('sitename_pagetitles', 0)) {
if ($app->getCfg('sitename_pagetitles', 0) == '2') {
$title = Text::sprintf('JPAGETITLE', $title, $app->getCfg('sitename'));
} else {
$title = Text::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
}
}
$this->document->setTitle($title);
if ($this->params->get('menu-meta_description'))
{
$this->document->setDescription($this->params->get('menu-meta_description'));
}
if ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
}
if ($this->params->get('robots'))
{
$this->document->setMetadata('robots', $this->params->get('robots'));
}
$uri = Uri::getInstance();
$vars = $uri->getQuery(true);
unset($vars['order']);
unset($vars['dir']);
unset($vars['l']);
$canonical = DJCatalogHelperRoute::getProducerCategoryRoute($this->category->catslug);
if (!empty($vars)){
$canonical .= '&'.$uri->buildQuery($vars);
}
$app->setHeader('X-App-DJCatalog-URI', urlencode(Route::_($canonical, false)));
$app->setHeader('X-App-DJCatalog-URL', urlencode(Route::_($canonical, false, (Uri::getInstance()->isSSL() ? 1 : -1))));
$canonical = Route::_($canonical, true, (Uri::getInstance()->isSSL() ? 1 : -1));
foreach($this->document->_links as $key => $headlink) {
if ($headlink['relation'] == 'canonical' ) {
unset($this->document->_links[$key]);
}
}
$this->document->addHeadLink($canonical, 'canonical');
}
}