2009-10-17 17:19:16 +02:00
|
|
|
<?php
|
|
|
|
// Pandora FMS - http://pandorafms.com
|
|
|
|
// ==================================================
|
2010-03-04 17:08:09 +01:00
|
|
|
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
2009-10-17 17:19:16 +02:00
|
|
|
// 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 variables
|
2010-03-03 18:10:37 +01:00
|
|
|
global $config;
|
2009-10-17 17:19:16 +02:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
require_once 'include/functions_custom_graphs.php';
|
2009-10-17 17:19:16 +02:00
|
|
|
|
|
|
|
// Check user credentials
|
2019-01-30 16:18:44 +01:00
|
|
|
check_login();
|
2009-10-17 17:19:16 +02:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$report_r = check_acl($config['id_user'], 0, 'RR');
|
|
|
|
$report_w = check_acl($config['id_user'], 0, 'RW');
|
|
|
|
$report_m = check_acl($config['id_user'], 0, 'RM');
|
2018-03-02 13:13:55 +01:00
|
|
|
|
2016-09-08 16:06:12 +02:00
|
|
|
if (!$report_r && !$report_w && !$report_m) {
|
2019-01-30 16:18:44 +01:00
|
|
|
db_pandora_audit(
|
|
|
|
'ACL Violation',
|
|
|
|
'Trying to access Inventory Module Management'
|
|
|
|
);
|
|
|
|
include 'general/noaccess.php';
|
|
|
|
return;
|
2009-10-17 17:19:16 +02:00
|
|
|
}
|
|
|
|
|
2018-03-02 13:13:55 +01:00
|
|
|
$access = ($report_r == true) ? 'RR' : (($report_w == true) ? 'RW' : (($report_m == true) ? 'RM' : 'RR'));
|
|
|
|
|
2012-02-24 14:29:22 +01:00
|
|
|
$activeTab = get_parameter('tab', 'main');
|
|
|
|
|
|
|
|
$enterpriseEnable = false;
|
|
|
|
if (enterprise_include_once('include/functions_reporting.php') !== ENTERPRISE_NOT_HOOK) {
|
2019-01-30 16:18:44 +01:00
|
|
|
$enterpriseEnable = true;
|
2012-02-24 14:29:22 +01:00
|
|
|
}
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$buttons['graph_list'] = [
|
|
|
|
'active' => true,
|
|
|
|
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/graphs">'.html_print_image('images/list.png', true, ['title' => __('Graph list')]).'</a>',
|
|
|
|
];
|
2013-04-25 Miguel de Dios <miguel.dedios@artica.es>
* godmode/events/custom_events.php,
godmode/massive/massive_enable_disable_alerts.php,
godmode/massive/massive_edit_agents.php,
godmode/massive/massive_delete_modules.php,
godmode/massive/massive_add_action_alerts.php,
godmode/massive/massive_delete_profiles.php,
godmode/massive/massive_delete_alerts.php,
godmode/groups/modu_group_list.php, godmode/groups/group_list.php,
godmode/reporting/graph_builder.php, godmode/reporting/graphs.php,
godmode/alerts/alert_templates.php,
godmode/alerts/configure_alert_action.php, include/functions_ui.php,
include/functions_graph.php: improved the source code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8057 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-04-25 12:16:41 +02:00
|
|
|
|
2015-06-08 11:05:19 +02:00
|
|
|
if ($enterpriseEnable) {
|
2019-01-30 16:18:44 +01:00
|
|
|
$buttons = reporting_enterprise_add_template_graph_tabs($buttons);
|
2012-02-24 14:29:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$subsection = '';
|
2013-04-25 Miguel de Dios <miguel.dedios@artica.es>
* godmode/events/custom_events.php,
godmode/massive/massive_enable_disable_alerts.php,
godmode/massive/massive_edit_agents.php,
godmode/massive/massive_delete_modules.php,
godmode/massive/massive_add_action_alerts.php,
godmode/massive/massive_delete_profiles.php,
godmode/massive/massive_delete_alerts.php,
godmode/groups/modu_group_list.php, godmode/groups/group_list.php,
godmode/reporting/graph_builder.php, godmode/reporting/graphs.php,
godmode/alerts/alert_templates.php,
godmode/alerts/configure_alert_action.php, include/functions_ui.php,
include/functions_graph.php: improved the source code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8057 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-04-25 12:16:41 +02:00
|
|
|
switch ($activeTab) {
|
2019-01-30 16:18:44 +01:00
|
|
|
case 'main':
|
|
|
|
$buttons['graph_list']['active'] = true;
|
|
|
|
$subsection = ' » '.__('Graph list');
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
$subsection = reporting_enterprise_add_graph_template_subsection($activeTab, $buttons);
|
|
|
|
break;
|
2013-04-25 Miguel de Dios <miguel.dedios@artica.es>
* godmode/events/custom_events.php,
godmode/massive/massive_enable_disable_alerts.php,
godmode/massive/massive_edit_agents.php,
godmode/massive/massive_delete_modules.php,
godmode/massive/massive_add_action_alerts.php,
godmode/massive/massive_delete_profiles.php,
godmode/massive/massive_delete_alerts.php,
godmode/groups/modu_group_list.php, godmode/groups/group_list.php,
godmode/reporting/graph_builder.php, godmode/reporting/graphs.php,
godmode/alerts/alert_templates.php,
godmode/alerts/configure_alert_action.php, include/functions_ui.php,
include/functions_graph.php: improved the source code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8057 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-04-25 12:16:41 +02:00
|
|
|
}
|
2012-02-23 16:55:51 +01:00
|
|
|
|
2012-02-24 14:29:22 +01:00
|
|
|
switch ($activeTab) {
|
2019-01-30 16:18:44 +01:00
|
|
|
case 'main':
|
|
|
|
include_once 'godmode/reporting/graphs.php';
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
reporting_enterprise_select_graph_template_tab($activeTab);
|
|
|
|
break;
|
2012-02-24 14:29:22 +01:00
|
|
|
}
|
2019-01-30 16:18:44 +01:00
|
|
|
|
|
|
|
$buttons['graph_container'] = [
|
|
|
|
'active' => false,
|
|
|
|
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/graph_container">'.html_print_image('images/graph-container.png', true, ['title' => __('Graphs containers')]).'</a>',
|
|
|
|
];
|
|
|
|
|
|
|
|
$delete_graph = (bool) get_parameter('delete_graph');
|
|
|
|
$view_graph = (bool) get_parameter('view_graph');
|
|
|
|
$id = (int) get_parameter('id');
|
|
|
|
$multiple_delete = (bool) get_parameter('multiple_delete', 0);
|
2009-10-17 17:19:16 +02:00
|
|
|
|
2010-03-04 17:08:09 +01:00
|
|
|
// Header
|
2019-01-30 16:18:44 +01:00
|
|
|
ui_print_page_header(__('Reporting').' » '.__('Custom graphs'), 'images/chart.png', false, '', false, $buttons);
|
2010-03-04 17:08:09 +01:00
|
|
|
|
2009-10-17 17:19:16 +02:00
|
|
|
// Delete module SQL code
|
|
|
|
if ($delete_graph) {
|
2019-01-30 16:18:44 +01:00
|
|
|
if ($report_w || $report_m) {
|
|
|
|
$exist = db_get_value('id_graph', 'tgraph_source', 'id_graph', $id);
|
|
|
|
if ($exist) {
|
|
|
|
$result = db_process_sql_delete('tgraph_source', ['id_graph' => $id]);
|
|
|
|
|
|
|
|
if ($result) {
|
|
|
|
$result = ui_print_success_message(__('Successfully deleted'));
|
|
|
|
} else {
|
|
|
|
$result = ui_print_error_message(__('Not deleted. Error deleting data'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$result = db_process_sql_delete('tgraph', ['id_graph' => $id]);
|
|
|
|
|
|
|
|
if ($result) {
|
|
|
|
db_pandora_audit('Report management', "Delete graph #$id");
|
|
|
|
$result = ui_print_success_message(__('Successfully deleted'));
|
|
|
|
} else {
|
|
|
|
db_pandora_audit('Report management', "Fail try to delete graph #$id");
|
|
|
|
$result = ui_print_error_message(__('Not deleted. Error deleting data'));
|
|
|
|
}
|
|
|
|
|
|
|
|
echo $result;
|
|
|
|
} else {
|
|
|
|
db_pandora_audit('ACL Violation', 'Trying to delete a graph from access graph builder');
|
|
|
|
include 'general/noaccess.php';
|
|
|
|
exit;
|
|
|
|
}
|
2009-10-17 17:19:16 +02:00
|
|
|
}
|
|
|
|
|
2012-02-23 16:55:51 +01:00
|
|
|
if ($multiple_delete) {
|
2019-01-30 16:18:44 +01:00
|
|
|
$ids = (array) get_parameter('delete_multiple', []);
|
|
|
|
|
|
|
|
foreach ($ids as $id) {
|
|
|
|
$result = db_process_sql_delete(
|
|
|
|
'tgraph',
|
|
|
|
['id_graph' => $id]
|
|
|
|
);
|
|
|
|
|
|
|
|
if ($result === false) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($result !== false) {
|
|
|
|
$result = true;
|
|
|
|
} else {
|
|
|
|
$result = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
$str_ids = implode(',', $ids);
|
|
|
|
if ($result) {
|
|
|
|
db_pandora_audit('Report management', "Multiple delete graph: $str_ids");
|
|
|
|
} else {
|
|
|
|
db_pandora_audit('Report management', "Fail try to delete graphs: $str_ids");
|
|
|
|
}
|
|
|
|
|
|
|
|
ui_print_result_message(
|
|
|
|
$result,
|
|
|
|
__('Successfully deleted'),
|
|
|
|
__('Not deleted. Error deleting data')
|
|
|
|
);
|
2012-02-23 16:55:51 +01:00
|
|
|
}
|
2012-08-02 Miguel de Dios <miguel.dedios@artica.es>
* pandoradb_data.sql, pandoradb.data.postgreSQL.sql,
pandoradb.data.oracle.sql, include/functions_config.php: fixed the
"list_ACL_IPs_for_API" update.
* operation/events/events_marquee.php, godmode/setup/setup.php,
godmode/reporting/graph_builder.php,
godmode/reporting/map_builder.php, godmode/reporting/graphs.php,
godmode/reporting/visual_console_builder.wizard.php,
godmode/reporting/visual_console_builder.php,
godmode/alerts/configure_alert_compound.php,
godmode/alerts/alert_list.php,
godmode/alerts/configure_alert_template.php,
godmode/alerts/alert_templates.php,
godmode/alerts/configure_alert_action.php,
godmode/alerts/configure_alert_command.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.builder.php,
godmode/alerts/configure_alert_special_days.php,
include/functions_api.php, include/functions_ui.php,
include/functions_netflow.php, include/functions_alerts.php,
include/functions_menu.php, include/functions_messages.php: cleaned
source code style.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6846 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-08-03 14:48:09 +02:00
|
|
|
|
2012-12-28 18:06:17 +01:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$graphs = custom_graphs_get_user($config['id_user'], false, true, $access);
|
|
|
|
$offset = (int) get_parameter('offset');
|
|
|
|
|
|
|
|
ui_pagination(count($graphs));
|
|
|
|
|
|
|
|
if (!empty($graphs)) {
|
|
|
|
$table = new stdClass();
|
|
|
|
$table->width = '100%';
|
2019-03-27 17:03:55 +01:00
|
|
|
$table->class = 'info_table';
|
|
|
|
$table->cellpadding = 0;
|
|
|
|
$table->cellspacing = 0;
|
2019-01-30 16:18:44 +01:00
|
|
|
$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.').html_print_checkbox('all_delete', 0, false, true, false);
|
|
|
|
$table->size[4] = '90px';
|
|
|
|
}
|
|
|
|
|
|
|
|
$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] = '';
|
|
|
|
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).'</a>';
|
|
|
|
}
|
|
|
|
|
|
|
|
$data[4] .= ' ';
|
|
|
|
|
|
|
|
if ($report_m) {
|
|
|
|
$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')]).'</a>'.html_print_checkbox_extended('delete_multiple[]', $graph['id_graph'], false, false, '', 'class="check_delete" style="margin-left:2px;"', true);
|
|
|
|
}
|
|
|
|
|
|
|
|
array_push($table->data, $data);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!empty($result_graphs)) {
|
|
|
|
echo "<form method='post' style='' action='index.php?sec=reporting&sec2=godmode/reporting/graphs'>";
|
|
|
|
html_print_input_hidden('multiple_delete', 1);
|
|
|
|
html_print_table($table);
|
2019-03-27 17:03:55 +01:00
|
|
|
ui_pagination(count($graphs), false, 0, 0, false, 'offset', true, 'pagination-bottom');
|
2019-01-30 16:18:44 +01:00
|
|
|
echo "<div style='float: right;'>";
|
|
|
|
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
|
|
|
|
echo '</div>';
|
|
|
|
echo '</form>';
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
echo "<div style='float: right;'>";
|
|
|
|
if ($report_w || $report_m) {
|
|
|
|
echo '<form method="post" style="float:right;" action="index.php?sec=reporting&sec2=godmode/reporting/graph_builder">';
|
|
|
|
html_print_submit_button(__('Create graph'), 'create', false, 'class="sub next" style="margin-right:5px;"');
|
|
|
|
echo '</form>';
|
|
|
|
}
|
|
|
|
|
|
|
|
echo '</div>';
|
|
|
|
} else {
|
|
|
|
include_once $config['homedir'].'/general/firts_task/custom_graphs.php';
|
2009-10-17 17:19:16 +02:00
|
|
|
}
|
2012-02-28 17:08:30 +01:00
|
|
|
|
2009-10-26 Ramon Novoa <rnovoa@artica.es>
* extensions/update_manager.php,
operation/incidents/incident.php,
operation/menu.php,
godmode/setup/links.php,
godmode/users/configure_user.php,
godmode/agentes/planned_downtime.php,
godmode/agentes/agent_manager.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/map_builder.php,
godmode/reporting/graphs.php,
godmode/reporting/graph_builder.php,
godmode/alerts/alert_templates.php,
godmode/menu.php: Several ACL related fixes.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2053 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-10-26 19:51:29 +01:00
|
|
|
?>
|
2012-02-23 16:55:51 +01:00
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
2016-02-11 15:20:02 +01:00
|
|
|
$("input[name=all_delete]").css("margin-left", "32px");
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$( 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-all_delete]').change(function(){
|
|
|
|
if ($("#checkbox-all_delete").prop("checked")) {
|
|
|
|
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected');
|
|
|
|
$(".check_delete").prop("checked", true);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected');
|
|
|
|
$(".check_delete").prop("checked", false);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2012-02-23 16:55:51 +01:00
|
|
|
</script>
|
2018-09-13 16:07:40 +02:00
|
|
|
|