From 6639d4f29231e2b679883873327c4593427a80ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Loguercio?= Date: Wed, 27 Jul 2016 18:29:56 -0500 Subject: [PATCH] Revert "Fix Skill Wheel that showing disabled skills - Refs #8370" --- main/inc/ajax/skill.ajax.php | 2 +- main/inc/lib/skill.lib.php | 33 ++++++++------------------------- 2 files changed, 9 insertions(+), 26 deletions(-) diff --git a/main/inc/ajax/skill.ajax.php b/main/inc/ajax/skill.ajax.php index 62845f114f..46f098a615 100755 --- a/main/inc/ajax/skill.ajax.php +++ b/main/inc/ajax/skill.ajax.php @@ -140,7 +140,7 @@ switch ($action) { $userId = isset($_REQUEST['load_user']) && $_REQUEST['load_user'] == 1 ? api_get_user_id() : 0; $skill_id = isset($_REQUEST['skill_id']) ? intval($_REQUEST['skill_id']) : 0; $depth = isset($_REQUEST['main_depth']) ? intval($_REQUEST['main_depth']) : 2; - $all = $skill->get_skills_tree_json($userId, $skill_id, false, $depth, true); + $all = $skill->get_skills_tree_json($userId, $skill_id, false, $depth); echo $all; break; case 'get_user_skill': diff --git a/main/inc/lib/skill.lib.php b/main/inc/lib/skill.lib.php index 536665df60..776fd4a84f 100755 --- a/main/inc/lib/skill.lib.php +++ b/main/inc/lib/skill.lib.php @@ -1089,28 +1089,18 @@ class Skill extends Model * @param int skill id * @param bool return a flat array or not * @param int depth of the skills - * @param bool filter status - * @return json + * */ - public function get_skills_tree_json($user_id = null, $skill_id = null, $return_flat_array = false, $main_depth = 2, $filter_status = false) + public function get_skills_tree_json($user_id = null, $skill_id = null, $return_flat_array = false, $main_depth = 2) { $tree = $this->get_skills_tree($user_id, $skill_id, $return_flat_array, true); $simple_tree = array(); if (!empty($tree['children'])) { foreach ($tree['children'] as $element) { - if ($filter_status) { - if (intval($element['status'])) { - $simple_tree[] = array( - 'name' => $element['name'], - 'children' => $this->get_skill_json($element['children'], 1, $main_depth, $filter_status) - ); - } - } else { - $simple_tree[] = array( - 'name' => $element['name'], - 'children' => $this->get_skill_json($element['children'], 1, $main_depth) - ); - } + $simple_tree[] = array( + 'name' => $element['name'], + 'children' => $this->get_skill_json($element['children'], 1, $main_depth) + ); } } @@ -1122,28 +1112,21 @@ class Skill extends Model * @param array $subtree * @param int $depth * @param int $max_depth - * @param bool $filter_status * @return array|null */ - public function get_skill_json($subtree, $depth = 1, $max_depth = 2, $filter_status = false) + public function get_skill_json($subtree, $depth = 1, $max_depth = 2) { $simple_sub_tree = array(); if (is_array($subtree)) { $counter = 1; foreach ($subtree as $elem) { - if ($filter_status) { - if (!intval($elem['status'])) { - break 1; - } - } - $tmp = array(); $tmp['name'] = $elem['name']; $tmp['id'] = $elem['id']; $tmp['isSearched'] = self::isSearched($elem['id']); if (isset($elem['children']) && is_array($elem['children'])) { - $tmp['children'] = $this->get_skill_json($elem['children'], $depth + 1, $max_depth, $filter_status); + $tmp['children'] = $this->get_skill_json($elem['children'], $depth + 1, $max_depth); } else { //$tmp['colour'] = $this->colours[$depth][rand(0,3)]; }