Set color to searched skills - refs #7347

1.9.x
Angel Fernando Quiroz Campos 11 years ago
parent 8f91cf3d19
commit f97487204d
  1. 34
      main/inc/lib/skill.lib.php
  2. 6
      main/template/default/skill/skill_wheel.js.tpl

@ -869,6 +869,7 @@ class Skill extends Model
$tmp = array();
$tmp['name'] = $elem['name'];
$tmp['id'] = $elem['id'];
$tmp['isSearched'] = self::isSearched($elem['id']);
if (is_array($elem['children'])) {
$tmp['children'] = $this->get_skill_json($elem['children'], $depth + 1, $max_depth);
@ -987,4 +988,37 @@ class Skill extends Model
}
return false;
}
public static function isSearched($id)
{
$id = intval($id);
if (empty($id)) {
return false;
}
$skillRelProfileTable = Database::get_main_table(TABLE_MAIN_SKILL_REL_PROFILE);
$result = Database::select(
'COUNT( DISTINCT `skill_id`) AS qty',
$skillRelProfileTable,
array(
'where' => array(
'skill_id = ?' => $id
)
),
'first'
);
if ($result === false) {
return false;
}
if ($result['qty'] > 0) {
return true;
}
return false;
}
}

@ -173,10 +173,8 @@ function set_skill_style(d, attribute, searched_skill_id) {
}
//3. Red - if you search that skill
if (searched_skill_id) {
if (d.id == searched_skill_id) {
return_fill = '#B94A48';
}
if (d.isSearched) {
return_fill = '#B94A48';
}
//4. Blue - if user achieved that skill

Loading…
Cancel
Save