0) { $group = db_get_row('tgrupo', 'id_grupo', $id_group); if ($group !== false) { $icon = $group['icon']; $name = $group['nombre']; $id_parent = $group['parent']; $group_pass = io_safe_output($group['password']); $alerts_disabled = $group['disabled']; $custom_id = $group['custom_id']; $propagate = $group['propagate']; $skin = $group['id_skin']; $contact = $group['contact']; $other = $group['other']; $description = $group['description']; $max_agents = $group['max_agents']; } else { db_pandora_audit( AUDIT_LOG_SYSTEM, 'There was a problem loading group in configure agent group.' ); include 'general/noaccess.php'; exit; } } else { // Set default values. $icon = ''; $name = ''; $id_parent = 0; $group_pass = ''; $alerts_disabled = 0; $custom_id = ''; $propagate = 0; $skin = 0; $contact = ''; $other = ''; $description = ''; $max_agents = 0; } // Header. if (is_metaconsole() === true) { agents_meta_print_header(); $sec = 'advanced'; } else { $title_in_header = ($id_group > 0) ? __('Update group') : __('Create group'); // Header. ui_print_standard_header( $title_in_header, 'images/group.png', false, '', false, [], [ [ 'link' => '', 'label' => __('Profiles'), ], [ 'link' => '', 'label' => __('Manage agents group'), ], ] ); $sec = 'gagente'; } // Data before table. $files = list_files(((is_metaconsole() === true) ? '../../' : '').'images/', '@groups.svg', 1, 0); $files_old = list_files('images/groups_small/', 'png', 1, 0); foreach ($files_old as $key => $f) { // Remove from the list the non-desired .png files. if (strpos($f, '.bad.png') !== false || strpos($f, '.default.png') !== false || strpos($f, '.ok.png') !== false || strpos($f, '.warning.png') !== false) { unset($files_old[$key]); } } $files = array_merge($files, $files_old); $table = new stdClass(); $table->width = '100%'; $table->class = 'databox filter-table-adv'; $table->size = []; $table->size[0] = '50%'; $table->size[1] = '50%'; $table->data = []; $table->data[0][0] = html_print_label_input_block( __('Name'), html_print_input_text('name', $name, '', 35, 100, true) ); $extension = pathinfo($icon, PATHINFO_EXTENSION); if (empty($extension) === true) { $icon .= '.png'; } $input_icon = html_print_select($files, 'icon', $icon, '', 'None', '', true, false, true, '', false, 'width: 100%;'); $input_icon .= ' '; if (empty($icon) === false) { if (empty($extension) === true || $extension === 'png') { $input_icon .= html_print_image('images/groups_small/'.$icon, true); } else { $input_icon .= html_print_image('images/'.$icon, true); } } $input_icon .= ''; $table->data[0][1] = html_print_label_input_block( __('Icon'), html_print_div( [ 'class' => 'flex-content-left ', 'content' => $input_icon, ], true ) ); if ($id_group > 0) { // The user can access to the parent, but she want to edit the group. if ((bool) check_acl($config['id_user'], $id_parent, 'AR') === false) { $acl_parent = false; $input_parent = __('You have not access to the parent.').html_print_input_hidden('id_parent', $id_parent, true); } else { $input_parent = '
'; $input_parent .= html_print_select_groups( false, 'AR', false, 'id_parent', $id_parent, '', __('None'), -1, true, false, true, '', false, false, false, $id_group ); $input_parent .= '
'; } } else { $input_parent = '
'; $input_parent .= html_print_input( [ 'type' => 'select_groups', 'name' => 'id_parent', 'selected' => $id_parent, 'return' => true, 'returnAllGroup' => false, 'nothing' => __('None'), 'nothing_value' => -1, ] ); $input_parent .= '
'; } if ($acl_parent === true) { $input_parent .= ' '; $input_parent .= html_print_image('images/'.(($id_parent !== 0) ? groups_get_icon($id_parent) : 'unknown@groups.svg'), true); $input_parent .= ''; } $table->data[1][0] = html_print_label_input_block( __('Parent'), html_print_div( [ 'class' => 'flex-content-left ', 'content' => $input_parent, ], true ) ); if ((bool) $config['enterprise_installed'] === true) { $table->data[1][1] .= html_print_label_input_block( __('Group Password'), html_print_input_password('group_pass', $group_pass, '', 16, 255, true) ); } $table->data[2][0] = html_print_label_input_block( __('Alerts').ui_print_help_tip(__('Enable alert use in this group.'), true), html_print_checkbox_switch('alerts_enabled', 1, ! $alerts_disabled, true) ); $table->data[2][1] = html_print_label_input_block( __('Propagate ACL').ui_print_help_tip(__('Propagate the same ACL security into the child subgroups.'), true), html_print_checkbox_switch('propagate', 1, $propagate, true) ); $table->data[3][0] = html_print_label_input_block( __('Custom ID'), html_print_input_text('custom_id', $custom_id, '', 16, 255, true) ); $table->data[3][1] = html_print_label_input_block( __('Description'), html_print_input_text('description', $description, '', 60, 255, true) ); $table->data[4][0] = html_print_label_input_block( __('Contact').ui_print_help_tip(__('Contact information accessible through the _groupcontact_ macro'), true), html_print_textarea('contact', 4, 40, $contact, "class='min-height-0px'", true) ); $table->data[4][1] = html_print_label_input_block( __('Other').ui_print_help_tip(__('Information accessible through the _group_other_ macro'), true), html_print_textarea('other', 4, 40, $other, "class='min-height-0px'", true) ); $table->data[5][0] = html_print_label_input_block( __('Max agents allowed').ui_print_help_tip(__('Set the maximum of agents allowed for this group. 0 is unlimited.'), true), html_print_input_text('max_agents', $max_agents, '', 10, 255, true) ); $sec = (is_metaconsole() === true) ? 'advanced' : 'gagente'; echo '
'; html_print_table($table); $buttons = ''; if ($id_group) { $buttons .= html_print_input_hidden('update_group', 1, true); $buttons .= html_print_input_hidden('id_group', $id_group, true); $buttons .= html_print_submit_button( __('Update'), 'updbutton', false, ['icon' => 'upd'], true ); } else { $buttons .= html_print_input_hidden('create_group', 1); $buttons .= html_print_submit_button( __('Create'), 'crtbutton', false, ['icon' => 'next'], true ); } $buttons .= html_print_button( __('Go back'), 'button_back', false, '', [ 'icon' => 'back', 'mode' => 'secondary', ], true ); html_print_action_buttons( $buttons ); echo '
'; ?>