Added searchbar to select multiple modules on custom graph
This commit is contained in:
parent
f383586dcc
commit
5b624fc388
|
@ -331,7 +331,7 @@ echo "<form id='agentmodules' method='post' action='index.php?sec=reporting&sec
|
||||||
|
|
||||||
echo "<table width='100%' cellpadding='4' cellpadding='4' class='databox filters'>";
|
echo "<table width='100%' cellpadding='4' cellpadding='4' class='databox filters'>";
|
||||||
echo '<tr>';
|
echo '<tr>';
|
||||||
echo '<td class="w50p" id="select_multiple_modules_filtered">'.html_print_input(
|
echo '<td class="w50p pdd_50px" id="select_multiple_modules_filtered">'.html_print_input(
|
||||||
[
|
[
|
||||||
'type' => 'select_multiple_modules_filtered',
|
'type' => 'select_multiple_modules_filtered',
|
||||||
'uniqId' => 'modules',
|
'uniqId' => 'modules',
|
||||||
|
|
|
@ -222,7 +222,7 @@ function add_quotes($item)
|
||||||
|
|
||||||
if ($add_module === true) {
|
if ($add_module === true) {
|
||||||
$id_graph = get_parameter('id');
|
$id_graph = get_parameter('id');
|
||||||
$id_agent_modules = explode(',', get_parameter('id_modules'));
|
$id_modules = explode(',', get_parameter('id_modules'));
|
||||||
$id_agents = explode(',', get_parameter('id_agents'));
|
$id_agents = explode(',', get_parameter('id_agents'));
|
||||||
$weight = get_parameter('weight');
|
$weight = get_parameter('weight');
|
||||||
|
|
||||||
|
@ -230,11 +230,10 @@ if ($add_module === true) {
|
||||||
// Safe output remove all entities.
|
// Safe output remove all entities.
|
||||||
io_safe_output_array($id_modules, '');
|
io_safe_output_array($id_modules, '');
|
||||||
|
|
||||||
// We need to put the entities again
|
|
||||||
// to browse in db.
|
|
||||||
io_safe_input_array($id_modules);
|
|
||||||
|
|
||||||
|
|
||||||
|
$id_agent_modules = db_get_all_rows_sql(
|
||||||
|
'SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente IN ('.implode(',', $id_agents).") AND nombre IN ('".implode("','", $id_modules)."')"
|
||||||
|
);
|
||||||
|
|
||||||
if (count($id_agent_modules) > 0 && $id_agent_modules != '') {
|
if (count($id_agent_modules) > 0 && $id_agent_modules != '') {
|
||||||
$order = db_get_row_sql("SELECT `field_order` from tgraph_source WHERE id_graph=$id_graph ORDER BY `field_order` DESC");
|
$order = db_get_row_sql("SELECT `field_order` from tgraph_source WHERE id_graph=$id_graph ORDER BY `field_order` DESC");
|
||||||
|
@ -242,7 +241,7 @@ if ($add_module === true) {
|
||||||
$order = $order['field_order'];
|
$order = $order['field_order'];
|
||||||
foreach ($id_agent_modules as $id_agent_module) {
|
foreach ($id_agent_modules as $id_agent_module) {
|
||||||
$order++;
|
$order++;
|
||||||
$result = db_process_sql_insert('tgraph_source', ['id_graph' => $id_graph, 'id_agent_module' => $id_agent_module, 'weight' => $weight, 'field_order' => $order]);
|
$result = db_process_sql_insert('tgraph_source', ['id_graph' => $id_graph, 'id_agent_module' => $id_agent_module['id_agente_modulo'], 'weight' => $weight, 'field_order' => $order]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$result = false;
|
$result = false;
|
||||||
|
|
|
@ -1491,11 +1491,11 @@ function html_print_select_multiple_modules_filtered(array $data):string
|
||||||
$output .= '<div>';
|
$output .= '<div>';
|
||||||
$output .= html_print_input(
|
$output .= html_print_input(
|
||||||
[
|
[
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'name' => 'agent-searchBar-'.$uniqId,
|
'name' => 'agent-searchBar-'.$uniqId,
|
||||||
'onKeyUp' => 'searchAgent(\''.$uniqId.'\')',
|
'onKeyUp' => 'searchAgent(\''.$uniqId.'\')',
|
||||||
'value' => __('Type for search...'),
|
'placeholder' => __('Type to search agents'),
|
||||||
'return' => true,
|
'return' => true,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1504,11 +1504,11 @@ function html_print_select_multiple_modules_filtered(array $data):string
|
||||||
$output .= '<div>';
|
$output .= '<div>';
|
||||||
$output .= html_print_input(
|
$output .= html_print_input(
|
||||||
[
|
[
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'name' => 'module-searchBar-'.$uniqId,
|
'name' => 'module-searchBar-'.$uniqId,
|
||||||
'onKeyUp' => 'searchModule(\''.$uniqId.'\')',
|
'onKeyUp' => 'searchModule(\''.$uniqId.'\')',
|
||||||
'return' => true,
|
'return' => true,
|
||||||
'value' => 'test',
|
'placeholder' => __('Type to search modules'),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -8501,6 +8501,8 @@ div#err_msg_centralised {
|
||||||
min-width: 250px !important;
|
min-width: 250px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
#select_multiple_modules_filtered > div > div > select {
|
#select_multiple_modules_filtered > div > div > input {
|
||||||
max-width: 250px !important;
|
max-width: 250px;
|
||||||
|
width: 95%;
|
||||||
|
height: 95%;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue