2010-10-04 Sergio Martin <sergio.martin@artica.es>
* include/javascript/pandora.js operation/agentes/ver_agente.php godmode/massive/massive_operations.php godmode/massive/massive_edit_modules.php: Restructured the massive module editor to increase the power of the tool adding multiple selection methods git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3336 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
db70e74db3
commit
1dbc8de2ab
|
@ -1,3 +1,12 @@
|
|||
2010-10-04 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/javascript/pandora.js
|
||||
operation/agentes/ver_agente.php
|
||||
godmode/massive/massive_operations.php
|
||||
godmode/massive/massive_edit_modules.php: Restructured
|
||||
the massive module editor to increase the power of the tool
|
||||
adding multiple selection methods
|
||||
|
||||
2010-10-4 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/pChart/pChart.class: merge bugfixes from the proyect
|
||||
|
|
|
@ -26,29 +26,18 @@ if (! give_acl ($config['id_user'], 0, "PM")) {
|
|||
|
||||
require_once ('include/functions_modules.php');
|
||||
|
||||
function process_manage_edit ($module_name, $group_select = null, $agents_select = null) {
|
||||
function process_manage_edit ($module_name, $agents_select = null) {
|
||||
if (is_int ($module_name) && $module_name <= 0) {
|
||||
echo '<h3 class="error">'.__('No modules selected').'</h3>';
|
||||
return false;
|
||||
}
|
||||
|
||||
if (($group_select === null) || ($group_select == 0))
|
||||
$agents = array_keys (get_group_agents (array_keys (get_user_groups ()), false, "none"));
|
||||
else {
|
||||
if (($agents_select === null) || ($agents_select == 0)) {
|
||||
$agents = array_keys (get_group_agents ($group_select, false, "none"));
|
||||
}
|
||||
else {
|
||||
$agents = $agents_select;
|
||||
}
|
||||
}
|
||||
|
||||
/* List of fields which can be updated */
|
||||
$fields = array ('min_warning', 'max_warning', 'min_critical', 'max_critical', 'min_ff_event','module_interval',
|
||||
'disabled','post_process','snmp_community','min','max','id_module_group', 'plugin_user', 'plugin_pass', 'id_export', 'history_data');
|
||||
$values = array ();
|
||||
foreach ($fields as $field) {
|
||||
$value = get_parameter ($field);
|
||||
$value = get_parameter ($field, '');
|
||||
if ($value != '')
|
||||
$values[$field] = $value;
|
||||
}
|
||||
|
@ -58,14 +47,15 @@ function process_manage_edit ($module_name, $group_select = null, $agents_select
|
|||
}
|
||||
|
||||
$modules = get_db_all_rows_filter ('tagente_modulo',
|
||||
array ('id_agente' => $agents,
|
||||
array ('id_agente' => $agents_select,
|
||||
'nombre' => $module_name),
|
||||
array ('id_agente_modulo'));
|
||||
|
||||
process_sql_begin ();
|
||||
|
||||
|
||||
if ($modules === false)
|
||||
return false;
|
||||
|
||||
foreach ($modules as $module) {
|
||||
$result = update_agent_module ($module['id_agente_modulo'], $values, true);
|
||||
|
||||
|
@ -82,21 +72,103 @@ function process_manage_edit ($module_name, $group_select = null, $agents_select
|
|||
}
|
||||
|
||||
$module_type = (int) get_parameter ('module_type');
|
||||
$module_name = (string) get_parameter ('module_name');
|
||||
$idGroupMassive = (int) get_parameter('id_group_massive');
|
||||
$idAgentMassive = (int) get_parameter('id_agent_massive');
|
||||
$group_select = get_parameter('groups_select');
|
||||
$agents_select = get_parameter('agents_select');
|
||||
|
||||
$module_name = get_parameter ('module_name');
|
||||
$agents_select = get_parameter('agents');
|
||||
$agents_id = get_parameter('id_agents');
|
||||
$modules_select = get_parameter('module');
|
||||
$selection_mode = get_parameter('selection_mode', 'modules');
|
||||
|
||||
|
||||
$update = (bool) get_parameter_post ('update');
|
||||
|
||||
if ($update) {
|
||||
$result = process_manage_edit ($module_name, $group_select, $agents_select);
|
||||
if ($update) {
|
||||
if($selection_mode == 'modules') {
|
||||
$force = get_parameter('force_type', false);
|
||||
|
||||
if($agents_select == false) {
|
||||
$agents_select = array();
|
||||
$agents_ = array();
|
||||
}
|
||||
|
||||
foreach($agents_select as $agent_name) {
|
||||
$agents_[] = get_agent_id($agent_name);
|
||||
}
|
||||
$modules_ = $module_name;
|
||||
}
|
||||
else if($selection_mode == 'agents') {
|
||||
$force = get_parameter('force_group', false);
|
||||
|
||||
$agents_ = $agents_id;
|
||||
$modules_ = $modules_select;
|
||||
}
|
||||
|
||||
print_result_message ($result,
|
||||
__('Successfully updated'),
|
||||
$success = 0;
|
||||
$count = 0;
|
||||
|
||||
if($agents_ == false) {
|
||||
$agents_ = array();
|
||||
}
|
||||
|
||||
// If the option to select all of one group or module type is checked
|
||||
if($force) {
|
||||
if($force == 'type') {
|
||||
$condition = '';
|
||||
if($module_type != 0)
|
||||
$condition = ' AND t2.id_tipo_modulo = '.$module_type;
|
||||
|
||||
$agents_ = get_db_all_rows_sql('SELECT DISTINCT(t1.id_agente) FROM tagente t1, tagente_modulo t2 WHERE t1.id_agente = t2.id_agente');
|
||||
foreach($agents_ as $id_agent) {
|
||||
$module_name = get_db_all_rows_filter('tagente_modulo', array('id_agente' => $id_agent, 'id_tipo_modulo' => $module_type),'nombre');
|
||||
|
||||
if($module_name == false) {
|
||||
$module_name = array();
|
||||
}
|
||||
foreach($module_name as $mod_name) {
|
||||
$result = process_manage_edit ($mod_name['nombre'], $id_agent['id_agente']);
|
||||
$count ++;
|
||||
$success += (int)$result;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if($force == 'group') {
|
||||
$agents_ = array_keys (get_group_agents ($group_select, false, "none"));
|
||||
foreach($agents_ as $id_agent) {
|
||||
$module_name = get_db_all_rows_filter('tagente_modulo', array('id_agente' => $id_agent),'nombre');
|
||||
if($module_name == false) {
|
||||
$module_name = array();
|
||||
}
|
||||
foreach($module_name as $mod_name) {
|
||||
$result = process_manage_edit ($mod_name['nombre'], $id_agent);
|
||||
$count ++;
|
||||
$success += (int)$result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We empty the agents array to skip the standard procedure
|
||||
$agents_ = array();
|
||||
}
|
||||
|
||||
foreach($agents_ as $agent_) {
|
||||
|
||||
if($modules_ == false) {
|
||||
$modules_ = array();
|
||||
}
|
||||
|
||||
foreach($modules_ as $module_) {
|
||||
$result = process_manage_edit ($module_, $agents_);
|
||||
$count ++;
|
||||
$success += (int)$result;
|
||||
}
|
||||
}
|
||||
|
||||
print_result_message ($success > 0,
|
||||
__('Successfully updated')."(".$success."/".$count.")",
|
||||
__('Could not be updated'));
|
||||
|
||||
}
|
||||
|
||||
$table->id = 'delete_table';
|
||||
|
@ -138,12 +210,23 @@ foreach ($module_types as $type) {
|
|||
}
|
||||
|
||||
$table->data = array ();
|
||||
$table->data[0][0] = __('Module type');
|
||||
$table->data[0][0] .= '<span id="module_loading" class="invisible">';
|
||||
$table->data[0][0] .= '<img src="images/spinner.png" />';
|
||||
$table->data[0][0] .= '</span>';
|
||||
$table->data[0][1] = print_select ($types,
|
||||
'module_type', $module_type, false, __('Select'), 0, true, false, false);
|
||||
|
||||
$table->data[0][0] = __('Selection mode');
|
||||
$table->data[0][1] = __('Select modules first').' '.print_radio_button_extended ("selection_mode", 'modules', '', $selection_mode, false, '', 'style="margin-right: 40px;"', true);
|
||||
$table->data[0][2] = '';
|
||||
$table->data[0][3] = __('Select agents first').' '.print_radio_button_extended ("selection_mode", 'agents', '', $selection_mode, false, '', 'style="margin-right: 40px;"', true);
|
||||
|
||||
$table->rowclass[1] = 'select_modules_row';
|
||||
$table->data[1][0] = __('Module type');
|
||||
$table->data[1][0] .= '<span id="module_loading" class="invisible">';
|
||||
$table->data[1][0] .= '<img src="images/spinner.png" />';
|
||||
$table->data[1][0] .= '</span>';
|
||||
$types[0] = __('All');
|
||||
$table->colspan[1][1] = 2;
|
||||
$table->data[1][1] = print_select ($types,
|
||||
'module_type', '', false, __('Select'), -1, true, false, true);
|
||||
|
||||
$table->data[1][3] = __('Select all modules of this type').' '.print_checkbox_extended ("force_type", 'type', '', '', false, '', 'style="margin-right: 40px;"', true);
|
||||
|
||||
$modules = array ();
|
||||
if ($module_type != '') {
|
||||
|
@ -159,17 +242,34 @@ foreach ($names as $name) {
|
|||
$modules[$name['nombre']] = $name['nombre'];
|
||||
}
|
||||
|
||||
$table->data[0][2] = __('Module name');
|
||||
$table->data[0][3] = print_select ($modules, 'module_name',
|
||||
$module_name, false, __('Select'), 0, true, false, false);
|
||||
$table->rowclass[2] = 'select_agents_row';
|
||||
$table->data[2][0] = __('Agent group');
|
||||
$groups = get_all_groups(true);
|
||||
$groups[0] = __('All');
|
||||
$table->colspan[2][1] = 2;
|
||||
$table->data[2][1] = print_select ($groups, 'groups_select',
|
||||
'', true, __('Select'), -1, true, false, true);
|
||||
$table->data[2][3] = __('Select all modules of this group').' '.print_checkbox_extended ("force_group", 'group', '', '', false, '', 'style="margin-right: 40px;"', true);
|
||||
|
||||
$table->rowstyle[1] = 'vertical-align: top;';
|
||||
$table->data[1][0] = __('Agent group');
|
||||
$table->data[1][1] = print_select (get_all_groups(true), 'groups_select',
|
||||
$idGroupMassive, false, __('All'), 0, true, false, false);
|
||||
$table->data[1][2] = __('Agents');
|
||||
$table->data[1][3] = print_select ($agents, 'agents_select[]',
|
||||
$idAgentMassive, false, __('All'), 0, true, true, false);
|
||||
$table->rowstyle[3] = 'vertical-align: top;';
|
||||
$table->rowclass[3] = 'select_modules_row select_modules_row_2';
|
||||
$table->data[3][0] = __('Modules');
|
||||
$table->data[3][1] = print_select ($modules, 'module_name[]',
|
||||
$module_name, false, __('Select'), -1, true, true, true);
|
||||
|
||||
$table->data[3][2] = __('Agents');
|
||||
$table->data[3][3] = print_select (array(), 'agents[]',
|
||||
$agents_select, false, __('None'), 0, true, true, false);
|
||||
|
||||
$table->rowstyle[4] = 'vertical-align: top;';
|
||||
$table->rowclass[4] = 'select_agents_row select_agents_row_2';
|
||||
$table->data[4][0] = __('Agents');
|
||||
$table->data[4][1] = print_select ($agents, 'id_agents[]',
|
||||
$agents_id, false, '', '', true, true, false);
|
||||
|
||||
$table->data[4][2] = __('Modules');
|
||||
$table->data[4][3] = print_select (array(), 'module[]',
|
||||
$modules_select, false, '', '', true, true, false);
|
||||
|
||||
|
||||
$table->data['edit1'][0] = __('Warning status');
|
||||
|
@ -228,27 +328,59 @@ echo '</div>';
|
|||
echo '</form>';
|
||||
|
||||
echo '<h3 class="error invisible" id="message"> </h3>';
|
||||
|
||||
//Hack to translate text "none" in PHP to javascript
|
||||
echo '<span id ="none_text" style="display: none;">' . __('None') . '</span>';
|
||||
require_jquery_file ('pandora.controls');
|
||||
|
||||
if($selection_mode == 'modules'){
|
||||
$modules_row = '';
|
||||
$agents_row = 'none';
|
||||
}
|
||||
else {
|
||||
$modules_row = 'none';
|
||||
$agents_row = '';
|
||||
}
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
$(document).ready (function () {
|
||||
$("#id_agents").change(agent_changed_by_multiple_agents);
|
||||
$("#module_name").change(module_changed_by_multiple_modules);
|
||||
|
||||
clean_lists();
|
||||
|
||||
$(".select_modules_row").css('display', '<?php echo $modules_row?>');
|
||||
$(".select_agents_row").css('display', '<?php echo $agents_row?>');
|
||||
|
||||
$("#module_type").change (function () {
|
||||
if (this.value < 0) {
|
||||
clean_lists();
|
||||
$(".select_modules_row_2").css('display', 'none');
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$("#module").html('<?php echo __('None'); ?>');
|
||||
$("#module_name").html('');
|
||||
$('input[type=checkbox]').attr('disabled', false);
|
||||
$(".select_modules_row_2").css('display', '');
|
||||
}
|
||||
|
||||
$("tr#delete_table-edit1, tr#delete_table-edit2, tr#delete_table-edit3, tr#delete_table-edit4, tr#delete_table-edit5, tr#delete_table-edit6, tr#delete_table-edit7").hide ();
|
||||
|
||||
if (this.value == '0') {
|
||||
filter = '';
|
||||
}
|
||||
else {
|
||||
filter = "id_tipo_modulo="+this.value;
|
||||
}
|
||||
|
||||
|
||||
$("#module_loading").show ();
|
||||
$("tr#delete_table-edit1, tr#delete_table-edit2").hide ();
|
||||
$("#module_name").attr ("disabled", "disabled")
|
||||
$("#module_name option[value!=0]").remove ();
|
||||
jQuery.post ("ajax.php",
|
||||
{"page" : "operation/massive/ver_agente",
|
||||
{"page" : "operation/agentes/ver_agente",
|
||||
"get_agent_modules_json" : 1,
|
||||
"filter" : filter,
|
||||
"fields" : "DISTINCT(nombre)",
|
||||
|
@ -265,34 +397,98 @@ $(document).ready (function () {
|
|||
"json"
|
||||
);
|
||||
});
|
||||
|
||||
$("#module_name").change (function () {
|
||||
if (this.value <= 0) {
|
||||
// $("td#delete_table-0-1").css ("width", "85%");
|
||||
$("tr#delete_table-edit1, tr#delete_table-edit2, tr#delete_table-edit3, tr#delete_table-edit4, tr#delete_table-edit5, tr#delete_table-edit6, tr#delete_table-edit7").hide ();
|
||||
return;
|
||||
}
|
||||
function show_form() {
|
||||
$("td#delete_table-0-1, td#delete_table-edit1-1, td#delete_table-edit2-1").css ("width", "35%");
|
||||
$("#form_edit input[type=text]").attr ("value", "");
|
||||
$("#form_edit input[type=checkbox]").removeAttr ("checked");
|
||||
$("tr#delete_table-edit1, tr#delete_table-edit2, tr#delete_table-edit3, tr#delete_table-edit4, tr#delete_table-edit5, tr#delete_table-edit6, tr#delete_table-edit7").show ();
|
||||
}
|
||||
|
||||
function clean_lists() {
|
||||
$("#id_agents").html('<?php echo __('None'); ?>');
|
||||
$("#module_name").html('<?php echo __('None'); ?>');
|
||||
$("#agents").html('<?php echo __('None'); ?>');
|
||||
$("#module").html('<?php echo __('None'); ?>');
|
||||
$("tr#delete_table-edit1, tr#delete_table-edit2, tr#delete_table-edit3, tr#delete_table-edit4, tr#delete_table-edit5, tr#delete_table-edit6, tr#delete_table-edit7").hide ();
|
||||
$('input[type=checkbox]').attr('checked', false);
|
||||
$('input[type=checkbox]').attr('disabled', true);
|
||||
$('#module_type').val(-1);
|
||||
$('#groups_select').val(-1);
|
||||
}
|
||||
|
||||
$('input[type=checkbox]').change (
|
||||
function () {
|
||||
if(this.id == "checkbox-force_type"){
|
||||
if(this.checked) {
|
||||
$(".select_modules_row_2").css('display', 'none');
|
||||
$("tr#delete_table-edit1, tr#delete_table-edit2, tr#delete_table-edit3, tr#delete_table-edit4, tr#delete_table-edit5, tr#delete_table-edit6, tr#delete_table-edit7").show ();
|
||||
}
|
||||
else {
|
||||
$(".select_modules_row_2").css('display', '');
|
||||
if($('#module_name option:selected').val() == undefined) {
|
||||
$("tr#delete_table-edit1, tr#delete_table-edit2, tr#delete_table-edit3, tr#delete_table-edit4, tr#delete_table-edit5, tr#delete_table-edit6, tr#delete_table-edit7").hide ();
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(this.checked) {
|
||||
$(".select_agents_row_2").css('display', 'none');
|
||||
$("tr#delete_table-edit1, tr#delete_table-edit2, tr#delete_table-edit3, tr#delete_table-edit4, tr#delete_table-edit5, tr#delete_table-edit6, tr#delete_table-edit7").show ();
|
||||
}
|
||||
else {
|
||||
$(".select_agents_row_2").css('display', '');
|
||||
if($('#id_agents option:selected').val() == undefined) {
|
||||
$("tr#delete_table-edit1, tr#delete_table-edit2, tr#delete_table-edit3, tr#delete_table-edit4, tr#delete_table-edit5, tr#delete_table-edit6, tr#delete_table-edit7").hide ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
$("#module_name").change (show_form);
|
||||
$("#id_agents").change (show_form);
|
||||
|
||||
$("#form_edit input[name=selection_mode]").change (function () {
|
||||
selector = this.value;
|
||||
clean_lists();
|
||||
|
||||
if(selector == 'agents') {
|
||||
$(".select_modules_row").css('display', 'none');
|
||||
$(".select_agents_row").css('display', '');
|
||||
}
|
||||
else if(selector == 'modules') {
|
||||
$(".select_agents_row").css('display', 'none');
|
||||
$(".select_modules_row").css('display', '');
|
||||
}
|
||||
});
|
||||
|
||||
$("#groups_select").change (
|
||||
function () {
|
||||
if (this.value < 0) {
|
||||
clean_lists();
|
||||
$(".select_agents_row_2").css('display', 'none');
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$("#module").html('<?php echo __('None'); ?>');
|
||||
$("#id_agents").html('');
|
||||
$('input[type=checkbox]').attr('disabled', false);
|
||||
$(".select_agents_row_2").css('display', '');
|
||||
}
|
||||
|
||||
$("tr#delete_table-edit1, tr#delete_table-edit2, tr#delete_table-edit3, tr#delete_table-edit4, tr#delete_table-edit5, tr#delete_table-edit6, tr#delete_table-edit7").hide ();
|
||||
|
||||
jQuery.post ("ajax.php",
|
||||
{"page" : "operation/massive/ver_agente",
|
||||
{"page" : "operation/agentes/ver_agente",
|
||||
"get_agents_group_json" : 1,
|
||||
"id_group" : this.value,
|
||||
},
|
||||
function (data, status) {
|
||||
$("#agents_select").html('');
|
||||
option = $("<option></option>").attr ("value", 0).html ("<?php echo __('All'); ?>").attr ("selected", "selected");
|
||||
$("#agents_select").append (option);
|
||||
$("#id_agents").html('');
|
||||
|
||||
jQuery.each (data, function (id, value) {
|
||||
option = $("<option></option>").attr ("value", value["id_agente"]).html (value["nombre"]);
|
||||
$("#agents_select").append (option);
|
||||
$("#id_agents").append (option);
|
||||
});
|
||||
},
|
||||
"json"
|
||||
|
|
|
@ -130,7 +130,7 @@ echo '<table border="0"><tr><td>';
|
|||
echo '<h3>'.__('Massive options').':</h3>';
|
||||
echo '</td><td>';
|
||||
print_select($options, 'option', $option, 'this.form.submit()', '', 0, false, false, false);
|
||||
if($option == 'edit_agents')
|
||||
if($option == 'edit_agents' || $option == 'edit_modules')
|
||||
echo '<a href="#" class="tip"> <span>' . __("The blank fields will not be updated") . '</span></a>';
|
||||
echo '</td></tr></table>';
|
||||
echo '</form>';
|
||||
|
|
|
@ -164,6 +164,63 @@ function agent_changed_by_multiple_agents (event, id_agent, selected) {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill up select box with id "agent" with agents after module has been selected, but this not empty the select box.s
|
||||
*
|
||||
* @param event that has been triggered
|
||||
* @param id_module Module ID that has been selected
|
||||
* @param selected Which agent(s) have to be selected
|
||||
*/
|
||||
function module_changed_by_multiple_modules (event, id_module, selected) {
|
||||
var idModules = Array();
|
||||
|
||||
jQuery.each ($("#module_name option:selected"), function (i, val) {
|
||||
//val() because the var is same <option val="NNN"></option>
|
||||
idModules.push($(val).val());
|
||||
});
|
||||
|
||||
$('#agents').attr ('disabled', 1);
|
||||
$('#agents').empty ();
|
||||
$('#agents').append ($('<option></option>').html ("Loading...").attr ("value", 0));
|
||||
jQuery.post ('ajax.php',
|
||||
{"page": "operation/agentes/ver_agente",
|
||||
"get_agents_json_for_multiple_modules": 1,
|
||||
"module_name[]": idModules
|
||||
},
|
||||
function (data) {
|
||||
$('#agents').append ($('<option></option>').html ("Loading...").attr ("value", 0));
|
||||
|
||||
$('#agents').empty ();
|
||||
|
||||
if (typeof($(document).data('text_for_module')) != 'undefined') {
|
||||
$('#agents').append ($('<option></option>').html ($(document).data('text_for_module')).attr("value", 0).attr('selected', true));
|
||||
}
|
||||
else {
|
||||
if (typeof(data['any_text']) != 'undefined') {
|
||||
$('#agents').append ($('<option></option>').html (data['any_text']).attr ("value", 0).attr('selected', true));
|
||||
}
|
||||
else {
|
||||
var anyText = $("#any_text").html(); //Trick for catch the translate text.
|
||||
|
||||
if (anyText == null) {
|
||||
anyText = 'Any';
|
||||
}
|
||||
|
||||
$('#agents').append ($('<option></option>').html (anyText).attr ("value", 0).attr('selected', true));
|
||||
}
|
||||
}
|
||||
jQuery.each (data, function (i, val) {
|
||||
s = js_html_entity_decode(val);
|
||||
$('#agents').append ($('<option></option>').html (s).attr ("value", val));
|
||||
$('#agents').fadeIn ('normal');
|
||||
});
|
||||
if (selected != undefined)
|
||||
$('#agents').attr ('value', selected);
|
||||
$('#agents').attr ('disabled', 0);
|
||||
},
|
||||
"json"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill up select box with id "module" with modules after agent has been selected, but this not empty the select box.s
|
||||
|
|
|
@ -32,6 +32,7 @@ if (is_ajax ()) {
|
|||
$get_agent_status_tooltip = (bool) get_parameter ("get_agent_status_tooltip");
|
||||
$get_agents_group_json = (bool) get_parameter ("get_agents_group_json");
|
||||
$get_agent_modules_json_for_multiple_agents = (bool) get_parameter("get_agent_modules_json_for_multiple_agents");
|
||||
$get_agents_json_for_multiple_modules = (bool) get_parameter("get_agents_json_for_multiple_modules");
|
||||
$get_agent_modules_json_for_multiple_agents_id = (bool) get_parameter("get_agent_modules_json_for_multiple_agents_id");
|
||||
$get_agentmodule_status_tooltip = (bool) get_parameter ("get_agentmodule_status_tooltip");
|
||||
$get_group_status_tooltip = (bool) get_parameter ("get_group_status_tooltip");
|
||||
|
@ -74,6 +75,19 @@ if (is_ajax ()) {
|
|||
return;
|
||||
}
|
||||
|
||||
if ($get_agents_json_for_multiple_modules) {
|
||||
$nameModules = get_parameter('module_name');
|
||||
|
||||
$nameAgents = get_db_all_rows_sql('SELECT DISTINCT(t1.nombre) as name FROM tagente t1, tagente_modulo t2 WHERE t1.id_agente = t2.id_agente AND t2.nombre IN (\'' . implode('\',\'', $nameModules) . '\') AND (SELECT count(t3.nombre) FROM tagente t3, tagente_modulo t4 WHERE t3.id_agente = t4.id_agente AND t1.nombre = t3.nombre AND t4.nombre IN (\'' . implode('\',\'', $nameModules) . '\')) = '.count($nameModules));
|
||||
|
||||
foreach($nameAgents as $nameAgent) {
|
||||
$names[] = $nameAgent['name'];
|
||||
}
|
||||
|
||||
echo json_encode($names);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($get_agent_modules_json_for_multiple_agents) {
|
||||
$idAgents = get_parameter('id_agent');
|
||||
|
||||
|
|
Loading…
Reference in New Issue