2014-01-22 Miguel de Dios <miguel.dedios@artica.es>

* godmode/reporting/reporting_builder.item_editor.php,
	include/constants.php, include/functions_reporting.php: added
	constants and killed magic numbers and unicorns.
	
	* include/functions_modules.php: added function
	"modules_get_modules_in_group".




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@9353 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2014-01-22 12:52:43 +00:00
parent d261c685c3
commit b528f359cd
5 changed files with 69 additions and 8 deletions

View File

@ -1,3 +1,12 @@
2014-01-22 Miguel de Dios <miguel.dedios@artica.es>
* godmode/reporting/reporting_builder.item_editor.php,
include/constants.php, include/functions_reporting.php: added
constants and killed magic numbers and unicorns.
* include/functions_modules.php: added function
"modules_get_modules_in_group".
2014-01-21 Sergio Martin <sergio.martin@artica.es> 2014-01-21 Sergio Martin <sergio.martin@artica.es>
* images/long_arrow.png * images/long_arrow.png

View File

@ -915,11 +915,14 @@ html_print_input_hidden('id_item', $idItem);
<td> <td>
<?php <?php
echo __('Ascending'); echo __('Ascending');
html_print_radio_button ('radiobutton_order_uptodown', 2, '', $order_uptodown); html_print_radio_button ('radiobutton_order_uptodown',
REPORT_ITEM_ORDER_BY_ASCENDING, '', $order_uptodown);
echo __('Descending'); echo __('Descending');
html_print_radio_button ('radiobutton_order_uptodown', 1, '', $order_uptodown); html_print_radio_button ('radiobutton_order_uptodown',
REPORT_ITEM_ORDER_BY_DESCENDING, '', $order_uptodown);
echo __('By agent name'); echo __('By agent name');
html_print_radio_button ('radiobutton_order_uptodown', 3, '', $order_uptodown); html_print_radio_button ('radiobutton_order_uptodown',
REPORT_ITEM_ORDER_BY_AGENT_NAME, '', $order_uptodown);
?> ?>
</td> </td>
</tr> </tr>

View File

@ -317,6 +317,10 @@ define ('REPORT_EXCEPTION_CONDITION_NE', 8);
define ('REPORT_EXCEPTION_CONDITION_OK', 3); define ('REPORT_EXCEPTION_CONDITION_OK', 3);
define ('REPORT_EXCEPTION_CONDITION_NOT_OK', 4); define ('REPORT_EXCEPTION_CONDITION_NOT_OK', 4);
define ('REPORT_ITEM_ORDER_BY_AGENT_NAME', 3);
define ('REPORT_ITEM_ORDER_BY_ASCENDING', 2);
define ('REPORT_ITEM_ORDER_BY_DESCENDING', 1);
/* POLICIES */ /* POLICIES */
define("POLICY_UPDATED", 0); define("POLICY_UPDATED", 0);

View File

@ -1109,6 +1109,49 @@ function modules_get_monitors_in_group ($id_group) {
return db_get_all_rows_sql ($sql); return db_get_all_rows_sql ($sql);
} }
/**
* Get all the modules defined in an group.
*
* @param int $id_group Group id to get all the modules.
*
* @return array An array with all the modules defined in the group (tagente_modulo).
*/
function modules_get_modules_in_group ($id_group) {
global $config;
if ($id_group <= 0) {
//We select all groups the user has access to if it's 0 or -1
global $config;
$id_group = array_keys (users_get_groups ($config['id_user']));
}
if (is_array ($id_group)) {
$id_group = implode (",",$id_group);
}
switch ($config["dbtype"]) {
case "mysql":
$sql = sprintf ("SELECT `tagente_modulo`.*
FROM `tagente_modulo`, `ttipo_modulo`, `tagente`
WHERE `id_tipo_modulo` = `id_tipo`
AND `tagente`.`id_agente` = `tagente_modulo`.`id_agente`
AND `tagente`.`id_grupo` IN (%s)
ORDER BY `tagente`.`nombre`", $id_group);
break;
case "postgresql":
case "oracle":
$sql = sprintf ("SELECT tagente_modulo.*
FROM tagente_modulo, ttipo_modulo, tagente
WHERE id_tipo_modulo = id_tipo
AND tagente.id_agente = tagente_modulo.id_agente
AND tagente.id_grupo IN (%s)
ORDER BY tagente.nombre", $id_group);
break;
}
return db_get_all_rows_sql ($sql);
}
/** /**
* Get all the monitors defined in an agent. * Get all the monitors defined in an agent.
* *

View File

@ -4972,9 +4972,9 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
array_push ($table->data, $data_desc); array_push ($table->data, $data_desc);
} }
//Get all the related data //Get all the related data
$sql = sprintf("select id_agent_module, server_name $sql = sprintf("SELECT id_agent_module, server_name
from treport_content_item FROM treport_content_item
where id_report_content = %d", $content['id_rc']); WHERE id_report_content = %d", $content['id_rc']);
$tops = db_process_sql ($sql); $tops = db_process_sql ($sql);
@ -5000,6 +5000,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
//Get data of all agents (before to slide to N values) //Get data of all agents (before to slide to N values)
$data_top = array(); $data_top = array();
foreach ($tops as $key => $row) { foreach ($tops as $key => $row) {
//Metaconsole connection //Metaconsole connection
@ -5014,7 +5015,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$ag_name = modules_get_agentmodule_agent_name($row ['id_agent_module']); $ag_name = modules_get_agentmodule_agent_name($row ['id_agent_module']);
$mod_name = modules_get_agentmodule_name ($row ['id_agent_module']); $mod_name = modules_get_agentmodule_name ($row ['id_agent_module']);
$unit = db_get_value('unit', 'tagente_modulo', 'id_agente_modulo', $row ['id_agent_module']); $unit = db_get_value('unit', 'tagente_modulo',
'id_agente_modulo', $row ['id_agent_module']);
switch ($top_n) { switch ($top_n) {