diff --git a/pandora_console/godmode/wizards/Wizard.main.php b/pandora_console/godmode/wizards/Wizard.main.php
index fa88e5df8b..6783ba20e1 100644
--- a/pandora_console/godmode/wizards/Wizard.main.php
+++ b/pandora_console/godmode/wizards/Wizard.main.php
@@ -27,7 +27,12 @@
*/
// Begin.
+global $config;
+require_once $config['homedir'].'/vendor/autoload.php';
+require_once $config['homedir'].'/include/class/HTML.class.php';
+
+use \HTML;
/**
* Global Wizard generic class. Needs to be inherited.
@@ -423,281 +428,6 @@ class Wizard
}
- /**
- * Print a block of inputs.
- * Example, using direct to 'anidate' inputs directly to wrapper:
- * [
- * 'wrapper' => 'div',
- * 'block_id' => 'example_id',
- * 'class' => 'your class',
- * 'direct' => 1,
- * 'block_content' => [
- * [
- * 'arguments' => [
- * 'label' => __('Sugesstion'),
- * 'type' => 'button',
- * 'attributes' => 'class="sub ok btn_sug"',
- * 'name' => 'option_1',
- * 'id' => 'option_1',
- * 'script' => 'change_option1()',
- * ],
- * ],
- * [
- * 'arguments' => [
- * 'label' => __('Something is not quite right'),
- * 'type' => 'button',
- * 'attributes' => 'class="sub ok btn_something"',
- * 'name' => 'option_2',
- * 'id' => 'option_2',
- * 'script' => 'change_option2()',
- * ],
- * ],
- * ],
- * ].
- *
- * @param array $input Definition of target block to be printed.
- * @param boolean $return Return as string or direct output.
- * @param boolean $direct Avoid encapsulation if input print is direct.
- *
- * @return string HTML content.
- */
- public function printBlock(
- array $input,
- bool $return=false,
- bool $direct=false
- ) {
- $output = '';
- if ($input['hidden'] == 1) {
- $class = ' hidden';
- } else {
- $class = '';
- }
-
- if (isset($input['class']) === true) {
- $class = $input['class'].$class;
- }
-
- if (is_array($input['block_content']) === true) {
- $direct = (bool) $input['direct'];
- $toggle = (bool) $input['toggle'];
-
- // Print independent block of inputs.
- $output .= '
';
-
- if ($input['wrapper']) {
- $output .= '<'.$input['wrapper'].' id="'.$input['block_id'].'" class="'.$class.'">';
- }
-
- if (!$direct) {
- // Avoid encapsulation if input is direct => 1.
- $output .= '';
- }
-
- if ($input['wrapper']) {
- $output .= ''.$input['wrapper'].'>';
- }
-
- $output .= '';
- } else {
- if ($input['arguments']['type'] != 'hidden'
- && $input['arguments']['type'] != 'hidden_extended'
- ) {
- if (!$direct) {
- $output .= '';
- }
-
- $output .= '';
- $output .= $this->printInput($input['arguments']);
- // Allow dynamic content.
- $output .= $input['extra'];
- if (!$direct) {
- $output .= '';
- }
- } else {
- $output .= $this->printInput($input['arguments']);
- // Allow dynamic content.
- $output .= $input['extra'];
- }
- }
-
- if ($return === false) {
- echo $output;
- }
-
- return $output;
- }
-
-
- /**
- * Print a block of inputs with grid format.
- *
- * @param array $input Definition of target block to be printed.
- * @param boolean $return Return as string or direct output.
- *
- * @return string HTML content.
- */
- public function printBlockAsGrid(array $input, bool $return=false)
- {
- $output = '';
- if ($input['hidden'] == 1) {
- $class = ' hidden';
- } else {
- $class = '';
- }
-
- if (isset($input['class']) === true) {
- $class = $input['class'].$class;
- }
-
- if (is_array($input['block_content']) === true) {
- // Print independent block of inputs.
- $output .= '';
- } else {
- if ($input['arguments']['type'] != 'hidden'
- && $input['arguments']['type'] != 'hidden_extended'
- ) {
- $id = '';
- if ($input['id']) {
- $id = $input['id'];
- }
-
- if ($input['arguments']['inline'] != 'true') {
- $output .= '';
- $output .= '';
- } else {
- $output .= '
';
- }
-
- $first_block_printed = true;
- }
-
- $row_output = '
';
-
- foreach ($row['columns'] as $column) {
- $width = isset($column['width']) ? 'width: '.$column['width'].';' : 'width: 100%;';
- $padding_left = isset($column['padding-left']) ? 'padding-left: '.$column['padding-left'].';' : 'padding-left: 0;';
- $padding_right = isset($column['padding-right']) ? 'padding-right: '.$column['padding-right'].';' : 'padding-right: 0;';
- $extra_styles = isset($column['style']) ? $column['style'] : '';
- $class = isset($column['class']) ? $column['class'] : '';
-
- $row_output .= '
';
-
- foreach ($column['inputs'] as $input) {
- if (is_array($input)) {
- if ($input['arguments']['type'] != 'submit') {
- $row_output .= $this->printBlockAsGrid($input, true);
- } else {
- $output_submit .= $this->printBlockAsGrid($input, true);
- }
- } else {
- $row_output .= $input;
- }
- }
-
- $row_output .= '
';
- }
-
- if (isset($row['toggle'])) {
- $output .= ui_print_toggle(
- [
- 'content' => $row_output,
- 'name' => $row['toggle_label'],
- 'hidden_default' => ! (bool) $row['toggle'],
- 'return' => true,
- ]
- );
- } else {
- $output .= $row_output;
- }
-
- $output .= '
';
- }
- }
-
- $output .= '
';
-
- $output .= '
';
- $output .= '';
- $output .= '';
- if ($rawjs) {
- $output .= $rawjs;
- }
-
- if ($return === false) {
- echo $output;
- }
-
- return $output_head.$output;
-
+ return HTML::printFormAsGrid($data, $return);
}
@@ -905,57 +470,7 @@ class Wizard
*/
public function printFormAsList(array $data, bool $return=false)
{
- $form = $data['form'];
- $inputs = $data['inputs'];
- $js = $data['js'];
- $rawjs = $data['js_block'];
- $cb_function = $data['cb_function'];
- $cb_args = $data['cb_args'];
-
- $output_head = '
';
- $output .= '';
- if ($rawjs) {
- $output .= $rawjs;
- }
-
- if ($return === false) {
- echo $output;
- }
-
- return $output_head.$output;
-
+ return HTML::printFormAsList($data, $return);
}
diff --git a/pandora_console/include/class/HTML.class.php b/pandora_console/include/class/HTML.class.php
index dd6bb79ca2..ed9d1fa459 100644
--- a/pandora_console/include/class/HTML.class.php
+++ b/pandora_console/include/class/HTML.class.php
@@ -610,9 +610,15 @@ class HTML
}
if (is_array($input['block_content']) === true) {
+ if (empty($input['label']) === false) {
+ $output .= '
';
+ $output .= $input['label'];
+ $output .= '
';
+ }
+
// Print independent block of inputs.
- $output .= '
';
$output .= '