pandorafms/pandora_console/views/cluster/edit.php

137 lines
3.5 KiB
PHP
Raw Normal View History

2022-10-20 13:17:26 +02:00
<?php
/**
* Cluster View: Edit
*
* @category View
* @package Pandora FMS
* @subpackage Cluster View
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
2023-06-08 12:42:10 +02:00
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
2022-10-20 13:17:26 +02: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
2022-10-20 13:17:26 +02: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.
* ============================================================================
*/
// Begin.
// Prepare header and breadcrums.
$i = 0;
$bc = [];
$extra = '&op='.$wizard->operation;
if ($wizard->id !== null) {
$extra .= '&id='.$wizard->id;
}
$bc[] = [
'link' => $wizard->parentUrl,
'label' => __('Cluster list'),
'selected' => false,
];
$labels = $wizard->getLabels();
foreach ($labels as $key => $label) {
$bc[] = [
'link' => $wizard->url.(($key >= 0) ? $extra.'&page='.$key : ''),
'label' => __($label),
'selected' => ($wizard->page == $key),
];
}
$wizard->prepareBreadcrum($bc);
$header_str = __(ucfirst($wizard->getOperation())).' ';
$header_str .= (($cluster->name() !== null) ? $cluster->name() : __('cluster '));
$header_str .= ' &raquo; '.__($labels[$wizard->page]);
// Header.
$buttons = [];
$main_page = '<a href="'.$wizard->parentUrl.'">';
$main_page .= html_print_image(
2023-03-09 23:31:40 +01:00
'images/logs@svg.svg',
2022-10-20 13:17:26 +02:00
true,
[
'title' => __('Cluster list'),
2023-03-09 23:31:40 +01:00
'class' => 'main_menu_icon invert_filter',
2022-10-20 13:17:26 +02:00
]
);
$main_page .= '</a>';
$buttons = [
[
'active' => false,
'text' => $main_page,
],
];
if ($cluster !== null) {
if ($cluster->id() !== null) {
$view = '<a href="'.$wizard->parentUrl.'&op=view&id='.$cluster->id().'">';
$view .= html_print_image(
2023-03-09 23:31:40 +01:00
'images/details.svg',
2022-10-20 13:17:26 +02:00
true,
[
'title' => __('View this cluster'),
2023-03-09 23:31:40 +01:00
'class' => 'main_menu_icon invert_filter',
2022-10-20 13:17:26 +02:00
]
);
$view .= '</a>';
$buttons[] = [
'active' => false,
'text' => $view,
];
}
}
ui_print_page_header(
$header_str,
'',
false,
'cluster_view',
true,
// Buttons.
$buttons,
false,
'',
GENERIC_SIZE_TEXT,
'',
$wizard->printHeader(true)
);
// Check if any error ocurred.
if (empty($wizard->errMessages) === false) {
foreach ($wizard->errMessages as $msg) {
ui_print_error_message(__($msg));
}
}
2023-04-10 16:38:37 +02:00
$buttons_input = '';
2022-10-20 13:17:26 +02:00
if (empty($form) === false) {
// Print form (prepared in ClusterWizard).
2023-04-10 16:38:37 +02:00
$submit = $form['submit-external-input'];
unset($form['submit-external-input']);
2022-10-20 13:17:26 +02:00
HTML::printForm($form, false, ($wizard->page < 6));
2023-04-10 16:38:37 +02:00
$buttons_input .= HTML::printInput($submit);
2022-10-20 13:17:26 +02:00
}
// Print always go back button.
2023-04-10 16:38:37 +02:00
$buttons_input .= HTML::printForm($wizard->getGoBackForm(), true);
2023-03-15 16:06:42 +01:00
2023-04-10 16:38:37 +02:00
html_print_action_buttons($buttons_input);