diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index c3dea8d961..a921c2796a 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -6026,3 +6026,36 @@ function html_print_select_agent_secondary($agent, $id_agente, $options=[]) return $output; } + + +/** + * Prints a simple 'Go Back' button. + * + * @param string $url Destination Url. + * @param array $options Options. + * `button_class`: Class for button. 'w100p' by default. + * `title`: Title of the button. 'Go Back' by default. + * `action_class`: Class of icon of button. 'cancel' by default. + * @param boolean $return If true, return a formed HTML element. + * + * @return mixed + */ +function html_print_go_back_button(string $url, array $options=[], bool $return=false) +{ + $output = html_print_div( + [ + 'class' => ($options['button_class'] ?? 'w100p'), + 'content' => html_print_button( + ($options['title'] ?? __('Go back')), + 'go_back', + false, + 'window.location.href = \''.$url.'\'', + 'class="sub '.($options['action_class'] ?? ' cancel').' right"', + true + ), + ], + $return + ); + + return $output; +}