pandorafms/pandora_console/views/dashboard/tipsWindow.php

140 lines
4.0 KiB
PHP
Raw Normal View History

2023-02-13 13:26:49 +01:00
<?php
/**
2023-02-17 12:53:35 +01:00
* Dashboards View tips in modal
2023-02-13 13:26:49 +01:00
*
* @category Console Class
2023-02-17 12:53:35 +01:00
* @package Pandora FMS
2023-02-13 13:26:49 +01:00
* @subpackage Dashboards
2023-02-17 12:53:35 +01:00
* @version 1.0.0
* @license See below
2023-02-13 13:26:49 +01:00
*
2023-02-17 12:53:35 +01:00
* ______ ___ _______ _______ ________
2023-06-08 12:42:10 +02:00
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
2023-02-13 13:26:49 +01:00
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
2023-06-08 11:53:13 +02:00
* Copyright (c) 2005-2023 Pandora FMS
2023-06-08 13:19:01 +02:00
* Please see https://pandorafms.com/community/ for full contribution list
2023-02-13 13:26:49 +01:00
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
2023-02-17 12:53:35 +01:00
2024-02-07 16:39:33 +01:00
if (isset($preview) === false) {
$preview = '';
}
2024-02-08 12:31:55 +01:00
if (isset($id) === false) {
$id = '';
}
2023-02-13 16:21:37 +01:00
$output = '';
2023-02-14 10:55:01 +01:00
$output .= '<script>var idTips = ['.$id.'];</script>';
2023-02-13 16:21:37 +01:00
$output .= '<div class="window">';
$output .= '<div class="tips_header">';
$output .= '<p class="title">'.__('Hello! These are the tips of the day.').'</p>';
$output .= '<p>'.html_print_checkbox(
'show_tips_startup',
true,
true,
true,
false,
2023-03-07 17:57:09 +01:00
'show_tips_startup(this)',
false,
'',
2023-02-16 18:13:34 +01:00
($preview === true) ? '' : 'checkbox_tips_startup'
2024-01-04 15:39:27 +01:00
).'&nbsp;'.__('Show usage tips at startup').'</p>';
2023-02-13 16:21:37 +01:00
$output .= '</div>';
2023-02-17 14:15:16 +01:00
$output .= '<div class="carousel '.((empty($files) === true && empty($files64) === true) ? 'invisible' : '').'">';
2023-02-13 16:21:37 +01:00
$output .= '<div class="images">';
2023-02-13 13:26:49 +01:00
2023-02-13 16:21:37 +01:00
if ($files !== false) {
2023-02-16 18:13:34 +01:00
if ($preview === true) {
foreach ($files as $key => $file) {
2023-03-16 13:31:16 +01:00
$output .= html_print_image($file, true, ['class' => 'main_menu_icon']);
2023-02-16 18:13:34 +01:00
}
} else {
foreach ($files as $key => $file) {
2023-03-16 13:31:16 +01:00
$output .= html_print_image($file['path'].$file['filename'], true, ['class' => 'main_menu_icon']);
2023-02-16 18:13:34 +01:00
}
2023-02-13 16:21:37 +01:00
}
}
2024-02-07 16:39:33 +01:00
if (isset($files64) === true) {
2024-02-08 12:31:55 +01:00
if ($files64 !== false) {
foreach ($files64 as $key => $file) {
$output .= '<img src="'.$file.'" />';
}
2023-02-17 11:07:28 +01:00
}
}
2023-02-13 16:21:37 +01:00
$output .= '</div>';
$output .= '</div>';
$output .= '<div class="description">';
$output .= '<h2 id="title_tip">'.$title.'</h2>';
$output .= '<p id="text_tip">';
$output .= $text;
$output .= '</p>';
$disabled_class = 'disabled_button';
$disabled = true;
2023-02-13 16:21:37 +01:00
if (empty($url) === false && $url !== '') {
$disabled_class = '';
$disabled = false;
2023-02-13 16:21:37 +01:00
}
$output .= '</div>';
$output .= '<div class="ui-dialog-buttonset">';
$output .= '<a href="'.$url.'" class="" target="_blank" id="url_tip">';
2023-03-07 17:57:09 +01:00
$output .= html_print_button(
__('Learn more'),
'learn_more',
$disabled,
2023-03-07 17:57:09 +01:00
'',
['class' => 'secondary mini '.$disabled_class],
2023-03-07 17:57:09 +01:00
true
);
$output .= '</a>';
2023-02-13 16:21:37 +01:00
$output .= '<div class="counter-tips">';
$output .= html_print_image('images/arrow-left-grey.png', true, ['class' => 'arrow_counter', 'onclick' => 'previous_tip()']);
$output .= html_print_image('images/arrow-right-grey.png', true, ['class' => 'arrow_counter', 'onclick' => 'next_tip()']);
$output .= html_print_input_hidden('tip_position', 0, true);
2023-02-13 16:21:37 +01:00
$output .= '</div>';
2023-02-16 18:13:34 +01:00
if ($preview === true) {
2023-03-07 17:57:09 +01:00
$output .= html_print_button(
__('Close'),
'close_dialog',
2023-03-07 17:57:09 +01:00
false,
'',
[
'onclick' => 'close_dialog()',
'class' => 'mini',
],
true
);
2023-02-16 18:13:34 +01:00
} else {
2023-03-07 17:57:09 +01:00
$output .= html_print_button(
__('Close'),
'close_dialog',
2023-03-07 17:57:09 +01:00
false,
'',
[
'onclick' => 'close_dialog()',
'class' => ($totalTips === '1') ? 'mini hide-button' : 'mini',
2023-03-07 17:57:09 +01:00
],
true
);
2023-02-16 18:13:34 +01:00
}
2023-02-13 16:21:37 +01:00
$output .= '</div>';
$output .= '</div>';
echo $output;