From 3ecf8a5e297eca8ea1240fa6d5a6b48170768509 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Fri, 23 Apr 2010 10:44:36 +0000 Subject: [PATCH] 2010-04-22 Miguel de Dios * godmode/reporting/reporting_builder.php: re-added the list of reports, re-added the delete reports. And fixed the notice PHP message and the action edit in the main tab. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2600 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 6 ++ .../godmode/reporting/reporting_builder.php | 79 ++++++++++++++++++- 2 files changed, 84 insertions(+), 1 deletion(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 76a0033ac8..17900a1802 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2010-04-22 Miguel de Dios + + * godmode/reporting/reporting_builder.php: re-added the list of reports, + re-added the delete reports. And fixed the notice PHP message and the + action edit in the main tab. + 2010-04-23 Sergio Martin * pandoradb.sql diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index 52fbc1690c..f8082168f1 100644 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -23,6 +23,8 @@ if (! give_acl ($config['id_user'], 0, "IW")) { exit; } +require_once ("include/functions_reports.php"); + $enterpriseEnable = false; if (enterprise_include_once('include/functions_reporting.php') !== ENTERPRISE_NOT_HOOK) { $enterpriseEnable = true; @@ -30,18 +32,92 @@ if (enterprise_include_once('include/functions_reporting.php') !== ENTERPRISE_NO $activeTab = get_parameter('tab', 'main'); -$action = get_parameter('action', 'new'); +$action = get_parameter('action', 'list'); $idReport = get_parameter('id_report', 0); $offset = get_parameter('offset', 0); $idItem = get_parameter('id_item', 0); switch ($action) { + case 'delete_report': + case 'list': + // Report LIST + print_page_header (__('Reporting').' » '.__('Custom reporting'), "images/reporting_edit.png", false, "", true); + + if ($action == 'delete_report') { + $result = delete_report ($idReport); + print_result_message ($result, + __('Successfully deleted'), + __('Could not be deleted')); + } + + $reports = get_reports (array ('order' => 'name'), + array ('name', 'id_report', 'description', 'private', 'id_user', 'id_group')); + $table->width = '0px'; + if (sizeof ($reports)) { + $table->id = 'report_list'; + $table->width = '720px'; + $table->head = array (); + $table->align = array (); + $table->align[2] = 'center'; + $table->align[4] = 'center'; + $table->data = array (); + $table->head[0] = __('Report name'); + $table->head[1] = __('Description'); + $table->head[2] = __('Private'); + $table->head[3] = __('Group'); + $table->head[4] = ''; + $table->size = array (); + $table->size[4] = '40px'; + + foreach ($reports as $report) { + + if (!is_user_admin ($config["id_user"])){ + if ($report["private"] && $report["id_user"] != $config['id_user']) + if (!give_acl ($config["id_user"], $report["id_group"], "AW")) + continue; + if (!give_acl ($config["id_user"], $report["id_group"], "AW")) + continue; + } + + $data = array (); + $data[0] = ''.$report['name'].''; + $data[1] = $report['description']; + if ($report["private"] == 1) + $data[2] = __('Yes'); + else + $data[2] = __('No'); + + $data[3] = get_group_name($report['id_group']); + $data[4] = '
'; + $data[4] .= print_input_hidden ('id_report', $report['id_report'], true); + $data[4] .= print_input_hidden ('action','delete_report', true); + $data[4] .= print_input_image ('delete', 'images/cross.png', 1, '', + true, array ('title' => __('Delete'))); + $data[4] .= '
'; + + array_push ($table->data, $data); + + } + print_table ($table); + } else { + echo "
".__('There are no defined reportings')."
"; + } + + echo '
'; + echo '
'; + print_submit_button (__('Create report'), 'create', false, 'class="sub next"'); + echo "
"; + echo "
"; + return; + break; case 'new': switch ($activeTab) { case 'main': $reportName = ''; $idGroupReport = 1; //All groups $description = ''; + $resultOperationDB = null; break; case 'item_editor': $resultOperationDB = null; @@ -74,6 +150,7 @@ switch ($action) { $idReport = $idOrResult; } } + $action = 'edit'; break; case 'item_editor': $resultOperationDB = null;