// added title for helperlist, admincontroller factorisation of helper list usage
This commit is contained in:
@@ -76,6 +76,12 @@ class AdminControllerCore extends Controller
|
|||||||
/** @var array Errors displayed after post processing */
|
/** @var array Errors displayed after post processing */
|
||||||
public $_errors = array();
|
public $_errors = array();
|
||||||
|
|
||||||
|
/** @var define if the header of the list contains filter and sorting links or not */
|
||||||
|
protected $list_simple_header;
|
||||||
|
|
||||||
|
/** @var define if the header of the list contains filter and sorting links or not */
|
||||||
|
protected $list_title;
|
||||||
|
|
||||||
/** @var array list to be generated */
|
/** @var array list to be generated */
|
||||||
protected $fieldsDisplay;
|
protected $fieldsDisplay;
|
||||||
|
|
||||||
@@ -947,11 +953,15 @@ class AdminControllerCore extends Controller
|
|||||||
{
|
{
|
||||||
if (Tab::checkTabRights($tab['id_tab']) === true)
|
if (Tab::checkTabRights($tab['id_tab']) === true)
|
||||||
{
|
{
|
||||||
$img_exists_cache = Tools::file_exists_cache(_PS_ADMIN_DIR_.'/themes/'.$this->context->employee->bo_theme.'/img/t/'.$tab['class_name'].'.gif');
|
$img_exists_cache = Tools::file_exists_cache(_PS_ADMIN_DIR_.'/themes/'.$this->context->employee->bo_theme.'/img/t/'.$tab['class_name'].'.png');
|
||||||
$img = ($img_exists_cache ? 'themes/'.Context::getContext()->employee->bo_theme.'/img/' : _PS_IMG_).'t/'.$tab['class_name'].'.gif';
|
$img = ($img_exists_cache ? 'themes/'.Context::getContext()->employee->bo_theme.'/img/' : _PS_IMG_).'t/'.$tab['class_name'].'.png';
|
||||||
|
|
||||||
if (trim($tab['module']) != '')
|
if (trim($tab['module']) != '')
|
||||||
$img = _MODULE_DIR_.$tab['module'].'/'.$tab['class_name'].'.gif';
|
$img = _MODULE_DIR_.$tab['module'].'/'.$tab['class_name'].'.png';
|
||||||
|
|
||||||
|
// retrocompatibility
|
||||||
|
if(!file_exists($img))
|
||||||
|
$img = str_replace('png', 'gif', $img);
|
||||||
|
|
||||||
// tab[class_name] does not contains the "Controller" suffix
|
// tab[class_name] does not contains the "Controller" suffix
|
||||||
$tabs[$index]['current'] = ($tab['class_name'].'Controller' == get_class($this)) || (Tab::getCurrentParentId() == $tab['id_tab']);
|
$tabs[$index]['current'] = ($tab['class_name'].'Controller' == get_class($this)) || (Tab::getCurrentParentId() == $tab['id_tab']);
|
||||||
@@ -1151,7 +1161,21 @@ class AdminControllerCore extends Controller
|
|||||||
$this->actions[] = $action;
|
$this->actions[] = $action;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->setHelperListDisplay($helper);
|
||||||
|
return $helper->generateList($this->_list, $this->fieldsDisplay);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* this function set various display option for helper list
|
||||||
|
*
|
||||||
|
* @param Helper $helper
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setHelperListDisplay(Helper $helper)
|
||||||
|
{
|
||||||
$helper->actions = $this->actions;
|
$helper->actions = $this->actions;
|
||||||
|
$helper->simple_header = $this->list_simple_header;
|
||||||
|
$helper->title = $this->list_title;
|
||||||
$helper->toolbar_btn = $this->toolbar_btn;
|
$helper->toolbar_btn = $this->toolbar_btn;
|
||||||
$helper->bulk_actions = $this->bulk_actions;
|
$helper->bulk_actions = $this->bulk_actions;
|
||||||
$helper->currentIndex = self::$currentIndex;
|
$helper->currentIndex = self::$currentIndex;
|
||||||
@@ -1173,7 +1197,6 @@ class AdminControllerCore extends Controller
|
|||||||
// For each action, try to add the corresponding skip elements list
|
// For each action, try to add the corresponding skip elements list
|
||||||
$helper->list_skip_actions = $this->list_skip_actions;
|
$helper->list_skip_actions = $this->list_skip_actions;
|
||||||
|
|
||||||
return $helper->generateList($this->_list, $this->fieldsDisplay);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -99,6 +99,9 @@ class HelperListCore extends Helper
|
|||||||
'id_carrier' => 'id_carrier'
|
'id_carrier' => 'id_carrier'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/** @var if not null, a title will be added on that list */
|
||||||
|
public $title = null;
|
||||||
|
|
||||||
/** @var boolean ask for simple header : no filters, no paginations and no sorting */
|
/** @var boolean ask for simple header : no filters, no paginations and no sorting */
|
||||||
public $simple_header = false;
|
public $simple_header = false;
|
||||||
|
|
||||||
@@ -513,6 +516,7 @@ class HelperListCore extends Helper
|
|||||||
'action' => $action,
|
'action' => $action,
|
||||||
'page' => $page,
|
'page' => $page,
|
||||||
'simple_header' => $this->simple_header,
|
'simple_header' => $this->simple_header,
|
||||||
|
'title' => $this->title,
|
||||||
'total_pages' => $total_pages,
|
'total_pages' => $total_pages,
|
||||||
'selected_pagination' => $selected_pagination,
|
'selected_pagination' => $selected_pagination,
|
||||||
'pagination' => $this->_pagination,
|
'pagination' => $this->_pagination,
|
||||||
|
|||||||
Reference in New Issue
Block a user