skill_wheel_student.tpl 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  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 '\
  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">{{ 'YourSkillRankingX'|get_lang|format(ranking) }}</a>
  153. </p>
  154. <div class="text-center">
  155. {% if skills is not empty %}
  156. {% for skill in skills %}
  157. {% if skill.icon is empty %}
  158. <img src="{{ 'badges.png'|icon(32) }}" width="32" height="32" alt="{{ skill.name }}" title="{{ skill.name }}">
  159. {% else %}
  160. <img src="{{ skill.web_icon_thumb_path }}" width="32" height="32" alt="{{ skill.name }}" title="{{ skill.name }}">
  161. {% endif %}
  162. {% endfor %}
  163. {% endif %}
  164. {% for i in 1..(5 - ranking) %}
  165. <img src="{{ 'badges-default.png'|icon(32) }}" width="32" height="32">
  166. {% endfor %}
  167. </div>
  168. </div>
  169. </div>
  170. <!-- ACCORDION -->
  171. <div class="accordion" id="accordion2">
  172. <div class="panel panel-default">
  173. <div class="panel-heading">
  174. <a data-toggle="collapse" data-parent="#accordion2" href="#collapseTwo">
  175. {{ 'GetNewSkills'|get_lang }}
  176. </a>
  177. </div>
  178. <div id="collapseTwo" class="panel-collapse collapse">
  179. <div class="panel-body">
  180. <!-- SEARCH -->
  181. <div class="search-skill">
  182. <h5 class="page-header">{{ 'SkillsSearch'|get_lang }}</h5>
  183. <form id="skill_search" class="form-search">
  184. <select id="skill_id" name="skill_id" multiple style="width: 100%;"></select>
  185. <table id="skill_holder" class="table table-condensed"></table>
  186. </form>
  187. </div>
  188. <!-- END SEARCH -->
  189. <!-- INFO SKILL -->
  190. <h5 class="page-header">{{ 'SkillInfo'|get_lang }}</h5>
  191. <div id="skill_info"></div>
  192. <!-- END INFO SKILL -->
  193. <p>
  194. <a class="btn btn-default btn-block load_root" rel="0" href="#">
  195. <em class="fa fa-eye"></em> {{ "ViewSkillsWheel"|get_lang }}
  196. </a>
  197. </p>
  198. </div>
  199. </div>
  200. </div>
  201. </div>
  202. <div class="panel-group" id="wheel-second-accordion" role="tablist" aria-multiselectable="true">
  203. <div class="panel panel-default">
  204. <div class="panel-heading" role="tab" id="wheel-legend-heading">
  205. <h4 class="panel-title">
  206. <a role="button" data-toggle="collapse" data-parent="#wheel-second-accordion" href="#wheel-legend-collapse" aria-expanded="true" aria-controls="wheel-legend-collapse">
  207. {{ "Legend"|get_lang }}
  208. </a>
  209. </h4>
  210. </div>
  211. <div id="wheel-legend-collapse" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="wheel-legend-heading">
  212. <div class="panel-body">
  213. <ul class="fa-ul">
  214. <li>
  215. <em class="fa fa-li fa-square skill-legend-basic"></em> {{ "BasicSkills"|get_lang }}
  216. </li>
  217. <li>
  218. <em class="fa fa-li fa-square skill-legend-badges"></em> {{ "SkillsYouAcquired"|get_lang }}
  219. </li>
  220. <li>
  221. <em class="fa fa-li fa-square skill-legend-add"></em> {{ "SkillsYouCanLearn"|get_lang }}
  222. </li>
  223. <li>
  224. <em class="fa fa-li fa-square skill-legend-search"></em> {{ "SkillsSearchedFor"|get_lang }}
  225. </li>
  226. </ul>
  227. </div>
  228. </div>
  229. </div>
  230. <div class="panel panel-default">
  231. <div class="panel-heading" role="tab" id="wheel-display-heading">
  232. <h4 class="panel-title">
  233. <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">
  234. {{ 'DisplayOptions'|get_lang }}
  235. </a>
  236. </h4>
  237. </div>
  238. <div id="wheel-display-collapse" class="panel-collapse collapse" role="tabpanel" aria-labelledby="wheel-display-heading">
  239. <div class="panel-body">
  240. <p>{{ 'ChooseABackgroundColor'|get_lang }}</p>
  241. <ul class="list-unstyled" id="skill-change-background-options">
  242. <li><a href="#" data-color="#FFFFFF">{{ 'White'|get_lang }}</a></li>
  243. <li><a href="#" data-color="#000000">{{ 'Black'|get_lang }}</a></li>
  244. <li><a href="#" data-color="#A9E2F3">{{ 'LightBlue' }}</a></li>
  245. <li><a href="#" data-color="#848484">{{ 'Gray'|get_lang }}</a></li>
  246. <li><a href="#" data-color="#F7F8E0">{{ 'Corn'|get_lang }}</a></li>
  247. </ul>
  248. </div>
  249. </div>
  250. </div>
  251. </div>
  252. <!-- END ACCORDEON -->
  253. </div>
  254. <div id="wheel_container" class="col-md-9">
  255. <div id="skill_wheel">
  256. <img src="">
  257. </div>
  258. </div>
  259. </div>
  260. </div>
  261. </div>
  262. <div class="modal fade" id="frm-skill" tabindex="-1" role="dialog" aria-labelledby="form-skill-title" aria-hidden="true">
  263. <div class="modal-dialog modal-lg">
  264. <div class="modal-content">
  265. <div class="modal-header">
  266. <button type="button" class="close" data-dismiss="modal" aria-label="{{ "Close" | get_lang }}">
  267. <span aria-hidden="true">&times;</span>
  268. </button>
  269. <h4 class="modal-title" id="form-skill-title">{{ "Skill" | get_lang }}</h4>
  270. </div>
  271. <div class="modal-body">
  272. {{ dialogForm }}
  273. </div>
  274. <div class="modal-footer">
  275. <button type="button" class="btn btn-primary" data-dismiss="modal">
  276. {{ "Close" | get_lang }}
  277. </button>
  278. </div>
  279. </div>
  280. </div>
  281. </div>
  282. <div class="modal fade" id="frm-course-info" tabindex="-1" role="dialog" aria-labelledby="form-course-info-title" aria-hidden="true">
  283. <div class="modal-dialog">
  284. <div class="modal-content">
  285. <div class="modal-header">
  286. <button type="button" class="close" data-dismiss="modal" aria-label="{{ "Close" | get_lang }}">
  287. <span aria-hidden="true">&times;</span>
  288. </button>
  289. <h4 class="modal-title" id="form-course-info-title">{{ "ChooseCourse" | get_lang }}</h4>
  290. </div>
  291. <div class="modal-body"></div>
  292. <div class="modal-footer">
  293. <button type="button" class="btn btn-primary" data-dismiss="modal">{{ "Close" | get_lang }}</button>
  294. </div>
  295. </div>
  296. </div>
  297. </div>