diff --git a/pandora_console/godmode/wizards/HostDevices.class.php b/pandora_console/godmode/wizards/HostDevices.class.php index 6612e0e088..330ae72865 100755 --- a/pandora_console/godmode/wizards/HostDevices.class.php +++ b/pandora_console/godmode/wizards/HostDevices.class.php @@ -68,7 +68,7 @@ class HostDevices extends Wizard /** * Undocumented function. * - * @param integer $page Mensajito. + * @param integer $page Start page, by default 0. * @param string $msg Mensajito. * @param string $icon Mensajito. * @param string $label Mensajito. @@ -81,6 +81,8 @@ class HostDevices extends Wizard string $icon='hostDevices.png', string $label='Host & Devices' ) { + $this->setBreadcrum([]); + $this->id = null; $this->msg = $msg; $this->icon = $icon; @@ -105,6 +107,8 @@ class HostDevices extends Wizard $mode = get_parameter('mode', null); if ($mode === null) { + $this->setBreadcrum(['Host&devices']); + $this->printHeader(); if (extensions_is_enabled_extension('csv_import')) { echo 'Importar csv'; } @@ -114,10 +118,24 @@ class HostDevices extends Wizard } if ($mode == 'importcsv') { + $this->setBreadcrum( + [ + 'Host&devices', + 'Import CSV', + ] + ); + $this->printHeader(); return $this->runCSV(); } if ($mode == 'netscan') { + $this->setBreadcrum( + [ + 'Host&devices', + 'Net scan', + ] + ); + $this->printHeader(); return $this->runNetScan(); } @@ -154,6 +172,7 @@ class HostDevices extends Wizard public function runCSV() { global $config; + if (!check_acl($config['id_user'], 0, 'AW') ) { db_pandora_audit( @@ -187,7 +206,6 @@ class HostDevices extends Wizard { global $config; - echo 'formulario netscan'; check_login(); if (! check_acl($config['id_user'], 0, 'PM')) { @@ -688,158 +706,12 @@ class HostDevices extends Wizard echo ''; ui_require_javascript_file('pandora_modules'); - $javascript = ` - `; - echo $javascript; - - return [ - 'result' => $this->result, - 'id' => $this->id, - 'msg' => $this->msg, - ]; + return [ + 'result' => $this->result, + 'id' => $this->id, + 'msg' => $this->msg, + ]; } diff --git a/pandora_console/godmode/wizards/Wizard.main.php b/pandora_console/godmode/wizards/Wizard.main.php index 9a827d73da..6a97cf73a3 100644 --- a/pandora_console/godmode/wizards/Wizard.main.php +++ b/pandora_console/godmode/wizards/Wizard.main.php @@ -6,6 +6,37 @@ class Wizard { + /** + * Breadcrum + * + * @var array. + */ + public $breadcrum; + + + /** + * Setter for breadcrum + * + * @param array $str Breadcrum. + * + * @return void + */ + public function setBreadcrum(array $str) + { + $this->breadcrum = $str; + } + + + /** + * Getter for breadcrum + * + * @return array Breadcrum. + */ + public function getBreadcrum() + { + return $this->breadcrum; + } + /** * To be overwritten. @@ -27,6 +58,35 @@ class Wizard } + /** + * Print breadcrum to follow flow. + * + * @return string Breadcrum HTML code. + */ + public function printBreadcrum() + { + return '

'.implode(' > ', $this->breadcrum).'

'; + } + + + /** + * Prints a header for current wizard. + * + * @param boolean $return Return HTML or print it. + * + * @return string HTML code for header. + */ + public function printHeader(bool $return=false) + { + $output = $this->printBreadcrum(); + if ($return === false) { + echo $output; + } + + return $output; + } + + /** * Print input using functions html lib. * @@ -168,7 +228,7 @@ class Wizard * * @param array $data Definition of target form to be printed. * - * @return void + * @return string HTML code. */ public function printForm(array $data) {