| 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/administrator/components/com_djcatalog2/helpers/html/ |
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;
use Joomla\Registry\Registry;
use Joomla\CMS\Language\Associations;
use Joomla\CMS\Factory;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Layout\LayoutHelper;
JLoader::register('Djcatalog2AdminHelper', JPATH_ADMINISTRATOR . '/components/com_djcatalog2/helpers/djcatalog2.php');
class HTMLHelperDJCatalog2
{
public static function associationTemplate($id){
// Defaults
$html = '';
// Get the associations
if ($associations = Associations::getAssociations('com_djcatalog2', '#__djc2_message_templates', 'com_djcatalog2.template', (int)$id, 'id', '', ''))
{
foreach ($associations as $tag => $associated)
{
$associations[$tag] = (int) $associated->id;
}
// get the relevant category titles and languages, for the tooltip
$db = Factory::getDbo();
$query = $db->getQuery(true)
->select('i.*')
->select('l.sef as lang_sef')
->select('l.lang_code')
->from('#__djc2_message_templates as i')
->where('i.id IN (' . implode(',', array_values($associations)) . ')')
->join('LEFT', '#__languages as l ON i.language=l.lang_code')
->select('l.image')
->select('l.title as language_title');
$db->setQuery($query);
try
{
$items = $db->loadObjectList('id');
}
catch (RuntimeException $e)
{
throw new Exception($e->getMessage(), 500, $e);
}
if ($items)
{
foreach ($items as &$item)
{
$text = $item->lang_sef ? strtoupper($item->lang_sef) : 'XX';
$url = Route::_('index.php?option=com_djcatalog2&task=template.edit&id=' . (int) $item->id);
$tooltip = htmlspecialchars($item->name, ENT_QUOTES, 'UTF-8') . '<br />';
$classes = 'hasPopover label label-association label-' . $item->lang_sef;
$item->link = '<a href="' . $url . '" title="' . $item->language_title . '" class="' . $classes
. '" data-content="' . $tooltip . '" data-placement="top">'
. $text . '</a>';
}
}
Joomla\CMS\HTML\HTMLHelper::_('bootstrap.popover');
$html = LayoutHelper::render('joomla.content.associations', $items);
}
return $html;
}
/**
* Render the list of associated items
*
* @param integer $id The id of the helloworld record
*
* @return string The language HTML
*
* @throws Exception
*/
public static function associationItem($id)
{
// Defaults
$html = '';
// Get the associations
if ($associations = Associations::getAssociations('com_djcatalog2', '#__djc2_items', 'com_djcatalog2.item', (int)$id, 'id', '', ''))
{
foreach ($associations as $tag => $associated)
{
$associations[$tag] = (int) $associated->id;
}
// get the relevant category titles and languages, for the tooltip
$db = Factory::getDbo();
$query = $db->getQuery(true)
->select('i.*')
->select('l.sef as lang_sef')
->select('l.lang_code')
->from('#__djc2_items as i')
->where('i.id IN (' . implode(',', array_values($associations)) . ')')
->join('LEFT', '#__languages as l ON i.language=l.lang_code')
->select('l.image')
->select('l.title as language_title');
$db->setQuery($query);
try
{
$items = $db->loadObjectList('id');
}
catch (RuntimeException $e)
{
throw new Exception($e->getMessage(), 500, $e);
}
if ($items)
{
foreach ($items as &$item)
{
$text = $item->lang_sef ? strtoupper($item->lang_sef) : 'XX';
$url = Route::_('index.php?option=com_djcatalog2&task=item.edit&id=' . (int) $item->id);
$tooltip = htmlspecialchars($item->name, ENT_QUOTES, 'UTF-8') . '<br />';
$classes = 'hasPopover label label-association label-' . $item->lang_sef;
$item->link = '<a href="' . $url . '" title="' . $item->language_title . '" class="' . $classes
. '" data-content="' . $tooltip . '" data-placement="top">'
. $text . '</a>';
}
}
Joomla\CMS\HTML\HTMLHelper::_('bootstrap.popover');
$html = LayoutHelper::render('joomla.content.associations', $items);
}
return $html;
}
public static function associationCategory($id)
{
// Defaults
$html = '';
// Get the associations
if ($associations = Associations::getAssociations('com_djcatalog2', '#__djc2_categories', 'com_djcatalog2.category', (int)$id, 'id', '', ''))
{
foreach ($associations as $tag => $associated)
{
$associations[$tag] = (int) $associated->id;
}
// get the relevant category titles and languages, for the tooltip
$db = Factory::getDbo();
$query = $db->getQuery(true)
->select('i.*')
->select('l.sef as lang_sef')
->select('l.lang_code')
->from('#__djc2_categories as i')
->where('i.id IN (' . implode(',', array_values($associations)) . ')')
->join('LEFT', '#__languages as l ON i.language=l.lang_code')
->select('l.image')
->select('l.title as language_title');
$db->setQuery($query);
try
{
$items = $db->loadObjectList('id');
}
catch (RuntimeException $e)
{
throw new Exception($e->getMessage(), 500, $e);
}
if ($items)
{
foreach ($items as &$item)
{
$text = $item->lang_sef ? strtoupper($item->lang_sef) : 'XX';
$url = Route::_('index.php?option=com_djcatalog2&task=category.edit&id=' . (int) $item->id);
$tooltip = htmlspecialchars($item->name, ENT_QUOTES, 'UTF-8') . '<br />';
$classes = 'hasPopover label label-association label-' . $item->lang_sef;
$item->link = '<a href="' . $url . '" title="' . $item->language_title . '" class="' . $classes
. '" data-content="' . $tooltip . '" data-placement="top">'
. $text . '</a>';
}
}
Joomla\CMS\HTML\HTMLHelper::_('bootstrap.popover');
$html = LayoutHelper::render('joomla.content.associations', $items);
}
return $html;
}
public static function associationField($id)
{
// Defaults
$html = '';
// Get the associations
if ($associations = Associations::getAssociations('com_djcatalog2', '#__djc2_items_extra_fields', 'com_djcatalog2.field', (int)$id, 'id', '', ''))
{
foreach ($associations as $tag => $associated)
{
$associations[$tag] = (int) $associated->id;
}
// get the relevant category titles and languages, for the tooltip
$db = Factory::getDbo();
$query = $db->getQuery(true)
->select('i.*')
->select('l.sef as lang_sef')
->select('l.lang_code')
->from('#__djc2_items_extra_fields as i')
->where('i.id IN (' . implode(',', array_values($associations)) . ')')
->join('LEFT', '#__languages as l ON i.language=l.lang_code')
->select('l.image')
->select('l.title as language_title');
$db->setQuery($query);
try
{
$items = $db->loadObjectList('id');
}
catch (RuntimeException $e)
{
throw new Exception($e->getMessage(), 500, $e);
}
if ($items)
{
foreach ($items as &$item)
{
$text = $item->lang_sef ? strtoupper($item->lang_sef) : 'XX';
$url = Route::_('index.php?option=com_djcatalog2&task=field.edit&id=' . (int) $item->id);
$tooltip = htmlspecialchars($item->name, ENT_QUOTES, 'UTF-8') . '<br />';
$classes = 'hasPopover label label-association label-' . $item->lang_sef;
$item->link = '<a href="' . $url . '" title="' . $item->language_title . '" class="' . $classes
. '" data-content="' . $tooltip . '" data-placement="top">'
. $text . '</a>';
}
}
Joomla\CMS\HTML\HTMLHelper::_('bootstrap.popover');
$html = LayoutHelper::render('joomla.content.associations', $items);
}
return $html;
}
public static function associationProducer($id)
{
// Defaults
$html = '';
// Get the associations
if ($associations = Associations::getAssociations('com_djcatalog2', '#__djc2_producers', 'com_djcatalog2.producer', (int)$id, 'id', '', ''))
{
foreach ($associations as $tag => $associated)
{
$associations[$tag] = (int) $associated->id;
}
// get the relevant category titles and languages, for the tooltip
$db = Factory::getDbo();
$query = $db->getQuery(true)
->select('i.*')
->select('l.sef as lang_sef')
->select('l.lang_code')
->from('#__djc2_producers as i')
->where('i.id IN (' . implode(',', array_values($associations)) . ')')
->join('LEFT', '#__languages as l ON i.language=l.lang_code')
->select('l.image')
->select('l.title as language_title');
$db->setQuery($query);
try
{
$items = $db->loadObjectList('id');
}
catch (RuntimeException $e)
{
throw new Exception($e->getMessage(), 500, $e);
}
if ($items)
{
foreach ($items as &$item)
{
$text = $item->lang_sef ? strtoupper($item->lang_sef) : 'XX';
$url = Route::_('index.php?option=com_djcatalog2&task=producer.edit&id=' . (int) $item->id);
$tooltip = htmlspecialchars($item->name, ENT_QUOTES, 'UTF-8') . '<br />';
$classes = 'hasPopover label label-association label-' . $item->lang_sef;
$item->link = '<a href="' . $url . '" title="' . $item->language_title . '" class="' . $classes
. '" data-content="' . $tooltip . '" data-placement="top">'
. $text . '</a>';
}
}
Joomla\CMS\HTML\HTMLHelper::_('bootstrap.popover');
$html = LayoutHelper::render('joomla.content.associations', $items);
}
return $html;
}
public static function associationProducerfield($id)
{
// Defaults
$html = '';
// Get the associations
if ($associations = Associations::getAssociations('com_djcatalog2', '#__djc2_producers_extra_fields', 'com_djcatalog2.producerfield', (int)$id, 'id', '', ''))
{
foreach ($associations as $tag => $associated)
{
$associations[$tag] = (int) $associated->id;
}
// get the relevant category titles and languages, for the tooltip
$db = Factory::getDbo();
$query = $db->getQuery(true)
->select('i.*')
->select('l.sef as lang_sef')
->select('l.lang_code')
->from('#__djc2_producers_extra_fields as i')
->where('i.id IN (' . implode(',', array_values($associations)) . ')')
->join('LEFT', '#__languages as l ON i.language=l.lang_code')
->select('l.image')
->select('l.title as language_title');
$db->setQuery($query);
try
{
$items = $db->loadObjectList('id');
}
catch (RuntimeException $e)
{
throw new Exception($e->getMessage(), 500, $e);
}
if ($items)
{
foreach ($items as &$item)
{
$text = $item->lang_sef ? strtoupper($item->lang_sef) : 'XX';
$url = Route::_('index.php?option=com_djcatalog2&task=producerfield.edit&id=' . (int) $item->id);
$tooltip = htmlspecialchars($item->name, ENT_QUOTES, 'UTF-8') . '<br />';
$classes = 'hasPopover label label-association label-' . $item->lang_sef;
$item->link = '<a href="' . $url . '" title="' . $item->language_title . '" class="' . $classes
. '" data-content="' . $tooltip . '" data-placement="top">'
. $text . '</a>';
}
}
Joomla\CMS\HTML\HTMLHelper::_('bootstrap.popover');
$html = LayoutHelper::render('joomla.content.associations', $items);
}
return $html;
}
public static function associationProducercategory($id)
{
// Defaults
$html = '';
// Get the associations
if ($associations = Associations::getAssociations('com_djcatalog2', '#__djc2_producer_categories', 'com_djcatalog2.producercategory', (int)$id, 'id', '', ''))
{
foreach ($associations as $tag => $associated)
{
$associations[$tag] = (int) $associated->id;
}
// get the relevant category titles and languages, for the tooltip
$db = Factory::getDbo();
$query = $db->getQuery(true)
->select('i.*')
->select('l.sef as lang_sef')
->select('l.lang_code')
->from('#__djc2_producer_categories as i')
->where('i.id IN (' . implode(',', array_values($associations)) . ')')
->join('LEFT', '#__languages as l ON i.language=l.lang_code')
->select('l.image')
->select('l.title as language_title');
$db->setQuery($query);
try
{
$items = $db->loadObjectList('id');
}
catch (RuntimeException $e)
{
throw new Exception($e->getMessage(), 500, $e);
}
if ($items)
{
foreach ($items as &$item)
{
$text = $item->lang_sef ? strtoupper($item->lang_sef) : 'XX';
$url = Route::_('index.php?option=com_djcatalog2&task=producercategory.edit&id=' . (int) $item->id);
$tooltip = htmlspecialchars($item->name, ENT_QUOTES, 'UTF-8') . '<br />';
$classes = 'hasPopover label label-association label-' . $item->lang_sef;
$item->link = '<a href="' . $url . '" title="' . $item->language_title . '" class="' . $classes
. '" data-content="' . $tooltip . '" data-placement="top">'
. $text . '</a>';
}
}
Joomla\CMS\HTML\HTMLHelper::_('bootstrap.popover');
$html = LayoutHelper::render('joomla.content.associations', $items);
}
return $html;
}
public static function getBSClasses()
{
$cl = new Registry;
if(version_compare(JVERSION, '4', '>=')) { // Bootstrap 4
$cl->set('tab', 'uitab');
$cl->set('row', 'row');
$cl->set('col', 'col-md-');
}else{ // Boostrap 2.3.2
$cl->set('tab', 'bootstrap');
$cl->set('row', 'row row-fluid');
$cl->set('col', 'span');
}
return $cl;
}
public static function isJoomla4()
{
return (bool)(version_compare(JVERSION, '4', '>='));
}
}