' .
html_print_image ("images/full_screen.png", true, array ("title" => __('Full screen mode'))) . "";
}
else {
$buttons[]['text'] = '' .
html_print_image ("images/normalscreen.png", true, array ("title" => __('Back to normal mode'))) . "";
}
if ($has_management_acl) {
$hash = md5($config["dbpass"] . $idMap . $config["id_user"]);
$buttons['public_link']['text'] = ''.
html_print_image ("images/camera_mc.png", true, array ("title" => __('Show link to public Visual Console'))).'';
}
$times = array(
5 => __('5 seconds'),
10 => __('10 seconds'),
30 => __('30 seconds'),
SECONDS_1MINUTE => __('1 minute'),
SECONDS_2MINUTES => __('2 minutes'),
SECONDS_5MINUTES => __('5 minutes'),
SECONDS_10MINUTES => __('10 minutes'),
SECONDS_1HOUR => __('1 hour'),
SECONDS_2HOUR => __('2 hours')
);
$buttons[]['text'] = "
"
.__('Refresh') . ": "
. html_print_select($times, 'refresh_time', 60, 'changeRefreshTime(this.value);', '', 0, true, false, false)
. "
";
$status = array(
'all' => __('None'),
'bad' => __('Critical'),
'warning' => __('Warning'),
'ok' => __('Ok'),
'default' => __('Other')
);
$buttons[]['text'] = ""
. __('Filter by status') . ": "
. html_print_select($status, 'show_status', 'all', 'changeShowStatus(this.value);', '', 0, true, false, false)
. "
";
if ($has_management_acl) {
$buttons['setup']['text'] = ''.html_print_image ("images/setup.png", true, array ("title" => __('Setup'))).'';
$buttons['setup']['godmode'] = 1;
}
ui_print_page_header(__('Map') . " » " . __('Map') . " " . $map['map_name'],
"images/op_gis.png", false, "", false, $buttons);
$map_inline_style = "width: 100%; min-height:500px; height: calc(100vh - 80px);";
$map_inline_style .= $config["pure"]
? "position:absolute; top: 80px; left: 0px;"
: "border: 1px solid black;";
echo '';
gis_print_map('map', $map['zoom_level'], $map['initial_latitude'],
$map['initial_longitude'], $baselayers, $controls);
if ($layers != false) {
foreach ($layers as $layer) {
gis_make_layer($layer['layer_name'],
$layer['view_layer'], null, $layer['id_tmap_layer']);
// calling agents_get_group_agents with none to obtain the names in the same case as they are in the DB.
$agentNamesByGroup = array();
if ($layer['tgrupo_id_grupo'] >= 0) {
$agentNamesByGroup = agents_get_group_agents($layer['tgrupo_id_grupo'],
false, 'none', true, true, false);
}
$agentNamesByLayer = gis_get_agents_layer($layer['id_tmap_layer']);
$groupsByAgentId = gis_get_groups_layer_by_agent_id($layer['id_tmap_layer']);
$agentNamesOfGroupItems = array();
foreach ($groupsByAgentId as $agentId => $groupInfo) {
$agentNamesOfGroupItems[$agentId] = $groupInfo["agent_name"];
}
$agentNames = array_unique($agentNamesByGroup + $agentNamesByLayer + $agentNamesOfGroupItems);
foreach ($agentNames as $key => $agentName) {
$idAgent = $key;
$coords = gis_get_data_last_position_agent($idAgent);
if ($coords === false) {
$coords['stored_latitude'] = $map['default_latitude'];
$coords['stored_longitude'] = $map['default_longitude'];
}
else {
if ($show_history == 'y') {
$lastPosition = array('longitude' => $coords['stored_longitude'], 'latitude' => $coords['stored_latitude']);
gis_add_path($layer['layer_name'], $idAgent, $lastPosition);
}
}
$status = agents_get_status($idAgent, true);
$icon = gis_get_agent_icon_map($idAgent, true, $status);
$icon_size = getimagesize($icon);
$icon_width = $icon_size[0];
$icon_height = $icon_size[1];
// Is a group item
if (!empty($groupsByAgentId[$idAgent])) {
$groupId = (int) $groupsByAgentId[$idAgent]["id"];
$groupName = $groupsByAgentId[$idAgent]["name"];
gis_add_agent_point($layer['layer_name'],
io_safe_output($groupName), $coords['stored_latitude'],
$coords['stored_longitude'], $icon, $icon_width,
$icon_height, $idAgent, $status, 'point_group_info',
$groupId);
}
else {
$parent = db_get_value('id_parent', 'tagente', 'id_agente', $idAgent);
gis_add_agent_point($layer['layer_name'],
io_safe_output($agentName), $coords['stored_latitude'],
$coords['stored_longitude'], $icon, $icon_width,
$icon_height, $idAgent, $status, 'point_agent_info',
$parent);
}
}
}
gis_add_parent_lines();
switch ($config["dbtype"]) {
case "mysql":
$timestampLastOperation = db_get_value_sql("SELECT UNIX_TIMESTAMP()");
break;
case "postgresql":
$timestampLastOperation = db_get_value_sql(
"SELECT ceil(date_part('epoch', CURRENT_TIMESTAMP))");
break;
case "oracle":
$timestampLastOperation = db_get_value_sql(
"SELECT ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (" . SECONDS_1DAY . ")) FROM dual");
break;
}
gis_activate_select_control();
gis_activate_ajax_refresh($layers, $timestampLastOperation);
}
?>