Add pagination in custom reports and visual console. Tiquet: #2398
This commit is contained in:
parent
1fa83a35dc
commit
606e29684b
|
@ -35,7 +35,8 @@ ui_print_info_message(
|
|||
ignore it or will update its information.There are three types of detection: Based on <strong id="fuerte"> ICMP </strong>(pings),
|
||||
<strong id="fuerte">SNMP</strong> (detecting the topology of networks and their interfaces), and other <strong id="fuerte"> customized </strong>
|
||||
type. You can define your own customized recon script.'); ?></p>
|
||||
<form action="index.php?sec=gservers&sec2=godmode/servers/manage_recontask_form&create" method="post">
|
||||
<form action="index.php?sec=reporting&sec2=godmode/reporting/visual_console_builder" method="post">
|
||||
<?php html_print_input_hidden ('edit_layout', 1); ?>
|
||||
<input type="submit" class="button_task" value="<?php echo __('Create Visual Console'); ?>" />
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -44,6 +44,8 @@ $id_layout = (int) get_parameter ('id_layout');
|
|||
$copy_layout = (bool) get_parameter ('copy_layout');
|
||||
$delete_layout = (bool) get_parameter ('delete_layout');
|
||||
$refr = (int) get_parameter('refr');
|
||||
$offset = (int) get_parameter('offset', 0);
|
||||
$pagination = (int) get_parameter ("pagination", $config["block_size"]);
|
||||
|
||||
if ($delete_layout || $copy_layout) {
|
||||
// Visual console required
|
||||
|
@ -206,9 +208,6 @@ $table->head[0] = __('Map name');
|
|||
$table->head[1] = __('Group');
|
||||
$table->head[2] = __('Items');
|
||||
|
||||
if (defined("METACONSOLE"))
|
||||
$table->styleTable = "margin-top:0px";
|
||||
|
||||
// Fix: IW was the old ACL for report editing, now is RW
|
||||
//Only for RW flag
|
||||
if ($vconsoles_write || $vconsoles_manage) {
|
||||
|
@ -227,13 +226,24 @@ $table->align[4] = 'left';
|
|||
|
||||
// Only display maps of "All" group if user is administrator
|
||||
// or has "VR" privileges, otherwise show only maps of user group
|
||||
$filters['offset'] = $offset;
|
||||
$filters['limit'] = $pagination;
|
||||
$own_info = get_user_info ($config['id_user']);
|
||||
if ($own_info['is_admin'] || $vconsoles_read)
|
||||
$maps = visual_map_get_user_layouts ();
|
||||
else
|
||||
if (!defined('METACONSOLE')) {
|
||||
$url = 'index.php?sec=reporting&sec2=godmode/reporting/map_builder&pagination='.$pagination;
|
||||
}
|
||||
else {
|
||||
$url = 'index.php?sec=screen&sec2=screens/screens&action=visualmap&pagination='.$pagination;
|
||||
}
|
||||
if ($own_info['is_admin'] || $vconsoles_read) {
|
||||
$maps = visual_map_get_user_layouts (0,false,$filters);
|
||||
$total_maps = count(visual_map_get_user_layouts());
|
||||
} else {
|
||||
$maps = visual_map_get_user_layouts ($config['id_user'], false,
|
||||
false, false);
|
||||
|
||||
$filters, false);
|
||||
$total_maps = count(visual_map_get_user_layouts ($config['id_user'], false,
|
||||
false, false));
|
||||
}
|
||||
if (!$maps && !defined("METACONSOLE")) {
|
||||
require_once ($config['homedir'] . "/general/firts_task/map_builder.php");
|
||||
}
|
||||
|
@ -244,6 +254,8 @@ elseif (!$maps && defined("METACONSOLE")) {
|
|||
'message'=> __('There are no visual console defined yet.')));
|
||||
}
|
||||
else {
|
||||
ui_pagination ($total_maps, $url, $offset, $pagination);
|
||||
|
||||
foreach ($maps as $map) {
|
||||
// ACL for the visual console permission
|
||||
$vconsole_write = check_acl ($config['id_user'],
|
||||
|
|
|
@ -46,11 +46,11 @@ define ('_MPDF_TTFONTPATH', 'include/fonts/');
|
|||
$activeTab = get_parameter('tab', 'main');
|
||||
$action = get_parameter('action', 'list');
|
||||
$idReport = get_parameter('id_report', 0);
|
||||
$offset = get_parameter('offset', 0);
|
||||
$offset = (int) get_parameter('offset', 0);
|
||||
$idItem = get_parameter('id_item', 0);
|
||||
$pure = get_parameter('pure',0);
|
||||
$schedule_report = get_parameter('schbutton', '');
|
||||
|
||||
$pagination = (int) get_parameter ("pagination", $config["block_size"]);
|
||||
$strict_user = db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']);
|
||||
|
||||
if ($schedule_report != '') {
|
||||
|
@ -440,7 +440,8 @@ switch ($action) {
|
|||
else {
|
||||
$group = false;
|
||||
}
|
||||
|
||||
$filter['offset'] = $offset;
|
||||
$filter['limit'] = $pagination;
|
||||
|
||||
// Filter normal and metaconsole reports
|
||||
if ($config['metaconsole'] == 1 and defined('METACONSOLE'))
|
||||
|
@ -458,9 +459,17 @@ switch ($action) {
|
|||
'id_group',
|
||||
'non_interactive'), $return_all_group, 'RR', $group, $strict_user);
|
||||
|
||||
$table = new stdClass();
|
||||
$table->width = '0px';
|
||||
|
||||
unset($filter['offset']);
|
||||
unset($filter['limit']);
|
||||
$total_reports = (int) count(reports_get_reports ($filter,
|
||||
array ('name'), $return_all_group, 'RR', $group, $strict_user));
|
||||
|
||||
|
||||
if (sizeof ($reports)) {
|
||||
$url = "index.php?sec=reporting&sec2=godmode/reporting/reporting_builder";
|
||||
ui_pagination ($total_reports, $url, $offset, $pagination);
|
||||
|
||||
$table = new stdClass();
|
||||
$table->id = 'report_list';
|
||||
$table->width = '100%';
|
||||
|
|
|
@ -1874,8 +1874,6 @@ function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter
|
|||
if (! is_array ($filter))
|
||||
$filter = array ();
|
||||
|
||||
$where = db_format_array_where_clause_sql ($filter);
|
||||
|
||||
if ($returnAllGroup)
|
||||
$groups = users_get_groups ($id_user, 'RR');
|
||||
else
|
||||
|
@ -1888,6 +1886,8 @@ function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter
|
|||
$where .= sprintf ('id_group IN (%s)', implode (",", array_keys ($groups)));
|
||||
}
|
||||
|
||||
$where .= db_format_array_where_clause_sql ($filter);
|
||||
|
||||
if ($where == '') {
|
||||
$where = array();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue