skill_wheel_student.tpl 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  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").fcbkcomplete({
  114. json_url: "{{ url }}&a=find_skills",
  115. cache: false,
  116. filter_case: false,
  117. filter_hide: true,
  118. complete_text: "{{ 'EnterTheSkillNameToSearch'|get_lang }}",
  119. firstselected: true,
  120. //onremove: "testme",
  121. onselect: "check_skills_sidebar",
  122. filter_selected: true,
  123. newel: true
  124. });
  125. load_nodes(0, main_depth);
  126. $('#frm-course-info').on('', function () {
  127. $('#frm-course-info').find('.modal-body').html('');
  128. });
  129. });
  130. </script>
  131. <div id="page-back" class="page-skill">
  132. <div class="container-fluid">
  133. <div class="row">
  134. <div class="col-md-3 skill-options">
  135. <p class="skill-home">
  136. <a class="btn btn-large btn-block btn-primary" href="{{ _p.web }}user_portal.php">
  137. <em class="fa fa-home"></em> {{ "ReturnToCourseList"|get_lang }}
  138. </a>
  139. </p>
  140. <div class="panel panel-default">
  141. <div class="panel-body">
  142. <figure class="text-center">
  143. <img width="100px" src="{{ user_info.avatar }}" class="img-circle center-block">
  144. <figcaption class="lead">{{ user_info.complete_name }}</figcaption>
  145. </figure>
  146. <p class="text-center">
  147. <a href="{{ _p.web_main }}social/skills_ranking.php" class="btn btn-default" target="_blank">{{ 'YourSkillRankingX'|get_lang|format(ranking) }}</a>
  148. </p>
  149. <div class="text-center">
  150. {% if skills is not empty %}
  151. {% for skill in skills %}
  152. {% if skill.icon is empty %}
  153. <img src="{{ 'badges.png'|icon(32) }}" width="32" height="32" alt="{{ skill.name }}" title="{{ skill.name }}">
  154. {% else %}
  155. <img src="{{ skill.web_icon_thumb_path }}" width="32" height="32" alt="{{ skill.name }}" title="{{ skill.name }}">
  156. {% endif %}
  157. {% endfor %}
  158. {% endif %}
  159. {% for i in 1..(5 - ranking) %}
  160. <img src="{{ 'badges-default.png'|icon(32) }}" width="32" height="32">
  161. {% endfor %}
  162. </div>
  163. </div>
  164. </div>
  165. <!-- ACCORDION -->
  166. <div class="accordion" id="accordion2">
  167. <div class="panel panel-default">
  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. <h5 class="page-header">{{ 'SkillsSearch'|get_lang }}</h5>
  178. <form id="skill_search" class="form-search">
  179. <select id="skill_id" name="skill_id" /></select>
  180. <table id="skill_holder" class="table table-condensed"></table>
  181. </form>
  182. </div>
  183. <!-- END SEARCH -->
  184. <!-- INFO SKILL -->
  185. <h5 class="page-header">{{ 'SkillInfo'|get_lang }}</h5>
  186. <div id="skill_info"></div>
  187. <!-- END INFO SKILL -->
  188. <p>
  189. <a class="btn btn-default btn-block load_root" rel="0" href="#">
  190. <em class="fa fa-eye"></em> {{ "ViewSkillsWheel"|get_lang }}
  191. </a>
  192. </p>
  193. </div>
  194. </div>
  195. </div>
  196. </div>
  197. <div class="panel-group" id="wheel-second-accordion" role="tablist" aria-multiselectable="true">
  198. <div class="panel panel-default">
  199. <div class="panel-heading" role="tab" id="wheel-legend-heading">
  200. <h4 class="panel-title">
  201. <a role="button" data-toggle="collapse" data-parent="#wheel-second-accordion" href="#wheel-legend-collapse" aria-expanded="true" aria-controls="wheel-legend-collapse">
  202. {{ "Legend"|get_lang }}
  203. </a>
  204. </h4>
  205. </div>
  206. <div id="wheel-legend-collapse" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="wheel-legend-heading">
  207. <div class="panel-body">
  208. <ul class="fa-ul">
  209. <li>
  210. <em class="fa fa-li fa-square skill-legend-basic"></em> {{ "BasicSkills"|get_lang }}
  211. </li>
  212. <li>
  213. <em class="fa fa-li fa-square skill-legend-badges"></em> {{ "SkillsYouAcquired"|get_lang }}
  214. </li>
  215. <li>
  216. <em class="fa fa-li fa-square skill-legend-add"></em> {{ "SkillsYouCanLearn"|get_lang }}
  217. </li>
  218. <li>
  219. <em class="fa fa-li fa-square skill-legend-search"></em> {{ "SkillsSearchedFor"|get_lang }}
  220. </li>
  221. </ul>
  222. </div>
  223. </div>
  224. </div>
  225. <div class="panel panel-default">
  226. <div class="panel-heading" role="tab" id="wheel-display-heading">
  227. <h4 class="panel-title">
  228. <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">
  229. {{ 'DisplayOptions'|get_lang }}
  230. </a>
  231. </h4>
  232. </div>
  233. <div id="wheel-display-collapse" class="panel-collapse collapse" role="tabpanel" aria-labelledby="wheel-display-heading">
  234. <div class="panel-body">
  235. <p>{{ 'ChooseABackgroundColor'|get_lang }}</p>
  236. <ul class="list-unstyled" id="skill-change-background-options">
  237. <li><a href="#" data-color="#FFFFFF">{{ 'White'|get_lang }}</a></li>
  238. <li><a href="#" data-color="#000000">{{ 'Black'|get_lang }}</a></li>
  239. <li><a href="#" data-color="#A9E2F3">{{ 'LightBlue' }}</a></li>
  240. <li><a href="#" data-color="#848484">{{ 'Gray'|get_lang }}</a></li>
  241. <li><a href="#" data-color="#F7F8E0">{{ 'Corn'|get_lang }}</a></li>
  242. </ul>
  243. </div>
  244. </div>
  245. </div>
  246. </div>
  247. <!-- END ACCORDEON -->
  248. </div>
  249. <div id="wheel_container" class="col-md-9">
  250. <div id="skill_wheel">
  251. <img src="">
  252. </div>
  253. </div>
  254. </div>
  255. </div>
  256. </div>
  257. <div class="modal fade" id="frm-skill" tabindex="-1" role="dialog" aria-labelledby="form-skill-title" aria-hidden="true">
  258. <div class="modal-dialog modal-lg">
  259. <div class="modal-content">
  260. <div class="modal-header">
  261. <button type="button" class="close" data-dismiss="modal" aria-label="{{ "Close" | get_lang }}">
  262. <span aria-hidden="true">&times;</span>
  263. </button>
  264. <h4 class="modal-title" id="form-skill-title">{{ "Skill" | get_lang }}</h4>
  265. </div>
  266. <div class="modal-body">
  267. {{ dialogForm }}
  268. </div>
  269. <div class="modal-footer">
  270. <button type="button" class="btn btn-primary" data-dismiss="modal">
  271. {{ "Close" | get_lang }}
  272. </button>
  273. </div>
  274. </div>
  275. </div>
  276. </div>
  277. <div class="modal fade" id="frm-course-info" tabindex="-1" role="dialog" aria-labelledby="form-course-info-title" aria-hidden="true">
  278. <div class="modal-dialog">
  279. <div class="modal-content">
  280. <div class="modal-header">
  281. <button type="button" class="close" data-dismiss="modal" aria-label="{{ "Close" | get_lang }}">
  282. <span aria-hidden="true">&times;</span>
  283. </button>
  284. <h4 class="modal-title" id="form-course-info-title">{{ "ChooseCourse" | get_lang }}</h4>
  285. </div>
  286. <div class="modal-body"></div>
  287. <div class="modal-footer">
  288. <button type="button" class="btn btn-primary" data-dismiss="modal">{{ "Close" | get_lang }}</button>
  289. </div>
  290. </div>
  291. </div>
  292. </div>