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