skill_wheel_student.tpl 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. {% include template ~ '/skill/skill_wheel.js.tpl' %}
  2. <script>
  3. /* Skill search input in the left menu */
  4. function check_skills_sidebar() {
  5. //Selecting only selected skills
  6. $("#skill_id option:selected").each(function() {
  7. var skill_id = $(this).val();
  8. if (skill_id != "" ) {
  9. $.ajax({
  10. url: "{{ url }}&a=skill_exists",
  11. data: "skill_id="+skill_id,
  12. // async: false,
  13. success: function(return_value) {
  14. if (return_value == 0 ) {
  15. alert("{{ 'SkillDoesNotExist'|get_lang }}");
  16. //Deleting select option tag
  17. //$("#skill_id option[value="+skill_id+"]").remove();
  18. $("#skill_id").empty();
  19. //Deleting holder
  20. $("#skill_search .holder li").each(function () {
  21. if ($(this).attr("rel") == skill_id) {
  22. $(this).remove();
  23. }
  24. });
  25. } else {
  26. $("#skill_id option[value="+skill_id+"]").remove();
  27. //Deleting holder
  28. $("#skill_search .holder li").each(function () {
  29. if ($(this).attr("rel") == skill_id) {
  30. $(this).remove();
  31. }
  32. });
  33. if ($('#skill_to_select_id_'+skill_id).length == 0) {
  34. skill_info = get_skill_info(skill_id);
  35. li = fill_skill_search_li(skill_id, skill_info.name);
  36. $("#skill_holder").append(li);
  37. }
  38. }
  39. },
  40. });
  41. }
  42. });
  43. }
  44. function fill_skill_search_li(skill_id, skill_name, checked) {
  45. checked_condition = '';
  46. if (checked == 1) {
  47. checked_condition = 'checked=checked';
  48. }
  49. return '<li><a id="skill_to_select_id_'+skill_id+'" href="#" class="load_wheel" rel="'+skill_id+'">'+skill_name+'</a></li>';
  50. }
  51. function load_skill_info(skill_id) {
  52. $.ajax({
  53. url: url+'&a=get_skill_course_info&id='+skill_id,
  54. async: false,
  55. success: function(data) {
  56. $('#skill_info').html(data);
  57. return data;
  58. }
  59. });
  60. }
  61. $(document).ready(function() {
  62. /* Skill search */
  63. /* Skill item list onclick */
  64. $("#skill_holder").on("click", "input.skill_to_select", function() {
  65. skill_id = $(this).attr('rel');
  66. skill_name = $(this).attr('name');
  67. add_skill_in_profile_list(skill_id, skill_name);
  68. });
  69. /* URL link when searching skills */
  70. $("#skill_holder").on("click", "a.load_wheel", function() {
  71. skill_id = $(this).attr('rel');
  72. skill_to_load_from_get = 0;
  73. load_nodes(skill_id, main_depth);
  74. load_skill_info(skill_id);
  75. });
  76. /* URL link when searching skills */
  77. $("#skill_search").on("click", "a.load_root", function() {
  78. skill_id = $(this).attr('rel');
  79. skill_to_load_from_get = 0;
  80. load_nodes(skill_id, main_depth);
  81. });
  82. /* When clicking in a course title */
  83. $("#skill_info").on("click", "a.course_description_popup[rel]", function(e) {
  84. e.preventDefault();
  85. var getCourseInfo = $.ajax(
  86. url,
  87. {
  88. data: {
  89. a: 'get_course_info_popup',
  90. code: $(this).attr('rel')
  91. }
  92. }
  93. );
  94. $.when(getCourseInfo).done(function(response) {
  95. $('#frm-course-info').find('.modal-body').html(response);
  96. $('#frm-course-info').modal('show');
  97. });
  98. });
  99. /* change background color */
  100. $("#celestial").click(function () {
  101. $("#page-back").css("background","#A9E2F3");
  102. });
  103. $("#white").click(function () {
  104. $("#page-back").css("background","#FFFFFF");
  105. });
  106. $("#black").click(function () {
  107. $("#page-back").css("background","#000000");
  108. });
  109. $("#lead").click(function () {
  110. $("#page-back").css("background","#848484");
  111. });
  112. $("#light-yellow").click(function () {
  113. $("#page-back").css("background","#F7F8E0");
  114. });
  115. /* Wheel skill popup form */
  116. $("#skill_id").fcbkcomplete({
  117. json_url: "{{ url }}&a=find_skills",
  118. cache: false,
  119. filter_case: false,
  120. filter_hide: true,
  121. complete_text:"{{ 'StartToType' | get_lang }}",
  122. firstselected: true,
  123. //onremove: "testme",
  124. onselect:"check_skills_sidebar",
  125. filter_selected: true,
  126. newel: true
  127. });
  128. load_nodes(0, main_depth);
  129. $('#frm-course-info').on('', function() {
  130. $('#frm-course-info').find('.modal-body').html('');
  131. });
  132. });
  133. </script>
  134. <div id="page-back" class="page-skill">
  135. <div class="container-fluid">
  136. <div class="row">
  137. <div class="col-md-3 skill-options">
  138. <div class="skill-home">
  139. <a class="btn btn-large btn-block btn-success" href="{{ _p.web }}user_portal.php">
  140. <i class="fa fa-home"></i> {{ "ReturnToCourseList"|get_lang }}</a>
  141. </div>
  142. <div class="skill-profile">
  143. <div class="avatar">
  144. <img width="100px" src="{{ user_info.avatar }}" style="text-align: center">
  145. </div>
  146. <div class="info-user">
  147. <h4 class="title-skill">{{ user_info.complete_name }}</h4>
  148. <p>
  149. <a href="{{ _p.web_main }}social/skills_ranking.php" class="btn btn-default btn-block" target="_blank">{{ 'YourSkillRankingX' | get_lang | format(ranking) }}</a>
  150. </p>
  151. {% if skills is not empty %}
  152. {% for skill in skills %}
  153. {% if skill.icon is empty %}
  154. <img src="{{ 'badges.png' | icon(32) }}" width="32" height="32" alt="{{ skill.name }}" title="{{ skill.name }}">
  155. {% else %}
  156. <img src="{{ skill.web_icon_thumb_path }}" alt="{{ skill.name }}" title="{{ skill.name }}">
  157. {% endif %}
  158. {% endfor %}
  159. {% endif %}
  160. {% for i in 1..(9 - ranking) %}
  161. <img src="{{ 'badges-default.png' | icon(32) }}" width="32" height="32">
  162. {% endfor %}
  163. </div>
  164. </div>
  165. <!-- ACCORDION -->
  166. <div class="accordion" id="accordion2">
  167. <div class="panel panel-primary">
  168. <div class="panel-heading">
  169. <a data-toggle="collapse" data-parent="#accordion2" href="#collapseTwo">
  170. {{ 'GetNewSkills' | get_lang }}
  171. </a>
  172. </div>
  173. <div id="collapseTwo" class="panel-collapse collapse">
  174. <div class="panel-body">
  175. <!-- SEARCH -->
  176. <div class="search-skill">
  177. <p class="text">{{ 'EnterTheSkillNameToSearch' | get_lang }}</p>
  178. <form id="skill_search" class="form-search">
  179. <select id="skill_id" name="skill_id" /></select>
  180. <div class="button-skill">
  181. <a class="btn btn-default btn-block load_root" rel="0" href="#"><i class="fa fa-eye"></i> {{ "ViewSkillsWheel"|get_lang }}</a>
  182. <!-- <a id="clear_selection" class="btn btn-danger">{{ "Clear"|get_lang }}</a> -->
  183. </div>
  184. <ul id="skill_holder" class="holder_simple"></ul>
  185. </form>
  186. </div>
  187. <!-- END SEARCH -->
  188. <!-- INFO SKILL -->
  189. <div class="section-info-skill">
  190. <p class="text">{{ 'SkillInfo'|get_lang }}</p>
  191. <div id="skill_info"></div>
  192. </div>
  193. <!-- END INFO SKILL -->
  194. </div>
  195. </div>
  196. </div>
  197. <div class="panel panel-primary">
  198. <div class="panel-heading">
  199. <a data-toggle="collapse" data-parent="#accordion2" href="#collapseThree">
  200. {{ 'DisplayOptions' | get_lang }}
  201. </a>
  202. </div>
  203. <div id="collapseThree" class="panel-collapse collapse">
  204. <div class="panel-body">
  205. <p class="text">{{ 'ChooseABackgroundColor' | get_lang }}</p>
  206. <ul>
  207. <li><a href="#" id="white">{{ 'White' | get_lang }}</a></li>
  208. <li><a href="#" id="black">{{ 'Black' | get_lang }}</a></li>
  209. <li><a href="#" id="celestial">{{ 'LightBlue' }}</a></li>
  210. <li><a href="#" id="lead">{{ 'Gray' | get_lang }}</a></li>
  211. <li><a href="#" id="light-yellow">{{ 'Corn' | get_lang }}</a></li>
  212. </ul>
  213. </div>
  214. </div>
  215. </div>
  216. <div class="panel panel-primary">
  217. <div class="panel-heading">
  218. <a data-toggle="collapse" data-parent="#accordion2" href="#collapseFour">
  219. {{ "Legend"|get_lang }}
  220. </a>
  221. </div>
  222. <div id="collapseFour" class="panel-collapse collapse">
  223. <div class="panel-body">
  224. <p class="text"><span class="skill-legend-badges">&nbsp;&nbsp;&nbsp;&nbsp;</span> {{ "SkillsYouAcquired"|get_lang }}</p>
  225. <p class="text"><span class="skill-legend-add">&nbsp;&nbsp;&nbsp;&nbsp;</span> {{ "SkillsYouCanLearn"|get_lang }}</p>
  226. <p class="text"><span class="skill-legend-search">&nbsp;&nbsp;&nbsp;&nbsp;</span> {{ "SkillsSearchedFor"|get_lang }}</p>
  227. </div>
  228. </div>
  229. </div>
  230. </div>
  231. <!-- END ACCORDEON -->
  232. </div>
  233. <div id="wheel_container" class="col-md-9">
  234. <div id="skill_wheel">
  235. <img src="">
  236. </div>
  237. </div>
  238. </div>
  239. </div>
  240. </div>
  241. <div class="modal fade" id="frm-skill" tabindex="-1" role="dialog" aria-labelledby="form-skill-title" aria-hidden="true">
  242. <div class="modal-dialog modal-lg">
  243. <div class="modal-content">
  244. <div class="modal-header">
  245. <button type="button" class="close" data-dismiss="modal" aria-label="{{ "Close" | get_lang }}">
  246. <span aria-hidden="true">&times;</span>
  247. </button>
  248. <h4 class="modal-title" id="form-skill-title">{{ "Skill" | get_lang }}</h4>
  249. </div>
  250. <div class="modal-body">
  251. {{ dialogForm }}
  252. </div>
  253. <div class="modal-footer">
  254. <button type="button" class="btn btn-primary" data-dismiss="modal">
  255. {{ "Close" | get_lang }}
  256. </button>
  257. </div>
  258. </div>
  259. </div>
  260. </div>
  261. <div class="modal fade" id="frm-course-info" tabindex="-1" role="dialog" aria-labelledby="form-course-info-title" aria-hidden="true">
  262. <div class="modal-dialog">
  263. <div class="modal-content">
  264. <div class="modal-header">
  265. <button type="button" class="close" data-dismiss="modal" aria-label="{{ "Close" | get_lang }}">
  266. <span aria-hidden="true">&times;</span>
  267. </button>
  268. <h4 class="modal-title" id="form-course-info-title">{{ "ChooseCourse" | get_lang }}</h4>
  269. </div>
  270. <div class="modal-body"></div>
  271. <div class="modal-footer">
  272. <button type="button" class="btn btn-primary" data-dismiss="modal">{{ "Close" | get_lang }}</button>
  273. </div>
  274. </div>
  275. </div>
  276. </div>