'.__('Correlated alerts').'';
$table->id = 'filter_compound_table';
$table->width = '90%';
$table->data = array ();
$table->style = array ();
$table->style[0] = 'font-weight: bold; vertical-align:top';
$table->style[2] = 'font-weight: bold';
$table->size = array ();
$table->colspan = array ();
$table->size[0] = '15%';
$table->size[1] = '35%';
$table->size[2] = '15%';
$table->size[3] = '35%';
$table->data[0][0] = __('Group');
$table->data[0][1] = print_select ($groups, 'id_group', $id_group, false, '',
'', true);
$table->data[0][2] = __('Agent');
$table->data[0][2] .= ' ';
$table->data[0][2] .= '
';
$table->data[0][2] .= '';
$table->data[0][3] = print_select ($agents, 'id_agent', $id_agent, false,
__('All'), 0, true);
$table->data[1][0] = __('Free search');
$table->data[1][1] = print_input_text ('search', $search, '', 20, 40, true);
$table->colspan[1][1] = 3;
echo '
';
unset ($table);
$where = '';
if ($search != '')
$where = sprintf (' AND (description LIKE "%%%s%%" OR name LIKE "%%%s%%")',
$search, $search);
if ($id_agent)
$agents = array ($id_agent => $id_agent);
$sql = sprintf ('SELECT COUNT(*) FROM talert_compound
WHERE id_agent in (%s)%s',
implode (',', array_keys ($agents)), $where);
$total = (int) get_db_sql ($sql);
pagination ($total, $url);
$table->id = 'alert_list';
$table->class = 'alert_list databox';
$table->width = '90%';
$table->data = array ();
$table->head = array ();
$table->style = array ();
$table->style[1] = 'font-weight: bold';
$table->align = array ();
$table->align[3] = 'center';
$table->size = array ();
$table->size[0] = '20px';
$table->size[3] = '20px';
$table->head[0] = '';
$table->head[1] = __('Name');
$table->head[2] = __('Agent');
$table->head[3] = __('Delete');
$sql = sprintf ('SELECT id FROM talert_compound
WHERE id_agent in (%s)%s LIMIT %d OFFSET %d',
implode (',', array_keys ($agents)), $where,
$config['block_size'], get_parameter ('offset'));
$id_alerts = get_db_all_rows_sql ($sql);
if ($id_alerts === false)
$id_alerts = array ();
foreach ($id_alerts as $alert) {
$alert = get_alert_compound ($alert['id']);
if ($alert === false)
continue;
$data = array ();
$data[0] = '';
$data[1] = '';
$data[1] .= $alert['name'];
$data[1] .= '';
$data[2] = get_agent_name ($alert['id_agent']);
$data[3] = '';
$data[3] .= '
';
$data[3] .= '';
array_push ($table->data, $data);
}
print_table ($table);
echo '';
echo '';
echo '
';
require_jquery_file ('pandora.controls');
?>