$config['id_user'])); // If shortcut bar is disabled return to index.php if ($shortcut_state == 0) return; if (is_ajax()) { require_once("include/functions_events.php"); $update_shortcut_state = get_parameter('update_shortcut_state', 0); $get_critical_events = get_parameter('get_critical_events', 0); $get_opened_incidents = get_parameter('get_opened_incidents', 0); // Update if shortcut is visible or hidden if ($update_shortcut_state){ $value = get_parameter('value', 0); db_process_sql_update('tusuario', array('shortcut' => $value), array('id_user' => $config['id_user'])); } // Get critical events (realtime update) if ($get_critical_events){ $own_info = get_user_info ($config['id_user']); if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM")) $own_groups = array_keys(users_get_groups($config['id_user'], "LM")); else $own_groups = array_keys(users_get_groups($config['id_user'], "LM", false)); // Get events in the last 8 hours $shortcut_events_update = events_get_group_events($own_groups, 28800, time()); if ($shortcut_events_update == false) $shortcut_events_update = array(); $critical_events_update = 0; foreach($shortcut_events_update as $event_update){ if ($event_update['criticity'] == 4 and $event_update['estado'] == 0){ $critical_events_update++; } } echo $critical_events_update; } // Select only opened incidents if ($get_opened_incidents){ $own_info = get_user_info ($config['id_user']); if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM")) $own_groups = array_keys(users_get_groups($config['id_user'], "LM")); else $own_groups = array_keys(users_get_groups($config['id_user'], "LM", false)); $sql = "SELECT count(*) total_incidents FROM tincidencia WHERE id_grupo IN (".implode (",",array_keys ($own_groups)).") AND estado IN (0) ORDER BY actualizacion"; $result_incidents_update = db_get_all_rows_sql ($sql); if ($result_incidents_update === false) $shortcut_incidents = 0; else $shortcut_incidents = $result_incidents_update[0]['total_incidents']; echo $shortcut_incidents; } return; } if ($shortcut_state == 2){ echo "
"; }else{ echo "
"; } html_print_image("images/pandora_textlogo.png", false, array("title" => __("Press here to activate shortcut bar"))); echo "
"; if ($shortcut_state == 2){ echo "
"; } else { echo "
"; } echo "     "; echo ""; html_print_image("images/bell.png", false, array("title" => __("Alerts fired"), "style" => "margin-bottom: -5px;")); echo " "; // Calculate alerts fired $data_reporting = reporting_get_group_stats(); echo "" . $data_reporting['monitor_alerts_fired'] . ""; echo ""; echo "     "; echo ""; html_print_image("images/lightning_go.png", false, array("title" => __("Critical events"), "style" => "margin-bottom: -5px;")); echo " "; // Calculate critical events (not validated) $own_info = get_user_info ($config['id_user']); if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM")) $own_groups = array_keys(users_get_groups($config['id_user'], "LM")); else $own_groups = array_keys(users_get_groups($config['id_user'], "LM", false)); // Get events in the last 8 hours $shortcut_events = events_get_group_events($own_groups, 28800, time()); if ($shortcut_events == false) $shortcut_events = array(); $critical_events = 0; foreach($shortcut_events as $event){ if ($event['criticity'] == 4 and $event['estado'] == 0){ $critical_events++; } } echo "" . $critical_events . ""; echo ""; echo "     "; // Calculate opened incidents (id integria incidents are not enabled) if ($config['integria_enabled'] == 0){ echo ""; html_print_image("images/book_edit.png", false, array("title" => __("Incidents opened"), "style" => "margin-bottom: -5px;")); echo " "; // Select only opened incidents $sql = "SELECT count(*) total_incidents FROM tincidencia WHERE id_grupo IN (".implode (",",array_keys ($own_groups)).") AND estado IN (0) ORDER BY actualizacion"; $result_incidents = db_get_all_rows_sql ($sql); if ($result_incidents === false) $shortcut_incidents = 0; else $shortcut_incidents = $result_incidents[0]['total_incidents']; echo "" . $shortcut_incidents . ""; echo ""; echo "     "; } echo "   "; echo "|"; echo "    "; echo "    "; echo ""; html_print_image("images/reporting.png", false, array("title" => __("View reports"), "style" => "margin-bottom: -5px;")); echo ""; echo "     "; echo ""; html_print_image("images/email.png", false, array("title" => __("Create new message"), "style" => "margin-bottom: -5px;")); echo ""; // Login in Console and shortcut bar is disabled // This will show and hide the shortcut value in Javascript code if (isset($_POST['nick']) and $shortcut_state != 2){ html_print_input_hidden("login_console", 1); } else { html_print_input_hidden("login_console", 0); } html_print_input_hidden("shortcut_id_user", $config['id_user']); echo "
"; ?>