diff --git a/pandora_console/include/functions_treeview.php b/pandora_console/include/functions_treeview.php index 17f0ea5bfe..19aee51f0f 100755 --- a/pandora_console/include/functions_treeview.php +++ b/pandora_console/include/functions_treeview.php @@ -274,18 +274,11 @@ function treeview_printTable($id_agente, $server_data = array()) { $url_hash = metaconsole_get_servers_url_hash($server_data); } - require_once ("include/functions_agents.php"); + require_once ($config["homedir"] . "/include/functions_agents.php"); require_once ($config["homedir"] . '/include/functions_graph.php'); - include_graphs_dependencies(); require_once ($config['homedir'] . '/include/functions_groups.php'); require_once ($config['homedir'] . '/include/functions_gis.php'); - - $agent = db_get_row ("tagente", "id_agente", $id_agente); - - if ($agent === false) { - ui_print_error_message(__('There was a problem loading agent')); - return; - } + include_graphs_dependencies(); $is_extra = enterprise_hook('policies_is_agent_extra_policy', array($id_agente)); @@ -300,11 +293,21 @@ function treeview_printTable($id_agente, $server_data = array()) { return; } - echo '
'.__('Agent name').' | '; + $agent = db_get_row ("tagente", "id_agente", $id_agente); + if ($agent === false) { + ui_print_error_message(__('There was a problem loading agent')); + return; + } + + $table = new StdClass(); + $table->width = "100%"; + $table->style = array(); + $table->style['title'] = 'font-weight: bold;'; + $table->head = array(); + $table->data = array(); + + // Agent name if ($agent['disabled']) { $cellName = ""; } @@ -317,12 +320,13 @@ function treeview_printTable($id_agente, $server_data = array()) { if ($agent['disabled']) { $cellName .= ui_print_help_tip(__('Disabled'), true) . ""; } - - echo ''.$cellName.' | '; - + + $row = array(); + $row['title'] = __('Agent name'); + $row['data'] = $cellName; + $table->data['name'] = $row; + //Addresses - echo '|
'.__('IP Address').' | '; - echo '';
$ips = array();
$addresses = agents_get_addresses ($id_agente);
$address = agents_get_address($id_agente);
@@ -333,95 +337,115 @@ function treeview_printTable($id_agente, $server_data = array()) {
}
}
- echo $address;
-
if (!empty($addresses)) {
- ui_print_help_tip(__('Other IP addresses').': '.implode(' ',$addresses)); + $address .= ui_print_help_tip(__('Other IP addresses').': '.implode(' ',$addresses), true); } - echo ' | |
'.__('Interval').' | '; - echo ''.human_time_description_raw ($agent["intervalo"]).' | |
' . __('Description') . ' | '; - echo '' . $agent["comentarios"] . ' | |
' . __('Last contact') . " / " . __('Remote') . ' | '; - - ui_print_timestamp ($agent["ultimo_contacto"]); - - echo " / "; - + $last_contact = ui_print_timestamp($agent["ultimo_contacto"], true); + if ($agent["ultimo_contacto_remoto"] == "01-01-1970 00:00:00") { - echo __('Never'); + $last_remote_contact = __('Never'); } else { - ui_print_timestamp ($agent["ultimo_contacto_remoto"]); + $last_remote_contact = ui_print_timestamp ($agent["ultimo_contacto_remoto"], true); } - echo ' | |
'.__('Next agent contact').' | '; - echo '' . progress_bar($progress, 150, 20) . ' |
'.__('Agent Version'). ' | '; - $advanced .= ''.$agent["agent_version"].' | |
'.__('Position (Long, Lat)'). ' | '; - $advanced .= ''; - - if ($dataPositionAgent === false) { - $advanced .= __('There is no GIS data.'); - } - else { - $advanced .= ''; + if ($dataPositionAgent !== false) { + $position = ''; if ($dataPositionAgent['description'] != "") - $advanced .= $dataPositionAgent['description']; + $position .= $dataPositionAgent['description']; else - $advanced .= $dataPositionAgent['stored_longitude'].', '.$dataPositionAgent['stored_latitude']; - $advanced .= ""; + $position .= $dataPositionAgent['stored_longitude'].', '.$dataPositionAgent['stored_latitude']; + $position .= ""; + + $row = array(); + $row['title'] = __('Position (Long, Lat)'); + $row['data'] = $position; + $table->data['agent_position'] = $row; } - - $advanced .= ' | |
'.__('Url address').' | '; - $advanced .= '' . $agent["url_address"] . ' | |
'.__('Timezone Offset'). ' | '; - $advanced .= ''.$agent["timezone_offset"].' | |
'.$field['name'] . ui_print_help_tip (__('Custom field'), true).' | '; $custom_value = db_get_value_filter('description', 'tagent_custom_data', array('id_field' => $field['id_field'], 'id_agent' => $id_agente)); - if ($custom_value === false || $custom_value == '') { - $custom_value = '-'.__('empty').'-'; + if (!empty($custom_value)) { + $row = array(); + $row['title'] = $field['name'] . ui_print_help_tip (__('Custom field'), true); + $row['data'] = $custom_value; + $table->data['custom_field_'.$field['id_field']] = $row; } - $advanced .= ''.$custom_value.' |