skills_wheel.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * @package chamilo.admin
  5. */
  6. $cidReset = true;
  7. require_once __DIR__.'/../inc/global.inc.php';
  8. $this_section = SECTION_SOCIAL;
  9. if (api_get_setting('allow_skills_tool') !== 'true') {
  10. api_not_allowed();
  11. }
  12. api_block_anonymous_users();
  13. //Adds the JS needed to use the jqgrid
  14. $htmlHeadXtra[] = api_get_js('d3/d3.v3.5.4.min.js');
  15. $htmlHeadXtra[] = api_get_js('d3/colorbrewer.js');
  16. $htmlHeadXtra[] = api_get_js('d3/jquery.xcolor.js');
  17. $htmlHeadXtra[] = api_get_js('jquery.jsPlumb.all.js');
  18. $htmlHeadXtra[] = api_get_js('jqueryui-touch-punch/jquery.ui.touch-punch.min.js');
  19. $htmlHeadXtra[] = api_get_js('skills.js');
  20. $tpl = new Template(null, false, false);
  21. $userId = api_get_user_id();
  22. $userInfo = api_get_user_info();
  23. $skill = new Skill();
  24. $ranking = $skill->get_user_skill_ranking($userId);
  25. $skills = $skill->get_user_skills($userId, true);
  26. $dialogForm = new FormValidator('form', 'post', null, null, ['id' => 'add_item']);
  27. $dialogForm->addLabel(
  28. get_lang('Name'),
  29. Display::tag('p', null, ['id' => 'name', 'class' => 'form-control-static'])
  30. );
  31. $dialogForm->addLabel(
  32. get_lang('ShortCode'),
  33. Display::tag('p', null, ['id' => 'short_code', 'class' => 'form-control-static'])
  34. );
  35. $dialogForm->addLabel(
  36. get_lang('Parent'),
  37. Display::tag('p', null, ['id' => 'parent', 'class' => 'form-control-static'])
  38. );
  39. $dialogForm->addLabel(
  40. [get_lang('Gradebook'), get_lang('WithCertificate')],
  41. Display::tag('ul', null, ['id' => 'gradebook', 'class' => 'form-control-static list-unstyled'])
  42. );
  43. $dialogForm->addLabel(
  44. get_lang('Description'),
  45. Display::tag('p', null, ['id' => 'description', 'class' => 'form-control-static'])
  46. );
  47. $type = 'read'; //edit
  48. $tree = $skill->get_skills_tree($userId, null, true);
  49. $skill_visualizer = new SkillVisualizer($tree, $type);
  50. $tpl->assign('skill_visualizer', $skill_visualizer);
  51. //$html = $skill_visualizer->return_html();
  52. //$tpl->assign('html', $html);
  53. $tpl->assign('dialogForm', $dialogForm->returnForm());
  54. $url = api_get_path(WEB_AJAX_PATH)."skill.ajax.php?a=get_skills_tree_json&load_user=$userId";
  55. $tpl->assign('wheel_url', $url);
  56. $url = api_get_path(WEB_AJAX_PATH).'skill.ajax.php?1=1';
  57. $tpl->assign('url', $url);
  58. $tpl->assign('user_info', $userInfo);
  59. $tpl->assign('ranking', $ranking);
  60. $tpl->assign('skills', $skills);
  61. $template = $tpl->get_template('skill/skill_wheel_student.tpl');
  62. $content = $tpl->fetch($template);
  63. $tpl->assign('content', $content);
  64. $tpl->display_no_layout_template();