diff --git a/main/admin/skills_wheel.php b/main/admin/skills_wheel.php index 8a50915f81..ed04685f7b 100755 --- a/main/admin/skills_wheel.php +++ b/main/admin/skills_wheel.php @@ -40,11 +40,10 @@ if (isset($_GET['skill_id'])) { $url = api_get_path(WEB_AJAX_PATH)."skill.ajax.php?a=get_skills_tree_json&load_user=$load_user"; $tpl->assign('wheel_url', $url); - $url = api_get_path(WEB_AJAX_PATH).'skill.ajax.php?1=1'; $tpl->assign('url', $url); $tpl->assign('isAdministration', true); $content = $tpl->fetch('default/skill/skill_wheel.tpl'); $tpl->assign('content', $content); -$tpl->display_no_layout_template(); \ No newline at end of file +$tpl->display_no_layout_template(); diff --git a/main/template/default/skill/skill_wheel.js.tpl b/main/template/default/skill/skill_wheel.js.tpl index 8f3ea9b716..14f2a1af90 100755 --- a/main/template/default/skill/skill_wheel.js.tpl +++ b/main/template/default/skill/skill_wheel.js.tpl @@ -13,7 +13,7 @@ var main_parent_id = 0; // Used to split in two word or not var max_size_text_length = 20; - + /* ColorBrewer settings */ var my_domain = [1,2,3,4,5,6,7,8,9]; var col = 9; @@ -22,16 +22,16 @@ var color_patterns = []; /* See colorbrewer documentation - -color_patterns[1] = d3.scale.ordinal().domain(my_domain).range(colorbrewer.Blues[col]); + +color_patterns[1] = d3.scale.ordinal().domain(my_domain).range(colorbrewer.Blues[col]); color_patterns[2] = d3.scale.ordinal().domain(my_domain).range(colorbrewer.Purples[col]); color_patterns[2] = d3.scale.ordinal().domain(my_domain).range(colorbrewer.Blues[6]); -color_patterns[3] = d3.scale.ordinal().domain(my_domain).range(colorbrewer.Greens[col]); +color_patterns[3] = d3.scale.ordinal().domain(my_domain).range(colorbrewer.Greens[col]); color_patterns[4] = d3.scale.ordinal().domain(my_domain).range(colorbrewer.Reds[col]); color_patterns[5] = d3.scale.ordinal().domain(my_domain).range(colorbrewer.Oranges[col]); color_patterns[6] = d3.scale.ordinal().domain(my_domain).range(colorbrewer.YlOrBr[col]); -color_patterns[7] = d3.scale.ordinal().domain(my_domain).range(colorbrewer.YlGn[col]); +color_patterns[7] = d3.scale.ordinal().domain(my_domain).range(colorbrewer.YlGn[col]); color_patterns[8] = d3.scale.ordinal().domain(my_domain).range(colorbrewer.YlGnBu[col]); color_patterns[9] = d3.scale.ordinal().domain(my_domain).range(colorbrewer.GnBu[col]); color_patterns[10] = d3.scale.ordinal().domain(my_domain).range(colorbrewer.BuGn[col]); @@ -58,7 +58,7 @@ var color_loops = 4; // Generating array of colors thanks to the "$.xcolor.analogous" function we can create a rainbow style! for (i= 0; i < color_loops; i++) { - //Getting the latest color hex of the 8 colors loaded + //Getting the latest color hex of the 8 colors loaded last_color = colors[colors.length-1].getHex(); //Getting the complementary glue_color = $.xcolor.complementary(last_color); @@ -116,32 +116,32 @@ function isParentOf(p, c) { }); } return false; -} +} function get_color(d) { depth = d.depth; - if (d.family_id) { - /*var p = color_patterns[d.family_id]; + if (d.family_id) { + /*var p = color_patterns[d.family_id]; color = p(depth -1 + d.counter); - d.color = color;*/ - if (depth > 1) { + d.color = color;*/ + if (depth > 1) { family1 = colors[d.family_id]; - family2 = colors[d.family_id + 2]; - position = d.depth*d.counter; + family2 = colors[d.family_id + 2]; + position = d.depth*d.counter; //part_color = $.xcolor.gradientlevel(family1, family2, position, 100); - part_color = $.xcolor.lighten(family1, position, 15); + part_color = $.xcolor.lighten(family1, position, 15); color = part_color.getHex(); //console.log(d.depth + " - " + d.name + " + "+ color+ "+ " +d.counter); } else { - color = colors[d.family_id]; - } + color = colors[d.family_id]; + } return color; } color = '#fefefe'; return color; //missing colors } -/* +/* gray tones for all skills that have no particular property ("Basic skills wheel" view) yellow tones for skills that are provided by courses in Chamilo ("Teachable skills" view) bright blue tones for personal skills already acquired by the student currently looking at the weel ("My skills" view) @@ -152,7 +152,7 @@ bright red for missing skills, in the "Required skills" view for a student when */ /** - Manage the partition background colors + Manage the partition background colors **/ function set_skill_style(d, attribute, searched_skill_id) { //Default border color (stroke) @@ -160,14 +160,14 @@ function set_skill_style(d, attribute, searched_skill_id) { //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 = color; + return_fill = color; //2. Yellow - If the skill has a gradebook attached - if (d.skill_has_gradebook) { + if (d.skill_has_gradebook) { return_fill = '#F89406'; //return_stroke = 'grey'; } @@ -176,7 +176,7 @@ function set_skill_style(d, attribute, searched_skill_id) { if (d.isSearched) { return_fill = '#B94A48'; } - + //4. Blue - if user achieved that skill //var skill = false; $.ajax({ @@ -187,7 +187,7 @@ function set_skill_style(d, attribute, searched_skill_id) { return_fill = '#3A87AD'; } } - }); + }); switch (attribute) { case 'fill': @@ -203,7 +203,7 @@ function set_skill_style(d, attribute, searched_skill_id) { /* When you click a skill partition */ function click_partition(d, path, text, icon, arc, x, y, r, p, vis) { - //console.log(d.depth); + //console.log(d.depth); if (debug) { console.log('Clicking a partition skill id: '+d.id); console.log(d); @@ -213,27 +213,27 @@ 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) { + if (d.depth >= main_depth) { //main_depth += main_depth; - if (main_parent_id) { - load_nodes(main_parent_id, main_depth); + if (main_parent_id) { + load_nodes(main_parent_id, main_depth); } else { - load_nodes(d.id, main_depth); + load_nodes(d.id, main_depth); } } - if (d.id) { + if (d.id) { console.log('Getting skill info'); - skill_info = get_skill_info(d.parent_id); + skill_info = get_skill_info(d.parent_id); console.log(skill_info); - main_parent_id = skill_info.extra.parent_id; - main_parent_id = d.parent_id; + main_parent_id = skill_info.extra.parent_id; + main_parent_id = d.parent_id; console.log('Setting main_parent_id: ' + main_parent_id); } //console.log(main_parent_id); - /* "No id" means that we reach the center of the wheel go to the root*/ + /* "No id" means that we reach the center of the wheel go to the root*/ if (!d.id) { load_nodes(main_parent_id, main_depth); } @@ -285,7 +285,7 @@ function click_partition(d, path, text, icon, arc, x, y, r, p, vis) { return x(d.x + d.dx / 2) > Math.PI ? "end" : "start"; }; }) - .attrTween("transform", function(d) { + .attrTween("transform", function(d) { return function() { var angle = x(d.x + d.dx / 2) * 180 / Math.PI - 90, rotate = angle; @@ -300,12 +300,12 @@ function click_partition(d, path, text, icon, arc, x, y, r, p, vis) { });*/ } -/* - Open a popup in order to modify the skill +/* + Open a popup in order to modify the skill */ function open_popup(skill_id, parent_id) { - //Cleaning selects - $("#gradebook_id").find('option').remove(); + // Cleaning selects + $("#gradebook_id").find('option').remove(); $("#parent_id").find('option').remove(); //Cleaning lists $("#gradebook_holder").find('li').remove(); @@ -335,15 +335,15 @@ function open_popup(skill_id, parent_id) { $("#description").text(skill.description); } - //Filling parent_id - $("#parent_id").append(''); } - }, - }); + } + }); } }); } @@ -115,39 +114,39 @@ function check_gradebook() { //selecting only selected users $("#gradebook_id option:selected").each(function() { var gradebook_id = $(this).val(); - + if (gradebook_id != "" ) { - $.ajax({ - url: "{{ url }}&a=gradebook_exists", + $.ajax({ + url: "{{ url }}&a=gradebook_exists", data: "gradebook_id="+gradebook_id, - success: function(return_value) { + success: function(return_value) { if (return_value == 0 ) { - alert("{{ 'GradebookDoesNotExist'|get_lang }}"); + alert("{{ 'GradebookDoesNotExist'|get_lang }}"); //Deleting select option tag - $("#gradebook_id option[value="+gradebook_id+"]").remove(); + $("#gradebook_id option[value="+gradebook_id+"]").remove(); //Deleting holder $("#gradebook_row .holder li").each(function () { if ($(this).attr("rel") == gradebook_id) { $(this).remove(); } - }); - } else { - //Deleting holder + }); + } else { + //Deleting holder $("#gradebook_row .holder li").each(function () { if ($(this).attr("rel") == gradebook_id) { $(this).remove(); } }); - + if ($('#gradebook_item_'+gradebook_id).length == 0) { - gradebook = get_gradebook_info(gradebook_id); + gradebook = get_gradebook_info(gradebook_id); if (gradebook) { $("#gradebook_holder").append('
  • '+gradebook.name+'
  • '); - } + } } } - }, - }); + } + }); } }); } @@ -155,7 +154,7 @@ function check_gradebook() { function delete_gradebook_from_skill(skill_id, gradebook_id) { $.ajax({ url: url+'&a=delete_gradebook_from_skill&skill_id='+skill_id+'&gradebook_id='+gradebook_id, - async: false, + async: false, success: function(result) { //if (result == 1) { $('#gradebook_item_'+gradebook_id).remove(); @@ -172,29 +171,29 @@ function delete_gradebook_from_skill(skill_id, gradebook_id) { function return_skill_list_from_profile_search() { var skill_list = {}; - if ($("#profile_search li").length != 0) { + if ($("#profile_search li").length != 0) { $("#profile_search li").each(function(index) { - id = $(this).attr("id").split('_')[3]; - if (id) { + id = $(this).attr("id").split('_')[3]; + if (id) { skill_list[index] = id; } - }); + }); } return skill_list; } function submit_profile_search_form() { $("#skill_wheel").remove(); - + var skill_list = return_skill_list_from_profile_search(); if (skill_list.length != 0) { skill_list = { 'skill_id' : skill_list }; - skill_params = $.param(skill_list); + skill_params = $.param(skill_list); $.ajax({ url: url+'&a=profile_matches&'+skill_params, - async: false, + async: false, success: function (html) { //users = jQuery.parseJSON(users); $('#wheel_container').html(html); @@ -206,104 +205,100 @@ function submit_profile_search_form() { } function add_skill_in_profile_list(skill_id, skill_name) { - if ($('#profile_match_item_'+skill_id).length == 0 ) { - $('#profile_search').append('
  • '+skill_name+'
  • '); - } else { + if ($('#profile_match_item_'+skill_id).length == 0 ) { + $('#profile_search').append('
  • '+skill_name+'
  • '); + } else { $('#profile_match_item_'+skill_id).remove(); } toogle_save_profile_form(); } function toogle_save_profile_form() { - //Hiding showing the save this search + //Hiding showing the save this search if ($('#profile_search li').length == 0) { - $('#profile-options-container').hide(); + $('#profile-options-container').hide(); } else { $('#profile-options-container').show(); } } $(document).ready(function() { - /* Skill search */ - + /* Skill search */ + //Tool tip (in exercises) var tip_options = { placement : 'right' } $('.tooltip_skill').tooltip(tip_options); - + /* Skill item list onclick */ $("#skill_holder").on("click", "input.skill_to_select", function() { skill_id = $(this).attr('rel'); skill_name = $(this).attr('name'); add_skill_in_profile_list(skill_id, skill_name); }); - + /* URL link when searching skills */ $("#skill_holder").on("click", "a.load_wheel", function() { skill_id = $(this).attr('rel'); skill_to_load_from_get = 0; load_nodes(skill_id, main_depth); }); - + /* URL link when searching skills */ $("#skill_search").on("click", "a.load_root", function() { skill_id = $(this).attr('rel'); skill_to_load_from_get = 0; load_nodes(skill_id, main_depth); }); - - /*$("#skill_search").on("click", "a#clear_selection", function() { - - });*/ - - + /* Profile matcher */ - + /* Submit button */ $("#search_profile_form").submit(function() { submit_profile_search_form(); return false; }); - - $("#save_profile_form_button").submit(function() { + + $("#save_profile_form_button").submit(function() { open_save_profile_popup(); return false; }); - + /* Close button in profile matcher items */ $("#profile_search").on("click", "a.closebutton", function() { - skill_id = $(this).attr('rel'); + skill_id = $(this).attr('rel'); $('input[id=skill_to_select_id_'+skill_id+']').attr('checked', false); $('#profile_match_item_'+skill_id).remove(); submit_profile_search_form(); toogle_save_profile_form(); }); - - //Fill saved profiles list + + // Fill saved profiles list update_my_saved_profiles(); - + /* Click in profile */ $("#saved_profiles").on("click", "li.load_profile", function() { profile_id = $(this).attr('rel'); - $('#profile_id').attr('value',profile_id); + $('#profile_id').attr('value',profile_id); $.ajax({ url: '{{ url }}&a=get_skills_by_profile&profile_id='+profile_id, success:function(json) { - skill_list = jQuery.parseJSON(json); - + skill_list = jQuery.parseJSON(json); + $('#profile_search').empty(); - $('#skill_holder').empty(); - jQuery.each(skill_list, function(index, skill_id) { - skill_info = get_skill_info(skill_id); + $('#skill_holder').empty(); + jQuery.each(skill_list, function(index, skill_id) { + skill_info = get_skill_info(skill_id); li = fill_skill_search_li(skill_id, skill_info.name, 1); $("#skill_holder").append(li); add_skill_in_profile_list(skill_id, skill_info.name); - }); - submit_profile_search_form(); - } - }); + }); + submit_profile_search_form(); + } + }); }); + $("#saved_profiles").on('click', 'li.load_profile button.close', function () { var $parent = $(this).parent(); var profileId = $parent.attr('rel'); @@ -318,13 +313,13 @@ $(document).ready(function() { }); /* Wheel skill popup form */ - + /* Close button in gradebook select */ $("#gradebook_holder").on("click", "a.closebutton", function() { gradebook_id = $(this).attr('rel'); - skill_id = $('#id').attr('value'); - delete_gradebook_from_skill(skill_id, gradebook_id); - }); + skill_id = $('#id').attr('value'); + delete_gradebook_from_skill(skill_id, gradebook_id); + }); $("#skill_id").fcbkcomplete({ json_url: "{{ url }}&a=find_skills", @@ -337,8 +332,8 @@ $(document).ready(function() { onselect:"check_skills_sidebar", filter_selected: true, newel: true - }); - + }); + $("#parent_id").fcbkcomplete({ json_url: "{{ url }}&a=find_skills", cache: false, @@ -350,8 +345,8 @@ $(document).ready(function() { onselect:"check_skills_edit_form", filter_selected: true, newel: true - }); - + }); + $("#gradebook_id").fcbkcomplete({ json_url: "{{ url }}&a=find_gradebooks", cache: false, @@ -368,21 +363,21 @@ $(document).ready(function() { //Skill popup (edit, create child... ) $("#dialog-form").dialog({ autoOpen: false, - modal : true, - width : 600, + modal : true, + width : 600, height : 630 }); - + //Save search profile dialog $("#dialog-form-profile").dialog({ autoOpen: false, - modal : true, - width : 500, + modal : true, + width : 500, height : 400 }); - + load_nodes(0, main_depth); - + function open_save_profile_popup() { var profileId = $("#profile_id").val(); $.ajax({ @@ -395,16 +390,16 @@ $(document).ready(function() { } } }); - + $("#dialog-form-profile").dialog({ buttons: { "{{ "Save"|get_lang }}" : function() { var name = $("#name_profile").val(); var description = $("#description_profile").val(); - var skill_list = return_skill_list_from_profile_search(); + var skill_list = return_skill_list_from_profile_search(); skill_list = { 'skill_id' : skill_list }; skill_params = $.param(skill_list); - + $.ajax({ url: '{{ url }}&a=save_profile&name='+name+'&description='+description+'&'+skill_params+'&profile='+profileId, success:function(data) { @@ -414,33 +409,34 @@ $(document).ready(function() { } else { alert("{{ "Error"|get_lang }}"); } - - $("#dialog-form-profile").dialog("close"); + + $("#dialog-form-profile").dialog("close"); $("#name_profile").attr('value', ''); $("#description_profile").attr('value', ''); - $("#profile_id").attr('value', '0'); - } + $("#profile_id").attr('value', '0'); + } }); } }, - close: function() { + close: function() { $("#name_profile").attr('value', ''); $("#description_profile").attr('value', ''); - $("#profile_id").attr('value', '0'); + $("#profile_id").attr('value', '0'); } }); $("#dialog-form-profile").dialog("open"); } - + function update_my_saved_profiles() { $.ajax({ url: '{{ url }}&a=get_saved_profiles', success:function(data) { $("#saved_profiles").html(data); - } + } }); } -/* change background color */ + + /* change background color */ $(document).ready(function () { $("#celestial").click(function () { $("#page-back").css("background","#A9E2F3"); @@ -458,10 +454,11 @@ $(document).ready(function() { $("#page-back").css("background","#F7F8E0"); }); }); + /* Generated random colour */ /* function colour(d) { - + if (d.children) { // There is a maximum of two children! var colours = d.children.map(colour), @@ -469,7 +466,7 @@ $(document).ready(function() { b = d3.hsl(colours[1]); // L*a*b* might be better here... return d3.hsl((a.h + b.h) / 2, a.s * 1.2, a.levels_to_show / 1.2); - } + } return d.colour || "#fff"; }*/ }); @@ -483,7 +480,6 @@ $(document).ready(function() { {{ "ReturnToCourseList"|get_lang }} -
    @@ -585,72 +581,73 @@ $(document).ready(function() {
    -
    - -
    - +
    + +
    +
    - -
    - -
    - + +
    + +
    +
    -
    - -
    +
    + +
    - -
    - -
    + +
    + +
    - + +
    - + {{ 'WithCertificate'|get_lang }} - +
    - -
    - -
    - + +
    + +
    +
    -
    +
    -
    +
    + - \ No newline at end of file +