This commit is contained in:
Michael RICOIS 2017-11-08 09:48:45 +01:00
parent 731d431be1
commit 9963cbee23

View File

@ -26,32 +26,32 @@ class AdminGuideCategories extends AdminTab
$this->fieldsDisplay = array(
'id_guide_category' => array(
'title' => $this->l('ID'),
'align' => 'center',
'title' => $this->l('ID'),
'align' => 'center',
'width' => 30
),
'name' => array(
'title' => $this->l('Title'),
'title' => $this->l('Title'),
'width' => 100
),
'description' => array(
'title' => $this->l('Description'),
'width' => 500,
'maxlength' => 90,
'title' => $this->l('Description'),
'width' => 500,
'maxlength' => 90,
'orderby' => false
),
'position' => array(
'title' => $this->l('Position'),
'title' => $this->l('Position'),
'width' => 40,
'filter_key' => 'position',
'align' => 'center',
'filter_key' => 'position',
'align' => 'center',
'position' => 'position'
),
'active' => array(
'title' => $this->l('Displayed'),
'active' => 'status',
'align' => 'center',
'type' => 'bool',
'title' => $this->l('Displayed'),
'active' => 'status',
'align' => 'center',
'type' => 'bool',
'orderby' => false
)
);
@ -64,7 +64,7 @@ class AdminGuideCategories extends AdminTab
else {
self::$current_category = new GuideCategory(
(int)(
Tools::getValue('id_guide_category',
Tools::getValue('id_guide_category',
Tools::getValue('id_guide_category_parent', 0))
)
);
@ -105,16 +105,16 @@ class AdminGuideCategories extends AdminTab
'options_map' => ['id_guide_category', 'name', 'level'],
'empty_option' => ['value'=>'0', 'label'=>$this->l('No parent category')],
'initial_value' => $obj->id_parent?$obj->id_parent:self::$current_category->id
),
),
'id_category_family' => array(
'title' => $this->l('Famille'),
'type' => 'select',
'options_raw' => GuideCategory::findFamiliesTree($cookie->id_lang),
'options_map' => ['id_category_family', 'name', 'level'],
'initial_value' => $obj->id_category_family
),
),
'name' => array(
'title' => $this->l('Title'),
'title' => $this->l('Title'),
'type' => 'text',
'required' => true,
'translatable' => true,
@ -143,17 +143,17 @@ class AdminGuideCategories extends AdminTab
'required' => true,
),
'link_rewrite' => array(
'title' => $this->l('Simplified URL'),
'title' => $this->l('Simplified URL'),
'type' => 'text',
'required' => true,
),
'meta_title' => array(
'title' => $this->l('Title (META)'),
'title' => $this->l('Title (META)'),
'type' => 'text',
'translatable' => true,
),
'meta_description' => array(
'title' => $this->l('Description (META)'),
'title' => $this->l('Description (META)'),
'type' => 'textarea',
'translatable' => true,
),
@ -255,7 +255,7 @@ class AdminGuideCategories extends AdminTab
public function postProcess()
{
{
if (isset($_GET['delete'.$this->table]) ||
Tools::getValue('submitDel'.$this->table)) {
$this->postProcessDelete();
@ -274,11 +274,9 @@ class AdminGuideCategories extends AdminTab
protected function afterAdd()
{
if (isset($_FILES['image']['tmp_name']) &&
$_FILES['image']['tmp_name'] != NULL) {
if (isset($_FILES['image']['tmp_name']) && $_FILES['image']['tmp_name'] != NULL) {
$object = $this->loadObject();
$error = checkImage( $_FILES['image'], $this->maxImageSize);
$error = checkImage($_FILES['image'], $this->maxImageSize);
if ($error) {
$this->_errors[] = $error;
return false;
@ -296,14 +294,15 @@ class AdminGuideCategories extends AdminTab
if (file_exists($new_path)) {
@unlink($new_path);
}
if (!imageResize($tmpName, $new_path, self::IMG_WIDTH, self::IMG_HEIGHT)) {
$this->_errors[] = Tools::displayError('An error occurred while copying image.');
return false;
}
@unlink($tmpName);
}
return true;
}
@ -333,7 +332,7 @@ class AdminGuideCategories extends AdminTab
else {
Tools::redirectAdmin($currentIndex.'&id_guide_category_parent='.self::$current_category->id.'&conf=1&token='.$this->token);
}
}
}
else {
$this->_errors[] = Tools::displayError('An error occurred while deleting object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
}
@ -351,7 +350,7 @@ class AdminGuideCategories extends AdminTab
$this->_errors[] = Tools::displayError($this->l('One of the selected categories contains at least one page'));
}
else {
$this->_errors[] = Tools::displayError('An error occurred while deleting selection.');
$this->_errors[] = Tools::displayError('An error occurred while deleting selection.');
}
}
else {