Added prepareBreadcrum function

Former-commit-id: caf781a20bdd16bed7347bf755e2bf0da6ae7e99
This commit is contained in:
manuel 2019-02-20 08:41:15 +01:00
parent fa3f548cdd
commit 3d2ae47543
1 changed files with 63 additions and 11 deletions

View File

@ -92,7 +92,15 @@ class HostDevices extends Wizard
$mode = get_parameter('mode', null);
if ($mode === null) {
$this->setBreadcrum(['<a href="index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd" class="text_color"><div class="arrow_box">&nbsp &nbsp Host & devices</div></a>']);
$this->prepareBreadcrum(
[
[
'link' => $this->url.'&wiz=hd',
'label' => __('&nbsp &nbsp Host & devices'),
],
]
);
$this->printHeader();
$this->printBigButtonsList(
[
@ -115,10 +123,16 @@ class HostDevices extends Wizard
if (enterprise_installed()) {
if ($mode == 'importcsv') {
$this->setBreadcrum(
$this->prepareBreadcrum(
[
'<a href="index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd" class="text_color"><div class="arrow_box">&nbsp &nbsp Host & devices</div></a>',
'<a href="index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd&mode=importcsv" class="text_color"><div class="arrow_box">&nbsp &nbsp &nbsp Import CSV</div></a>',
[
'link' => $this->url.'&wiz=hd',
'label' => __('&nbsp &nbsp Host & devices'),
],
[
'link' => $this->url.'&wiz=hd&mode=importcsv',
'label' => __('&nbsp &nbsp &nbsp Import CSV'),
],
]
);
$this->printHeader();
@ -130,18 +144,34 @@ class HostDevices extends Wizard
if ($mode == 'netscan') {
if ($this->page != 2) {
// Do not paint breadcrum in last page. Redirected.
$this->setBreadcrum(
$this->prepareBreadcrum(
[
'<a href="index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd"class="text_color"><div class="arrow_box">&nbsp &nbsp Host & devices</div></a>',
'<a href="index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd&mode=netscan" class="text_color"><div class="arrow_box">&nbsp &nbsp Net scan definition</div></a>',
[
'link' => $this->url.'&wiz=hd',
'label' => __('&nbsp &nbsp Host & devices'),
],
[
'link' => $this->url.'&wiz=hd&mode=netscan',
'label' => __('&nbsp &nbsp &nbsp Net scan definition'),
],
]
);
if ($this->page == 1) {
$this->setBreadcrum(
$this->prepareBreadcrum(
[
'<a href="index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd"class="text_color"><div class="arrow_box">&nbsp &nbsp Host & devices</div></a>',
'<a href="index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd&mode=netscan" class="text_color"><div class="arrow_box">&nbsp &nbsp Net scan definition</div></a>',
'<a href="index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd&mode=netscan&page=1" class="text_color"><div class="arrow_box">&nbsp &nbsp Net scan features</div></a>',
[
'link' => $this->url.'&wiz=hd',
'label' => __('&nbsp &nbsp Host & devices'),
],
[
'link' => $this->url.'&wiz=hd&mode=netscan',
'label' => __('&nbsp &nbsp &nbsp Net scan definition'),
],
[
'link' => $this->url.'&wiz=hd&mode=netscan&page=1',
'label' => __('&nbsp &nbsp &nbsp Net scan features'),
],
]
);
}
@ -1096,4 +1126,26 @@ $(function() {
}
/**
* Builder for breadcrum
*
* @param array $urls Array of urls to be stored in breadcrum.
*
* @return void
*/
public function prepareBreadcrum(array $urls)
{
$bc = [];
$i = 0;
foreach ($urls as $url) {
$bc[$i] = '<a href="'.$url['link'].'" class="text_color">';
$bc[$i] .= '<div class="arrow_box">'.$url['label'].'</div>';
$bc[$i++] .= '</a>';
}
$this->setBreadcrum($bc);
}
}