2012-08-14 Vanessa Gil <vanessa.gil@artica.es>

* godmode/reporting/reporting_builder.php
	  include/functions_reports.php: Added filter to report list.

	* godmode/agentes/module_manager.php: Fixed warning.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6860 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
vgilc 2012-08-14 14:42:24 +00:00
parent 23240b4cd6
commit fbe1a97744
4 changed files with 69 additions and 8 deletions

View File

@ -1,3 +1,10 @@
2012-08-14 Vanessa Gil <vanessa.gil@artica.es>
* godmode/reporting/reporting_builder.php
include/functions_reports.php: Added filter to report list.
* godmode/agentes/module_manager.php: Fixed warning.
2012-08-14 Sergio Martin <sergio.martin@artica.es>
* include/javascript/pandora_modules.js

View File

@ -17,6 +17,8 @@
if (isset ($id_agente)) {
$url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente;
} else {
$url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module';
}
enterprise_include ('godmode/agentes/module_manager.php');
@ -28,7 +30,8 @@ require_once ('include/functions_servers.php');
$search_string = io_safe_output(urldecode(trim(get_parameter ("search_string", ""))));
// Search string filter form
echo '<form id="create_module_type" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.'">';
//echo '<form id="create_module_type" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.'">';
echo '<form id="create_module_type" method="post" action="'.$url.'">';
echo '<table width="98%" cellpadding="2" cellspacing="2" class="databox" >';
echo "<tr><td class='datos' style='width:25%'>";
echo __('Search') . ' ' .

View File

@ -225,16 +225,62 @@ switch ($action) {
__('Successfully deleted'),
__('Could not be deleted'));
}
$id_group = (int) get_parameter ("id_group", 0);
$search = trim(get_parameter ("search", ""));
$search_sql = '';
if ($search != ""){
$search_name = "%$search%' OR description LIKE '%$search%";
}
$table_aux->width = '98%';
$table_aux->colspan[0][0] = 4;
$table_aux->data[0][0] = "<b>". __("Group") . "</b>";
$table_aux->data[0][1] = html_print_select_groups(false, "AR", true, 'id_group', $id_group, '', '', '', true, false, true, '', false, 'width:150px');
$table_aux->data[0][2] = "<b>". __("Free text for search: ") . "</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);
echo "<form action='index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&id_group='.$id_group'
method='post'>";
html_print_table($table_aux);
echo "</form>";
ui_require_jquery_file ('pandora.controls');
ui_require_jquery_file ('ajaxqueue');
ui_require_jquery_file ('bgiframe');
ui_require_jquery_file ('autocomplete');
// Show only selected groups
if ($id_group > 0) {
$group = array("$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, "PM"))
$return_all_group = true;
else
$return_all_group = false;
$reports = reports_get_reports (array ('order' => 'name'),
array ('name', 'id_report', 'description', 'private', 'id_user', 'id_group'), $return_all_group, 'IR');
if ($search != "") {
$filter = array (
'name' => $search_name,
'order' => 'name'
);
} else {
$filter = array (
'order' => 'name'
);
}
$reports = reports_get_reports ($filter,
array ('name', 'id_report', 'description', 'private', 'id_user', 'id_group'), $return_all_group, 'IR', $group);
$table->width = '0px';
if (sizeof ($reports)) {
$table->id = 'report_list';

View File

@ -68,7 +68,7 @@ function reports_get_report ($id_report, $filter = false, $fields = false) {
*
* @return array An array with all the reports the user can view.
*/
function reports_get_reports ($filter = false, $fields = false, $returnAllGroup = true, $privileges = 'IR') {
function reports_get_reports ($filter = false, $fields = false, $returnAllGroup = true, $privileges = 'IR', $group = false) {
global $config;
if (! is_array ($filter))
@ -86,8 +86,13 @@ function reports_get_reports ($filter = false, $fields = false, $returnAllGroup
if (empty($all_reports))
$all_reports = array();
//Recheck in all reports if the user have permissions to see each report.
$groups = users_get_groups ($config['id_user'], $privileges, $returnAllGroup);
if ($group) {
$groups = $group;
} else {
//Recheck in all reports if the user have permissions to see each report.
$groups = users_get_groups ($config['id_user'], $privileges, $returnAllGroup);
}
foreach ($all_reports as $report) {
if (!in_array($report['id_group'], array_keys($groups)))
continue;