" . __('Alerts') . ""; } else { if (!check_acl ($config["id_user"], 0, "AR")) { db_pandora_audit("ACL Violation","Trying to access alert view"); require ("general/noaccess.php"); return; } $agents = array_keys(get_group_agents(array_keys(get_user_groups($config["id_user"], 'AR', false)))); $idGroup = $id_group; $print_agent = true; ui_print_page_header (__('Alert detail'), "images/bricks.png", false, "alert_validation"); } if ($alert_validate) { validateAlert(); } if ($free_search != '') { switch ($config["dbtype"]) { case "mysql": $whereAlertSimple = 'AND (' . 'id_alert_template IN (SELECT id FROM talert_templates WHERE name LIKE "%' . $free_search . '%") OR ' . 'id_alert_template IN (SELECT id FROM talert_templates WHERE id_alert_action IN (SELECT id FROM talert_actions WHERE name LIKE "%' . $free_search . '%")) OR ' . 'talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action IN (SELECT id FROM talert_actions WHERE name LIKE "%' . $free_search . '%")) OR ' . 'id_agent_module IN (SELECT id_agente_modulo FROM tagente_modulo WHERE nombre LIKE "%' . $free_search . '%") OR ' . 'id_agent_module IN (SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente IN (SELECT id_agente FROM tagente WHERE nombre LIKE "%' . $free_search . '%"))' . ')'; $whereAlertCombined = 'AND (' . 'name LIKE "%' . $free_search . '%" OR ' . 'id IN (SELECT id_alert_compound FROM talert_compound_elements WHERE id_alert_template_module IN (SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action IN (SELECT id FROM talert_actions WHERE name LIKE "%' . $free_search . '%"))) ' . ')'; break; case "postgresql": case "oracle": $whereAlertSimple = 'AND (' . 'id_alert_template IN (SELECT id FROM talert_templates WHERE name LIKE \'%' . $free_search . '%\') OR ' . 'id_alert_template IN (SELECT id FROM talert_templates WHERE id_alert_action IN (SELECT id FROM talert_actions WHERE name LIKE \'%' . $free_search . '%\')) OR ' . 'talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action IN (SELECT id FROM talert_actions WHERE name LIKE \'%' . $free_search . '%\')) OR ' . 'id_agent_module IN (SELECT id_agente_modulo FROM tagente_modulo WHERE nombre LIKE \'%' . $free_search . '%\') OR ' . 'id_agent_module IN (SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente IN (SELECT id_agente FROM tagente WHERE nombre LIKE \'%' . $free_search . '%\'))' . ')'; $whereAlertCombined = 'AND (' . 'name LIKE "%' . $free_search . '%" OR ' . 'id IN (SELECT id_alert_compound FROM talert_compound_elements WHERE id_alert_template_module IN (SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action IN (SELECT id FROM talert_actions WHERE name LIKE \'%' . $free_search . '%\'))) ' . ')'; break; } } else { $whereAlertSimple = ''; $whereAlertCombined = ''; } $sortField = get_parameter('sort_field'); $sort = get_parameter('sort', 'none'); $selected = 'border: 1px solid black;'; $selectAgentUp = ''; $selectAgentDown = ''; $selectModuleUp = ''; $selectModuleDown = ''; $selectTemplateUp = ''; $selectTemplateDown = ''; switch ($sortField) { case 'agent': switch ($sort) { case 'up': $selectAgentUp = $selected; $order = array('field' => 'agent_name', 'order' => 'ASC'); break; case 'down': $selectAgentDown = $selected; $order = array('field' => 'agent_name', 'order' => 'DESC'); break; } break; case 'module': switch ($sort) { case 'up': $selectModuleUp = $selected; $order = array('field' => 'agent_module_name', 'order' => 'ASC'); break; case 'down': $selectModuleDown = $selected; $order = array('field' => 'agent_module_name', 'order' => 'DESC'); break; } break; case 'template': switch ($sort) { case 'up': $selectTemplateUp = $selected; $order = array('field' => 'template_name', 'order' => 'ASC'); break; case 'down': $selectTemplateDown = $selected; $order = array('field' => 'template_name', 'order' => 'DESC'); break; } break; default: if ($print_agent) { $selectDisabledUp = ''; $selectDisabledDown = ''; $selectAgentUp = ''; $selectAgentDown = ''; $selectModuleUp = $selected; $selectModuleDown = ''; $selectTemplateUp = ''; $selectTemplateDown = ''; $order = array('field' => 'agent_module_name', 'order' => 'ASC'); } else { $selectDisabledUp = ''; $selectDisabledDown = ''; $selectAgentUp = ''; $selectAgentDown = ''; $selectModuleUp = $selected; $selectModuleDown = ''; $selectTemplateUp = ''; $selectTemplateDown = ''; $order = array('field' => 'agent_module_name', 'order' => 'ASC'); } break; } $alerts = array(); $options_simple = array('offset' => $offset_simple, 'limit' => $config['block_size'], 'order' => $order); $options_combined = array('limit' => $config["block_size"], 'offset' => $offset_combined); $filter_alert = array(); if($filter_standby == 'standby_on') { $filter_alert['disabled'] = $filter; $filter_alert['standby'] = '1'; }else if($filter_standby == 'standby_off') { $filter_alert['disabled'] = $filter; $filter_alert['standby'] = '0'; }else { $filter_alert['disabled'] = $filter; } $alerts['alerts_simple'] = agents_get_alerts_simple ($agents, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup); $countAlertsSimple = agents_get_alerts_simple ($agents, $filter, false, $whereAlertSimple, false, false, $idGroup, true); $alerts['alerts_combined'] = agents_get_alerts_compound($agents, $filter, $options_combined, $idGroup, false, $whereAlertCombined); $countAlertsCombined = agents_get_alerts_compound($agents, $filter, false, $idGroup, true, $whereAlertCombined); if ($tab != null) { $url = $url.'&tab='.$tab; } // Filter form if ($print_agent) { ui_toggle(printFormFilterAlert($id_group, $filter, $free_search, $url, $filter_standby, true),__('Alert control filter'), __('Toggle filter(s)')); } $table->width = '95%'; $table->class = "databox"; $table->size = array (); $table->head = array (); $table->align = array (); if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { if ($print_agent) { $table->size[0] = '20px'; $table->size[1] = '20px'; $table->size[2] = '20px'; $table->size[3] = '25%'; $table->size[4] = '25%'; $table->size[5] = '30%'; $table->size[6] = '30%'; $table->size[7] = '20px'; $table->size[8] = '60px'; $table->head[0] = "" . __('P.') . ""; $table->head[1] = "" . __('S.') . ""; $table->head[2] = "" . __('F.') . ""; $table->head[3] = __('Agent') . ' ' . '' . print_image("images/sort_up.png", true, array("style" => $selectAgentUp)) . '' . '' . print_image("images/sort_down.png", true, array("style" => $selectAgentDown)) . ''; $table->head[4] = __('Module') . ' ' . '' . print_image("images/sort_up.png", true, array("style" =>$selectModuleUp)) . '' . '' . print_image("images/sort_down.png", true, array("style" => $selectModuleDown)) . ''; $table->head[5] = __('Template') . ' ' . '' . print_image("images/sort_up.png", true, array("style" =>$selectTemplateUp)) . '' . '' . print_image("images/sort_down.png", true, array("style" => $selectTemplateDown)) . ''; $table->head[6] = __('Action'); $table->head[7] = __('Last fired'); $table->head[8] = __('Status'); $table->head[9] = __('Validate'); $table->align[8] = 'center'; $table->align[9] = 'center'; } else { $table->size[0] = '20px'; $table->size[1] = '20px'; $table->size[2] = '20px'; $table->size[3] = '25%'; $table->size[4] = '50%'; $table->size[5] = '25%'; $table->size[6] = '20px'; $table->size[7] = '60px'; $table->head[0] = "" . __('P.') . ""; $table->head[1] = "" . __('S.') . ""; $table->head[2] = "" . __('F.') . ""; $table->head[3] = __('Module') . ' ' . '' . print_image("images/sort_up.png", true, array("style" => $selectModuleUp)) . '' . '' . print_image("images/sort_down.png", true, array("style" => $selectModuleDown)) . ''; $table->head[4] = __('Template') . ' ' . '' . print_image("images/sort_up.png", true, array("style" => $selectTemplateUp)) . '' . '' . print_image("images/sort_down.png", true, array("style" => $selectTemplateDown)) . ''; $table->head[5] = __('Action'); $table->head[6] = __('Last fired'); $table->head[7] = __('Status'); $table->head[8] = __('Validate'); $table->align[7] = 'center'; $table->align[8] = 'center'; } } else { if ($print_agent) { $table->size[0] = '20px'; $table->size[1] = '20px'; $table->size[2] = '25%'; $table->size[3] = '25%'; $table->size[4] = '50%'; $table->size[5] = '25%'; $table->size[6] = '20px'; $table->size[7] = '60px'; $table->head[0] = "" . __('S.') . ""; $table->head[1] = "" . __('F.') . ""; $table->head[2] = __('Agent') . ' ' . ''. print_image("images/sort_up.png", true, array("style" => $selectAgentUp)) . '' . '' . print_image("images/sort_down.png", true, array("style" => $selectAgentDown)) . ''; $table->head[3] = __('Module') . ' ' . '' . print_image("images/sort_up.png", true, array("style" => $selectModuleUp)) . '' . '' . print_image("images/sort_down.png", true, array("style" => $selectModuleDown)) . ''; $table->head[4] = __('Template') . ' ' . '' . print_image("images/sort_up.png", true, array("style" => $selectTemplateUp)) . '' . '' . print_image("images/sort_down.png", true, array("style" => $selectTemplateDown)) . ''; $table->head[5] = __('Action'); $table->head[6] = __('Last fired'); $table->head[7] = __('Status'); $table->head[8] = __('Validate'); $table->align[7] = 'center'; $table->align[8] = 'center'; } else { $table->size[0] = '20px'; $table->size[1] = '20px'; $table->size[2] = '25%'; $table->size[3] = '50%'; $table->size[4] = '25%'; $table->size[5] = '20px'; $table->size[6] = '60px'; $table->head[0] = "" . __('S.') . ""; $table->head[1] = "" . __('F.') . ""; $table->head[2] = __('Module') . ' ' . '' . print_image("images/sort_up.png", true, array("style" => $selectModuleUp)) . '' . '' . print_image("images/sort_down.png", true, array("style" => $selectModuleDown)) . ''; $table->head[3] = __('Template') . ' ' . '' . print_image("images/sort_up.png", true, array("style" => $selectTemplateUp)) . '' . '' . print_image("images/sort_down.png", true, array("style" => $selectTemplateDown)) . ''; $table->head[4] = __('Action'); $table->head[5] = __('Last fired'); $table->head[6] = __('Status'); $table->head[7] = __('Validate'); $table->align[6] = 'center'; $table->align[7] = 'center'; } } $table->title = __('Single alerts'); $table->titlestyle = "background-color:#799E48;"; $table->data = array (); $rowPair = true; $iterator = 0; foreach ($alerts['alerts_simple'] as $alert) { if ($rowPair) $table->rowclass[$iterator] = 'rowPair'; else $table->rowclass[$iterator] = 'rowOdd'; $rowPair = !$rowPair; array_push ($table->data, ui_format_alert_row ($alert, false, $print_agent, $url)); } echo '
'; ui_require_css_file('cluetip'); ui_require_jquery_file('cluetip'); ?>