skills_wheel.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. use Chamilo\CoreBundle\Framework\Container;
  4. /**
  5. * @package chamilo.admin
  6. */
  7. $cidReset = true;
  8. //require_once '../inc/global.inc.php';
  9. $this_section = SECTION_SOCIAL;
  10. if (api_get_setting('skill.allow_skills_tool') != 'true') {
  11. api_not_allowed();
  12. }
  13. api_block_anonymous_users();
  14. //Adds the JS needed to use the jqgrid
  15. $htmlHeadXtra[] = api_get_js('js/d3/d3.v3.5.4.min.js');
  16. $htmlHeadXtra[] = api_get_js('js/d3/colorbrewer.js');
  17. $htmlHeadXtra[] = api_get_js('js/d3/jquery.xcolor.js');
  18. $userId = api_get_user_id();
  19. $userInfo = api_get_user_info();
  20. $skill = new Skill();
  21. $ranking = $skill->get_user_skill_ranking($userId);
  22. $skills = $skill->get_user_skills($userId, true);
  23. $dialogForm = new FormValidator('form', 'post', null, null, ['id' => 'add_item']);
  24. $dialogForm->addLabel(
  25. get_lang('Name'),
  26. Display::tag('p', null, ['id' => 'name', 'class' => 'form-control-static'])
  27. );
  28. $dialogForm->addLabel(
  29. get_lang('ShortCode'),
  30. Display::tag('p', null, ['id' => 'short_code', 'class' => 'form-control-static'])
  31. );
  32. $dialogForm->addLabel(
  33. get_lang('Parent'),
  34. Display::tag('p', null, ['id' => 'parent', 'class' => 'form-control-static'])
  35. );
  36. $dialogForm->addLabel(
  37. [get_lang('Gradebook'), get_lang('WithCertificate')],
  38. Display::tag('ul', null, ['id' => 'gradebook', 'class' => 'form-control-static list-unstyled'])
  39. );
  40. $dialogForm->addLabel(
  41. get_lang('Description'),
  42. Display::tag('p', null, ['id' => 'description', 'class' => 'form-control-static'])
  43. );
  44. $wheelUrl = api_get_path(WEB_AJAX_PATH)."skill.ajax.php?a=get_skills_tree_json&load_user=$userId";
  45. $url = api_get_path(WEB_AJAX_PATH).'skill.ajax.php?1=1';
  46. echo Container::getTemplating()->render(
  47. '@template_style/skill/skill_wheel_student.html.twig',
  48. [
  49. 'skill_id_to_load' => 0,
  50. 'url' => $url,
  51. 'wheel_url' => $wheelUrl,
  52. 'dialogForm' => $dialogForm->returnForm(),
  53. 'user_info' => $userInfo,
  54. 'ranking' => $ranking,
  55. 'skills' => $skills
  56. ]
  57. );