skills_wheel.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. api_block_anonymous_users();
  10. Skill::isAllowed(api_get_user_id());
  11. //Adds the JS needed to use the jqgrid
  12. $htmlHeadXtra[] = api_get_js('d3/d3.v3.5.4.min.js');
  13. $htmlHeadXtra[] = api_get_js('d3/colorbrewer.js');
  14. $htmlHeadXtra[] = api_get_js('d3/jquery.xcolor.js');
  15. $htmlHeadXtra[] = api_get_js('jquery.jsPlumb.all.js');
  16. $htmlHeadXtra[] = api_get_js('jqueryui-touch-punch/jquery.ui.touch-punch.min.js');
  17. $htmlHeadXtra[] = api_get_js('skills.js');
  18. $tpl = new Template(null, false, false);
  19. $userId = api_get_user_id();
  20. $userInfo = api_get_user_info();
  21. $skill = new Skill();
  22. $ranking = $skill->getUserSkillRanking($userId);
  23. $skills = $skill->getUserSkills($userId, true);
  24. $dialogForm = new FormValidator('form', 'post', null, null, ['id' => 'add_item']);
  25. $dialogForm->addLabel(
  26. get_lang('Name'),
  27. Display::tag('p', null, ['id' => 'name', 'class' => 'form-control-static'])
  28. );
  29. $dialogForm->addLabel(
  30. get_lang('ShortCode'),
  31. Display::tag('p', null, ['id' => 'short_code', 'class' => 'form-control-static'])
  32. );
  33. $dialogForm->addLabel(
  34. get_lang('Parent'),
  35. Display::tag('p', null, ['id' => 'parent', 'class' => 'form-control-static'])
  36. );
  37. $dialogForm->addLabel(
  38. [
  39. get_lang('Gradebook'),
  40. get_lang('WithCertificate'),
  41. ],
  42. Display::tag(
  43. 'ul',
  44. null,
  45. ['id' => 'gradebook', 'class' => 'form-control-static list-unstyled']
  46. )
  47. );
  48. $dialogForm->addLabel(
  49. get_lang('Description'),
  50. Display::tag('p', null, ['id' => 'description', 'class' => 'form-control-static'])
  51. );
  52. $type = 'read';
  53. $tree = $skill->getSkillsTree($userId, null, true);
  54. $skill_visualizer = new SkillVisualizer($tree, $type);
  55. $tpl->assign('skill_visualizer', $skill_visualizer);
  56. $tpl->assign('dialogForm', $dialogForm->returnForm());
  57. $url = api_get_path(WEB_AJAX_PATH)."skill.ajax.php?a=get_skills_tree_json&load_user=$userId";
  58. $tpl->assign('wheel_url', $url);
  59. $url = api_get_path(WEB_AJAX_PATH).'skill.ajax.php?1=1';
  60. $tpl->assign('url', $url);
  61. $tpl->assign('user_info', $userInfo);
  62. $tpl->assign('ranking', $ranking);
  63. $tpl->assign('skills', $skills);
  64. $template = $tpl->get_template('skill/skill_wheel_student.tpl');
  65. $content = $tpl->fetch($template);
  66. $tpl->assign('content', $content);
  67. $tpl->display_no_layout_template();