Merge branch 'ent-8281-anadir-recursion-de-grupos-a-los-widgets-de-dashboards-groups-status-y-general-group-status' into 'develop'
Added recursion to widgets Group status and General group status See merge request artica/pandorafms!5094
This commit is contained in:
commit
c9712a81db
|
@ -239,6 +239,10 @@ class SystemGroupStatusWidget extends Widget
|
|||
$values['groupId'] = $decoder['groupId'];
|
||||
}
|
||||
|
||||
if (isset($decoder['groupRecursion']) === true) {
|
||||
$values['groupRecursion'] = $decoder['groupRecursion'];
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
@ -326,6 +330,16 @@ class SystemGroupStatusWidget extends Widget
|
|||
],
|
||||
];
|
||||
|
||||
$inputs[] = [
|
||||
'label' => __('Group recursion'),
|
||||
'arguments' => [
|
||||
'name' => 'groupRecursion',
|
||||
'id' => 'groupRecursion',
|
||||
'type' => 'switch',
|
||||
'value' => $values['groupRecursion'],
|
||||
],
|
||||
];
|
||||
|
||||
return $inputs;
|
||||
}
|
||||
|
||||
|
@ -342,6 +356,7 @@ class SystemGroupStatusWidget extends Widget
|
|||
|
||||
$values['groupId'] = \get_parameter('groupId', []);
|
||||
$values['status'] = \get_parameter('status', []);
|
||||
$values['groupRecursion'] = (bool) \get_parameter_switch('groupRecursion', 0);
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
@ -381,6 +396,14 @@ class SystemGroupStatusWidget extends Widget
|
|||
|
||||
$selected_groups = explode(',', $this->values['groupId'][0]);
|
||||
|
||||
// Recursion.
|
||||
if ($this->values['groupRecursion'] === true) {
|
||||
foreach ($selected_groups as $father) {
|
||||
$children = \groups_get_children_ids($father);
|
||||
$selected_groups = ($selected_groups + $children);
|
||||
}
|
||||
}
|
||||
|
||||
if ($selected_groups[0] === '') {
|
||||
return false;
|
||||
}
|
||||
|
@ -450,7 +473,7 @@ class SystemGroupStatusWidget extends Widget
|
|||
$result_groups[0] = $all_counters;
|
||||
}
|
||||
|
||||
$this->values['groupId'] = explode(',', $this->values['groupId'][0]);
|
||||
$this->values['groupId'] = $selected_groups;
|
||||
$this->values['status'] = explode(',', $this->values['status'][0]);
|
||||
|
||||
$style = 'font-size: 12px; text-align: center;';
|
||||
|
|
Loading…
Reference in New Issue