convert spaces to tab
This commit is contained in:
parent
7554906e59
commit
82c4adc5c7
|
@ -135,14 +135,14 @@ class Tree {
|
||||||
|
|
||||||
protected function getFirstLevelFields() {
|
protected function getFirstLevelFields() {
|
||||||
$fields = array (
|
$fields = array (
|
||||||
"g AS " . $this->L1fieldName,
|
"g AS " . $this->L1fieldName,
|
||||||
"SUM(x_critical) AS total_critical_count",
|
"SUM(x_critical) AS total_critical_count",
|
||||||
"SUM(x_warning) AS total_warning_count",
|
"SUM(x_warning) AS total_warning_count",
|
||||||
"SUM(x_normal) AS total_normal_count",
|
"SUM(x_normal) AS total_normal_count",
|
||||||
"SUM(x_unknown) AS total_unknown_count",
|
"SUM(x_unknown) AS total_unknown_count",
|
||||||
"SUM(x_not_init) AS total_not_init_count",
|
"SUM(x_not_init) AS total_not_init_count",
|
||||||
"SUM(x_alerts) AS total_alerts_count",
|
"SUM(x_alerts) AS total_alerts_count",
|
||||||
"SUM(x_total) AS total_count"
|
"SUM(x_total) AS total_count"
|
||||||
);
|
);
|
||||||
return implode(",", array_merge($fields, $this->L1extraFields));
|
return implode(",", array_merge($fields, $this->L1extraFields));
|
||||||
}
|
}
|
||||||
|
@ -203,22 +203,22 @@ class Tree {
|
||||||
|
|
||||||
// FIXME: Separate and condition from inner join
|
// FIXME: Separate and condition from inner join
|
||||||
protected function getTagJoin () {
|
protected function getTagJoin () {
|
||||||
// $parent is the agent id
|
// $parent is the agent id
|
||||||
$group_id = (int) db_get_value('id_grupo', 'tagente', 'id_agente', $this->id);
|
$group_id = (int) db_get_value('id_grupo', 'tagente', 'id_agente', $this->id);
|
||||||
$tag_join = '';
|
$tag_join = '';
|
||||||
if (empty($group_id)) {
|
if (empty($group_id)) {
|
||||||
// ACL error, this will restrict the module search
|
// ACL error, this will restrict the module search
|
||||||
$tag_join = 'INNER JOIN ttag_module tta
|
$tag_join = 'INNER JOIN ttag_module tta
|
||||||
ON 1=0';
|
ON 1=0';
|
||||||
}
|
}
|
||||||
else if (!empty($this->acltags) && isset($this->acltags[$group_id])) {
|
else if (!empty($this->acltags) && isset($this->acltags[$group_id])) {
|
||||||
$tags_str = $this->acltags[$group_id];
|
$tags_str = $this->acltags[$group_id];
|
||||||
|
|
||||||
if (!empty($tags_str)) {
|
if (!empty($tags_str)) {
|
||||||
$tag_join = sprintf('INNER JOIN ttag_module ttm
|
$tag_join = sprintf('INNER JOIN ttag_module ttm
|
||||||
ON tam.id_agente_modulo = ttm.id_agente_modulo
|
ON tam.id_agente_modulo = ttm.id_agente_modulo
|
||||||
AND ttm.id_tag IN (%s)', $tags_str);
|
AND ttm.id_tag IN (%s)', $tags_str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $tag_join;
|
return $tag_join;
|
||||||
}
|
}
|
||||||
|
@ -290,7 +290,7 @@ class Tree {
|
||||||
|
|
||||||
protected function getGroupSearchInner() {
|
protected function getGroupSearchInner() {
|
||||||
if (empty($this->filter['searchGroup'])) return "";
|
if (empty($this->filter['searchGroup'])) return "";
|
||||||
return "INNER JOIN tgrupo tg
|
return "INNER JOIN tgrupo tg
|
||||||
ON ta.id_grupo = tg.id_grupo
|
ON ta.id_grupo = tg.id_grupo
|
||||||
OR tasg.id_group = tg.id_grupo"
|
OR tasg.id_group = tg.id_grupo"
|
||||||
;
|
;
|
||||||
|
@ -298,7 +298,7 @@ class Tree {
|
||||||
|
|
||||||
protected function getGroupSearchFilter() {
|
protected function getGroupSearchFilter() {
|
||||||
if (empty($this->filter['searchGroup'])) return "";
|
if (empty($this->filter['searchGroup'])) return "";
|
||||||
return " AND tg.nombre LIKE '%" . $this->filter['searchGroup'] . "%'";
|
return " AND tg.nombre LIKE '%" . $this->filter['searchGroup'] . "%'";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getAgentCounterColumnsSql ($agent_table) {
|
protected function getAgentCounterColumnsSql ($agent_table) {
|
||||||
|
@ -851,7 +851,7 @@ class Tree {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getFirstLevel() {
|
protected function getFirstLevel() {
|
||||||
$sql = $this->getFirstLevelSql();
|
$sql = $this->getFirstLevelSql();
|
||||||
$items = db_get_all_rows_sql($sql);
|
$items = db_get_all_rows_sql($sql);
|
||||||
if ($items === false) $items = array();
|
if ($items === false) $items = array();
|
||||||
|
@ -862,83 +862,83 @@ class Tree {
|
||||||
protected function getProcessedItemsFirstLevel($items){
|
protected function getProcessedItemsFirstLevel($items){
|
||||||
$processed_items = array();
|
$processed_items = array();
|
||||||
foreach ($items as $key => $item) {
|
foreach ($items as $key => $item) {
|
||||||
$processed_item = $this->getProcessedItem($item);
|
$processed_item = $this->getProcessedItem($item);
|
||||||
$processed_items[] = $processed_item;
|
$processed_items[] = $processed_item;
|
||||||
}
|
}
|
||||||
return $processed_items;
|
return $processed_items;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getFirstLevelSql() {
|
protected function getFirstLevelSql() {
|
||||||
|
|
||||||
$fields = $this->getFirstLevelFields();
|
$fields = $this->getFirstLevelFields();
|
||||||
$field_name_sql = $this->L1fieldNameSql;
|
$field_name_sql = $this->L1fieldNameSql;
|
||||||
$inside_fields = $this->getFirstLevelFieldsInside();
|
$inside_fields = $this->getFirstLevelFieldsInside();
|
||||||
$inner = $this->L1inner;
|
$inner = $this->L1inner;
|
||||||
$inner_inside = $this->L1innerInside;
|
$inner_inside = $this->L1innerInside;
|
||||||
$order_by_final = $this->L1orderByFinal;
|
$order_by_final = $this->L1orderByFinal;
|
||||||
|
|
||||||
$group_inner = $this->getGroupSearchInner();
|
$group_inner = $this->getGroupSearchInner();
|
||||||
$group_acl = $this->getGroupAclCondition();
|
$group_acl = $this->getGroupAclCondition();
|
||||||
$group_search_filter = $this->getGroupSearchFilter();
|
$group_search_filter = $this->getGroupSearchFilter();
|
||||||
$agent_search_filter = $this->getAgentSearchFilter();
|
$agent_search_filter = $this->getAgentSearchFilter();
|
||||||
$agent_status_filter = $this->getAgentStatusFilter();
|
$agent_status_filter = $this->getAgentStatusFilter();
|
||||||
$module_search_filter = $this->getModuleSearchFilter();
|
$module_search_filter = $this->getModuleSearchFilter();
|
||||||
$module_status_inner = "";
|
$module_status_inner = "";
|
||||||
$module_status_filter = $this->getModuleStatusFilterFromTestado();
|
$module_status_filter = $this->getModuleStatusFilterFromTestado();
|
||||||
if (!empty($module_status_filter)) {
|
if (!empty($module_status_filter)) {
|
||||||
$module_status_inner = "
|
$module_status_inner = "
|
||||||
INNER JOIN tagente_estado tae
|
INNER JOIN tagente_estado tae
|
||||||
ON tae.id_agente_modulo = tam.id_agente_modulo";
|
ON tae.id_agente_modulo = tam.id_agente_modulo";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql_model = "SELECT %s FROM
|
$sql_model = "SELECT %s FROM
|
||||||
(
|
(
|
||||||
SELECT COUNT(DISTINCT(ta.id_agente)) AS total, $field_name_sql AS g
|
SELECT COUNT(DISTINCT(ta.id_agente)) AS total, $field_name_sql AS g
|
||||||
FROM tagente ta
|
FROM tagente ta
|
||||||
LEFT JOIN tagent_secondary_group tasg
|
LEFT JOIN tagent_secondary_group tasg
|
||||||
ON ta.id_agente = tasg.id_agent
|
ON ta.id_agente = tasg.id_agent
|
||||||
INNER JOIN tagente_modulo tam
|
INNER JOIN tagente_modulo tam
|
||||||
ON ta.id_agente = tam.id_agente
|
ON ta.id_agente = tam.id_agente
|
||||||
$inner_inside
|
$inner_inside
|
||||||
$module_status_inner
|
$module_status_inner
|
||||||
$group_inner
|
$group_inner
|
||||||
WHERE ta.disabled = 0
|
WHERE ta.disabled = 0
|
||||||
AND tam.disabled = 0
|
AND tam.disabled = 0
|
||||||
%s
|
%s
|
||||||
$agent_search_filter
|
$agent_search_filter
|
||||||
$agent_status_filter
|
$agent_status_filter
|
||||||
$module_search_filter
|
$module_search_filter
|
||||||
$module_status_filter
|
$module_status_filter
|
||||||
$group_search_filter
|
$group_search_filter
|
||||||
$group_acl
|
$group_acl
|
||||||
GROUP BY $field_name_sql
|
GROUP BY $field_name_sql
|
||||||
) x GROUP BY g";
|
) x GROUP BY g";
|
||||||
$sql_array = array();
|
$sql_array = array();
|
||||||
foreach ($inside_fields as $inside_field) {
|
foreach ($inside_fields as $inside_field) {
|
||||||
$sql_array[] = sprintf(
|
$sql_array[] = sprintf(
|
||||||
$sql_model,
|
$sql_model,
|
||||||
$inside_field['header'],
|
$inside_field['header'],
|
||||||
$inside_field['condition']
|
$inside_field['condition']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$sql = "SELECT $fields FROM (" . implode(" UNION ALL ", $sql_array) . ") x2
|
$sql = "SELECT $fields FROM (" . implode(" UNION ALL ", $sql_array) . ") x2
|
||||||
$inner
|
$inner
|
||||||
GROUP BY g
|
GROUP BY g
|
||||||
ORDER BY $order_by_final";
|
ORDER BY $order_by_final";
|
||||||
return $sql;
|
return $sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getSecondLevel() {
|
protected function getSecondLevel() {
|
||||||
$sql = $this->getSecondLevelSql();
|
$sql = $this->getSecondLevelSql();
|
||||||
$data = db_process_sql($sql);
|
$data = db_process_sql($sql);
|
||||||
if (empty($data)) {
|
if (empty($data)) {
|
||||||
$this->tree = array();
|
$this->tree = array();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->processAgents($data);
|
$this->processAgents($data);
|
||||||
|
|
||||||
$this->tree = $data;
|
$this->tree = $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getSecondLevelSql() {
|
protected function getSecondLevelSql() {
|
||||||
$columns = sprintf("ta.id_agente AS id, ta.nombre AS name, ta.alias,
|
$columns = sprintf("ta.id_agente AS id, ta.nombre AS name, ta.alias,
|
||||||
|
@ -1006,12 +1006,12 @@ class Tree {
|
||||||
return $sql;
|
return $sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getThirdLevel() {
|
protected function getThirdLevel() {
|
||||||
$sql = $this->getThirdLevelSql();
|
$sql = $this->getThirdLevelSql();
|
||||||
$data = db_process_sql($sql);
|
$data = db_process_sql($sql);
|
||||||
if (empty($data)) {
|
if (empty($data)) {
|
||||||
$this->tree = array();
|
$this->tree = array();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$data = $this->getProcessedModules($data);
|
$data = $this->getProcessedModules($data);
|
||||||
$this->processModules($data);
|
$this->processModules($data);
|
||||||
|
@ -1021,48 +1021,48 @@ class Tree {
|
||||||
|
|
||||||
protected function getThirdLevelSql() {
|
protected function getThirdLevelSql() {
|
||||||
// Get the server id
|
// Get the server id
|
||||||
$serverID = $this->serverID;
|
$serverID = $this->serverID;
|
||||||
|
|
||||||
$group_acl = $this->getGroupAclCondition();
|
$group_acl = $this->getGroupAclCondition();
|
||||||
$agent_search_filter = $this->getAgentSearchFilter();
|
$agent_search_filter = $this->getAgentSearchFilter();
|
||||||
$agent_status_filter = $this->getAgentStatusFilter();
|
$agent_status_filter = $this->getAgentStatusFilter();
|
||||||
$module_search_filter = $this->getModuleSearchFilter();
|
$module_search_filter = $this->getModuleSearchFilter();
|
||||||
$module_status_filter = $this->getModuleStatusFilterFromTestado();
|
$module_status_filter = $this->getModuleStatusFilterFromTestado();
|
||||||
$agent_filter = "AND ta.id_agente = " . $this->id;
|
$agent_filter = "AND ta.id_agente = " . $this->id;
|
||||||
$tag_join = $this->getTagJoin();
|
$tag_join = $this->getTagJoin();
|
||||||
|
|
||||||
$condition = $this->L2condition;
|
$condition = $this->L2condition;
|
||||||
$inner = $this->L2inner;
|
$inner = $this->L2inner;
|
||||||
|
|
||||||
$columns = 'DISTINCT(tam.id_agente_modulo) AS id, tam.nombre AS name,
|
$columns = 'DISTINCT(tam.id_agente_modulo) AS id, tam.nombre AS name,
|
||||||
tam.id_tipo_modulo, tam.id_modulo, tae.estado, tae.datos,
|
tam.id_tipo_modulo, tam.id_modulo, tae.estado, tae.datos,
|
||||||
tam.parent_module_id AS parent, tatm.id AS alerts';
|
tam.parent_module_id AS parent, tatm.id AS alerts';
|
||||||
|
|
||||||
// has any of this tags.
|
// has any of this tags.
|
||||||
$tag_join = '';
|
$tag_join = '';
|
||||||
|
|
||||||
$sql = "SELECT $columns
|
$sql = "SELECT $columns
|
||||||
FROM tagente_modulo tam
|
FROM tagente_modulo tam
|
||||||
$tag_join
|
$tag_join
|
||||||
INNER JOIN tagente_estado tae
|
INNER JOIN tagente_estado tae
|
||||||
ON tam.id_agente_modulo = tae.id_agente_modulo
|
ON tam.id_agente_modulo = tae.id_agente_modulo
|
||||||
INNER JOIN tagente ta
|
INNER JOIN tagente ta
|
||||||
ON tam.id_agente = ta.id_agente
|
ON tam.id_agente = ta.id_agente
|
||||||
LEFT JOIN tagent_secondary_group tasg
|
LEFT JOIN tagent_secondary_group tasg
|
||||||
ON ta.id_agente = tasg.id_agent
|
ON ta.id_agente = tasg.id_agent
|
||||||
LEFT JOIN talert_template_modules tatm
|
LEFT JOIN talert_template_modules tatm
|
||||||
ON tatm.id_agent_module = tam.id_agente_modulo
|
ON tatm.id_agent_module = tam.id_agente_modulo
|
||||||
$inner
|
$inner
|
||||||
WHERE tam.disabled = 0 AND ta.disabled = 0
|
WHERE tam.disabled = 0 AND ta.disabled = 0
|
||||||
$condition
|
$condition
|
||||||
$agent_filter
|
$agent_filter
|
||||||
$group_acl
|
$group_acl
|
||||||
$agent_search_filter
|
$agent_search_filter
|
||||||
$agent_status_filter
|
$agent_status_filter
|
||||||
$module_status_filter
|
$module_status_filter
|
||||||
$module_search_filter
|
$module_search_filter
|
||||||
ORDER BY tam.nombre ASC, tam.id_agente_modulo ASC";
|
ORDER BY tam.nombre ASC, tam.id_agente_modulo ASC";
|
||||||
return $sql;
|
return $sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJSON() {
|
public function getJSON() {
|
||||||
|
|
|
@ -23,7 +23,7 @@ class TreeGroup extends Tree {
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
parent::__construct($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
parent::__construct($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
||||||
|
|
||||||
$this->L1fieldName = "id_group";
|
$this->L1fieldName = "id_group";
|
||||||
$this->L1extraFields = array(
|
$this->L1extraFields = array(
|
||||||
|
@ -33,28 +33,28 @@ class TreeGroup extends Tree {
|
||||||
"tg.id_grupo AS gid"
|
"tg.id_grupo AS gid"
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->L2conditionInside = "AND (
|
$this->L2conditionInside = "AND (
|
||||||
ta.id_grupo = " . $this->id . "
|
ta.id_grupo = " . $this->id . "
|
||||||
OR tasg.id_group = " . $this->id . "
|
OR tasg.id_group = " . $this->id . "
|
||||||
)";
|
)";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getData() {
|
protected function getData() {
|
||||||
if ($this->id == -1) {
|
if ($this->id == -1) {
|
||||||
$this->getFirstLevel();
|
$this->getFirstLevel();
|
||||||
} elseif ($this->type == 'group') {
|
} elseif ($this->type == 'group') {
|
||||||
$this->getSecondLevel();
|
$this->getSecondLevel();
|
||||||
} elseif ($this->type == 'agent') {
|
} elseif ($this->type == 'agent') {
|
||||||
$this->getThirdLevel();
|
$this->getThirdLevel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getGroupSearchFilter() {
|
protected function getGroupSearchFilter() {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getFirstLevel() {
|
protected function getFirstLevel() {
|
||||||
$processed_items = $this->getProcessedGroups();
|
$processed_items = $this->getProcessedGroups();
|
||||||
|
|
||||||
if (!empty($processed_items)) {
|
if (!empty($processed_items)) {
|
||||||
// Filter by group name. This should be done after rerieving the items cause we need the possible items descendants
|
// Filter by group name. This should be done after rerieving the items cause we need the possible items descendants
|
||||||
|
@ -83,12 +83,12 @@ class TreeGroup extends Tree {
|
||||||
|
|
||||||
$processed_items = ($result === false) ? array() : array($result);
|
$processed_items = ($result === false) ? array() : array($result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->tree = $processed_items;
|
$this->tree = $processed_items;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getProcessedGroups () {
|
protected function getProcessedGroups () {
|
||||||
$processed_groups = array();
|
$processed_groups = array();
|
||||||
// Index and process the groups
|
// Index and process the groups
|
||||||
$groups = $this->getGroupCounters(0);
|
$groups = $this->getGroupCounters(0);
|
||||||
|
@ -133,9 +133,9 @@ class TreeGroup extends Tree {
|
||||||
|
|
||||||
usort($groups, array("Tree", "cmpSortNames"));
|
usort($groups, array("Tree", "cmpSortNames"));
|
||||||
return $groups;
|
return $groups;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getGroupCounters() {
|
protected function getGroupCounters() {
|
||||||
//FIXME PLEASE
|
//FIXME PLEASE
|
||||||
if (true) {
|
if (true) {
|
||||||
$fields = $this->getFirstLevelFields();
|
$fields = $this->getFirstLevelFields();
|
||||||
|
@ -248,14 +248,14 @@ class TreeGroup extends Tree {
|
||||||
}
|
}
|
||||||
|
|
||||||
return $group_stats;
|
return $group_stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getProcessedModules($modules_tree) {
|
protected function getProcessedModules($modules_tree) {
|
||||||
|
|
||||||
$groups = array();
|
$groups = array();
|
||||||
foreach ($modules_tree as $group) {
|
foreach ($modules_tree as $group) {
|
||||||
$groups[$group["id"]] = $group;
|
$groups[$group["id"]] = $group;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build the module hierarchy
|
// Build the module hierarchy
|
||||||
foreach ($groups as $id => $group) {
|
foreach ($groups as $id => $group) {
|
||||||
|
@ -265,12 +265,12 @@ class TreeGroup extends Tree {
|
||||||
if (!isset($groups[$parent]['children'])) {
|
if (!isset($groups[$parent]['children'])) {
|
||||||
$groups[$parent]['children'] = array();
|
$groups[$parent]['children'] = array();
|
||||||
}
|
}
|
||||||
// Store a reference to the group into the parent
|
// Store a reference to the group into the parent
|
||||||
$groups[$parent]['children'][] = &$groups[$id];
|
$groups[$parent]['children'][] = &$groups[$id];
|
||||||
// This group was introduced into a parent
|
// This group was introduced into a parent
|
||||||
$groups[$id]['have_parent'] = true;
|
$groups[$id]['have_parent'] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort the children groups
|
// Sort the children groups
|
||||||
foreach ($groups as $id => $group) {
|
foreach ($groups as $id => $group) {
|
||||||
|
@ -281,13 +281,13 @@ class TreeGroup extends Tree {
|
||||||
//Filter groups and eliminates the reference to children groups out of her parent
|
//Filter groups and eliminates the reference to children groups out of her parent
|
||||||
$groups = array_filter($groups, function ($group) {
|
$groups = array_filter($groups, function ($group) {
|
||||||
return !$group['have_parent'];
|
return !$group['have_parent'];
|
||||||
});
|
});
|
||||||
|
|
||||||
return array_values($groups);
|
return array_values($groups);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Hierarchy lops is broken
|
// FIXME: Hierarchy lops is broken
|
||||||
protected function getProcessedModules_old($modules_tree) {
|
protected function getProcessedModules_old($modules_tree) {
|
||||||
|
|
||||||
$tree_modules = array();
|
$tree_modules = array();
|
||||||
$new_modules_root = array_filter($modules_tree, function ($module) {
|
$new_modules_root = array_filter($modules_tree, function ($module) {
|
||||||
|
@ -298,25 +298,25 @@ class TreeGroup extends Tree {
|
||||||
return (isset($module['parent']) && ($module['parent'] != 0));
|
return (isset($module['parent']) && ($module['parent'] != 0));
|
||||||
});
|
});
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while (!empty($new_modules_child)) {
|
while (!empty($new_modules_child)) {
|
||||||
foreach ($new_modules_child as $i => $child) {
|
foreach ($new_modules_child as $i => $child) {
|
||||||
TreeGroup::recursive_modules_tree_view($new_modules_root, $new_modules_child, $i, $child);
|
TreeGroup::recursive_modules_tree_view($new_modules_root, $new_modules_child, $i, $child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($new_modules_root as $m) {
|
foreach ($new_modules_root as $m) {
|
||||||
$tree_modules[] = $m;
|
$tree_modules[] = $m;
|
||||||
}
|
}
|
||||||
return $tree_modules;
|
return $tree_modules;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME with getProcessedModules_old
|
// FIXME with getProcessedModules_old
|
||||||
static function recursive_modules_tree_view (&$new_modules, &$new_modules_child, $i, $child) {
|
static function recursive_modules_tree_view (&$new_modules, &$new_modules_child, $i, $child) {
|
||||||
foreach ($new_modules as $index => $module) {
|
foreach ($new_modules as $index => $module) {
|
||||||
if ($module['id'] == $child['parent']) {
|
if ($module['id'] == $child['parent']) {
|
||||||
$new_modules[$index]['children'][] = $child;
|
$new_modules[$index]['children'][] = $child;
|
||||||
unset($new_modules_child[$i]);
|
unset($new_modules_child[$i]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (isset($new_modules[$index]['children'])) {
|
else if (isset($new_modules[$index]['children'])) {
|
||||||
|
@ -325,7 +325,7 @@ class TreeGroup extends Tree {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static function processCounters(&$groups) {
|
static function processCounters(&$groups) {
|
||||||
$all_counters = array();
|
$all_counters = array();
|
||||||
foreach ($groups as $id => $group) {
|
foreach ($groups as $id => $group) {
|
||||||
$child_counters = array();
|
$child_counters = array();
|
||||||
|
@ -342,9 +342,9 @@ class TreeGroup extends Tree {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $all_counters;
|
return $all_counters;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Recursive function to remove the empty groups
|
* @brief Recursive function to remove the empty groups
|
||||||
*
|
*
|
||||||
* @param groups All groups structure
|
* @param groups All groups structure
|
||||||
|
@ -367,7 +367,7 @@ class TreeGroup extends Tree {
|
||||||
$new_groups[] = $group;
|
$new_groups[] = $group;
|
||||||
}
|
}
|
||||||
return $new_groups;
|
return $new_groups;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function extractGroupsWithIDs ($groups, $ids_hash) {
|
private static function extractGroupsWithIDs ($groups, $ids_hash) {
|
||||||
$result_groups = array();
|
$result_groups = array();
|
||||||
|
@ -386,9 +386,9 @@ class TreeGroup extends Tree {
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result_groups;
|
return $result_groups;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function extractItemWithID ($items, $item_id, $item_type = "group", $strictACL = false) {
|
private static function extractItemWithID ($items, $item_id, $item_type = "group", $strictACL = false) {
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
if ($item["type"] != $item_type)
|
if ($item["type"] != $item_type)
|
||||||
continue;
|
continue;
|
||||||
|
@ -416,7 +416,7 @@ class TreeGroup extends Tree {
|
||||||
|
|
||||||
// Item not found
|
// Item not found
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getDisplayHierarchy() {
|
protected function getDisplayHierarchy() {
|
||||||
return $this->filter['searchHirearchy'] ||
|
return $this->filter['searchHirearchy'] ||
|
||||||
|
|
|
@ -23,35 +23,35 @@ class TreeModule extends Tree {
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
parent::__construct($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
parent::__construct($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
||||||
|
|
||||||
$this->L1fieldName = 'name';
|
$this->L1fieldName = 'name';
|
||||||
$this->L1fieldNameSql = 'tam.nombre';
|
$this->L1fieldNameSql = 'tam.nombre';
|
||||||
$this->L1inner = '';
|
$this->L1inner = '';
|
||||||
$this->L1orderByFinal = 'name';
|
$this->L1orderByFinal = 'name';
|
||||||
|
|
||||||
$this->L2condition = "AND tam.nombre = '" . $this->symbol2name($this->rootID) . "'";
|
$this->L2condition = "AND tam.nombre = '" . $this->symbol2name($this->rootID) . "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getData() {
|
protected function getData() {
|
||||||
if ($this->id == -1) {
|
if ($this->id == -1) {
|
||||||
$this->getFirstLevel();
|
$this->getFirstLevel();
|
||||||
} elseif ($this->type == 'module') {
|
} elseif ($this->type == 'module') {
|
||||||
$this->getSecondLevel();
|
$this->getSecondLevel();
|
||||||
} elseif ($this->type == 'agent') {
|
} elseif ($this->type == 'agent') {
|
||||||
$this->getThirdLevel();
|
$this->getThirdLevel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getProcessedItemsFirstLevel($items){
|
protected function getProcessedItemsFirstLevel($items){
|
||||||
$processed_items = array();
|
$processed_items = array();
|
||||||
foreach ($items as $key => $item) {
|
foreach ($items as $key => $item) {
|
||||||
$name = $this->name2symbol($item['name']);
|
$name = $this->name2symbol($item['name']);
|
||||||
$processed_item = $this->getProcessedItem($item);
|
$processed_item = $this->getProcessedItem($item);
|
||||||
$processed_item['id'] = $name;
|
$processed_item['id'] = $name;
|
||||||
$processed_item['rootID'] = $name;
|
$processed_item['rootID'] = $name;
|
||||||
$processed_items[] = $processed_item;
|
$processed_items[] = $processed_item;
|
||||||
}
|
}
|
||||||
return $processed_items;
|
return $processed_items;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,26 +23,26 @@ class TreeModuleGroup extends Tree {
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
parent::__construct($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
parent::__construct($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
||||||
|
|
||||||
$this->L1fieldName = 'id_module_group';
|
$this->L1fieldName = 'id_module_group';
|
||||||
$this->L1fieldNameSql = 'tam.id_module_group';
|
$this->L1fieldNameSql = 'tam.id_module_group';
|
||||||
$this->L1extraFields = array('tmg.name', 'tmg.id_mg AS id');
|
$this->L1extraFields = array('tmg.name', 'tmg.id_mg AS id');
|
||||||
$this->L1inner = 'INNER JOIN tmodule_group tmg ON tmg.id_mg = x2.g';
|
$this->L1inner = 'INNER JOIN tmodule_group tmg ON tmg.id_mg = x2.g';
|
||||||
$this->L1orderByFinal = 'tmg.name';
|
$this->L1orderByFinal = 'tmg.name';
|
||||||
|
|
||||||
$this->L2condition = "AND tam.id_module_group = " . $this->rootID;
|
$this->L2condition = "AND tam.id_module_group = " . $this->rootID;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getData() {
|
protected function getData() {
|
||||||
if ($this->id == -1) {
|
if ($this->id == -1) {
|
||||||
$this->getFirstLevel();
|
$this->getFirstLevel();
|
||||||
} elseif ($this->type == 'module_group') {
|
} elseif ($this->type == 'module_group') {
|
||||||
$this->getSecondLevel();
|
$this->getSecondLevel();
|
||||||
} elseif ($this->type == 'agent') {
|
} elseif ($this->type == 'agent') {
|
||||||
$this->getThirdLevel();
|
$this->getThirdLevel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -23,26 +23,26 @@ class TreeOS extends Tree {
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
parent::__construct($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
parent::__construct($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
||||||
|
|
||||||
$this->L1fieldName = 'id_os';
|
$this->L1fieldName = 'id_os';
|
||||||
$this->L1fieldNameSql = 'ta.id_os';
|
$this->L1fieldNameSql = 'ta.id_os';
|
||||||
$this->L1extraFields = array('tco.name', 'tco.id_os AS id', 'tco.icon_name AS iconHTML');
|
$this->L1extraFields = array('tco.name', 'tco.id_os AS id', 'tco.icon_name AS iconHTML');
|
||||||
$this->L1inner = 'INNER JOIN tconfig_os tco ON tco.id_os = x2.g';
|
$this->L1inner = 'INNER JOIN tconfig_os tco ON tco.id_os = x2.g';
|
||||||
$this->L1orderByFinal = 'tco.name';
|
$this->L1orderByFinal = 'tco.name';
|
||||||
|
|
||||||
$this->L2condition = "AND ta.id_os = " . $this->rootID;
|
$this->L2condition = "AND ta.id_os = " . $this->rootID;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getData() {
|
protected function getData() {
|
||||||
if ($this->id == -1) {
|
if ($this->id == -1) {
|
||||||
$this->getFirstLevel();
|
$this->getFirstLevel();
|
||||||
} elseif ($this->type == 'os') {
|
} elseif ($this->type == 'os') {
|
||||||
$this->getSecondLevel();
|
$this->getSecondLevel();
|
||||||
} elseif ($this->type == 'agent') {
|
} elseif ($this->type == 'agent') {
|
||||||
$this->getThirdLevel();
|
$this->getThirdLevel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -23,31 +23,31 @@ class TreeTag extends Tree {
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
parent::__construct($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
parent::__construct($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
||||||
|
|
||||||
$this->L1fieldName = 'id_tag';
|
$this->L1fieldName = 'id_tag';
|
||||||
$this->L1fieldNameSql = 'ttm.id_tag';
|
$this->L1fieldNameSql = 'ttm.id_tag';
|
||||||
$this->L1innerInside = '
|
$this->L1innerInside = '
|
||||||
INNER JOIN ttag_module ttm
|
INNER JOIN ttag_module ttm
|
||||||
ON ttm.id_agente_modulo = tam.id_agente_modulo
|
ON ttm.id_agente_modulo = tam.id_agente_modulo
|
||||||
';
|
';
|
||||||
$this->L1extraFields = array('tt.name', 'tt.id_tag AS id');
|
$this->L1extraFields = array('tt.name', 'tt.id_tag AS id');
|
||||||
$this->L1inner = 'INNER JOIN ttag tt ON tt.id_tag = x2.g';
|
$this->L1inner = 'INNER JOIN ttag tt ON tt.id_tag = x2.g';
|
||||||
$this->L1orderByFinal = 'tt.name';
|
$this->L1orderByFinal = 'tt.name';
|
||||||
|
|
||||||
$this->L2condition = "AND ttm.id_tag = " . $this->rootID;
|
$this->L2condition = "AND ttm.id_tag = " . $this->rootID;
|
||||||
$this->L2inner = $this->L1innerInside;
|
$this->L2inner = $this->L1innerInside;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getData() {
|
protected function getData() {
|
||||||
if ($this->id == -1) {
|
if ($this->id == -1) {
|
||||||
$this->getFirstLevel();
|
$this->getFirstLevel();
|
||||||
} elseif ($this->type == 'tag') {
|
} elseif ($this->type == 'tag') {
|
||||||
$this->getSecondLevel();
|
$this->getSecondLevel();
|
||||||
} elseif ($this->type == 'agent') {
|
} elseif ($this->type == 'agent') {
|
||||||
$this->getThirdLevel();
|
$this->getThirdLevel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue