mdtrooper d7435de974 2012-06-14 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_html.php, include/functions_reporting.php,
	include/functions_groups.php, include/functions_visual_map.php,
	include/ajax/reporting.ajax.php, include/functions_ui.php,
	extensions/agents_modules.php, extensions/module_groups.php,
	operation/incidents/incident.php,
	operation/incidents/incident_detail.php,
	operation/agentes/status_monitor.php,
	operation/agentes/estado_ultimopaquete.php,
	operation/agentes/estado_agente.php,
	operation/agentes/ver_agente.php,
	operation/snmpconsole/snmp_view.php.
	operation/integria_incidents/incident.incident.php,
	mobile/operation/agents/monitor_status.php,
	mobile/operation/agents/view_agents.php,
	mobile/operation/agents/view_alerts.php,
	mobile/operation/events/events.php,
	godmode/groups/modu_group_list.php, godmode/groups/group_list.php,
	godmode/agentes/module_manager.php,
	godmode/agentes/modificar_agente.php,
	godmode/agentes/configurar_agente.php,
	godmode/alerts/alert_list.list.php, godmode/setup/os.list.php,
	godmode/users/configure_user.php,
	godmode/modules/manage_network_templates.php,
	godmode/reporting/reporting_builder.list_items.php,
	godmode/tag/tag.php: changed the calls of "ui_print_truncate_text"
	now we are trying that more easy and standar, now the string name of
	agent have the equal number of characters in all code...but there
	are two styles, small and medium size for agents text name, modules
	text name, but description is only size. You can set this sizes in
	the visual setup page into your Pandora.
	
	MERGED from 4.0.2




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6554 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-06-14 16:23:23 +00:00

100 lines
3.2 KiB
PHP

<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
global $config;
include_once ($config['homedir'] . "/include/functions_agents.php");
include_once ($config['homedir'].'/include/functions_modules.php');
include_once ($config['homedir'].'/include/functions_users.php');
class ViewAlerts {
private $system;
public function __construct() {
global $system;
$this->system = $system;
}
public function show() {
$table = null;
//$table->width = '100%';
$table->head = array();
$table->head[0] = __('Module');
$table->head[1] = __('Template');
$table->head[2] = __('Action');
$table->head[2] = '<span title="' . __('Last fired') . '" alt="' . __('Last fired') . '">' . __('Last') . '</span>';
$table->head[3] = '<span title="' . __('Status') . '" alt="' . __('Status') . '">' . __('S') . '</span>';
$table->align = array();
$table->align[3] = 'right';
$table->align[2] = 'center';
$table->data = array();
$table->rowclass = array();
$groups = users_get_groups($this->system->getConfig('id_user'));
$idGroups = array_keys($groups);
$agents = agents_get_group_agents($idGroups);
$idAgents = array_keys($agents);
$alertsSimple = agents_get_alerts_simple($idAgents);
$rowPair = false;
$iterator = 0;
foreach ($alertsSimple as $alert) {
if ($rowPair)
$table->rowclass[$iterator] = 'rowPair';
else
$table->rowclass[$iterator] = 'rowOdd';
$rowPair = !$rowPair;
$iterator++;
$data = array();
$idAgent = modules_get_agentmodule_agent($alert["id_agent_module"]);
$data[] = '<a href="index.php?page=agent&id=' . $idAgent . '">' .
ui_print_truncate_text(modules_get_agentmodule_name($alert["id_agent_module"]), 'module_small', true, true) . '</a>';
$template = io_safe_output(alerts_get_alert_template ($alert['id_alert_template']));
$data[] = ui_print_truncate_text(io_safe_output($template['name']), GENERIC_SIZE_TEXT, true, true);
$data[] = ui_print_timestamp ($alert["last_fired"], true, array('units' => 'tiny'));
$status = STATUS_ALERT_NOT_FIRED;
$title = "";
if ($alert["times_fired"] > 0) {
$status = STATUS_ALERT_FIRED;
$title = __('Alert fired').' '.$alert["times_fired"].' '.__('times');
}
elseif ($alert["disabled"] > 0) {
$status = STATUS_ALERT_DISABLED;
$title = __('Alert disabled');
}
else {
$status = STATUS_ALERT_NOT_FIRED;
$title = __('Alert not fired');
}
$data[] = str_replace(array('images/status_sets', '<img'),
array('images/status_sets', '<img width="15" height="15"'), ui_print_status_image($status, $title, true));
$table->data[] = $data;
}
html_print_table($table);
}
}
?>