diff --git a/pandora_console/godmode/reporting/graphs.php b/pandora_console/godmode/reporting/graphs.php
index 804855c02d..cb52af5e04 100644
--- a/pandora_console/godmode/reporting/graphs.php
+++ b/pandora_console/godmode/reporting/graphs.php
@@ -151,100 +151,193 @@ if ($multiple_delete) {
}
+$id_group = (int) get_parameter('id_group', 0);
+$search = trim(get_parameter('search', ''));
$graphs = custom_graphs_get_user($config['id_user'], false, true, $access);
$offset = (int) get_parameter('offset');
+$table_aux = new stdClass();
-ui_pagination(count($graphs));
+ $table_aux->width = '100%';
+ $table_aux->class = 'databox filters';
+ $table_aux->cellpadding = 0;
+ $table_aux->cellspacing = 0;
-if (!empty($graphs)) {
- $table = new stdClass();
- $table->width = '100%';
- $table->class = 'info_table';
- $table->cellpadding = 0;
- $table->cellspacing = 0;
- $table->align = [];
- $table->head = [];
- if ($report_w || $report_m) {
- $table->align[5] = 'left';
- $table->head[5] = html_print_checkbox('all_delete', 0, false, true, false);
- $table->size[5] = '20px';
- }
+ $table_aux->colspan[0][0] = 4;
+ $table_aux->data[0][0] = ''.__('Group').'';
- $table->head[0] = __('Graph name');
- $table->head[1] = __('Description');
- $table->head[2] = __('Number of Graphs');
- $table->head[3] = __('Group');
- $table->size[0] = '30%';
- $table->size[2] = '200px';
- $table->size[3] = '200px';
- $table->align[2] = 'left';
- $table->align[3] = 'left';
- $op_column = false;
- if ($report_w || $report_m) {
- $op_column = true;
- $table->align[4] = 'left';
- $table->head[4] = __('Op.');
- $table->size[4] = '90px';
- }
+ $table_aux->data[0][1] = html_print_select_groups(false, $access, true, 'id_group', $id_group, '', '', '', true, false, true, '', false, '', false, false, 'id_grupo', $strict_user).'
';
- $table->data = [];
+ $table_aux->data[0][2] = ''.__('Free text for search: ').ui_print_help_tip(
+ __('Search by report name or description, list matches.'),
+ true
+ ).'';
+ $table_aux->data[0][3] = html_print_input_text('search', $search, '', 30, '', true);
- $result_graphs = array_slice($graphs, $offset, $config['block_size']);
+ $table_aux->data[0][6] = html_print_submit_button(__('Search'), 'search_submit', false, 'class="sub upd"', true);
- foreach ($result_graphs as $graph) {
- $data = [];
-
- if ($report_m) {
- $data[5] .= html_print_checkbox_extended('delete_multiple[]', $graph['id_graph'], false, false, '', 'class="check_delete" style="margin-left:2px;"', true);
+ if (is_metaconsole()) {
+ $filter = "
';
+ ui_toggle($filter, __('Show Option'));
+ } else {
+ echo "';
}
- $data[0] = ''.ui_print_truncate_text($graph['name'], 70).'';
-
- $data[1] = ui_print_truncate_text($graph['description'], 70);
-
- $data[2] = $graph['graphs_count'];
- $data[3] = ui_print_group_icon($graph['id_group'], true);
-
- $data[4] = '';
- $table->cellclass[][4] = 'action_buttons';
- if (($report_w || $report_m)) {
- $data[4] = ''.html_print_image('images/config.png', true).'';
+ // Show only selected groups.
+ if ($id_group > 0) {
+ $group = ["$id_group" => $id_group];
+ } else {
+ $group = false;
}
- if ($report_m) {
- $data[4] .= ' $id_group];
+ $filter['id_group'] = $id_group;
+ } else {
+ $group = false;
+ }
+
+ // Filter normal and metaconsole reports.
+ if ($config['metaconsole'] == 1 && defined('METACONSOLE')) {
+ $filter['metaconsole'] = 1;
+ } else {
+ $filter['metaconsole'] = 0;
+ }
+
+
+ /*
+ $reports = reports_get_reports(
+ $filter,
+ [
+ 'name',
+ 'description',
+ 'id_graph',
+ 'id_group',
+ ],
+ $return_all_group,
+ $access,
+ $group,
+ false
+ );*/
+
+ if ($id_group != null || $search != null) {
+ $graphs = custom_graphs_search($id_group, $search);
+ }
+
+ ui_pagination(count($graphs));
+
+ if (!empty($graphs)) {
+ $table = new stdClass();
+ $table->width = '100%';
+ $table->class = 'info_table';
+ $table->cellpadding = 0;
+ $table->cellspacing = 0;
+ $table->align = [];
+ $table->head = [];
+ if ($report_w || $report_m) {
+ $table->align[5] = 'left';
+ $table->head[5] = html_print_checkbox('all_delete', 0, false, true, false);
+ $table->size[5] = '20px';
+ }
+
+ $table->head[0] = __('Graph name');
+ $table->head[1] = __('Description');
+ $table->head[2] = __('Number of Graphs');
+ $table->head[3] = __('Group');
+ $table->size[0] = '30%';
+ $table->size[2] = '200px';
+ $table->size[3] = '200px';
+ $table->align[2] = 'left';
+ $table->align[3] = 'left';
+ $op_column = false;
+ if ($report_w || $report_m) {
+ $op_column = true;
+ $table->align[4] = 'left';
+ $table->head[4] = __('Op.');
+ $table->size[4] = '90px';
+ }
+
+ $table->data = [];
+
+ $result_graphs = array_slice($graphs, $offset, $config['block_size']);
+
+ foreach ($result_graphs as $graph) {
+ $data = [];
+
+ if ($report_m) {
+ $data[5] .= html_print_checkbox_extended('delete_multiple[]', $graph['id_graph'], false, false, '', 'class="check_delete" style="margin-left:2px;"', true);
+ }
+
+ $data[0] = ''.ui_print_truncate_text($graph['name'], 70).'';
+
+ $data[1] = ui_print_truncate_text($graph['description'], 70);
+
+ $data[2] = $graph['graphs_count'];
+ $data[3] = ui_print_group_icon($graph['id_group'], true);
+
+ $data[4] = '';
+ $table->cellclass[][4] = 'action_buttons';
+ if (($report_w || $report_m)) {
+ $data[4] = ''.html_print_image('images/config.png', true).'';
+ }
+
+ if ($report_m) {
+ $data[4] .= ''.html_print_image('images/cross.png', true, ['alt' => __('Delete'), 'title' => __('Delete')]).'';
+ }
+
+ array_push($table->data, $data);
+ }
+
+
+ if (!empty($result_graphs)) {
+ echo "';
+ }
+
+
+ echo "";
+ if ($report_w || $report_m) {
+ echo '';
+ }
+
+ echo '
';
+ } else {
+ include_once $config['homedir'].'/general/firts_task/custom_graphs.php';
}
- array_push($table->data, $data);
- }
-
-
- if (!empty($result_graphs)) {
- echo "';
- }
-
-
- echo "";
- if ($report_w || $report_m) {
- echo '';
- }
-
- echo '
';
-} else {
- include_once $config['homedir'].'/general/firts_task/custom_graphs.php';
-}
-
-?>
+ ?>