diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php
index da2c86f941..da9b7e6c8e 100755
--- a/pandora_console/include/functions_ui.php
+++ b/pandora_console/include/functions_ui.php
@@ -7858,5 +7858,124 @@ function ui_print_fav_menu($id_element, $url, $label, $section)
$output .= '
'.__('Title').'
';
$output .= html_print_input_text('label_fav_menu', '', '', 25, 255, true, false, true);
$output .= '';
+ return $output;
+}
+
+
+function ui_print_tree(
+ $tree,
+ $id=0,
+ $depth=0,
+ $last=0,
+ $last_array=[],
+ $sufix=false,
+ $descriptive_ids=false,
+ $previous_id=''
+) {
+ static $url = false;
+ $output = '';
+
+ // Get the base URL for images.
+ if ($url === false) {
+ $url = ui_get_full_url('operation/tree', false, false, false);
+ }
+
+ // Leaf.
+ if (empty($tree['__LEAVES__'])) {
+ return '';
+ }
+
+ $count = 0;
+ $total = (count(array_keys($tree['__LEAVES__'])) - 1);
+ $last_array[$depth] = $last;
+ $class = 'item_'.$depth;
+
+ if ($depth > 0) {
+ $output .= '';
+ } else {
+ $output .= '';
+ }
+
+ foreach ($tree['__LEAVES__'] as $level => $sub_level) {
+ // Id used to expand leafs.
+ $sub_id = time().rand(0, getrandmax());
+ // Display the branch.
+ $output .= '- ';
+
+ // Indent sub branches.
+ for ($i = 1; $i <= $depth; $i++) {
+ if ($last_array[$i] == 1) {
+ $output .= '';
+ } else {
+ $output .= '';
+ }
+ }
+
+ // Branch.
+ if (! empty($sub_level['sublevel']['__LEAVES__'])) {
+ $output .= "";
+ if ($depth == 0 && $count == 0) {
+ if ($count == $total) {
+ $output .= '';
+ } else {
+ $output .= '';
+ }
+ } else if ($count == $total) {
+ $output .= '';
+ } else {
+ $output .= '';
+ }
+
+ $output .= '';
+ }
+
+ // Leave.
+ else {
+ if ($depth == 0 && $count == 0) {
+ if ($count == $total) {
+ $output .= '';
+ } else {
+ $output .= '';
+ }
+ } else if ($count == $total) {
+ $output .= '';
+ } else {
+ $output .= '';
+ }
+ }
+
+ $checkbox_name_sufix = ($sufix === true) ? '_'.$level : '';
+ if ($descriptive_ids === true) {
+ $checkbox_name = 'create_'.$sub_id.$previous_id.$checkbox_name_sufix;
+ } else {
+ $checkbox_name = 'create_'.$sub_id.$checkbox_name_sufix;
+ }
+
+ $previous_id = $checkbox_name_sufix;
+ if ($sub_level['selectable'] === true) {
+ $output .= html_print_checkbox($sub_level['name'], $sub_level['value'], $sub_level['checked'], true, false, '');
+ }
+
+ $output .= ' '.$sub_level['label'].'';
+
+ $output .= '
';
+
+ // Recursively print sub levels.
+ $output .= ui_print_tree(
+ $sub_level['sublevel'],
+ $sub_id,
+ ($depth + 1),
+ (($count == $total) ? 1 : 0),
+ $last_array,
+ $sufix,
+ $descriptive_ids,
+ $previous_id
+ );
+
+ $count++;
+ }
+
+ $output .= '
';
+
return $output;
}
\ No newline at end of file