Fixing "my skills" blue colors see #1791

skala
Julio Montoya 13 years ago
parent cbcd25d66c
commit 1c098932b1
  1. 65
      main/inc/ajax/skill.ajax.php
  2. 2
      main/social/skills_wheel.php
  3. 39
      main/template/default/skill/skill_wheel.js.tpl

@ -11,20 +11,30 @@ require_once api_get_path(LIBRARY_PATH).'gradebook.lib.php';
$action = isset($_REQUEST['a']) ? $_REQUEST['a'] : null;
if (api_get_setting('allow_skills_tool') != 'true') {
exit;
}
api_block_anonymous_users();
$skill = new Skill();
$gradebook = new Gradebook();
$skill_gradebook = new SkillRelGradebook();
switch ($action) {
case 'add':
if (isset($_REQUEST['id']) && !empty($_REQUEST['id'])) {
$skill_id = $skill->edit($_REQUEST);
} else {
$skill_id = $skill->add($_REQUEST);
}
case 'add':
if (api_is_platform_admin() || api_is_drh()) {
if (isset($_REQUEST['id']) && !empty($_REQUEST['id'])) {
$skill_id = $skill->edit($_REQUEST);
} else {
$skill_id = $skill->add($_REQUEST);
}
}
echo $skill_id;
case 'delete_skill':
echo $skill->delete($_REQUEST['skill_id']);
if (api_is_platform_admin() || api_is_drh()) {
echo $skill->delete($_REQUEST['skill_id']);
}
break;
case 'find_skills':
$skills = $skill->find('all', array('where' => array('name LIKE %?% '=>$_REQUEST['tag'])));
@ -178,8 +188,7 @@ switch ($action) {
break;
case 'profile_matches':
$skill_rel_user = new SkillRelUser();
$skills = $_REQUEST['skill_id'];
$skills = $_REQUEST['skill_id'];
$total_skills_to_search = $skills;
@ -251,28 +260,32 @@ switch ($action) {
break;
case 'delete_gradebook_from_skill':
case 'remove_skill':
if (!empty($_REQUEST['skill_id']) && !empty($_REQUEST['gradebook_id'])) {
$skill_item = $skill_gradebook->get_skill_info($_REQUEST['skill_id'], $_REQUEST['gradebook_id']);
if (!empty($skill_item)) {
$skill_gradebook->delete($skill_item['id']);
echo 1;
if (api_is_platform_admin() || api_is_drh()) {
if (!empty($_REQUEST['skill_id']) && !empty($_REQUEST['gradebook_id'])) {
$skill_item = $skill_gradebook->get_skill_info($_REQUEST['skill_id'], $_REQUEST['gradebook_id']);
if (!empty($skill_item)) {
$skill_gradebook->delete($skill_item['id']);
echo 1;
} else {
echo 0;
}
} else {
echo 0;
echo 0;
}
} else {
echo 0;
}
break;
case 'save_profile':
$skill_profile = new SkillProfile();
$params = $_REQUEST;
//$params['skills'] = isset($_SESSION['skills']) ? $_SESSION['skills'] : null;
$params['skills'] = $params['skill_id'];
$skill_data = $skill_profile->save($params);
if (!empty($skill_data)) {
echo 1;
} else {
echo 0;
if (api_is_platform_admin() || api_is_drh()) {
$skill_profile = new SkillProfile();
$params = $_REQUEST;
//$params['skills'] = isset($_SESSION['skills']) ? $_SESSION['skills'] : null;
$params['skills'] = $params['skill_id'];
$skill_data = $skill_profile->save($params);
if (!empty($skill_data)) {
echo 1;
} else {
echo 0;
}
}
break;
case 'skill_exists':

@ -17,6 +17,8 @@ if (api_get_setting('allow_skills_tool') != 'true') {
api_not_allowed();
}
api_block_anonymous_users();
//Adds the JS needed to use the jqgrid
$htmlHeadXtra[] = api_get_js('d3/d3.v2.min.js');
$htmlHeadXtra[] = api_get_js('d3/colorbrewer.js');

@ -151,38 +151,39 @@ dark green for skills most searched for, summed up from the different saved sear
bright red for missing skills, in the "Required skills" view for a student when looking at the "Most wanted skills" (or later, when we will have developed that, for the "Matching position" view)
*/
/* Manage the partition colors */
/**
Manage the partition background colors
**/
function set_skill_style(d, attribute, searched_skill_id) {
//Default stroke
//Default border color (stroke)
return_stroke = 'black';
//Nice rainbow colors
return_fill = get_color(d);
//Grey colors using colorbrewer
//0. Nice rainbow colors (Comment 1.0 to see the rainbow!)
return_fill = get_color(d);
//1. Grey colors using colorbrewer
var p = color_patterns[18];
color = p(depth -1 + d.counter);
return_fill = d.color = color;
//blue - if user achieved that skill
if (d.achieved) {
return_fill = '#3A87AD';
//return_stroke = '#FCD23A';
}
return_fill = color;
//yellow - If the skill has a gradebook attached
//2. Yellow - If the skill has a gradebook attached
if (d.skill_has_gradebook) {
return_fill = '#F89406';
//return_stroke = 'grey';
}
//red - if to show the searched skill
//3. Red - if you search that skill
if (searched_skill_id) {
if (d.id == searched_skill_id) {
return_fill = '#B94A48';
}
}
//4. Blue - if user achieved that skill
if (d.achieved) {
return_fill = '#3A87AD';
//return_stroke = '#FCD23A';
}
switch (attribute) {
case 'fill':
@ -208,7 +209,6 @@ function click_partition(d, path, text, icon, arc, x, y, r, p, vis) {
console.log('main_parent_id: ' + main_parent_id);
}
if (d.depth >= main_depth) {
//main_depth += main_depth;
if (main_parent_id) {
@ -218,7 +218,6 @@ function click_partition(d, path, text, icon, arc, x, y, r, p, vis) {
}
}
if (d.id) {
console.log('Getting skill info');
skill_info = get_skill_info(d.parent_id);
@ -235,7 +234,7 @@ function click_partition(d, path, text, icon, arc, x, y, r, p, vis) {
load_nodes(main_parent_id, main_depth);
}
console.log('Continue to click_partition');
if (debug) console.log('Continue to click_partition');
//console.log(main_parent_id);
@ -585,7 +584,7 @@ function load_nodes(load_skill_id, main_depth, extra_parent_id) {
/* Text settings */
var textEnter = text.enter().append("text")
.style("fill-opacity", 1)
.style("fill", function(d) {
.style("fill", function(d) {
return brightness(d3.rgb(d.color)) < 125 ? "#eee" : "#000";
})
.attr("text-anchor", function(d) {

Loading…
Cancel
Save