Reporting Custom Graphs change visual
This commit is contained in:
parent
a5e6e569e8
commit
dd1b58b83a
|
@ -15,9 +15,6 @@ global $config;
|
|||
check_login();
|
||||
ui_require_css_file('first_task');
|
||||
?>
|
||||
<?php
|
||||
ui_print_info_message(['no_close' => true, 'message' => __('There are no custom graphs defined yet.') ]);
|
||||
?>
|
||||
|
||||
<div class="new_task">
|
||||
<div class="image_task">
|
||||
|
@ -36,7 +33,17 @@ ui_print_info_message(['no_close' => true, 'message' => __('There are no custom
|
|||
?>
|
||||
</p>
|
||||
<form action="index.php?sec=reporting&sec2=godmode/reporting/graph_builder" method="post">
|
||||
<input type="submit" class="button_task" value="<?php echo __('Create Custom Graph'); ?>" />
|
||||
<?php
|
||||
html_print_action_buttons(
|
||||
html_print_submit_button(
|
||||
__('Create Custom Graph'),
|
||||
'button_task',
|
||||
false,
|
||||
['icon' => 'wand'],
|
||||
true
|
||||
)
|
||||
);
|
||||
?>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
|
@ -115,20 +115,18 @@ if ($edit_graph === true) {
|
|||
// -----------------------
|
||||
$url = 'index.php?sec=reporting&sec2=godmode/reporting/graph_builder&edit_graph=1';
|
||||
if ($edit_graph === true) {
|
||||
$output = "<form method='post' action='".$url.'&update_graph=1&id='.$id_graph."'>";
|
||||
$output = "<form method='post' class='max_floating_element_size' action='".$url.'&update_graph=1&id='.$id_graph."'>";
|
||||
} else {
|
||||
$output = "<form method='post' action='".$url."&add_graph=1'>";
|
||||
$output = "<form method='post' class='max_floating_element_size' action='".$url."&add_graph=1'>";
|
||||
}
|
||||
|
||||
$output .= "<table width='100%' cellpadding=4 cellspacing=4 class='databox filters'>";
|
||||
$output .= '<tr>';
|
||||
$output .= "<td class='datos'><b>".__('Name').'</b></td>';
|
||||
$output .= "<td class='datos'><input type='text' name='name' size='25' ";
|
||||
if ($edit_graph === true) {
|
||||
$output .= "value='".$graphInTgraph['name']."' ";
|
||||
}
|
||||
|
||||
$output .= '>';
|
||||
$output .= "<table width='100%' cellpadding=4 cellspacing=4 class='filter-table-adv databox'>";
|
||||
$output .= '<tbody width="100%">';
|
||||
$output .= '<tr class="datos2">';
|
||||
$graphInTgraph['name'] = (isset($graphInTgraph['name']) === true) ? $graphInTgraph['name'] : '';
|
||||
$output .= '<td width="50%">';
|
||||
$output .= html_print_label_input_block(__('Name'), html_print_input_text('name', $graphInTgraph['name'], '', '', 255, true), ['style' => 'width:50%']);
|
||||
$output .= '</td>';
|
||||
|
||||
$own_info = get_user_info($config['id_user']);
|
||||
|
||||
|
@ -140,9 +138,9 @@ if (users_can_manage_group_all('RW') === false
|
|||
$return_all_group = false;
|
||||
}
|
||||
|
||||
$output .= '<td><b>'.__('Group').'</b></td><td>';
|
||||
$output .= '<td width="50%">';
|
||||
if (check_acl($config['id_user'], 0, 'RW')) {
|
||||
$output .= html_print_input(
|
||||
$inputGroup = html_print_input(
|
||||
[
|
||||
'type' => 'select_groups',
|
||||
'id_user' => $config['id_user'],
|
||||
|
@ -158,7 +156,7 @@ if (check_acl($config['id_user'], 0, 'RW')) {
|
|||
]
|
||||
);
|
||||
} else if (check_acl($config['id_user'], 0, 'RM')) {
|
||||
$output .= html_print_input(
|
||||
$inputGroup = html_print_input(
|
||||
[
|
||||
'type' => 'select_groups',
|
||||
'id_user' => $config['id_user'],
|
||||
|
@ -175,38 +173,34 @@ if (check_acl($config['id_user'], 0, 'RW')) {
|
|||
);
|
||||
}
|
||||
|
||||
$output .= html_print_label_input_block(__('Group'), $inputGroup);
|
||||
$output .= '</td></tr>';
|
||||
$output .= '<tr>';
|
||||
$output .= "<td class='datos2'><b>".__('Description').'</b></td>';
|
||||
$output .= "<td class='datos2' colspan=3><textarea name='description' class='height_45px' cols=55 rows=2>";
|
||||
if ($edit_graph === true) {
|
||||
$output .= $graphInTgraph['description'];
|
||||
}
|
||||
|
||||
$output .= '</textarea>';
|
||||
$output .= '</td></tr>';
|
||||
if ($stacked == CUSTOM_GRAPH_GAUGE) {
|
||||
$hidden = ' class="invisible" ';
|
||||
} else {
|
||||
$hidden = '';
|
||||
}
|
||||
|
||||
$output .= '<tr>';
|
||||
$output .= "<td class='datos'>";
|
||||
$output .= '<b>'.__('Period').'</b></td>';
|
||||
$output .= "<td class='datos'>";
|
||||
$output .= html_print_extended_select_for_time(
|
||||
'period',
|
||||
$period,
|
||||
'',
|
||||
'',
|
||||
'0',
|
||||
10,
|
||||
true
|
||||
$output .= '<tr class="datos2">';
|
||||
$output .= '<td width="100%" colspan="2">';
|
||||
$graphInTgraph['description'] = (isset($graphInTgraph['description']) === true) ? $graphInTgraph['description'] : '';
|
||||
$output .= html_print_label_input_block(
|
||||
__('Description'),
|
||||
html_print_textarea('description', 10, 5, $graphInTgraph['description'], '', true)
|
||||
);
|
||||
$output .= "</td><td class='datos2'>";
|
||||
$output .= '<b>'.__('Type of graph').'</b></td>';
|
||||
$output .= "<td class='datos2'> <div class='left inline'>";
|
||||
$output .= '</td>';
|
||||
$output .= '</tr><tr class="datos2">';
|
||||
$output .= "<td class='datos' width='50%''>";
|
||||
$output .= html_print_label_input_block(
|
||||
__('Period'),
|
||||
html_print_extended_select_for_time(
|
||||
'period',
|
||||
$period,
|
||||
'',
|
||||
'',
|
||||
'0',
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'w100p'
|
||||
)
|
||||
);
|
||||
$output .= "</td><td class='datos2' width='50%'>";
|
||||
|
||||
require_once $config['homedir'].'/include/functions_graph.php';
|
||||
|
||||
|
@ -221,90 +215,116 @@ $stackeds = [
|
|||
CUSTOM_GRAPH_VBARS => __('Vertical bars'),
|
||||
CUSTOM_GRAPH_PIE => __('Pie'),
|
||||
];
|
||||
$output .= html_print_select($stackeds, 'stacked', $stacked, '', '', 0, true);
|
||||
|
||||
$output .= '</div></td></tr>';
|
||||
|
||||
$output .= '<tr>';
|
||||
$output .= "<td class='datos2 thresholdDiv'><b>";
|
||||
$output .= __('Equalize maximum thresholds');
|
||||
$output .= '</b></td>';
|
||||
$output .= "<td class='datos2 thresholdDiv'>";
|
||||
$output .= html_print_checkbox(
|
||||
'threshold',
|
||||
CUSTOM_GRAPH_BULLET_CHART_THRESHOLD,
|
||||
$check,
|
||||
true,
|
||||
false,
|
||||
'',
|
||||
false
|
||||
$output .= html_print_label_input_block(
|
||||
__('Type of graph'),
|
||||
html_print_select(
|
||||
$stackeds,
|
||||
'stacked',
|
||||
$stacked,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true
|
||||
)
|
||||
);
|
||||
$output .= '</td></tr>';
|
||||
|
||||
$output .= "<tr><td class='datos2 sparse_graph '><b>";
|
||||
$output .= __('Percentil');
|
||||
$output .= '</b></td>';
|
||||
$output .= "<td class='datos2 sparse_graph'>";
|
||||
$output .= html_print_checkbox(
|
||||
'percentil',
|
||||
1,
|
||||
$percentil,
|
||||
true
|
||||
$output .= '<tr class="datos2">';
|
||||
$output .= "<td class='datos2 thresholdDiv' width='50%'>";
|
||||
$output .= html_print_label_input_block(
|
||||
__('Equalize maximum thresholds'),
|
||||
html_print_checkbox(
|
||||
'threshold',
|
||||
CUSTOM_GRAPH_BULLET_CHART_THRESHOLD,
|
||||
$check,
|
||||
true,
|
||||
false,
|
||||
'',
|
||||
false
|
||||
)
|
||||
);
|
||||
$output .= '</td>';
|
||||
|
||||
$output .= '<td class="datos2 sparse_graph" width="50%">';
|
||||
$output .= html_print_label_input_block(
|
||||
__('Percentil'),
|
||||
html_print_checkbox(
|
||||
'percentil',
|
||||
1,
|
||||
$percentil,
|
||||
true
|
||||
)
|
||||
);
|
||||
$output .= '</td>';
|
||||
$output .= '</tr>';
|
||||
|
||||
$output .= "<tr><td class='datos2 sparse_graph'><b>";
|
||||
$output .= __('Add summatory series');
|
||||
$output .= '</b></td>';
|
||||
$output .= "<td class='datos2 sparse_graph'>";
|
||||
$output .= html_print_checkbox(
|
||||
'summatory_series',
|
||||
1,
|
||||
$summatory_series,
|
||||
true
|
||||
$output .= '<tr class="datos2"><td class="datos2 sparse_graph" width="50%">';
|
||||
$output .= html_print_label_input_block(
|
||||
__('Add summatory series'),
|
||||
html_print_checkbox(
|
||||
'summatory_series',
|
||||
1,
|
||||
$summatory_series,
|
||||
true
|
||||
)
|
||||
);
|
||||
$output .= "</td><td class='datos2 sparse_graph'><b>";
|
||||
$output .= __('Add average series');
|
||||
$output .= '</b></td>';
|
||||
$output .= "<td class='datos2 sparse_graph'>";
|
||||
$output .= html_print_checkbox(
|
||||
'average_series',
|
||||
1,
|
||||
$average_series,
|
||||
true
|
||||
$output .= "</td><td class='datos2 sparse_graph' width='50%'>";
|
||||
$output .= html_print_label_input_block(
|
||||
__('Add average series'),
|
||||
html_print_checkbox(
|
||||
'average_series',
|
||||
1,
|
||||
$average_series,
|
||||
true
|
||||
)
|
||||
);
|
||||
$output .= '</td></tr>';
|
||||
$output .= "<tr><td class='datos2 sparse_graph'><b>";
|
||||
$output .= __('Modules and series');
|
||||
$output .= '</b></td>';
|
||||
$output .= "<td class='datos2 sparse_graph'>";
|
||||
$output .= html_print_checkbox('modules_series', 1, $modules_series, true);
|
||||
$output .= '<tr class="datos2"><td class="datos2 sparse_graph" width="50%">';
|
||||
$output .= html_print_label_input_block(
|
||||
__('Modules and series'),
|
||||
html_print_checkbox('modules_series', 1, $modules_series, true)
|
||||
);
|
||||
$output .= '</td>';
|
||||
$output .= "<td class='datos2 sparse_graph'><b>";
|
||||
$output .= __('Show full scale graph (TIP)');
|
||||
$output .= '</td>';
|
||||
$output .= "<td class='datos2 sparse_graph'>";
|
||||
$output .= html_print_checkbox('fullscale', 1, $fullscale, true);
|
||||
$output .= "<td class='datos2 sparse_graph' width='50%'>";
|
||||
$output .= html_print_label_input_block(
|
||||
__('Show full scale graph (TIP)'),
|
||||
html_print_checkbox('fullscale', 1, $fullscale, true)
|
||||
);
|
||||
$output .= '</td>';
|
||||
$output .= '</tr>';
|
||||
|
||||
$output .= '</tbody>';
|
||||
$output .= '</table>';
|
||||
|
||||
$labelButton = ($edit_graph === true) ? __('Update') : __('Create');
|
||||
|
||||
$ActionButtons[] = html_print_submit_button(
|
||||
$labelButton,
|
||||
'store',
|
||||
false,
|
||||
[
|
||||
'class' => 'sub ok submitButton',
|
||||
'icon' => 'next',
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
$ActionButtons[] = html_print_button(
|
||||
__('Go back'),
|
||||
'back',
|
||||
false,
|
||||
"window.location.href = 'index.php?sec=reporting&sec2=godmode/reporting/graphs'",
|
||||
[
|
||||
'class' => 'sub ok submitButton',
|
||||
'icon' => 'back',
|
||||
'mode' => 'secondary',
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
$output .= html_print_div(
|
||||
[
|
||||
'class' => 'action-buttons',
|
||||
'content' => html_print_submit_button(
|
||||
($edit_graph === true) ? __('Update') : __('Create'),
|
||||
'store',
|
||||
false,
|
||||
[ 'icon' => 'next' ],
|
||||
true
|
||||
).html_print_go_back_button(
|
||||
'index.php?sec=reporting&sec2=godmode/reporting/graphs',
|
||||
[],
|
||||
true
|
||||
),
|
||||
'content' => html_print_action_buttons(implode('', $ActionButtons), ['type' => 'form_action'], true),
|
||||
],
|
||||
true
|
||||
);
|
||||
|
|
|
@ -222,218 +222,310 @@ $graphs = custom_graphs_get_user($config['id_user'], false, true, $access);
|
|||
$offset = (int) get_parameter('offset');
|
||||
$table_aux = new stdClass();
|
||||
|
||||
$table_aux->width = '100%';
|
||||
$table_aux->class = 'databox filters';
|
||||
$table_aux->cellpadding = 0;
|
||||
$table_aux->cellspacing = 0;
|
||||
$table_aux->width = '100%';
|
||||
if (is_metaconsole() === true) {
|
||||
$table_aux->class = 'databox filters';
|
||||
$table_aux->cellpadding = 0;
|
||||
$table_aux->cellspacing = 0;
|
||||
$table_aux->colspan[0][0] = 4;
|
||||
$table_aux->data[0][0] = '<b>'.__('Group').'</b>';
|
||||
$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).'<br>';
|
||||
$table_aux->data[0][2] = '<b>'.__('Free text for search: ').ui_print_help_tip(
|
||||
__('Search by report name or description, list matches.'),
|
||||
true
|
||||
).'</b>';
|
||||
$table_aux->data[0][3] = html_print_input_text('search', $search, '', 30, '', true);
|
||||
$table_aux->data[0][6] = html_print_submit_button(__('Search'), 'search_submit', false, 'class="sub upd"', true);
|
||||
$filter = "<form class ='' action='index.php?sec=reporting&sec2=godmode/reporting/graphs&id_group=$id_group&pure=$pure'
|
||||
method='post'>";
|
||||
$filter .= html_print_table($table_aux, true);
|
||||
$filter .= '</form>';
|
||||
ui_toggle($filter, __('Show Option'));
|
||||
} else {
|
||||
$table_aux->class = 'filter-table-adv';
|
||||
$table_aux->size[0] = '50%';
|
||||
|
||||
$table_aux->colspan[0][0] = 4;
|
||||
$table_aux->data[0][0] = '<b>'.__('Group').'</b>';
|
||||
$table_aux->data[0][0] = html_print_label_input_block(
|
||||
__('Group'),
|
||||
html_print_select_groups(
|
||||
false,
|
||||
$access,
|
||||
true,
|
||||
'id_group',
|
||||
$id_group,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
'id_grupo',
|
||||
$strict_user
|
||||
)
|
||||
);
|
||||
$table_aux->data[0][1] = html_print_label_input_block(
|
||||
__('Free text for search: ').ui_print_help_tip(__('Search by report name or description, list matches.'), true),
|
||||
html_print_input_text('search', $search, '', 30, '', true)
|
||||
);
|
||||
|
||||
$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).'<br>';
|
||||
$searchForm .= '<form action="index.php?sec=reporting&sec2=godmode/reporting/graphs&id_group='.$id_group.'&pure='.$pure.'"method="post">';
|
||||
$searchForm .= html_print_table($table_aux, true);
|
||||
|
||||
$table_aux->data[0][2] = '<b>'.__('Free text for search: ').ui_print_help_tip(
|
||||
__('Search by report name or description, list matches.'),
|
||||
true
|
||||
).'</b>';
|
||||
$table_aux->data[0][3] = html_print_input_text('search', $search, '', 30, '', true);
|
||||
$searchForm .= html_print_div(
|
||||
[
|
||||
'class' => 'action-buttons',
|
||||
'content' => html_print_submit_button(
|
||||
__('Filter'),
|
||||
'search_submit',
|
||||
false,
|
||||
[
|
||||
'mode' => 'mini',
|
||||
'icon' => 'search',
|
||||
],
|
||||
true
|
||||
),
|
||||
],
|
||||
true
|
||||
);
|
||||
$searchForm .= '</form>';
|
||||
|
||||
$table_aux->data[0][6] = html_print_submit_button(__('Search'), 'search_submit', false, 'class="sub upd"', true);
|
||||
ui_toggle(
|
||||
$searchForm,
|
||||
'<span class="subsection_header_title">'.__('Filters').'</span>',
|
||||
'filter_form',
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
'',
|
||||
'white-box-content',
|
||||
'box-flat white_table_graph fixed_filter_bar'
|
||||
);
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
$filter = "<form class ='' action='index.php?sec=reporting&sec2=godmode/reporting/graphs&id_group=$id_group&pure=$pure'
|
||||
method='post'>";
|
||||
$filter .= html_print_table($table_aux, true);
|
||||
$filter .= '</form>';
|
||||
ui_toggle($filter, __('Show Option'));
|
||||
} else {
|
||||
echo "<form action='index.php?sec=reporting&sec2=godmode/reporting/graphs&id_group=$id_group&pure=$pure'
|
||||
method='post'>";
|
||||
html_print_table($table_aux);
|
||||
// Show only selected groups.
|
||||
if ($id_group > 0) {
|
||||
$group = ["$id_group" => $id_group];
|
||||
} else {
|
||||
$group = false;
|
||||
}
|
||||
|
||||
$own_info = get_user_info($config['id_user']);
|
||||
if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'RM')) {
|
||||
$return_all_group = true;
|
||||
} else {
|
||||
$return_all_group = false;
|
||||
}
|
||||
|
||||
if ($search != '') {
|
||||
$filter = [
|
||||
'name' => $search_name,
|
||||
'order' => 'name',
|
||||
];
|
||||
} else {
|
||||
$filter = ['order' => 'name'];
|
||||
}
|
||||
|
||||
// Fix : group filter was not working
|
||||
// Show only selected groups.
|
||||
if ($id_group > 0) {
|
||||
$group = ["$id_group" => $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;
|
||||
}
|
||||
|
||||
if ($id_group != null || $search != null) {
|
||||
$graphs = custom_graphs_search($id_group, $search);
|
||||
}
|
||||
|
||||
if (!empty($graphs)) {
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = 'info_table';
|
||||
$table->cellpadding = 0;
|
||||
$table->cellspacing = 0;
|
||||
$table->align = [];
|
||||
$table->head = [];
|
||||
|
||||
$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';
|
||||
}
|
||||
|
||||
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->data = [];
|
||||
|
||||
$result_graphs = array_slice($graphs, $offset, $config['block_size']);
|
||||
|
||||
foreach ($result_graphs as $graph) {
|
||||
$data = [];
|
||||
|
||||
$data[0] = '<a href="index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=1&id='.$graph['id_graph'].'">'.ui_print_truncate_text(
|
||||
$graph['name'],
|
||||
70
|
||||
).'</a>';
|
||||
|
||||
$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] = 'table_action_buttons';
|
||||
if (($report_w || $report_m)) {
|
||||
$data[4] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/graph_builder&edit_graph=1&id='.$graph['id_graph'].'">'.html_print_image(
|
||||
'images/edit.svg',
|
||||
true,
|
||||
['class' => 'invert_filter main_menu_icon']
|
||||
).'</a>';
|
||||
}
|
||||
|
||||
$data[5] = '';
|
||||
if (check_acl_restricted_all($config['id_user'], $graph['id_group'], 'RM')) {
|
||||
$data[4] .= '<a href="index.php?sec=reporting&sec2=godmode/reporting/graphs&delete_graph=1&id='.$graph['id_graph'].'" onClick="if (!confirm(\''.__('Are you sure?').'\'))
|
||||
return false;">'.html_print_image(
|
||||
'images/delete.svg',
|
||||
true,
|
||||
[
|
||||
'alt' => __('Delete'),
|
||||
'title' => __('Delete'),
|
||||
'class' => 'invert_filter main_menu_icon',
|
||||
]
|
||||
).'</a>';
|
||||
|
||||
$data[5] .= html_print_checkbox_extended(
|
||||
'delete_multiple[]',
|
||||
$graph['id_graph'],
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
[
|
||||
'class' => 'check_delete mrgn_lft_2px check_delete',
|
||||
'form' => 'form_delete',
|
||||
'data-value' => $graph['id_graph'],
|
||||
],
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
array_push($table->data, $data);
|
||||
}
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
if (!empty($result_graphs)) {
|
||||
echo "<form method='post' action='index.php?sec=reporting&sec2=godmode/reporting/graphs'>";
|
||||
html_print_input_hidden('multiple_delete', 1);
|
||||
html_print_table($table);
|
||||
ui_pagination(count($graphs), false, 0, 0, false, 'offset', true, 'pagination-bottom');
|
||||
echo "<div class='right'>";
|
||||
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
// Show only selected groups.
|
||||
if ($id_group > 0) {
|
||||
$group = ["$id_group" => $id_group];
|
||||
} else {
|
||||
$group = false;
|
||||
|
||||
echo "<div class='right'>";
|
||||
if ($report_w || $report_m) {
|
||||
echo '<form method="post" class="right" action="index.php?sec=reporting&sec2=godmode/reporting/graph_builder">';
|
||||
html_print_submit_button(__('Create graph'), 'create', false, 'class="sub next mrgn_right_5px"');
|
||||
echo '</form>';
|
||||
}
|
||||
} else {
|
||||
if ($report_w || $report_m) {
|
||||
$ActionButtons[] = '<form method="post" class="right mrgn_lft_10px" action="index.php?sec=reporting&sec2=godmode/reporting/graph_builder">';
|
||||
$ActionButtons[] = html_print_submit_button(
|
||||
__('Create graph'),
|
||||
'create',
|
||||
false,
|
||||
[
|
||||
'class' => 'sub ok',
|
||||
'icon' => 'next',
|
||||
],
|
||||
true
|
||||
);
|
||||
$ActionButtons[] = '</form>';
|
||||
}
|
||||
|
||||
$own_info = get_user_info($config['id_user']);
|
||||
if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'RM')) {
|
||||
$return_all_group = true;
|
||||
} else {
|
||||
$return_all_group = false;
|
||||
if (!empty($result_graphs)) {
|
||||
$ActionButtons[] = "<form method='post' id='form_delete' action='index.php?sec=reporting&sec2=godmode/reporting/graphs'>";
|
||||
$ActionButtons[] = html_print_input_hidden('multiple_delete', 1, true);
|
||||
$ActionButtons[] = html_print_submit_button(
|
||||
__('Delete'),
|
||||
'delete_btn',
|
||||
false,
|
||||
[
|
||||
'class' => 'secondary',
|
||||
'icon' => 'delete',
|
||||
],
|
||||
true
|
||||
);
|
||||
$ActionButtons[] = '</form>';
|
||||
}
|
||||
|
||||
if ($search != '') {
|
||||
$filter = [
|
||||
'name' => $search_name,
|
||||
'order' => 'name',
|
||||
];
|
||||
} else {
|
||||
$filter = ['order' => 'name'];
|
||||
}
|
||||
// FALTA METER EL PRINT TABLE.
|
||||
html_print_table($table);
|
||||
html_print_action_buttons(
|
||||
implode('', $ActionButtons),
|
||||
['type' => 'form_action']
|
||||
);
|
||||
}
|
||||
|
||||
// Fix : group filter was not working
|
||||
// Show only selected groups.
|
||||
if ($id_group > 0) {
|
||||
$group = ["$id_group" => $id_group];
|
||||
$filter['id_group'] = $id_group;
|
||||
} else {
|
||||
$group = false;
|
||||
}
|
||||
echo '</div>';
|
||||
|
||||
// Filter normal and metaconsole reports.
|
||||
if ($config['metaconsole'] == 1 && defined('METACONSOLE')) {
|
||||
$filter['metaconsole'] = 1;
|
||||
} else {
|
||||
$filter['metaconsole'] = 0;
|
||||
}
|
||||
echo '</div>';
|
||||
} else {
|
||||
include_once $config['homedir'].'/general/first_task/custom_graphs.php';
|
||||
}
|
||||
|
||||
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 = [];
|
||||
|
||||
$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';
|
||||
}
|
||||
|
||||
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->data = [];
|
||||
|
||||
$result_graphs = array_slice($graphs, $offset, $config['block_size']);
|
||||
|
||||
foreach ($result_graphs as $graph) {
|
||||
$data = [];
|
||||
|
||||
$data[0] = '<a href="index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=1&id='.$graph['id_graph'].'">'.ui_print_truncate_text(
|
||||
$graph['name'],
|
||||
70
|
||||
).'</a>';
|
||||
|
||||
$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] = 'table_action_buttons';
|
||||
if (($report_w || $report_m)) {
|
||||
$data[4] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/graph_builder&edit_graph=1&id='.$graph['id_graph'].'">'.html_print_image(
|
||||
'images/config.png',
|
||||
true,
|
||||
['class' => 'invert_filter']
|
||||
).'</a>';
|
||||
}
|
||||
|
||||
$data[5] = '';
|
||||
if (check_acl_restricted_all($config['id_user'], $graph['id_group'], 'RM')) {
|
||||
$data[4] .= '<a href="index.php?sec=reporting&sec2=godmode/reporting/graphs&delete_graph=1&id='.$graph['id_graph'].'" onClick="if (!confirm(\''.__('Are you sure?').'\'))
|
||||
return false;">'.html_print_image(
|
||||
'images/cross.png',
|
||||
true,
|
||||
[
|
||||
'alt' => __('Delete'),
|
||||
'title' => __('Delete'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</a>';
|
||||
|
||||
$data[5] .= html_print_checkbox_extended(
|
||||
'delete_multiple[]',
|
||||
$graph['id_graph'],
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
'class="check_delete mrgn_lft_2px"',
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
array_push($table->data, $data);
|
||||
}
|
||||
|
||||
|
||||
if (!empty($result_graphs)) {
|
||||
echo "<form method='post' action='index.php?sec=reporting&sec2=godmode/reporting/graphs'>";
|
||||
html_print_input_hidden('multiple_delete', 1);
|
||||
html_print_table($table);
|
||||
ui_pagination(count($graphs), false, 0, 0, false, 'offset', true, 'pagination-bottom');
|
||||
echo "<div class='right'>";
|
||||
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
|
||||
echo "<div class='right'>";
|
||||
if ($report_w || $report_m) {
|
||||
echo '<form method="post" class="right" action="index.php?sec=reporting&sec2=godmode/reporting/graph_builder">';
|
||||
html_print_submit_button(__('Create graph'), 'create', false, 'class="sub next mrgn_right_5px"');
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
|
||||
echo '</div>';
|
||||
} else {
|
||||
include_once $config['homedir'].'/general/first_task/custom_graphs.php';
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$( document ).ready(function() {
|
||||
|
||||
$('[id^=checkbox-delete_multiple]').change(function(){
|
||||
if($(this).parent().parent().hasClass('checkselected')){
|
||||
$(this).parent().parent().removeClass('checkselected');
|
||||
}
|
||||
else{
|
||||
$(this).parent().parent().addClass('checkselected');
|
||||
$('[id^=checkbox-delete_multiple]').click(function(){
|
||||
if($(this).prop("checked") === false ){
|
||||
$(this).prop("checked", false);
|
||||
} else {
|
||||
$(this).prop("checked", true);
|
||||
}
|
||||
});
|
||||
|
||||
$('[id^=checkbox-all_delete]').change(function(){
|
||||
if ($("#checkbox-all_delete").prop("checked")) {
|
||||
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected');
|
||||
$(".check_delete").prop("checked", true);
|
||||
$('#checkbox-all_delete').click(function(){
|
||||
if ($("#checkbox-all_delete").prop("checked") === true) {
|
||||
$("[id^=checkbox-delete_multiple]").prop("checked", true);
|
||||
}
|
||||
else{
|
||||
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected');
|
||||
$(".check_delete").prop("checked", false);
|
||||
}
|
||||
$("[id^=checkbox-delete_multiple]").prop("checked", false);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -821,7 +821,7 @@ switch ($action) {
|
|||
[
|
||||
'class' => 'action-buttons',
|
||||
'content' => html_print_submit_button(
|
||||
__('Search'),
|
||||
__('Filter'),
|
||||
'search_submit',
|
||||
false,
|
||||
[
|
||||
|
|
|
@ -198,10 +198,12 @@ if ($edit_filter > -2) {
|
|||
$table->id = 'filter_table';
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox filters';
|
||||
$table->rowclass[0] = 'row-title-font-child';
|
||||
$table->rowclass[1] = 'row-title-font-child';
|
||||
$table->data[0][0] = __('Description');
|
||||
$table->data[0][1] = html_print_input_text('description', $description, '', 60, 100, true);
|
||||
$table->data[0][1] .= html_print_image(
|
||||
'images/add.png',
|
||||
'images/plus.png',
|
||||
true,
|
||||
[
|
||||
'id' => 'add_filter',
|
||||
|
@ -243,7 +245,7 @@ if ($edit_filter > -2) {
|
|||
}
|
||||
|
||||
$index++;
|
||||
echo '<form action="index.php?sec=snmpconsole&sec2=godmode/snmpconsole/snmp_filters" method="post">';
|
||||
echo '<form class="max_floating_element_size" action="index.php?sec=snmpconsole&sec2=godmode/snmpconsole/snmp_filters" method="post">';
|
||||
html_print_input_hidden('update_filter', $edit_filter);
|
||||
html_print_input_hidden('index_post', $index);
|
||||
if ($edit_filter > -1) {
|
||||
|
|
|
@ -77,7 +77,7 @@ if ($generate_trap) {
|
|||
}
|
||||
|
||||
$table = new stdClass();
|
||||
$traps_generator = '<form method="POST" action="index.php?sec=snmpconsole&sec2=godmode/snmpconsole/snmp_trap_generator">';
|
||||
$traps_generator = '<form class="max_floating_element_size" method="POST" action="index.php?sec=snmpconsole&sec2=godmode/snmpconsole/snmp_trap_generator">';
|
||||
$table->width = '100%';
|
||||
$table->class = 'filter-table-adv databox';
|
||||
$table->size = [];
|
||||
|
|
Loading…
Reference in New Issue