Minor corrections in UI

skala
Julio Montoya 13 years ago
parent 8484f974c6
commit e4723198dc
  1. 3
      main/inc/ajax/skill.ajax.php
  2. 18
      main/inc/lib/skill.lib.php
  3. 10
      main/template/default/skill/skill_wheel.js.tpl
  4. 3
      main/template/default/skill/skill_wheel.tpl
  5. 37
      main/template/default/skill/skill_wheel_student.tpl

@ -69,8 +69,6 @@ switch ($action) {
$course_info = api_get_course_info($_REQUEST['code']);
$courses = CourseManager::process_hot_course_item(array($course_info));
Display::display_no_header();
Display::$global_template->assign('span_size', 9);
Display::$global_template->assign('show_ranking', false);
Display::$global_template->assign('hot_courses', $courses);
echo Display::$global_template->fetch('default/layout/hot_course_item_popup.tpl');
break;
@ -98,7 +96,6 @@ switch ($action) {
break;
case 'get_skills':
$load_user_data = isset($_REQUEST['load_user_data']) ? $_REQUEST['load_user_data'] : null;
//$parent_id = intval($_REQUEST['parent_id']);
$id = intval($_REQUEST['id']);
$skills = $skill->get_all($load_user_data, false, $id);
echo json_encode($skills);

@ -280,7 +280,7 @@ class Skill extends Model {
var $required = array('name');
/** Array of colours by depth, for the coffee wheel. Each depth has 4 col */
var $colours = array(
/*var $colours = array(
0 => array('#f9f0ab', '#ecc099', '#e098b0', '#ebe378'),
1 => array('#d5dda1', '#4a5072', '#8dae43', '#72659d'),
2 => array('#b28647', '#2e6093', '#393e64', '#1e8323'),
@ -292,7 +292,7 @@ class Skill extends Model {
8 => array('#2e6093', '#2e6093', '#2e6093', '#2e6093'),
9 => array('#3a5988', '#3a5988', '#3a5988', '#3a5988'),
10 => array('#393e64', '#393e64', '#393e64', '#393e64'),
);
);*/
public function __construct() {
$this->table = Database::get_main_table(TABLE_MAIN_SKILL);
@ -327,7 +327,6 @@ class Skill extends Model {
function get_all($load_user_data = false, $user_id = false, $id = null, $parent_id = null) {
$id_condition = '';
if (isset($id) && !empty($id)) {
$id = intval($id);
$id_condition = " WHERE s.id = $id";
@ -359,16 +358,17 @@ class Skill extends Model {
}
}
/*
if ($load_user_data && $user_id) {
$passed_skills = $this->get_user_skills($user_id);
foreach ($skills as &$skill) {
$skill['done_by_user'] = 0;
if (in_array($skill['id'], $passed_skills)) {
$skill['done_by_user'] = 1;
}
}
}
}*/
//Load all children of the parent_id
if (!empty($skills) && !empty($parent_id)) {
@ -679,8 +679,6 @@ class Skill extends Model {
if (isset($skill['gradebooks']) && !empty($skill['gradebooks'])) {
$skill['data']['skill_has_gradebook'] = true;
}
$refs[$skill['id']] = &$skill;
$flat_array[$skill['id']] = &$skill;
}
@ -706,16 +704,14 @@ class Skill extends Model {
$refs['root']['children'][0]['children'][0] = $skills[$skill_id];
$flat_array[$skill_id] = $skills[$skill_id];
} else {
// Moving node to the children index of their parents
foreach ($skills as $my_skill_id => &$skill) {
$skill['data']['family_id'] = $new_family_array[$skill['id']];
$refs[$skill['parent_id']]['children'][] = &$skill;
$flat_array[$my_skill_id] = $skill;
}
}
$skills_tree = array(
'name' => get_lang('SkillRootName'),
'id' => 'root',
@ -764,7 +760,7 @@ class Skill extends Model {
if (is_array($elem['children'])) {
$tmp['children'] = $this->get_skill_json($elem['children'], $depth+1, $max_depth);
} else {
$tmp['colour'] = $this->colours[$depth][rand(0,3)];
//$tmp['colour'] = $this->colours[$depth][rand(0,3)];
}
if ($depth > $max_depth) {
continue;

@ -125,7 +125,7 @@ bright red for missing skills, in the "Required skills" view for a student when
*/
function set_skill_style(d, attribute) {
function set_skill_style(d, attribute, searched_skill_id) {
//Nice rainbow colors
return_fill = get_color(d);
@ -150,6 +150,12 @@ bright red for missing skills, in the "Required skills" view for a student when
return_fill = '#F89406';
//return_stroke = 'grey';
}
//console.log(d.id +' - ' + searched_skill_id);
if (searched_skill_id) {
if (d.id == searched_skill_id) {
// return_fill = '#B94A48';
}
}
switch (attribute) {
case 'fill':
@ -454,7 +460,7 @@ function load_nodes(load_skill_id, main_depth) {
.attr("class", "skill_partition skill_background")
// .style("fill", colour)
.style("fill", function(d) {
return set_skill_style(d, 'fill');
return set_skill_style(d, 'fill', load_skill_id);
})
.style("stroke", function(d) {
return set_skill_style(d, 'stroke');

@ -422,12 +422,9 @@ $(document).ready(function() {
}
return d.colour || "#fff";
}*/
});
</script>
<div class="container-fluid">
<div class="row-fluid">

@ -55,7 +55,6 @@ function fill_skill_search_li(skill_id, skill_name, checked) {
return '<li><a href="#" class="load_wheel" rel="'+skill_id+'">'+skill_name+'</a></li>';
}
function load_skill_info(skill_id) {
$.ajax({
url: url+'&a=get_skill_course_info&id='+skill_id,
@ -93,7 +92,7 @@ $(document).ready(function() {
load_nodes(skill_id, main_depth);
});
/* When clicking in a course title */
$("#skill_info").on("click", "a.course_description_popup", function() {
course_code = $(this).attr('rel');
$.ajax({
@ -242,40 +241,6 @@ $(document).ready(function() {
$("#dialog-form").dialog("open");
}
if (parent) {
$("#id").attr('value','');
$("#name").attr('value', '');
$("#short_code").attr('value', '');
$("#description").attr('value', '');
//Filling parent_id
$("#parent_id").append('<option class="selected" value="'+parent.id+'" selected="selected" >');
$("#skill_edit_holder").append('<li class="bit-box">'+parent.name+'</li>');
//Filling the gradebook_id
jQuery.each(parent.gradebooks, function(index, data) {
$("#gradebook_id").append('<option class="selected" value="'+data.id+'" selected="selected" >');
$("#gradebook_holder").append('<li id="gradebook_item_'+data.id+'" class="bit-box">'+data.name+' <a rel="'+data.id+'" class="closebutton" href="#"></a> </li>');
});
$("#dialog-form").dialog({
buttons: {
"{{ "Save"|get_lang }}" : function() {
var params = $("#add_item").find(':input').serialize();
add_skill(params);
}
},
close: function() {
$("#name").attr('value', '');
$("#description").attr('value', '');
load_nodes(0, main_depth);
}
});
$("#dialog-form").dialog("open");
}
}
});
</script>

Loading…
Cancel
Save