| 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/views/item/ |
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\Utilities\ArrayHelper;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Version;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Factory;
jimport('joomla.application.component.view');
class Djcatalog2ViewItem extends HtmlView {
protected $itemId;
protected $groupId;
public function display($tpl = null)
{
$app = Factory::getApplication();
$this->itemId = $app->input->getInt('itemId',0);
$groupIds = $app->input->getString('groupId','');
$groupIds = explode(',',$groupIds);
if (!empty($groupIds)) {
$groupIds = ArrayHelper::toInteger($groupIds);
$groupIds = array_unique($groupIds);
}
$groupIds[] = 0;
$this->groupId = $groupIds;
if (!$this->itemId) {
echo Text::_('COM_DJCATALOG2_SAVE_PRODUCT_FIRST');
return;
}
$db = Factory::getDbo();
if (!empty($this->groupId)){
$query = $db->getQuery(true);
$query->select('f.id, f.group_id, f.ordering, f.type, f.cart_variant, f.language, f.name');
// Select specific value fields based on the f.type
$query->select('CASE
WHEN (f.type=\'text\' OR f.type=\'textarea\' OR f.type=\'html\' OR f.type=\'media\') THEN vt.value
WHEN (f.type=\'calendar\') THEN vd.value
WHEN (f.type=\'checkbox\' OR f.type=\'select\' OR f.type=\'bool\' OR f.type=\'multiselect\' OR f.type=\'radio\' OR f.type=\'color\' OR f.type=\'multicolor\') THEN GROUP_CONCAT(vi.value SEPARATOR \'|\')
ELSE "" END AS field_value');
$query->from($db->quoteName('#__djc2_items_extra_fields', 'f'));
$query->leftJoin($db->quoteName('#__djc2_items_extra_fields_values_text', 'vt') . ' ON f.id = vt.field_id AND vt.item_id = ' . (int)$this->itemId);
$query->leftJoin($db->quoteName('#__djc2_items_extra_fields_values_int', 'vi') . ' ON f.id = vi.field_id AND vi.item_id = ' . (int)$this->itemId);
$query->leftJoin($db->quoteName('#__djc2_items_extra_fields_values_date', 'vd') . ' ON f.id = vd.field_id AND vd.item_id = ' . (int)$this->itemId);
$query->innerJoin($db->quoteName('#__djc2_items', 'i') . ' ON i.id = ' . (int)$this->itemId);
// Assuming $this->groupId is an array of group IDs, properly quote and bind the values to prevent SQL injection
$groupIds = array_map(array($db, 'quote'), $this->groupId);
$query->where('f.group_id IN (' . implode(',', $groupIds) . ')');
$query->where('(f.language = i.language OR f.language = ' . $db->quote('*') . ')');
// Commented out as per your request, but make sure it's not necessary for your logic
// $query->where('f.cart_variant=0');
$query->group('f.id');
$query->order('f.group_id ASC, f.ordering ASC');
$db->setQuery($query);
$this->fields = ($db->loadObjectList('id'));
if (count($this->fields)) {
$fieldIds = array_keys($this->fields);
$db->setQuery('SELECT * FROM #__djc2_items_extra_fields_options WHERE field_id IN ('.implode(',', $fieldIds).') ORDER BY field_id ASC, ordering ASC');
$optionList = $db->loadObjectList();
foreach($this->fields as $field_id => $field) {
foreach ($optionList as $optionRow) {
if ($optionRow->field_id == $field_id) {
if (empty($field->optionlist)) {
$this->fields[$field_id]->optionlist = array();
}
$this->fields[$field_id]->optionlist[] = $optionRow;
}
}
}
} else {
echo Text::_('COM_DJCATALOG2_NO_FIELDS_IN_GROUP');
return;
}
} else {
echo Text::_('COM_DJCATALOG2_CHOOSE_FIELDGROUP_FIRST');
return;
}
$version = new Version;
if (version_compare($version->getShortVersion(), '3.0.0', '<')) {
$tpl = 'legacy';
}
parent::display($tpl);
}
public function getDocumentRawProofEditor() {
if (empty($this->myEditor)) {
jimport('joomla.html.editor');
$lang = Factory::getApplication()->getLanguage();
$lang->load('plg_editors_tinymce');
$path = JPATH_PLUGINS . '/editors/tinymce.php';
if (!is_file($path))
{
$path = JPATH_PLUGINS . '/editors/tinymce/tinymce.php';
if (!is_file($path))
{
return false;
}
}
// Require plugin file
require_once $path;
$plugin = PluginHelper::getPlugin('editors', 'tinymce');
$params = new JRegistry;
$params->loadString($plugin->params);
$params->loadArray(array());
$plugin->params = $params;
$dummy = new JEditor();
$this->myEditor = new plgEditorTinymce($dummy, array($plugin));
}
return $this->myEditor;
}
}
?>