2012-01-23 18:01:00 +01:00
|
|
|
<?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.
|
|
|
|
// Load global vars
|
|
|
|
global $config;
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
require_once 'include/functions_incidents.php';
|
2012-01-23 18:01:00 +01:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
check_login();
|
2012-01-23 18:01:00 +01:00
|
|
|
|
|
|
|
$group = $id_grupo;
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
if (! check_acl($config['id_user'], $group, 'AW', $id_agente)) {
|
|
|
|
db_pandora_audit(
|
|
|
|
'ACL Violation',
|
|
|
|
'Trying to access agent manager'
|
|
|
|
);
|
|
|
|
include 'general/noaccess.php';
|
|
|
|
return;
|
2012-01-23 18:01:00 +01:00
|
|
|
}
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$offset = (int) get_parameter('offset', 0);
|
|
|
|
|
|
|
|
|
|
|
|
// See if id_agente is set (either POST or GET, otherwise -1
|
|
|
|
$id_agent = (int) get_parameter('id_agente');
|
|
|
|
$groups = users_get_groups($config['id_user'], 'IR');
|
|
|
|
$filter = ' AND id_agent = '.$id_agent;
|
|
|
|
$url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=incident&id_agente='.$id_agent;
|
|
|
|
|
|
|
|
// Select incidencts where the user has access to ($groups from
|
|
|
|
// get_user_groups), array_keys for the id, implode to pass to SQL
|
|
|
|
switch ($config['dbtype']) {
|
|
|
|
case 'mysql':
|
|
|
|
$sql = 'SELECT * FROM tincidencia WHERE
|
|
|
|
id_grupo IN ('.implode(',', array_keys($groups)).')'.$filter.'
|
|
|
|
ORDER BY actualizacion DESC LIMIT '.$offset.','.$config['block_size'];
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'oracle':
|
|
|
|
$sql = 'SELECT * FROM tincidencia WHERE
|
|
|
|
id_grupo IN ('.implode(',', array_keys($groups)).')'.$filter.'
|
|
|
|
AND rownum <= '.$offset.','.$config['block_size'].'
|
|
|
|
ORDER BY actualizacion DESC';
|
|
|
|
break;
|
2015-10-21 13:57:05 +02:00
|
|
|
}
|
2012-01-23 18:01:00 +01:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$result = db_get_all_rows_sql($sql);
|
|
|
|
|
|
|
|
$count_sql = 'SELECT count(*) FROM tincidencia WHERE
|
|
|
|
id_grupo IN ('.implode(',', array_keys($groups)).')'.$filter.'
|
|
|
|
ORDER BY actualizacion DESC';
|
2012-01-23 18:01:00 +01:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$count = db_get_value_sql($count_sql);
|
2012-01-23 18:01:00 +01:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
if (empty($result)) {
|
|
|
|
$result = [];
|
|
|
|
$count = 0;
|
|
|
|
echo '<div class="nf">'.__('No incidents associated to this agent').'</div><br />';
|
|
|
|
return;
|
2012-01-23 18:01:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Show pagination
|
2019-01-30 16:18:44 +01:00
|
|
|
ui_pagination($count, $url, $offset, 0, false, 'offset');
|
|
|
|
// ($count + $offset) it's real count of incidents because it's use LIMIT $offset in query.
|
2012-01-23 18:01:00 +01:00
|
|
|
echo '<br />';
|
|
|
|
|
|
|
|
// Show headers
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->width = '100%';
|
|
|
|
$table->class = 'databox';
|
2012-01-23 18:01:00 +01:00
|
|
|
$table->cellpadding = 4;
|
|
|
|
$table->cellspacing = 4;
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->head = [];
|
|
|
|
$table->data = [];
|
|
|
|
$table->size = [];
|
|
|
|
$table->align = [];
|
2012-01-23 18:01:00 +01:00
|
|
|
|
|
|
|
$table->head[0] = __('ID');
|
|
|
|
$table->head[1] = __('Status');
|
|
|
|
$table->head[2] = __('Incident');
|
|
|
|
$table->head[3] = __('Priority');
|
|
|
|
$table->head[4] = __('Group');
|
|
|
|
$table->head[5] = __('Updated');
|
|
|
|
$table->head[6] = __('Source');
|
|
|
|
$table->head[7] = __('Owner');
|
|
|
|
|
|
|
|
$table->size[0] = 43;
|
|
|
|
$table->size[7] = 50;
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->align[1] = 'center';
|
|
|
|
$table->align[3] = 'center';
|
|
|
|
$table->align[4] = 'center';
|
|
|
|
|
2012-01-23 18:01:00 +01:00
|
|
|
$rowPair = true;
|
|
|
|
$iterator = 0;
|
|
|
|
foreach ($result as $row) {
|
2019-01-30 16:18:44 +01:00
|
|
|
if ($rowPair) {
|
|
|
|
$table->rowclass[$iterator] = 'rowPair';
|
|
|
|
} else {
|
|
|
|
$table->rowclass[$iterator] = 'rowOdd';
|
|
|
|
}
|
|
|
|
|
|
|
|
$rowPair = !$rowPair;
|
|
|
|
$iterator++;
|
|
|
|
|
|
|
|
$data = [];
|
|
|
|
|
|
|
|
$data[0] = '<a href="index.php?sec=incidencias&sec2=operation/incidents/incident_detail&id='.$row['id_incidencia'].'">'.$row['id_incidencia'].'</a>';
|
|
|
|
$attach = incidents_get_attach($row['id_incidencia']);
|
|
|
|
|
|
|
|
if (!empty($attach)) {
|
|
|
|
$data[0] .= ' '.html_print_image('images/attachment.png', true, ['style' => 'align:middle;']);
|
|
|
|
}
|
|
|
|
|
|
|
|
$data[1] = incidents_print_status_img($row['estado'], true);
|
|
|
|
$data[2] = '<a href="index.php?sec=incidencias&sec2=operation/incidents/incident_detail&id='.$row['id_incidencia'].'">'.substr(io_safe_output($row['titulo']), 0, 45).'</a>';
|
|
|
|
$data[3] = incidents_print_priority_img($row['prioridad'], true);
|
|
|
|
$data[4] = ui_print_group_icon($row['id_grupo'], true);
|
|
|
|
$data[5] = ui_print_timestamp($row['actualizacion'], true);
|
|
|
|
$data[6] = $row['origen'];
|
|
|
|
$data[7] = ui_print_username($row['id_usuario'], true);
|
|
|
|
|
|
|
|
array_push($table->data, $data);
|
2012-01-23 18:01:00 +01:00
|
|
|
}
|
2019-01-30 16:18:44 +01:00
|
|
|
|
|
|
|
html_print_table($table);
|
2012-01-23 18:01:00 +01:00
|
|
|
|
|
|
|
echo '</div>';
|
2019-01-30 16:18:44 +01:00
|
|
|
unset($table);
|
2012-01-23 18:01:00 +01:00
|
|
|
echo '<br><br>';
|
|
|
|
|
|
|
|
echo '<div style="clear:both"> </div>';
|