skill_wheel_student.tpl 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. {% include 'skill/skill_wheel.js.tpl'|get_template %}
  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 '\
  50. <tr>\n\
  51. <td>' + skill_name + '</td>\n\
  52. <td class="text-right">\n\
  53. <button type="button" id="skill_to_select_id_' + skill_id + '" class="btn btn-warning btn-sm load_wheel" data-id="' + skill_id + '" title="{{ 'PlaceOnTheWheel'|get_lang }}" aria-label="{{ 'PlaceOnTheWheel'|get_lang }}">\n\
  54. <span class="fa fa-crosshairs fa-fw" aria-hidden="true"></span>\n\
  55. </button>\n\
  56. </td>\n\
  57. </tr>';
  58. }
  59. function load_skill_info(skill_id) {
  60. $.ajax({
  61. url: url + '&a=get_skill_course_info&id=' + skill_id,
  62. async: false,
  63. success: function (data) {
  64. $('#skill_info').html(data);
  65. return data;
  66. }
  67. });
  68. }
  69. $(document).ready(function () {
  70. /* Skill search */
  71. /* Skill item list onclick */
  72. $("#skill_holder").on("click", "input.skill_to_select", function () {
  73. skill_id = $(this).attr('rel');
  74. skill_name = $(this).attr('name');
  75. add_skill_in_profile_list(skill_id, skill_name);
  76. });
  77. /* URL link when searching skills */
  78. $("#skill_holder").on("click", "button.load_wheel", function () {
  79. skill_id = $(this).data('id') || 0;
  80. skill_to_load_from_get = 0;
  81. load_nodes(skill_id, main_depth);
  82. load_skill_info(skill_id);
  83. });
  84. /* URL link when searching skills */
  85. $("a.load_root").on("click", function (e) {
  86. e.preventDefault();
  87. skill_id = $(this).attr('rel');
  88. skill_to_load_from_get = 0;
  89. load_nodes(skill_id, main_depth);
  90. });
  91. /* When clicking in a course title */
  92. $("#skill_info").on("click", "a.course_description_popup[rel]", function (e) {
  93. e.preventDefault();
  94. var getCourseInfo = $.ajax(url, {
  95. data: {
  96. a: 'get_course_info_popup',
  97. code: $(this).attr('rel')
  98. }
  99. }
  100. );
  101. $.when(getCourseInfo).done(function (response) {
  102. $('#frm-course-info').find('.modal-body').html(response);
  103. $('#frm-course-info').modal('show');
  104. });
  105. });
  106. /* change background color */
  107. $('#skill-change-background-options li a').on('click', function (e) {
  108. e.preventDefault();
  109. var newBackgroundColor = $(this).data('color') || '#FFF';
  110. $("#page-back").css("background", newBackgroundColor);
  111. });
  112. /* Wheel skill popup form */
  113. $("#skill_id").select2({
  114. ajax: {
  115. url: '{{ url }}&a=find_skills',
  116. processResults: function (data) {
  117. return {
  118. results: data.items
  119. };
  120. }
  121. },
  122. cache: false,
  123. placeholder: '{{ 'EnterTheSkillNameToSearch'|get_lang }}'
  124. }).on('change', function () {
  125. check_skills_sidebar();
  126. });
  127. load_nodes(0, main_depth);
  128. $('#frm-course-info').on('', function () {
  129. $('#frm-course-info').find('.modal-body').html('');
  130. });
  131. $(".facebook-auto").css("width","100%");
  132. $(".facebook-auto ul").css("width","100%");
  133. $("ul.holder").css("width","100%");
  134. });
  135. </script>
  136. <div id="page-back" class="page-skill">
  137. <div class="container-fluid">
  138. <div class="row">
  139. <div class="col-md-3 skill-options">
  140. <p class="skill-home">
  141. <a class="btn btn-large btn-block btn-primary" href="{{ _p.web }}user_portal.php">
  142. <em class="fa fa-home"></em> {{ "ReturnToCourseList"|get_lang }}
  143. </a>
  144. </p>
  145. <div class="panel panel-default">
  146. <div class="panel-body">
  147. <figure class="text-center">
  148. <img width="100px" src="{{ user_info.avatar }}" class="img-circle center-block">
  149. <figcaption class="avatar-author">{{ user_info.complete_name }}</figcaption>
  150. </figure>
  151. <p class="text-center">
  152. <a href="{{ _p.web_main }}social/skills_ranking.php" class="btn btn-default" target="_blank">
  153. {{ 'YourSkillRankingX'|get_lang|format(ranking) }}
  154. </a>
  155. </p>
  156. <div class="text-center">
  157. {% if skills is not empty %}
  158. {% for skill in skills %}
  159. {{ skill.img_small }}
  160. {% endfor %}
  161. {% endif %}
  162. {% for i in 1..(5 - ranking) %}
  163. <img src="{{ 'badges-default.png'|icon(64) }}" width="64" height="64">
  164. {% endfor %}
  165. </div>
  166. </div>
  167. </div>
  168. <!-- ACCORDION -->
  169. <div class="accordion" id="accordion2">
  170. <div class="panel panel-default">
  171. <div class="panel-heading">
  172. <a data-toggle="collapse" data-parent="#accordion2" href="#collapseTwo">
  173. {{ 'GetNewSkills'|get_lang }}
  174. </a>
  175. </div>
  176. <div id="collapseTwo" class="panel-collapse collapse">
  177. <div class="panel-body">
  178. <!-- SEARCH -->
  179. <div class="search-skill">
  180. <h5 class="page-header">{{ 'SkillsSearch'|get_lang }}</h5>
  181. <form id="skill_search" class="form-search">
  182. <select id="skill_id" name="skill_id" multiple style="width: 100%;"></select>
  183. <table id="skill_holder" class="table table-condensed"></table>
  184. </form>
  185. </div>
  186. <!-- END SEARCH -->
  187. <!-- INFO SKILL -->
  188. <h5 class="page-header">{{ 'SkillInfo'|get_lang }}</h5>
  189. <div id="skill_info"></div>
  190. <!-- END INFO SKILL -->
  191. <p>
  192. <a class="btn btn-default btn-block load_root" rel="0" href="#">
  193. <em class="fa fa-eye"></em> {{ "ViewSkillsWheel"|get_lang }}
  194. </a>
  195. </p>
  196. </div>
  197. </div>
  198. </div>
  199. </div>
  200. <div class="panel-group" id="wheel-second-accordion" role="tablist" aria-multiselectable="true">
  201. <div class="panel panel-default">
  202. <div class="panel-heading" role="tab" id="wheel-legend-heading">
  203. <h4 class="panel-title">
  204. <a role="button" data-toggle="collapse" data-parent="#wheel-second-accordion" href="#wheel-legend-collapse" aria-expanded="true" aria-controls="wheel-legend-collapse">
  205. {{ "Legend"|get_lang }}
  206. </a>
  207. </h4>
  208. </div>
  209. <div id="wheel-legend-collapse" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="wheel-legend-heading">
  210. <div class="panel-body">
  211. <ul class="fa-ul">
  212. <li>
  213. <em class="fa fa-li fa-square skill-legend-basic"></em> {{ "BasicSkills"|get_lang }}
  214. </li>
  215. <li>
  216. <em class="fa fa-li fa-square skill-legend-badges"></em> {{ "SkillsYouAcquired"|get_lang }}
  217. </li>
  218. <li>
  219. <em class="fa fa-li fa-square skill-legend-add"></em> {{ "SkillsYouCanLearn"|get_lang }}
  220. </li>
  221. <li>
  222. <em class="fa fa-li fa-square skill-legend-search"></em> {{ "SkillsSearchedFor"|get_lang }}
  223. </li>
  224. </ul>
  225. </div>
  226. </div>
  227. </div>
  228. <div class="panel panel-default">
  229. <div class="panel-heading" role="tab" id="wheel-display-heading">
  230. <h4 class="panel-title">
  231. <a class="collapsed" role="button" data-toggle="collapse" data-parent="#wheel-second-accordion" href="#wheel-display-collapse" aria-expanded="false" aria-controls="wheel-display-collapse">
  232. {{ 'DisplayOptions'|get_lang }}
  233. </a>
  234. </h4>
  235. </div>
  236. <div id="wheel-display-collapse" class="panel-collapse collapse" role="tabpanel" aria-labelledby="wheel-display-heading">
  237. <div class="panel-body">
  238. <p>{{ 'ChooseABackgroundColor'|get_lang }}</p>
  239. <ul class="list-unstyled" id="skill-change-background-options">
  240. <li><a href="#" data-color="#FFFFFF">{{ 'White'|get_lang }}</a></li>
  241. <li><a href="#" data-color="#000000">{{ 'Black'|get_lang }}</a></li>
  242. <li><a href="#" data-color="#A9E2F3">{{ 'LightBlue'|get_lang }}</a></li>
  243. <li><a href="#" data-color="#848484">{{ 'Gray'|get_lang }}</a></li>
  244. <li><a href="#" data-color="#F7F8E0">{{ 'Corn'|get_lang }}</a></li>
  245. </ul>
  246. </div>
  247. </div>
  248. </div>
  249. </div>
  250. <!-- END ACCORDEON -->
  251. </div>
  252. <div id="wheel_container" class="col-md-9">
  253. <div id="skill_wheel">
  254. <img src="">
  255. </div>
  256. </div>
  257. </div>
  258. </div>
  259. </div>
  260. <div class="modal fade" id="frm-skill" tabindex="-1" role="dialog" aria-labelledby="form-skill-title" aria-hidden="true">
  261. <div class="modal-dialog modal-lg">
  262. <div class="modal-content">
  263. <div class="modal-header">
  264. <button type="button" class="close" data-dismiss="modal" aria-label="{{ "Close" | get_lang }}">
  265. <span aria-hidden="true">&times;</span>
  266. </button>
  267. <h4 class="modal-title" id="form-skill-title">{{ "Skill" | get_lang }}</h4>
  268. </div>
  269. <div class="modal-body">
  270. {{ dialogForm }}
  271. </div>
  272. <div class="modal-footer">
  273. <button type="button" class="btn btn-primary" data-dismiss="modal">
  274. {{ "Close" | get_lang }}
  275. </button>
  276. </div>
  277. </div>
  278. </div>
  279. </div>
  280. <div class="modal fade" id="frm-course-info" tabindex="-1" role="dialog" aria-labelledby="form-course-info-title" aria-hidden="true">
  281. <div class="modal-dialog">
  282. <div class="modal-content">
  283. <div class="modal-header">
  284. <button type="button" class="close" data-dismiss="modal" aria-label="{{ "Close" | get_lang }}">
  285. <span aria-hidden="true">&times;</span>
  286. </button>
  287. <h4 class="modal-title" id="form-course-info-title">{{ "ChooseCourse" | get_lang }}</h4>
  288. </div>
  289. <div class="modal-body"></div>
  290. <div class="modal-footer">
  291. <button type="button" class="btn btn-primary" data-dismiss="modal">{{ "Close" | get_lang }}</button>
  292. </div>
  293. </div>
  294. </div>
  295. </div>