false,
'text' => ''.html_print_image(
'images/os@svg.svg',
true,
[
'title' => __('Manage OS types'),
'class' => 'invert_filter main_menu_icon',
]
).'',
];
$buttons['manage_version'] = [
'active' => false,
'text' => ''.html_print_image(
'images/os_version@svg.svg',
true,
[
'title' => __('Manage version expiration dates'),
'class' => 'invert_filter main_menu_icon',
]
).'',
];
$buttons[$tab]['active'] = true;
switch ($tab) {
case 'builder':
$headerTitle = __('Edit OS');
break;
case 'manage_os':
$id_os = get_parameter('id_os', '');
if ($id_os !== '') {
$headerTitle = __('Edit OS');
} else {
$headerTitle = __('Create OS');
}
break;
case 'list':
if ($action === 'edit') {
$headerTitle = __('Edit OS');
} else {
$headerTitle = __('List of Operating Systems');
}
break;
case 'manage_version':
if ($action === 'edit') {
$headerTitle = __('Edit OS version expiration date');
} else {
$headerTitle = __('List of version expiration dates');
}
break;
default:
// Default.
break;
}
if (is_metaconsole() === false) {
// Header.
ui_print_standard_header(
$headerTitle,
'',
false,
'',
true,
$buttons,
[
[
'link' => '',
'label' => __('Servers'),
],
[
'link' => '',
'label' => __('Edit OS'),
],
]
);
}
if (empty($id_message) === false) {
switch ($id_message) {
case 1:
echo ui_print_success_message(__('Success creating OS'), '', true);
break;
case 2:
echo ui_print_error_message(__('Fail creating OS'), '', true);
break;
case 3:
echo ui_print_success_message(__('Success updating OS'), '', true);
break;
case 4:
echo ui_print_error_message(__('Error updating OS'), '', true);
break;
case 5:
echo ui_print_error_message(__('There are agents with this OS.'), '', true);
break;
case 6:
echo ui_print_success_message(__('Success deleting'), '', true);
break;
case 7:
echo ui_print_error_message(__('Error deleting'), '', true);
break;
case 8:
header('Location: index.php?sec=gagente&sec2=godmode/setup/os&tab=manage_os&action=edit&id_message=8');
break;
case 9:
header('Location: index.php?sec=gagente&sec2=godmode/setup/os&tab=manage_os&action=edit&id_message=9');
break;
case 10:
header('Location: index.php?sec=gagente&sec2=godmode/setup/os&tab=manage_os&action=edit&id_message=10');
break;
default:
// Default.
break;
}
}
switch ($tab) {
case 'manage_os':
case 'list':
if (in_array($action, ['edit', 'save', 'update']) && is_management_allowed() === true) {
include_once $config['homedir'].'/godmode/setup/os.builder.php';
} else {
include_once $config['homedir'].'/godmode/setup/os.list.php';
}
break;
case 'manage_version':
if (in_array($action, ['edit', 'save', 'update']) && is_management_allowed() === true) {
include_once $config['homedir'].'/godmode/setup/os_version.builder.php';
} else {
include_once $config['homedir'].'/godmode/setup/os_version.list.php';
}
break;
default:
// Default.
break;
}