2018-09-04 11:51:36 +02:00
|
|
|
<?php
|
|
|
|
//Pandora FMS- http://pandorafms.com
|
|
|
|
// ==================================================
|
|
|
|
// Copyright (c) 2005-2018 Artica Soluciones Tecnologicas
|
|
|
|
// Please see http://pandorafms.org for full contribution list
|
|
|
|
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation; version 2
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
|
|
|
global $config;
|
|
|
|
|
|
|
|
require_once($config['homedir']."/include/class/Tree.class.php");
|
|
|
|
|
|
|
|
class TreeGroup extends Tree {
|
|
|
|
|
|
|
|
public function __construct($type, $rootType = '', $id = -1, $rootID = -1, $serverID = false, $childrenMethod = "on_demand", $access = 'AR') {
|
|
|
|
|
|
|
|
global $config;
|
|
|
|
|
2018-09-05 14:01:32 +02:00
|
|
|
parent::__construct($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
2018-09-04 11:51:36 +02:00
|
|
|
|
2018-09-05 13:48:53 +02:00
|
|
|
$this->L1fieldName = "id_group";
|
|
|
|
$this->L1extraFields = array(
|
|
|
|
"tg.nombre AS `name`",
|
|
|
|
"tg.icon",
|
|
|
|
"tg.id_grupo AS gid"
|
|
|
|
);
|
|
|
|
|
2018-09-05 14:01:32 +02:00
|
|
|
$this->L2conditionInside = "AND (
|
|
|
|
ta.id_grupo = " . $this->id . "
|
|
|
|
OR tasg.id_group = " . $this->id . "
|
2018-09-05 13:48:53 +02:00
|
|
|
)";
|
2018-09-05 14:01:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
protected function getData() {
|
|
|
|
if ($this->id == -1) {
|
|
|
|
$this->getFirstLevel();
|
|
|
|
} elseif ($this->type == 'group') {
|
|
|
|
$this->getSecondLevel();
|
|
|
|
} elseif ($this->type == 'agent') {
|
|
|
|
$this->getThirdLevel();
|
|
|
|
}
|
2018-09-05 13:48:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
protected function getGroupSearchFilter() {
|
2018-09-05 14:01:32 +02:00
|
|
|
return "";
|
2018-09-05 13:48:53 +02:00
|
|
|
}
|
2018-09-04 11:51:36 +02:00
|
|
|
|
2018-09-05 14:01:32 +02:00
|
|
|
protected function getFirstLevel() {
|
|
|
|
$processed_items = $this->getProcessedGroups();
|
2018-09-04 11:51:36 +02:00
|
|
|
|
2018-09-05 18:28:31 +02:00
|
|
|
if (!empty($processed_items)) {
|
|
|
|
// Filter by group name. This should be done after rerieving the items cause we need the possible items descendants
|
|
|
|
if (!empty($this->filter['searchGroup'])) {
|
|
|
|
// Save the groups which intersect with the user groups
|
|
|
|
$groups = db_get_all_rows_filter('tgrupo', array('nombre' => '%' . $this->filter['searchGroup'] . '%'));
|
|
|
|
if ($groups == false) $groups = array();
|
|
|
|
$userGroupsACL = $this->userGroupsACL;
|
|
|
|
$ids_hash = array_reduce($groups, function ($userGroups, $group) use ($userGroupsACL) {
|
|
|
|
$group_id = $group['id_grupo'];
|
|
|
|
if (isset($userGroupsACL[$group_id])) {
|
|
|
|
$userGroups[$group_id] = $userGroupsACL[$group_id];
|
|
|
|
}
|
|
|
|
|
|
|
|
return $userGroups;
|
|
|
|
}, array());
|
|
|
|
|
|
|
|
$result = self::extractGroupsWithIDs($processed_items, $ids_hash);
|
|
|
|
|
|
|
|
$processed_items = ($result === false) ? array() : $result;
|
|
|
|
}
|
2018-09-04 11:51:36 +02:00
|
|
|
|
2018-09-05 18:28:31 +02:00
|
|
|
// groupID filter. To access the view from tactical views f.e.
|
|
|
|
if (!empty($this->filter['groupID'])) {
|
|
|
|
$result = self::extractItemWithID($processed_items, $this->filter['groupID'], "group", $this->strictACL);
|
2018-09-04 11:51:36 +02:00
|
|
|
|
2018-09-05 18:28:31 +02:00
|
|
|
$processed_items = ($result === false) ? array() : array($result);
|
2018-09-05 14:01:32 +02:00
|
|
|
}
|
2018-09-05 18:28:31 +02:00
|
|
|
}
|
2018-09-04 11:51:36 +02:00
|
|
|
|
|
|
|
$this->tree = $processed_items;
|
2018-09-05 14:01:32 +02:00
|
|
|
}
|
2018-09-05 09:54:28 +02:00
|
|
|
|
2018-09-05 14:01:32 +02:00
|
|
|
protected function getProcessedGroups () {
|
2018-09-05 09:54:28 +02:00
|
|
|
$processed_groups = array();
|
|
|
|
// Index and process the groups
|
2018-09-05 18:28:31 +02:00
|
|
|
$groups = $this->getGroupCounters();
|
2018-09-05 09:54:28 +02:00
|
|
|
|
|
|
|
// If user have not permissions in parent, set parent node to 0 (all)
|
|
|
|
// Avoid to do foreach for admins
|
|
|
|
if (!users_can_manage_group_all("AR")) {
|
|
|
|
foreach ($groups as $id => $group) {
|
|
|
|
if (!isset($this->userGroups[$groups[$id]['parent']])) {
|
|
|
|
$groups[$id]['parent'] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Build the group hierarchy
|
|
|
|
foreach ($groups as $id => $group) {
|
|
|
|
if (isset($groups[$id]['parent']) && ($groups[$id]['parent'] != 0)) {
|
|
|
|
$parent = $groups[$id]['parent'];
|
|
|
|
// Parent exists
|
|
|
|
if (!isset($groups[$parent]['children'])) {
|
|
|
|
$groups[$parent]['children'] = array();
|
|
|
|
}
|
|
|
|
// Store a reference to the group into the parent
|
|
|
|
$groups[$parent]['children'][] = &$groups[$id];
|
|
|
|
// This group was introduced into a parent
|
|
|
|
$groups[$id]['have_parent'] = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Sort the children groups
|
|
|
|
foreach ($groups as $id => $group) {
|
|
|
|
if (isset($groups[$id]['children'])) {
|
|
|
|
usort($groups[$id]['children'], array("Tree", "cmpSortNames"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//Filter groups and eliminates the reference to children groups out of her parent
|
|
|
|
$groups = array_filter($groups, function ($group) {
|
|
|
|
return !$group['have_parent'];
|
|
|
|
});
|
|
|
|
// Propagate child counters to her parents
|
|
|
|
TreeGroup::processCounters($groups);
|
|
|
|
// Filter groups and eliminates the reference to empty groups
|
|
|
|
$groups = TreeGroup::deleteEmptyGroups($groups);
|
|
|
|
|
|
|
|
usort($groups, array("Tree", "cmpSortNames"));
|
|
|
|
return $groups;
|
2018-09-05 14:01:32 +02:00
|
|
|
}
|
2018-09-05 09:54:28 +02:00
|
|
|
|
2018-09-05 14:01:32 +02:00
|
|
|
protected function getGroupCounters() {
|
2018-09-05 13:48:53 +02:00
|
|
|
//FIXME PLEASE
|
|
|
|
if (true) {
|
|
|
|
$fields = $this->getFirstLevelFields();
|
|
|
|
$inside_fields = $this->getFirstLevelFieldsInside();
|
2018-09-05 09:54:28 +02:00
|
|
|
|
|
|
|
$group_acl = "";
|
|
|
|
$secondary_group_acl = "";
|
|
|
|
if (!users_can_manage_group_all("AR")) {
|
|
|
|
$user_groups_str = implode(",", $this->userGroupsArray);
|
|
|
|
$group_acl = " AND ta.id_grupo IN ($user_groups_str)";
|
|
|
|
$secondary_group_acl = " AND tasg.id_group IN ($user_groups_str)";
|
|
|
|
}
|
2018-09-05 13:48:53 +02:00
|
|
|
$agent_search_filter = $this->getAgentSearchFilter();
|
|
|
|
$agent_search_filter = preg_replace("/%/", "%%", $agent_search_filter);
|
|
|
|
$agent_status_filter = $this->getAgentStatusFilter();
|
|
|
|
$module_status_filter = $this->getModuleStatusFilter();
|
|
|
|
|
|
|
|
$module_search_inner = "";
|
|
|
|
$module_search_filter = "";
|
|
|
|
if (!empty($this->filter['searchModule'])) {
|
|
|
|
$module_search_inner = "
|
|
|
|
INNER JOIN tagente_modulo tam
|
|
|
|
ON ta.id_agente = tam.id_agente
|
|
|
|
INNER JOIN tagente_estado tae
|
|
|
|
ON tae.id_agente_modulo = tam.id_agente_modulo";
|
|
|
|
$module_search_filter = "AND tam.disabled = 0
|
|
|
|
AND tam.nombre LIKE '%%" . $this->filter['searchModule'] . "%%' " .
|
|
|
|
$this->getModuleStatusFilterFromTestado()
|
|
|
|
;
|
|
|
|
}
|
2018-09-05 09:54:28 +02:00
|
|
|
|
|
|
|
$table = is_metaconsole() ? "tmetaconsole_agent" : "tagente";
|
|
|
|
$table_sec = is_metaconsole() ? "tmetaconsole_agent_secondary_group" : "tagent_secondary_group";
|
2018-09-05 13:48:53 +02:00
|
|
|
|
2018-09-05 09:54:28 +02:00
|
|
|
$sql_model = "SELECT %s FROM
|
|
|
|
(
|
2018-09-05 13:48:53 +02:00
|
|
|
SELECT COUNT(DISTINCT(ta.id_agente)) AS total, id_grupo AS g
|
|
|
|
FROM $table ta
|
|
|
|
$module_search_inner
|
|
|
|
WHERE ta.disabled = 0
|
|
|
|
%s
|
|
|
|
$agent_search_filter
|
|
|
|
$agent_status_filter
|
|
|
|
$module_status_filter
|
|
|
|
$module_search_filter
|
|
|
|
$group_acl
|
|
|
|
GROUP BY id_grupo
|
|
|
|
UNION ALL
|
2018-09-05 09:54:28 +02:00
|
|
|
SELECT COUNT(DISTINCT(ta.id_agente)) AS total, id_group AS g
|
|
|
|
FROM $table ta INNER JOIN $table_sec tasg
|
|
|
|
ON ta.id_agente = tasg.id_agent
|
2018-09-05 13:48:53 +02:00
|
|
|
$module_search_inner
|
2018-09-05 09:54:28 +02:00
|
|
|
WHERE ta.disabled = 0
|
2018-09-05 13:48:53 +02:00
|
|
|
%s
|
|
|
|
$agent_search_filter
|
|
|
|
$agent_status_filter
|
|
|
|
$module_status_filter
|
|
|
|
$module_search_filter
|
|
|
|
$secondary_group_acl
|
2018-09-05 09:54:28 +02:00
|
|
|
GROUP BY id_group
|
|
|
|
) x GROUP BY g";
|
|
|
|
$sql_array = array();
|
2018-09-05 13:48:53 +02:00
|
|
|
foreach ($inside_fields as $inside_field) {
|
2018-09-05 09:54:28 +02:00
|
|
|
$sql_array[] = sprintf(
|
|
|
|
$sql_model,
|
2018-09-05 13:48:53 +02:00
|
|
|
$inside_field['header'],
|
|
|
|
$inside_field['condition'],
|
|
|
|
$inside_field['condition']
|
2018-09-05 09:54:28 +02:00
|
|
|
);
|
|
|
|
}
|
2018-09-05 13:48:53 +02:00
|
|
|
$sql = "SELECT $fields FROM (" . implode(" UNION ALL ", $sql_array) . ") x2
|
|
|
|
RIGHT JOIN tgrupo tg
|
|
|
|
ON x2.g = tg.id_grupo
|
|
|
|
GROUP BY tg.id_grupo";
|
2018-09-05 09:54:28 +02:00
|
|
|
$stats = db_get_all_rows_sql($sql);
|
|
|
|
}
|
|
|
|
else{
|
2018-09-05 13:48:53 +02:00
|
|
|
$stats = db_get_all_rows_sql(
|
|
|
|
'SELECT tgs.agents AS total_count, tgs.critical AS total_critical_count,
|
|
|
|
tgs.unknown AS total_unknown_count, tgs.warning AS total_warning_count,
|
|
|
|
`non-init` AS total_not_init_count, tgs.normal AS total_normal_count,
|
|
|
|
tgs.alerts_fired AS total_alerts_count,
|
|
|
|
tg.nombre AS name, tg.parent, tg.icon, tg.id_grupo AS gid
|
|
|
|
FROM tgroup_stat tgs
|
|
|
|
INNER JOIN tgrupo tg
|
|
|
|
ON tg.id_grupo = tgs.id_group
|
|
|
|
');
|
2018-09-05 09:54:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# Update the group cache (from db or calculated).
|
|
|
|
$group_stats = array();
|
2018-09-05 13:48:53 +02:00
|
|
|
|
2018-09-05 09:54:28 +02:00
|
|
|
foreach ($stats as $group) {
|
2018-09-05 13:48:53 +02:00
|
|
|
$group_stats[$group['gid']]['total_count'] = (int)$group['total_count'];
|
|
|
|
$group_stats[$group['gid']]['total_critical_count'] = (int)$group['total_critical_count'];
|
|
|
|
$group_stats[$group['gid']]['total_unknown_count'] = (int)$group['total_unknown_count'];
|
|
|
|
$group_stats[$group['gid']]['total_warning_count'] = (int)$group['total_warning_count'];
|
|
|
|
$group_stats[$group['gid']]['total_not_init_count'] = (int)$group['total_not_init_count'];
|
|
|
|
$group_stats[$group['gid']]['total_normal_count'] = (int)$group['total_normal_count'];
|
|
|
|
$group_stats[$group['gid']]['total_fired_count'] = (int)$group['total_alerts_count'];
|
2018-09-05 09:54:28 +02:00
|
|
|
$group_stats[$group['gid']]['name'] = $group['name'];
|
|
|
|
$group_stats[$group['gid']]['parent'] = $group['parent'];
|
|
|
|
$group_stats[$group['gid']]['icon'] = $group['icon'];
|
|
|
|
$group_stats[$group['gid']]['id'] = $group['gid'];
|
|
|
|
$group_stats[$group['gid']] = $this->getProcessedItem($group_stats[$group['gid']]);
|
|
|
|
}
|
|
|
|
|
2018-09-05 13:48:53 +02:00
|
|
|
if (isset($group_stats[$group_id])) {
|
2018-09-05 09:54:28 +02:00
|
|
|
return $group_stats[$group_id];
|
|
|
|
}
|
2018-09-05 13:48:53 +02:00
|
|
|
|
|
|
|
return $group_stats;
|
2018-09-05 14:01:32 +02:00
|
|
|
}
|
2018-09-05 09:54:28 +02:00
|
|
|
|
2018-09-05 18:28:31 +02:00
|
|
|
protected function getFirstLevelFields() {
|
|
|
|
$fields = parent::getFirstLevelFields();
|
|
|
|
$parent = $this->getDisplayHierarchy() ? 'tg.parent' : '0 as parent';
|
|
|
|
return "$fields, $parent";
|
|
|
|
}
|
|
|
|
|
2018-09-05 09:54:28 +02:00
|
|
|
protected function getProcessedModules($modules_tree) {
|
|
|
|
|
2018-09-05 14:01:32 +02:00
|
|
|
$groups = array();
|
|
|
|
foreach ($modules_tree as $group) {
|
|
|
|
$groups[$group["id"]] = $group;
|
|
|
|
}
|
2018-09-05 09:54:28 +02:00
|
|
|
|
|
|
|
// Build the module hierarchy
|
|
|
|
foreach ($groups as $id => $group) {
|
|
|
|
if (isset($groups[$id]['parent']) && ($groups[$id]['parent'] != 0)) {
|
|
|
|
$parent = $groups[$id]['parent'];
|
|
|
|
// Parent exists
|
|
|
|
if (!isset($groups[$parent]['children'])) {
|
|
|
|
$groups[$parent]['children'] = array();
|
|
|
|
}
|
2018-09-05 14:01:32 +02:00
|
|
|
// Store a reference to the group into the parent
|
2018-09-05 09:54:28 +02:00
|
|
|
$groups[$parent]['children'][] = &$groups[$id];
|
|
|
|
// This group was introduced into a parent
|
|
|
|
$groups[$id]['have_parent'] = true;
|
|
|
|
}
|
2018-09-05 14:01:32 +02:00
|
|
|
}
|
2018-09-05 09:54:28 +02:00
|
|
|
|
|
|
|
// Sort the children groups
|
|
|
|
foreach ($groups as $id => $group) {
|
|
|
|
if (isset($groups[$id]['children'])) {
|
|
|
|
usort($groups[$id]['children'], array("Tree", "cmpSortNames"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//Filter groups and eliminates the reference to children groups out of her parent
|
|
|
|
$groups = array_filter($groups, function ($group) {
|
|
|
|
return !$group['have_parent'];
|
2018-09-05 14:01:32 +02:00
|
|
|
});
|
2018-09-05 09:54:28 +02:00
|
|
|
|
2018-09-05 14:01:32 +02:00
|
|
|
return array_values($groups);
|
|
|
|
}
|
2018-09-05 09:54:28 +02:00
|
|
|
|
2018-09-05 14:01:32 +02:00
|
|
|
// FIXME: Hierarchy lops is broken
|
|
|
|
protected function getProcessedModules_old($modules_tree) {
|
2018-09-05 09:54:28 +02:00
|
|
|
|
|
|
|
$tree_modules = array();
|
|
|
|
$new_modules_root = array_filter($modules_tree, function ($module) {
|
|
|
|
return (isset($module['parent']) && ($module['parent'] == 0));
|
|
|
|
});
|
|
|
|
|
|
|
|
$new_modules_child = array_filter($modules_tree, function ($module) {
|
|
|
|
return (isset($module['parent']) && ($module['parent'] != 0));
|
|
|
|
});
|
|
|
|
|
2018-09-05 14:01:32 +02:00
|
|
|
$i = 0;
|
2018-09-05 09:54:28 +02:00
|
|
|
while (!empty($new_modules_child)) {
|
|
|
|
foreach ($new_modules_child as $i => $child) {
|
|
|
|
TreeGroup::recursive_modules_tree_view($new_modules_root, $new_modules_child, $i, $child);
|
2018-09-05 14:01:32 +02:00
|
|
|
}
|
2018-09-05 09:54:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($new_modules_root as $m) {
|
|
|
|
$tree_modules[] = $m;
|
2018-09-05 14:01:32 +02:00
|
|
|
}
|
2018-09-05 09:54:28 +02:00
|
|
|
return $tree_modules;
|
|
|
|
}
|
|
|
|
|
2018-09-05 14:01:32 +02:00
|
|
|
// FIXME with getProcessedModules_old
|
2018-09-05 09:54:28 +02:00
|
|
|
static function recursive_modules_tree_view (&$new_modules, &$new_modules_child, $i, $child) {
|
|
|
|
foreach ($new_modules as $index => $module) {
|
|
|
|
if ($module['id'] == $child['parent']) {
|
2018-09-05 14:01:32 +02:00
|
|
|
$new_modules[$index]['children'][] = $child;
|
|
|
|
unset($new_modules_child[$i]);
|
2018-09-05 09:54:28 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if (isset($new_modules[$index]['children'])) {
|
|
|
|
TreeGroup::recursive_modules_tree_view ($new_modules[$index]['children'], $new_modules_child, $i, $child);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-05 14:01:32 +02:00
|
|
|
static function processCounters(&$groups) {
|
2018-09-05 09:54:28 +02:00
|
|
|
$all_counters = array();
|
|
|
|
foreach ($groups as $id => $group) {
|
|
|
|
$child_counters = array();
|
|
|
|
if (!empty($groups[$id]['children'])) {
|
|
|
|
$child_counters = TreeGroup::processCounters($groups[$id]['children']);
|
|
|
|
}
|
|
|
|
if (!empty($child_counters)) {
|
|
|
|
foreach($child_counters as $type => $value) {
|
|
|
|
$groups[$id]['counters'][$type] += $value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
foreach($groups[$id]['counters'] as $type => $value) {
|
|
|
|
$all_counters[$type] += $value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $all_counters;
|
2018-09-05 14:01:32 +02:00
|
|
|
}
|
2018-09-05 09:54:28 +02:00
|
|
|
|
2018-09-05 14:01:32 +02:00
|
|
|
/**
|
2018-09-05 09:54:28 +02:00
|
|
|
* @brief Recursive function to remove the empty groups
|
|
|
|
*
|
|
|
|
* @param groups All groups structure
|
|
|
|
*
|
|
|
|
* @return new_groups A new groups structure without empty groups
|
|
|
|
*/
|
|
|
|
protected static function deleteEmptyGroups ($groups) {
|
|
|
|
$new_groups = array();
|
|
|
|
foreach ($groups as $group) {
|
|
|
|
// If a group is empty, do not add to new_groups.
|
|
|
|
if (!isset($group['counters']['total']) || $group['counters']['total'] == 0) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
// Tray to remove the children groups
|
|
|
|
if (!empty($group['children'])) {
|
|
|
|
$children = TreeGroup::deleteEmptyGroups ($group['children']);
|
|
|
|
if (empty($children)) unset($group['children']);
|
|
|
|
else $group['children'] = $children;
|
|
|
|
}
|
|
|
|
$new_groups[] = $group;
|
|
|
|
}
|
|
|
|
return $new_groups;
|
2018-09-05 14:01:32 +02:00
|
|
|
}
|
2018-09-05 09:54:28 +02:00
|
|
|
|
|
|
|
private static function extractGroupsWithIDs ($groups, $ids_hash) {
|
|
|
|
$result_groups = array();
|
|
|
|
foreach ($groups as $group) {
|
|
|
|
if (isset($ids_hash[$group['id']])) {
|
|
|
|
$result_groups[] = $group;
|
|
|
|
}
|
|
|
|
else if (!empty($group['children'])) {
|
|
|
|
$result = self::extractGroupsWithIDs($group['children'], $ids_hash);
|
|
|
|
|
|
|
|
// Item found on children
|
|
|
|
if (!empty($result)) {
|
|
|
|
$result_groups = array_merge($result_groups, $result);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $result_groups;
|
2018-09-05 14:01:32 +02:00
|
|
|
}
|
2018-09-05 09:54:28 +02:00
|
|
|
|
2018-09-05 14:01:32 +02:00
|
|
|
private static function extractItemWithID ($items, $item_id, $item_type = "group", $strictACL = false) {
|
2018-09-05 09:54:28 +02:00
|
|
|
foreach ($items as $item) {
|
|
|
|
if ($item["type"] != $item_type)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
// Item found
|
|
|
|
if ($strictACL && is_metaconsole()) {
|
|
|
|
foreach ($item["id"] as $server_id => $id) {
|
|
|
|
if ($id == $item_id)
|
|
|
|
return $item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if ($item["id"] == $item_id)
|
|
|
|
return $item;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($item["type"] == "group" && !empty($item["children"])) {
|
|
|
|
$result = self::extractItemWithID($item["children"], $item_id, $item_type, $strictACL);
|
|
|
|
|
|
|
|
// Item found on children
|
|
|
|
if ($result !== false)
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Item not found
|
|
|
|
return false;
|
2018-09-05 14:01:32 +02:00
|
|
|
}
|
2018-09-05 09:54:28 +02:00
|
|
|
|
|
|
|
protected function getDisplayHierarchy() {
|
|
|
|
return $this->filter['searchHirearchy'] ||
|
|
|
|
(empty($this->filter['searchAgent']) && empty($this->filter['searchModule']));
|
|
|
|
}
|
|
|
|
|
2018-09-04 11:51:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
|
|
|