'.__('Agent icon').'
';
if ($icon_path == '') {
$display_icons = 'none';
// Hack to show no icon. Use any given image to fix not found image errors.
$path_without = 'images/spinner.gif';
$path_default = 'images/spinner.gif';
$path_ok = 'images/spinner.gif';
$path_bad = 'images/spinner.gif';
$path_warning = 'images/spinner.gif';
} else {
$display_icons = '';
$path_without = $path.$icon_path.'.default.png';
$path_default = $path.$icon_path.'.default.png';
$path_ok = $path.$icon_path.'.ok.png';
$path_bad = $path.$icon_path.'.bad.png';
$path_warning = $path.$icon_path.'.warning.png';
}
$tableAgent = new stdClass();
$tableAgent->class = 'floating_form primary_form';
$tableAgent->data = [];
$tableAgent->style = [];
$tableAgent->cellclass = [];
$tableAgent->colspan = [];
$tableAgent->rowspan = [];
// Agent name.
if ($new_agent === false) {
$tableAgent->data['caption_name'][0] = __('Agent name');
$tableAgent->data['name'][0] = html_print_input_text('agente', $nombre_agente, '', 76, 100, true, false, false, '', 'w540px');
$tableAgent->data['name'][0] .= html_print_div(
[
'class' => 'moduleIdBox',
'content' => __('ID').'
'.$id_agente.'',
],
true
);
// Agent options for QR code.
$agent_options_update = 'agent_options_update';
}
// Alias.
$tableAgent->data['caption_alias'][0] = __('Alias');
$tableAgent->data['alias'][0] = html_print_input_text('alias', $alias, '', 50, 100, true, false, true, '', 'w540px');
if ($new_agent === true) {
$tableAgent->rowclass['additional_alias'] = 'subinput';
$tableAgent->data['additional_alias'][0] = html_print_checkbox_switch('alias_as_name', 1, $config['alias_as_name'], true);
$tableAgent->data['additional_alias'][1] = __('Use alias as name');
} else {
$tableAgent->data['alias'][1] = html_print_anchor(
[
'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=remote_configuration&id_agente='.$id_agente.'&disk_conf='.$agent_md5,
'content' => html_print_image(
'images/application_edit.png',
true,
[
'border' => 0,
'title' => __('This agent can be remotely configured'),
'class' => 'invert_filter',
]
),
],
true
);
}
// Ip adress.
$tableAgent->data['caption_ip_address'] = __('IP Address');
$tableAgent->data['ip_address'][0] = html_print_input_text('direccion', $direccion_agente, '', 16, 100, true, false, false, '', 'w540px');
$tableAgent->rowclass['additional_ip_address'] = 'subinput';
$tableAgent->data['additional_ip_address'][0] = html_print_checkbox_switch('unique_ip', 1, $config['unique_ip'], true);
$tableAgent->data['additional_ip_address'][1] = __('Unique IP');
$tableAgent->cellclass['additional_ip_address'][1] = 'w120px';
$tableAgent->data['additional_ip_address'][2] = html_print_input(
[
'type' => 'switch',
'id' => 'fixed_ip',
'name' => 'fixed_ip',
'value' => $fixed_ip,
]
);
$tableAgent->data['additional_ip_address'][3] = __('Fix IP address');
$tableAgent->data['additional_ip_address'][3] .= ui_print_help_tip(__('Avoid automatic IP address update when agent IP changes.'), true);
// IP Address List.
if ($new_agent === false) {
$tableAgent->data['caption_ip_address_list'] = __('IP Address list');
$tableAgent->data['ip_address_list'][0] = html_print_select(agents_get_addresses($id_agente), 'address_list', $direccion_agente, '', '', 0, true, false, true, 'w540px');
$tableAgent->rowclass['additional_ip_address_list'] = 'subinput';
$tableAgent->data['additional_ip_address_list'][0] = html_print_checkbox_switch('delete_ip', 1, false, true);
$tableAgent->data['additional_ip_address_list'][1] = __('Delete selected IPs');
}
// Select primary group.
$tableAgent->data['caption_primary_group'][0] = __('Primary group');
if (isset($groups[$grupo]) === true || $new_agent === true) {
// Cannot change primary group if user have not permission for that group.
$tableAgent->data['primary_group'][0] = html_print_input(
[
'type' => 'select_groups',
'class' => 'w540px',
'returnAllGroup' => false,
'name' => 'grupo',
'selected' => $grupo,
'return' => true,
'required' => true,
'privilege' => 'AW',
'option_style' => 'width: 540px;',
]
);
} else {
$tableAgent->data['primary_group'][1] .= groups_get_name($grupo);
$tableAgent->data['primary_group'][1] .= html_print_input_hidden('grupo', $grupo, true);
}
$tableAgent->data['primary_group'][1] .= html_print_div(
[
'content' => ui_print_group_icon(
$grupo,
true,
'groups_small',
($id_agente === 0) ? 'display: none;' : ''
),
],
true
);
$tableAgent->data['caption_interval'][0] = __('Interval');
$tableAgent->rowstyle['interval'] = 'width: 260px';
$tableAgent->data['interval'][0] = html_print_extended_select_for_time(
'intervalo',
$intervalo,
'',
'',
'0',
10,
true,
false,
true,
'w33p'
);
if ($intervalo < SECONDS_5MINUTES) {
$tableAgent->data['interval'][0] .= clippy_context_help('interval_agent_min');
}
$tableAgent->data['caption_os'][0] = __('OS');
$tableAgent->data['os'][0] = html_print_select_from_sql(
'SELECT id_os, name FROM tconfig_os',
'id_os',
$id_os,
'',
'',
'0',
true,
false,
true,
false,
'width: 540px;'
);
$tableAgent->data['os'][0] .= html_print_div(
[
'class' => 'mrgn_lft_5px',
'id' => 'os_preview',
'content' => ui_print_os_icon(
$id_os,
false,
true
),
],
true
);
$tableAgent->data['caption_server'][0] = __('Server');
$tableAgent->data['server'][0] = html_print_select(
$servers,
'server_name',
$server_name,
'',
__('None'),
0,
true,
false,
true,
'w540px'
);
// Description.
$tableAgent->data['caption_description'][0] = __('Description');
$tableAgent->data['description'][0] = html_print_textarea(
'comentarios',
3,
80,
$comentarios,
'',
true,
'agent_description w540px'
);
html_print_div(
[
'class' => 'box-shadow white_table_graph white_box',
'style' => 'display: flex; justify-content: space-between; align-items: flex-start;',
'content' => html_print_table($tableAgent, true).$CodeQRTable,
]
);
/*
$table_satellite = '';
if ($remote_agent === true) {
// Satellite server selector.
$satellite_servers = db_get_all_rows_filter(
'tserver',
['server_type' => SERVER_TYPE_ENTERPRISE_SATELLITE],
[
'id_server',
'name',
]
);
$satellite_names = [];
if (empty($satellite_servers) === false) {
foreach ($satellite_servers as $s_server) {
$satellite_names[$s_server['id_server']] = $s_server['name'];
}
$table_satellite = '
'.__('Satellite').'
';
$table_satellite .= '
';
$table_satellite .= html_print_input(
[
'type' => 'select',
'fields' => $satellite_names,
'name' => 'satellite_server',
'selected' => $satellite_server,
'nothing' => __('None'),
'nothinf_value' => 0,
'return' => true,
]
).'
';
}
}
*/
// Advanced options.
$tableAdvancedAgent = new stdClass();
$tableAdvancedAgent->class = 'floating_form primary_form';
$tableAdvancedAgent->data = [];
$tableAdvancedAgent->style = [];
$tableAdvancedAgent->cellclass = [];
$tableAdvancedAgent->colspan = [];
$tableAdvancedAgent->rowspan = [];
// Secondary groups.
$tableAdvancedAgent->data['caption_secondary_groups'][0] = __('Secondary groups');
$tableAdvancedAgent->data['secondary_groups'][0] = html_print_select_agent_secondary(
$agent,
$id_agente
);
// Parent agent.
$tableAdvancedAgent->data['caption_parent_agent'][0] = __('Parent');
$tableAdvancedAgent->data['parent_agent'][0] = ui_print_agent_autocomplete_input($paramsParentAgent);
if (enterprise_installed() === true) {
$tableAdvancedAgent->data['caption_cascade_protection'][0] = __('Cascade protection modules');
$tableAdvancedAgent->data['cascade_protection'][0] = html_print_checkbox_switch(
'cascade_protection',
1,
$cascade_protection,
true
);
$tableAdvancedAgent->data['cascade_protection'][1] = html_print_select(
$modules_values,
'cascade_protection_module',
$cascade_protection_module,
'',
'',
0,
true,
false,
true,
'w220p'
);
}
// Module Definition (Learn mode).
$tableAdvancedAgent->data['caption_module_definition'][0] = __('Module definition');
$switchButtons = html_print_radio_button_extended(
'modo',
1,
__('Learning mode'),
$modo,
false,
'show_modules_not_learning_mode_context_help();',
'',
true
);
$switchButtons .= html_print_radio_button_extended(
'modo',
0,
__('Normal mode'),
$modo,
false,
'show_modules_not_learning_mode_context_help();',
'',
true
);
$switchButtons .= html_print_radio_button_extended(
'modo',
2,
__('Autodisable mode'),
$modo,
false,
'show_modules_not_learning_mode_context_help();',
'',
true
);
$tableAdvancedAgent->data['module_definition'][0] = html_print_div(
[
'class' => 'switch_radio_button',
'content' => $switchButtons,
],
true
);
// CPS - Cascade Protection Services.
$tableAdvancedAgent->data['caption_cps_value'][0] = __('Cascade protection services');
$tableAdvancedAgent->data['cps_value'][0] = html_print_checkbox_switch('cps', $cps_val, ($cps >= 0), true);
// Update GIS data.
if ((bool) $config['activate_gis'] === true) {
$tableAdvancedAgent->data['caption_gis'][0] = __('Update new GIS data');
$tableAdvancedAgent->data['gis'][0] = html_print_checkbox_switch('update_gis_data', 1, ($new_agent === true), true);
}
// Agent Icons.
$tableAdvancedAgent->data['caption_agent_icon'][0] = __('Agent icon');
$tableAdvancedAgent->data['agent_icon'][0] = html_print_select(
$arraySelectIcon,
'icon_path',
$icon_path,
'changeIcons();',
__('None'),
'',
true,
false,
true,
'w540px'
);
$tableAdvancedAgent->data['agent_icon'][1] = html_print_image(
$path_ok,
true,
[
'id' => 'icon_ok',
'style' => 'display:'.$display_icons.';',
]
).html_print_image(
$path_bad,
true,
[
'id' => 'icon_bad',
'style' => 'display:'.$display_icons.';',
]
).html_print_image(
$path_warning,
true,
[
'id' => 'icon_warning',
'style' => 'display:'.$display_icons.';',
]
);
// Url address.
$tableAdvancedAgent->data['caption_url_description'][0] = __('Url address');
if (enterprise_installed() === true) {
$tableAdvancedAgent->data['url_description'][0] = html_print_input_text(
'url_description',
$url_description,
'',
45,
255,
true,
false,
false,
'w540px',
'',
'',
// Autocomplete.
'new-password'
);
} else {
$tableAdvancedAgent->data['url_description'][0] = html_print_input_text(
'url_description',
$url_description,
'',
45,
255,
true
);
}
// Agent status.
$tableAdvancedAgent->data['caption_agent_status'][0] = __('Disabled mode');
$tableAdvancedAgent->data['agent_status'][0] = html_print_checkbox_switch(
'disabled',
1,
$disabled,
true
);
// Quiet mode.
$tableAdvancedAgent->data['caption_agent_quiet'][0] = __('Quiet');
$tableAdvancedAgent->data['agent_quiet'][0] = html_print_checkbox_switch('quiet', 1, $quiet, true);
// Remote configuration.
if ($new_agent === false && isset($filename) === true && file_exists($filename['md5']) === true) {
$tableAdvancedAgent->data['caption_remote_configuration'][0] = __('Remote configuration');
$tableAdvancedAgent->data['remote_configuration'][0] = html_print_input_text(
'remote_file_timestamp',
date('F d Y H:i:s', fileatime($filename['md5'])),
'',
45,
255,
true,
true
);
$tableAdvancedAgent->data['remote_configuration'][0] .= html_print_anchor(
[
'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&disk_conf_delete=1&id_agente='.$id_agente,
'content' => html_print_image(
'images/cross.png',
true,
[
'title' => __('Delete remote configuration file'),
'class' => 'vertical_middle invert_filter mrgn_lft_5px',
]
),
],
true
);
}
// Safe operation mode.
$tableAdvancedAgent->data['caption_safe_operation'][0] = __('Safe operation mode');
$tableAdvancedAgent->data['safe_operation'][0] = html_print_checkbox_switch('safe_mode', 1, $safe_mode, true);
$tableAdvancedAgent->data['safe_operation'][1] = html_print_select($safe_mode_modules, 'safe_mode_module', $safe_mode_module, '', '', 0, true);
if (enterprise_installed() === true) {
ui_toggle(
html_print_table($tableAdvancedAgent, true),
__('Advanced options'),
'',
'',
true,
false,
'white_box white_box_opened',
'no-border flex'
);
}
// Custom fields.
$customOutputData = '';
$fields = db_get_all_fields_in_table('tagent_custom_fields');
if ($fields === false) {
$fields = [];
}
foreach ($fields as $field) {
// Filling the data.
$combo = [];
$combo = $field['combo_values'];
$combo = explode(',', $combo);
$combo_values = [];
foreach ($combo as $value) {
$combo_values[$value] = $value;
}
$custom_value = db_get_value_filter(
'description',
'tagent_custom_data',
[
'id_field' => $field['id_field'],
'id_agent' => $id_agente,
]
);
if ($custom_value === false) {
$custom_value = '';
}
if ((bool) $field['is_password_type'] === true) {
$customContent = html_print_input_text_extended(
'customvalue_'.$field['id_field'],
$custom_value,
'customvalue_'.$field['id_field'],
'',
30,
100,
$view_mode,
'',
'',
true,
true
);
} else {
$customContent = html_print_textarea(
'customvalue_'.$field['id_field'],
2,
65,
$custom_value,
'class="min-height-30px',
true
);
}
if (empty($field['combo_values']) === false) {
$customContent = html_print_input(
[
'type' => 'select_search',
'fields' => $combo_values,
'name' => 'customvalue_'.$field['id_field'],
'selected' => $custom_value,
'nothing' => __('None'),
'nothing_value' => '',
'return' => true,
'sort' => false,
'size' => '400px',
'dropdownAutoWidth' => true,
]
);
};
$customOutputData .= ui_toggle(
html_print_div(
[ 'content' => $customContent ],
true
),
$field['name'],
$field['name'],
'custom_field_toggle_'.$field['id_field'],
true,
true,
);
}
if (empty($fields) === false) {
ui_toggle(
$customOutputData,
__('Custom fields'),
'',
'',
true,
false,
'white_box white_box_opened',
'no-border custom_fields_elements'
);
}
// The context help about the learning mode.
if ($modo == 0) {
echo "
";
} else {
echo "";
}
echo clippy_context_help('modules_not_learning_mode');
echo '';
if ($new_agent === false) {
$submitButton = html_print_submit_button(
__('Update'),
'updbutton',
false,
[ 'icon' => 'update'],
true
);
$submitButton .= html_print_input_hidden('update_agent', 1);
$submitButton .= html_print_input_hidden('id_agente', $id_agente);
if (is_management_allowed() === true) {
$submitButton .= html_print_button(
__('Delete agent'),
'deleteAgent',
false,
'deleteAgentDialog('.$id_agente.')',
[
'icon' => 'delete',
'mode' => 'secondary',
],
true
);
}
} else {
$submitButton = html_print_input_hidden('create_agent', 1);
$submitButton .= html_print_submit_button(
__('Create'),
'crtbutton',
false,
[ 'icon' => 'wand'],
true
);
}
$submitButton .= html_print_go_back_button(
'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente',
['button_class' => ''],
true
);
html_print_action_buttons($submitButton);
echo '