[-] BO : fixed breadcrumbs and filters (in the breadcrumbs)
This commit is contained in:
1 parent
80376e9034
commit
4ebc47856e
1 file changed
+32
-25
@@ -390,35 +390,38 @@ class AdminControllerCore extends Controller
|
|||||||
|
|
||||||
if (Tools::isSubmit('submitFilter'))
|
if (Tools::isSubmit('submitFilter'))
|
||||||
{
|
{
|
||||||
$filter = '';
|
$filters = array();
|
||||||
foreach ($this->fields_list AS $field => $t)
|
foreach ($this->fields_list as $field => $t)
|
||||||
{
|
{
|
||||||
|
if (isset($t['filter_key']))
|
||||||
|
$field = $t['filter_key'];
|
||||||
if ($val = Tools::getValue($this->table.'Filter_'.$field))
|
if ($val = Tools::getValue($this->table.'Filter_'.$field))
|
||||||
{
|
{
|
||||||
if(!is_array($val) && !empty($val))
|
if (!is_array($val))
|
||||||
$filter .= ($filter ? ', ' : $this->l(' filter by ')).$t['title'].' : ';
|
|
||||||
|
|
||||||
if (isset($t['type']) && $t['type'] == 'bool')
|
|
||||||
$filter .= ((bool)$val) ? $this->l('yes') : $this->l('no');
|
|
||||||
elseif(is_string($val))
|
|
||||||
$filter .= htmlspecialchars($val, ENT_QUOTES, 'UTF-8');
|
|
||||||
elseif(is_array($val))
|
|
||||||
{
|
{
|
||||||
$tmp = '';
|
$filter_value = '';
|
||||||
foreach($val as $v)
|
if (isset($t['type']) && $t['type'] == 'bool')
|
||||||
if(is_string($v) && !empty($v))
|
$filter_value = ((bool)$val) ? $this->l('yes') : $this->l('no');
|
||||||
$tmp .= ' - '.htmlspecialchars($v, ENT_QUOTES, 'UTF-8');
|
elseif (is_string($val))
|
||||||
if(Tools::strlen($tmp))
|
$filter_value = htmlspecialchars($val, ENT_QUOTES, 'UTF-8');
|
||||||
{
|
if (!empty($filter_value))
|
||||||
$tmp = ltrim($tmp, ' - ');
|
$filters[] = sprintf($this->l('%s: %s'), $t['title'], $filter_value);
|
||||||
$filter .= ($filter ? ', ' : $this->l(' filter by ')).$t['title'].' : ';
|
}
|
||||||
$filter .= $tmp;
|
else
|
||||||
}
|
{
|
||||||
|
$filter_value = '';
|
||||||
|
foreach ($val as $v)
|
||||||
|
if (is_string($v) && !empty($v))
|
||||||
|
$filter_value .= ' - '.htmlspecialchars($v, ENT_QUOTES, 'UTF-8');
|
||||||
|
$filter_value = ltrim($tmp, ' -');
|
||||||
|
if (!empty($filter_value))
|
||||||
|
$filters[] = sprintf($this->l('%s: %s'), $t['title'], $filter_value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($filter)
|
|
||||||
$this->toolbar_title[] = $filter;
|
if (count($filters))
|
||||||
|
$this->toolbar_title[] = sprintf($this->l('filter by %s'), implode(', ', $filters));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1092,14 +1095,18 @@ class AdminControllerCore extends Controller
|
|||||||
|
|
||||||
public function initPageHeaderToolbar()
|
public function initPageHeaderToolbar()
|
||||||
{
|
{
|
||||||
|
if (empty($this->toolbar_title))
|
||||||
|
$this->initToolbarTitle();
|
||||||
|
$title = implode(' > ', $this->toolbar_title);
|
||||||
|
|
||||||
if (is_array($this->page_header_toolbar_btn)
|
if (is_array($this->page_header_toolbar_btn)
|
||||||
&& $this->page_header_toolbar_btn instanceof Traversable
|
&& $this->page_header_toolbar_btn instanceof Traversable
|
||||||
|| trim($this->page_header_toolbar_title) != '')
|
|| trim($title) != '')
|
||||||
$this->show_page_header_toolbar = true;
|
$this->show_page_header_toolbar = true;
|
||||||
|
|
||||||
$this->context->smarty->assign(array(
|
$this->context->smarty->assign(array(
|
||||||
'show_page_header_toolbar' => $this->show_page_header_toolbar,
|
'show_page_header_toolbar' => $this->show_page_header_toolbar,
|
||||||
'page_header_toolbar_title' => $this->page_header_toolbar_title,
|
'page_header_toolbar_title' => $title,
|
||||||
'page_header_toolbar_btn' => $this->page_header_toolbar_btn
|
'page_header_toolbar_btn' => $this->page_header_toolbar_btn
|
||||||
));
|
));
|
||||||
|
|
||||||
@@ -1774,7 +1781,7 @@ class AdminControllerCore extends Controller
|
|||||||
$helper->id = $this->object->id;
|
$helper->id = $this->object->id;
|
||||||
|
|
||||||
// @todo : move that in Helper
|
// @todo : move that in Helper
|
||||||
$helper->title = $this->toolbar_title;
|
$helper->title = implode(' > ', $this->toolbar_title);
|
||||||
$helper->toolbar_btn = $this->toolbar_btn;
|
$helper->toolbar_btn = $this->toolbar_btn;
|
||||||
$helper->show_toolbar = $this->show_toolbar;
|
$helper->show_toolbar = $this->show_toolbar;
|
||||||
$helper->toolbar_scroll = $this->toolbar_scroll;
|
$helper->toolbar_scroll = $this->toolbar_scroll;
|
||||||
|
|||||||
Reference in new issue
Block a user