| 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/controllers/ |
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\CMS\Factory;
use Joomla\CMS\MVC\Controller\FormController;
jimport('joomla.application.component.controllerform');
class Djcatalog2ControllerField extends FormController {
protected function allowAdd($data = array())
{
$user = Factory::getUser();
return $user->authorise('core.create', $this->option) || $user->authorise('djcatalog2.admin.catalogue', $this->option);
}
protected function allowEdit($data = array(), $key = 'id')
{
$canDo = Factory::getUser()->authorise('core.edit', $this->option) || Factory::getUser()->authorise('djcatalog2.admin.catalogue', $this->option);
if (!$canDo) {
$task = Factory::getApplication()->input->getCmd('task');
if ($task == 'edit' && Factory::getUser()->authorise('djcatalog2.access.catalogue', $this->option)) {
return true;
} else if ($task == 'cancel') {
return true;
}
}
return $canDo;
}
public function save($key = null, $urlVar = null) {
/*echo '<pre>';
print_r($_POST);
print_r($_FILES);
die();*/
return parent::save($key, $urlVar);
}
/*
function getForm() {
$itemId = JRequest::getVar('itemId',0);
$groupId = JRequest::getVar('groupId',0);
$out = null;
$db = Factory::getDbo();
if ($groupId > 0){
$query = $db->getQuery(true);
$query->select('f.*');
$query->from('#__djc2_items_extra_fields AS f');
$query->select('GROUP_CONCAT(v.value SEPARATOR \'|\') AS field_value');
$query->join('LEFT','#__djc2_items_extra_fields_values AS v ON f.id=v.field_id AND v.item_id='.(int)$itemId);
$query->where('f.group_id='.(int)$groupId);
$query->group('f.id');
$query->order('f.ordering');
$db->setQuery($query);
$fields = ($db->loadObjectList());
if (count($fields)) {
$out .= '<div class="adminformlist">';
foreach ($fields as $k=>$v) {
$input = null;
switch ($v->type) {
case 'text': {
$input = '
<div class="control-label">
<label for="attribute_'.$v->id.'">
'.$v->name.'
</label>
</div>
<div class="controls">
<input size="40" id="attribute_'.$v->id.'" type="text" name="attribute['.$v->id.']" value="'.htmlspecialchars($v->field_value).'" />
</div>
';
break;
}
case 'textarea': {
$input = '
<div class="control-label">
<label for="attribute_'.$v->id.'">
'.$v->name.'
</label>
</div>
<div class="controls">
<textarea rows="3" cols="30" id="attribute_'.$v->id.'" name="attribute['.$v->id.']">'.htmlspecialchars($v->field_value).'</textarea>
</div>
';
break;
}
case 'html': {
$editor = Factory::getEditor();
$input = '
<div class="control-label">
<label for="attribute_'.$v->id.'">
'.$v->name.'
</label>
</div>
<div class="controls">
'.$editor->display( 'attribute['.$v->id.']', $v->field_value, '100%', '250', '0', '0',false).'
</div>
';
break;
}
case 'select': {
$db->setQuery('SELECT * FROM #__djc2_items_extra_fields_options WHERE field_id='.(int)$v->id.' ORDER BY ordering ASC');
$options = $db->loadObjectList();
$optionList = '<option value="">---</option>';
foreach ($options as $option) {
$selected = ($option->id == $v->field_value) ? 'selected="selected"' : '';
$optionList .= '<option '.$selected.' value="'.$option->id.'">'.htmlspecialchars($option->value).'</option>';
}
$input = '
<div class="control-label">
<label for="attribute_'.$v->id.'">'.$v->name.'</label>
</div>
<div class="controls">
<select id="attribute_'.$v->id.'" name="attribute['.$v->id.']">'.$optionList.'</select>
</div>
';
break;
}
case 'checkbox': {
$db->setQuery('SELECT * FROM #__djc2_items_extra_fields_options WHERE field_id='.(int)$v->id.' ORDER BY ordering ASC');
$options = $db->loadObjectList();
$optionList = null;
$values = explode('|', $v->field_value);
$i = 1;
foreach ($options as $option) {
$selected = (in_array($option->id, $values)) ? 'checked="checked"' : '';
$optionList .= '
<input id="attribute_'.$v->id.'-'.$i.'" type="checkbox" '.$selected.' name="attribute['.$v->id.'][]" value="'.$option->id.'">
<label for="attribute_'.$v->id.'-'.$i.'">'.htmlspecialchars($option->value).'</label>
';
$i++;
}
$input = '
<div class="control-label">
<label>'.$v->name.'</label>
</div>
<div class="controls">
<fieldset id="attribute_'.$v->id.'-" class="checkbox">
'.$optionList.'
</fieldset>
</div>
';
break;
}
case 'radio': {
$db->setQuery('SELECT * FROM #__djc2_items_extra_fields_options WHERE field_id='.(int)$v->id.' ORDER BY ordering ASC');
$options = $db->loadObjectList();
$optionList = null;
$i = 0;
foreach ($options as $option) {
$selected = ($option->id == $v->field_value) ? 'checked="checked"' : '';
$optionList .= '
<input id="attribute_'.$v->id.'-'.($i).'" type="radio" '.$selected.' name="attribute['.$v->id.']" value="'.$option->id.'">
<label for="attribute_'.$v->id.'-'.$i.'" for="attribute_'.$v->id.''.'-'.'-lbl">'.htmlspecialchars($option->value).'</label>';
$i++;
}
$input = '
<div class="control-label">
<label>'.$v->name.'</label>
</div>
<div class="controls">
<fieldset id="attribute_'.$v->id.'-" class="required radio">
'.$optionList.'
</fieldset>
</div>
';
break;
}
default: break;
}
$out .= '<div class="control-group">'.$input.'</div>';
}
$out .= '</div>';
} else {
$out = Text::_('COM_DJCATALOG2_NO_FIELDS_IN_GROUP');
}
} else {
$out = Text::_('COM_DJCATALOG2_CHOOSE_FIELDGROUP_FIRST');
}
echo $out;exit;
}*/
}
?>