Added several changes to agents/module reports. Ticket #4183
This commit is contained in:
parent
c3d1ba7aa6
commit
47d3e60d95
|
@ -514,6 +514,7 @@ switch ($action) {
|
|||
$description = $item['description'];
|
||||
$es = json_decode($item['external_source'], true);
|
||||
$agents_id = get_parameter('id_agents2');
|
||||
$selection_a_m = get_parameter('selection');
|
||||
|
||||
if ((count($es['module']) == 1) && ($es['module'][0] == 0)) {
|
||||
$module = "";
|
||||
|
@ -1009,6 +1010,17 @@ You can of course remove the warnings, that's why we include the source and do n
|
|||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="select_agent_modules" style="" class="datos">
|
||||
<td style="font-weight:bold;"><?php echo __('Show modules'); ?></td>
|
||||
<td>
|
||||
<?php
|
||||
$selection = array(0 => __('Show common modules'),
|
||||
1=> __('Show all modules'));
|
||||
html_print_select($selection, 'selection_agent_module', $selection_a_m, $script = '', "", 0, false, false, true, '', false, "min-width: 180px");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="modules_row" style="" class="datos">
|
||||
<td style="font-weight:bold;"><?php echo __('Modules'); ?></td>
|
||||
|
@ -1879,7 +1891,8 @@ $(document).ready (function () {
|
|||
{"page" : "operation/agentes/ver_agente",
|
||||
"get_modules_group_json" : 1,
|
||||
"id_module_group" : this.value,
|
||||
"id_agents" : $("#id_agents2").val()
|
||||
"id_agents" : $("#id_agents2").val(),
|
||||
"selection" : $("#selection_agent_module").val()
|
||||
},
|
||||
function (data, status) {
|
||||
$("#module").html('');
|
||||
|
@ -1901,7 +1914,31 @@ $(document).ready (function () {
|
|||
{"page" : "operation/agentes/ver_agente",
|
||||
"get_modules_group_json" : 1,
|
||||
"id_module_group" : $("#combo_modulegroup").val(),
|
||||
"id_agents" : $("#id_agents2").val()
|
||||
"id_agents" : $("#id_agents2").val(),
|
||||
"selection" : $("#selection_agent_module").val()
|
||||
},
|
||||
function (data, status) {
|
||||
$("#module").html('');
|
||||
jQuery.each (data, function (id, value) {
|
||||
option = $("<option></option>")
|
||||
.attr ("value", value["id_agente_modulo"])
|
||||
.html (value["nombre"]);
|
||||
$("#module").append (option);
|
||||
});
|
||||
},
|
||||
"json"
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
$("#selection_agent_module").change(
|
||||
function() {
|
||||
jQuery.post ("ajax.php",
|
||||
{"page" : "operation/agentes/ver_agente",
|
||||
"get_modules_group_json" : 1,
|
||||
"id_module_group" : $("#combo_modulegroup").val(),
|
||||
"id_agents" : $("#id_agents2").val(),
|
||||
"selection" : $("#selection_agent_module").val()
|
||||
},
|
||||
function (data, status) {
|
||||
$("#module").html('');
|
||||
|
@ -2455,6 +2492,7 @@ function chooseType() {
|
|||
$("#row_filter_search").hide();
|
||||
$("#row_percentil").hide();
|
||||
$("#agents_row").hide();
|
||||
$("#select_agent_modules").hide();
|
||||
$("#modules_row").hide();
|
||||
$("#row_event_type").hide();
|
||||
|
||||
|
@ -2855,6 +2893,7 @@ function chooseType() {
|
|||
$("#row_description").show();
|
||||
$("#row_group").show();
|
||||
$("#row_module_group").show();
|
||||
$("#select_agent_modules").show();
|
||||
$("#agents_row").show();
|
||||
$("#modules_row").show();
|
||||
break;
|
||||
|
|
|
@ -1627,7 +1627,7 @@ function reporting_agent_module($report, $content) {
|
|||
|
||||
foreach ($modules as $modul_id) {
|
||||
$modules_by_name[$cont]['name'] = io_safe_output(modules_get_agentmodule_name($modul_id));
|
||||
$modules_by_name[$cont]['id'][] = $modul_id;
|
||||
$modules_by_name[$cont]['id'] = $modul_id;
|
||||
$cont ++;
|
||||
}
|
||||
if ($modules_by_name == false || $agents == false) {
|
||||
|
@ -1636,21 +1636,21 @@ function reporting_agent_module($report, $content) {
|
|||
else {
|
||||
foreach ($agents as $agent) {
|
||||
$row = array();
|
||||
$row['agent_status'][$agent] =
|
||||
agents_get_status($agent);
|
||||
$row['agent_status'][$agent] = agents_get_status($agent);
|
||||
$row['agent_name'] = agents_get_name($agent);
|
||||
|
||||
$agent_modules = agents_get_modules($agent);
|
||||
|
||||
$row['modules'] = array();
|
||||
foreach ($modules_by_name as $module) {
|
||||
$row['modules'][$module['name']] = null;
|
||||
foreach ($module['id'] as $module_id) {
|
||||
if (array_key_exists($module_id, $agent_modules)) {
|
||||
$row['modules'][$module['name']] =
|
||||
modules_get_agentmodule_status($module_id);
|
||||
break;
|
||||
}
|
||||
if (array_key_exists($module['id'], $agent_modules)) {
|
||||
$row['modules'][$module['name']] =
|
||||
modules_get_agentmodule_status($module['id']);
|
||||
}
|
||||
else {
|
||||
if (!array_key_exists($module['name'], $row['modules'])) {
|
||||
$row['modules'][$module['name']] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -101,7 +101,6 @@ function reporting_html_header(&$table, $mini, $title, $subtitle,
|
|||
}
|
||||
|
||||
function reporting_html_print_report($report, $mini = false) {
|
||||
|
||||
foreach ($report['contents'] as $key => $item) {
|
||||
$table = new stdClass();
|
||||
$table->size = array ();
|
||||
|
|
|
@ -124,6 +124,7 @@ if (is_ajax ()) {
|
|||
if ($get_modules_group_json) {
|
||||
$id_group = (int) get_parameter('id_module_group');
|
||||
$id_agents = get_parameter('id_agents');
|
||||
$selection = get_parameter('selection');
|
||||
|
||||
$agents = implode(",", $id_agents);
|
||||
|
||||
|
@ -137,18 +138,42 @@ if (is_ajax ()) {
|
|||
$filter_agent = " AND id_agente IN (" . $agents . ")";
|
||||
}
|
||||
|
||||
$modules = db_get_all_rows_sql("SELECT DISTINCT nombre, id_agente_modulo FROM tagente_modulo WHERE 1 = 1" . $filter_agent . $filter_group);
|
||||
if ($selection == 1 || (count($id_agents) == 1)) {
|
||||
$modules = db_get_all_rows_sql("SELECT DISTINCT nombre, id_agente_modulo FROM tagente_modulo WHERE 1 = 1" . $filter_agent . $filter_group);
|
||||
|
||||
if (empty($modules)) $modules = array();
|
||||
|
||||
if (empty($modules)) $modules = array();
|
||||
|
||||
foreach ($modules as $k => $v) {
|
||||
for ($j = $k + 1; $j <= sizeof($modules); $j++) {
|
||||
if ($modules[$j]['nombre'] == $v['nombre']) {
|
||||
unset($modules[$j]);
|
||||
foreach ($modules as $k => $v) {
|
||||
for ($j = $k + 1; $j <= sizeof($modules); $j++) {
|
||||
if ($modules[$j]['nombre'] == $v['nombre']) {
|
||||
unset($modules[$j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$modules = db_get_all_rows_sql("SELECT nombre, id_agente_modulo FROM tagente_modulo WHERE 1 = 1" . $filter_agent . $filter_group);
|
||||
|
||||
if (empty($modules)) $modules = array();
|
||||
|
||||
foreach ($modules as $m) {
|
||||
$is_in_all_agents = true;
|
||||
$module_name = modules_get_agentmodule_name($m['id_agente_modulo']);
|
||||
foreach ($id_agents as $a) {
|
||||
$module_in_agent = db_get_value_filter('id_agente_modulo',
|
||||
'tagente_modulo', array('id_agente' => $a, 'nombre' => $module_name));
|
||||
if (!$module_in_agent) {
|
||||
$is_in_all_agents = false;
|
||||
}
|
||||
}
|
||||
if ($is_in_all_agents) {
|
||||
$modules_to_report[] = $m;
|
||||
}
|
||||
}
|
||||
$modules = $modules_to_report;
|
||||
|
||||
$modules = array_unique($modules);
|
||||
}
|
||||
|
||||
foreach ($modules as $k => $v) {
|
||||
$modules[$k] = io_safe_output($v);
|
||||
|
|
Loading…
Reference in New Issue