mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 17:25:26 +02:00
Merge branch 'ent-11231-15600-filtrar-por-grupo-padre-no-muestra-resultados-en-remote-components' into 'develop'
Ent 11231 15600 filtrar por grupo padre no muestra resultados en remote components See merge request artica/pandorafms!5915
This commit is contained in:
commit
7be57b2b22
@ -592,6 +592,7 @@ if ((bool) $id !== false || $new_component
|
||||
|
||||
|
||||
$search_id_group = (int) get_parameter('search_id_group');
|
||||
$group_recursive = (bool) get_parameter_switch('group_recursive', false);
|
||||
$search_string = (string) get_parameter('search_string');
|
||||
|
||||
$offset = (int) get_parameter('offset');
|
||||
@ -661,7 +662,15 @@ $table->data[0][] = html_print_label_input_block(
|
||||
'width: 100%'
|
||||
)
|
||||
);
|
||||
|
||||
$table->data[0][] = html_print_label_input_block(
|
||||
__('Recursive'),
|
||||
html_print_checkbox_switch(
|
||||
'group_recursive',
|
||||
1,
|
||||
$group_recursive,
|
||||
true
|
||||
)
|
||||
);
|
||||
$table->data[0][] = html_print_label_input_block(
|
||||
__('Free Search'),
|
||||
html_print_input_text(
|
||||
@ -712,7 +721,11 @@ ui_toggle(
|
||||
|
||||
$filter = [];
|
||||
if ($search_id_group) {
|
||||
$filter['id_group'] = $search_id_group;
|
||||
if ($group_recursive === true) {
|
||||
$filter['id_group'] = network_component_get_groups_recursive($search_id_group);
|
||||
} else {
|
||||
$filter['id_group'] = $search_id_group;
|
||||
}
|
||||
}
|
||||
|
||||
if ($search_string != '') {
|
||||
|
@ -594,3 +594,26 @@ function network_components_duplicate_network_component($id_local_component)
|
||||
|
||||
return network_components_create_network_component($name, $network['type'], $network['id_group'], $network);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return all children groups recursive include parent.
|
||||
*
|
||||
* @param integer $id_parent Id of parent.
|
||||
* @param array $groups NO setting, array for recursive.
|
||||
*
|
||||
* @return array $groups All children ids include first parent.
|
||||
*/
|
||||
function network_component_get_groups_recursive($id_parent, $groups=[])
|
||||
{
|
||||
$groups[] = $id_parent;
|
||||
$ids = db_get_all_rows_filter('tnetwork_component_group', ['parent' => $id_parent], 'id_sg');
|
||||
|
||||
if ($ids !== false) {
|
||||
foreach ($ids as $key => $id) {
|
||||
$groups = network_component_get_groups_recursive($id['id_sg'], $groups);
|
||||
}
|
||||
}
|
||||
|
||||
return $groups;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user