| 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/plugins/content/jlexreview/elements/ |
Upload File : |
<?php
defined('_JEXEC') or die;
$j5 = JPATH_ROOT.'/administrator/components/com_jlexreview/libs/j5.php';
if(file_exists($j5))
require_once $j5;
jimport('joomla.form.formfield');
class JFormFieldVirtuemart extends JFormField
{
protected $type = 'Virtuemart';
protected function getInput() {
// Check VM installed yet?
$VMXML = JPATH_ADMINISTRATOR . '/components/com_virtuemart/virtuemart.xml';
$VMADMIN = JPATH_ADMINISTRATOR . '/components/com_virtuemart';
if(!file_exists($VMXML))
{
return '<span style="color:red">VirtueMart not installed.</span>';
}
// Check version of VM
$xml = simplexml_load_file($VMXML);
$version = $xml->version.'';
if (version_compare ( $version, '3', '>=' )) {
// VM 3.x
if (! class_exists ( 'VmConfig' ))
require (JPATH_ROOT . '/administrator/components/com_virtuemart/helpers/config.php');
if (! class_exists ( 'ShopFunctions' ))
require ($VMADMIN . '/helpers/shopfunctions.php');
$key = ($this->element ['key_field'] ? $this->element ['key_field'] : 'value');
$val = ($this->element ['value_field'] ? $this->element ['value_field'] : $this->name);
VmConfig::loadConfig ();
VmConfig::loadJLang ( 'com_virtuemart' );
$categorylist = ShopFunctions::categoryListTree($this->value);
if(preg_match("/^\s*$/", $categorylist))
return '<span style="color:red">No category found.</span>';
$output = '<select class="inputbox custom-select" multiple="multiple" size="10" name="' . $this->name . '[]" >';
$output .= $categorylist;
$output .= "</select>";
} else {
// VM 2.x
if (! class_exists ( 'VmConfig' ))
require (JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/config.php');
if (! class_exists ( 'ShopFunctions' ))
require (JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/shopfunctions.php');
if (! class_exists ( 'TableCategories' ))
require (JPATH_ADMINISTRATOR . '/components/com_virtuemart/tables/categories.php');
if (! class_exists ( 'VmElements' ))
require (JPATH_ADMINISTRATOR . '/components/com_virtuemart/elements/vmelements.php');
$key = ($this->element ['key_field'] ? $this->element ['key_field'] : 'value');
$val = ($this->element ['value_field'] ? $this->element ['value_field'] : $this->name);
$this->value = ! is_array ( $this->value ) ? array () : $this->value;
$categorylist = ShopFunctions::categoryListTreeLoop ( $this->value );
$output = '<select name="' . $this->name . '[]" class="inputbox" multiple="multiple" size="10">';
$output .= '<option ' . (in_array ( '0', $this->value ) ? 'selected="selected" ' : '') . ' value="0">Select all</option>';
$output .= stripcslashes($categorylist);
$output .= '</select>';
}
return $output;
}
}