true,
'text' => '' .
html_print_image("images/god6.png", true, array ("title" => __('Graph list'))) .'');
if ($enterpriseEnable){
$buttons = reporting_enterprise_add_template_graph_tabs($buttons);
}
$subsection = '';
switch ($activeTab){
case 'main': $buttons['graph_list']['active'] = true;
$subsection = ' » '.__('Graph list');
break;
default: $subsection = reporting_enterprise_add_graph_template_subsection($activeTab, &$buttons);
break;
}
switch ($activeTab) {
case 'main': require_once('godmode/reporting/graphs.php');
break;
default: reporting_enterprise_select_graph_template_tab($activeTab);
break;
}
$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);
// Header
ui_print_page_header (__('Graphs management'), "", false, "", true, $buttons);
// Delete module SQL code
if ($delete_graph) {
if (check_acl ($config['id_user'], 0, "AW")) {
$result = db_process_sql_delete("tgraph_source", array('id_graph' =>$id));
if ($result)
$result = "
".__('Successfully deleted')."
";
else
$result = "".__('Not deleted. Error deleting data')."
";
$result = db_process_sql_delete("tgraph", array('id_graph' =>$id));
if ($result) {
db_pandora_audit("Report management", "Delete graph #$id");
$result = "".__('Successfully deleted')."
";
} else {
db_pandora_audit("Report management", "Fail try to delete graph #$id");
$result = "".__('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;
}
}
if ($multiple_delete) {
$ids = (array)get_parameter('delete_multiple', array());
db_process_sql_begin();
foreach ($ids as $id) {
$result = db_process_sql_delete ('tgraph',
array ('id_graph' => $id));
if ($result === false) {
db_process_sql_rollback();
break;
}
}
if ($result !== false) {
db_process_sql_commit();
}
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'));
}
$own_info = get_user_info ($config['id_user']);
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
$return_all_group = true;
else
$return_all_group = false;
$graphs = custom_graphs_get_user ($config['id_user'], false, $return_all_group, "IW");
if (! empty ($graphs)) {
$table->width = '98%';
$tale->class = 'databox_frame';
$table->align = array ();
$table->align[0] = 'center';
$table->align[3] = 'right';
$table->align[4] = 'center';
$table->head = array ();
$table->head[0] = __('View');
$table->head[1] = __('Graph name');
$table->head[2] = __('Description');
$table->head[3] = __('Number of Graphs');
$table->head[4] = __('Group');
$table->size[0] = '20px';
$table->size[3] = '125px';
$table->size[4] = '50px';
if (check_acl ($config['id_user'], 0, "AW")) {
$table->align[5] = 'center';
$table->head[5] = __('Delete'). html_print_checkbox('all_delete', 0, false, true, false, 'check_all_checkboxes();');
$table->size[5] = '60px';
}
$table->data = array ();
foreach ($graphs as $graph) {
$data = array ();
$data[0] = '' . html_print_image('images/eye.png', true) . "" . '';
$data[1] = ''.$graph['name'].'';
$data[2] = $graph["description"];
$data[3] = $graph["graphs_count"];
$data[4] = ui_print_group_icon($graph['id_group'],true);
if (check_acl ($config['id_user'], 0, "AW")) {
$data[5] = '' . html_print_image("images/cross.png", true) . '' .
html_print_checkbox_extended ('delete_multiple[]', $graph['id_graph'], false, false, '', 'class="check_delete"', true);
}
array_push ($table->data, $data);
}
echo "";
}
else {
echo "".__('There are no defined reportings')."
";
}
echo '";
?>