view.tpl 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. <div id="learning_path_main" class="{{ is_allowed_to_edit ? 'lp-view-include-breadcrumb' }} {{ lp_mode == 'embedframe' ? 'lp-view-collapsed' : '' }}">
  2. {% if show_left_column == 1 %}
  3. <div id="learning_path_left_zone" class="sidebar-scorm">
  4. <div class="lp-view-zone-container">
  5. <div id="scorm-info">
  6. <div id="panel-scorm" class="panel-body">
  7. <div class="image-avatar">
  8. {% if lp_author == '' %}
  9. <div class="text-center">
  10. {{ lp_preview_image }}
  11. </div>
  12. {% else %}
  13. <div class="media-author">
  14. <div class="media-author-avatar">
  15. {{ lp_preview_image }}
  16. </div>
  17. <div class="media-author-description">
  18. {{ lp_author }}
  19. </div>
  20. </div>
  21. {% endif %}
  22. </div>
  23. {% if show_audio_player %}
  24. <div id="lp_media_file" class="audio-scorm">
  25. {{ media_player }}
  26. </div>
  27. {% endif %}
  28. {% if lp_accumulate_work_time != '' %}
  29. {% set lp_progress %}
  30. <style>
  31. #timer .container{display:table;background:#777;color:#eee;font-weight:bold;width:100%;text-align:center;text-shadow:1px 1px 4px #999;}
  32. #timer .container div{display:table-cell;font-size:24px;padding:0px;width:20px;}
  33. #timer .container .divider{width:10px;color:#ddd;}
  34. </style>
  35. <script>
  36. $(function() {
  37. var timerData = {
  38. hour: parseInt($("#hour").text()),
  39. minute: parseInt($("#minute").text()),
  40. second: parseInt($("#second").text())
  41. };
  42. clearInterval(window.timerInterval);
  43. window.timerInterval = setInterval(function(){
  44. // Seconds
  45. timerData.second++;
  46. if (timerData.second >= 60) {
  47. timerData.second = 0;
  48. timerData.minute++;
  49. }
  50. // Minutes
  51. if (timerData.minute >= 60) {
  52. timerData.minute = 0;
  53. timerData.hour++;
  54. }
  55. $("#hour").text(timerData.hour < 10 ? '0' + timerData.hour : timerData.hour);
  56. $("#minute").text(timerData.minute < 10 ? '0' + timerData.minute : timerData.minute);
  57. $("#second").text(timerData.second < 10 ? '0' + timerData.second : timerData.second);
  58. }, 1000);
  59. })
  60. </script>
  61. <div class="row">
  62. <div class="col-xs-4">
  63. <b>
  64. {{ "ProgressSpentInLp"|get_lang|format(lp_accumulate_work_time) }}
  65. </b>
  66. </div>
  67. <div class="col-xs-8">
  68. <div id="progress_bar">
  69. {{ progress_bar }}
  70. </div>
  71. </div>
  72. </div>
  73. <div class="row">
  74. <div class="col-xs-4">
  75. <b>
  76. {{ "TimeSpentInLp"|get_lang|format(lp_accumulate_work_time) }}
  77. </b>
  78. </div>
  79. <div class="col-xs-8">
  80. <div id="timer">
  81. <div class="container">
  82. <div id="hour">{{ hour }}</div>
  83. <div class="divider">:</div>
  84. <div id="minute">{{ minute }}</div>
  85. <div class="divider">:</div>
  86. <div id="second">{{ second }}</div>
  87. <div id="slash"> / </div>
  88. <div>{{ hour_min }}</div>
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. {% endset %}
  94. {% else %}
  95. {% set lp_progress %}
  96. <div id="progress_bar">
  97. {{ progress_bar }}
  98. </div>
  99. {% endset %}
  100. {% endif %}
  101. {% if gamification_mode == 1 %}
  102. <!--- gamification -->
  103. <div id="scorm-gamification">
  104. <div class="row">
  105. <div class="col-xs-6">
  106. {% if gamification_stars > 0 %}
  107. {% for i in 1..gamification_stars %}
  108. <em class="fa fa-star level"></em>
  109. {% endfor %}
  110. {% endif %}
  111. {% if gamification_stars < 4 %}
  112. {% for i in 1..4 - gamification_stars %}
  113. <em class="fa fa-star"></em>
  114. {% endfor %}
  115. {% endif %}
  116. </div>
  117. <div class="col-xs-6 text-right">
  118. {{ "XPoints"|get_lang|format(gamification_points) }}
  119. </div>
  120. </div>
  121. <div class="row">
  122. <div class="col-xs-12 navegation-bar">
  123. {{ lp_progress }}
  124. </div>
  125. </div>
  126. </div>
  127. <!--- end gamification -->
  128. {% else %}
  129. {{ lp_progress }}
  130. {% endif %}
  131. {{ teacher_toc_buttons }}
  132. </div>
  133. </div>
  134. {# TOC layout #}
  135. <div id="toc_id" class="scorm-body" name="toc_name">
  136. {% include 'learnpath/scorm_list.tpl'|get_template %}
  137. </div>
  138. {# end TOC layout #}
  139. </div>
  140. </div>
  141. {# end left zone #}
  142. {% endif %}
  143. {# Right zone #}
  144. <div id="learning_path_right_zone" class="{{ show_left_column == 1 ? 'content-scorm' : 'no-right-col' }}">
  145. <div class="lp-view-zone-container">
  146. <div class="lp-view-tabs">
  147. <div id="navTabsbar" class="nav-tabs-bar">
  148. <ul id="navTabs" class="nav nav-tabs tabs-right" role="tablist">
  149. <li role="presentation" class="active">
  150. <a href="#lp-view-content" title="{{ 'Lesson'|get_lang }}"
  151. aria-controls="lp-view-content" role="tab" data-toggle="tab">
  152. <span class="fa fa-book fa-2x fa-fw" aria-hidden="true"></span>
  153. <span class="sr-only">{{ 'Lesson'|get_lang }}</span>
  154. </a>
  155. </li>
  156. <li role="presentation">
  157. <a href="#lp-view-forum" title="{{ 'Forum'|get_lang }}"
  158. aria-controls="lp-view-forum" role="tab" data-toggle="tab">
  159. <span class="fa fa-commenting-o fa-2x fa-fw" aria-hidden="true"></span>
  160. <span class="sr-only">{{ 'Forum'|get_lang }}</span>
  161. </a>
  162. </li>
  163. </ul>
  164. </div>
  165. <nav id="btn-menu-float" class="circular-menu">
  166. <div class="circle {{ show_toolbar_by_default == 1 ? 'open' : '' }}">
  167. {% if show_left_column == 1 %}
  168. <a href="#" title = "{{ 'Expand'|get_lang }}" id="lp-view-expand-toggle"
  169. class="icon-toolbar expand" role="button">
  170. {% if lp_mode == 'embedframe' %}
  171. <span class="fa fa-compress" aria-hidden="true"></span>
  172. <span class="sr-only">{{ 'Expand'|get_lang }}</span>
  173. {% else %}
  174. <span class="fa fa-expand" aria-hidden="true"></span>
  175. <span class="sr-only">{{ 'Expand'|get_lang }}</span>
  176. {% endif %}
  177. </a>
  178. {% endif %}
  179. <a id="home-course"
  180. title = "{{ 'Home'|get_lang }}"
  181. href="{{ button_home_url }}"
  182. class="icon-toolbar" target="_self"
  183. onclick="javascript: window.parent.API.save_asset();">
  184. <em class="fa fa-home"></em> <span class="hidden-xs hidden-sm"></span>
  185. </a>
  186. {{ navigation_bar }}
  187. </div>
  188. <a class="menu-button fa fa-bars icons" href="#"></a>
  189. </nav>
  190. <div id="tab-iframe" class="tab-content">
  191. <div role="tabpanel" class="tab-pane active" id="lp-view-content">
  192. <div id="wrapper-iframe">
  193. {% if lp_mode == 'fullscreen' %}
  194. <iframe
  195. id="content_id_blank"
  196. name="content_name_blank"
  197. src="blank.php"
  198. style="width:100%; height:100%"
  199. border="0"
  200. frameborder="0"
  201. allowfullscreen="true"
  202. webkitallowfullscreen="true" mozallowfullscreen="true"></iframe>
  203. {% else %}
  204. <iframe
  205. id="content_id"
  206. name="content_name"
  207. src="{{ iframe_src }}"
  208. style="width:100%; height:100%"
  209. border="0"
  210. frameborder="0"
  211. allowfullscreen="true"
  212. webkitallowfullscreen="true" mozallowfullscreen="true"></iframe>
  213. {% endif %}
  214. </div>
  215. </div>
  216. <div role="tabpanel" class="tab-pane" id="lp-view-forum">
  217. </div>
  218. </div>
  219. </div>
  220. </div>
  221. </div>
  222. {# end right Zone #}
  223. </div>
  224. <script>
  225. document.querySelector('.menu-button').onclick = function(e) {
  226. e.preventDefault(); document.querySelector('.circle').classList.toggle('open');
  227. }
  228. var LPViewUtils = {
  229. setHeightLPToc: function () {
  230. var scormInfoHeight = $('#scorm-info').outerHeight(true);
  231. $('#learning_path_toc').css({
  232. top: scormInfoHeight
  233. });
  234. }
  235. };
  236. $(function() {
  237. if (/iPhone|iPod|iPad/.test(navigator.userAgent)) {
  238. // Fix an issue where you cannot scroll below first screen in
  239. // learning paths on Apple devices
  240. document.getElementById('wrapper-iframe').setAttribute(
  241. 'style',
  242. 'width:100%; overflow:auto; position:auto; -webkit-overflow-scrolling:touch !important;'
  243. );
  244. // Fix another issue whereby buttons do not react to click below
  245. // second screen in learning paths on Apple devices
  246. document.getElementById('content_id').setAttribute('style', 'overflow: auto;');
  247. }
  248. {% if lp_mode == 'embedframe' %}
  249. $('#lp-view-expand-button, #lp-view-expand-toggle').on('click', function (e) {
  250. e.preventDefault();
  251. $('#learning_path_main').toggleClass('lp-view-collapsed');
  252. $('#lp-view-expand-toggle span.fa').toggleClass('fa-compress');
  253. $('#lp-view-expand-toggle span.fa').toggleClass('fa-expand');
  254. var className = $('#lp-view-expand-toggle span.fa').attr('class');
  255. if (className == 'fa fa-expand') {
  256. $(this).attr('title', '{{ "Expand" | get_lang }}');
  257. } else {
  258. $(this).attr('title', '{{ "Collapse" | get_lang }}');
  259. }
  260. if($('#navTabsbar').is(':hidden')) {
  261. $('#navTabsbar').show();
  262. } else {
  263. $('#navTabsbar').hide();
  264. }
  265. });
  266. {% else %}
  267. $('#lp-view-expand-button, #lp-view-expand-toggle').on('click', function (e) {
  268. e.preventDefault();
  269. $('#learning_path_main').toggleClass('lp-view-collapsed');
  270. $('#lp-view-expand-toggle span.fa').toggleClass('fa-expand');
  271. $('#lp-view-expand-toggle span.fa').toggleClass('fa-compress');
  272. var className = $('#lp-view-expand-toggle span.fa').attr('class');
  273. if (className == 'fa fa-expand') {
  274. $(this).attr('title', '{{ "Expand" | get_lang }}');
  275. } else {
  276. $(this).attr('title', '{{ "Collapse" | get_lang }}');
  277. }
  278. });
  279. {% endif %}
  280. $('.lp-view-tabs').on('click', '.disabled', function (e) {
  281. e.preventDefault();
  282. });
  283. $('a#ui-option').on('click', function (e) {
  284. e.preventDefault();
  285. var icon = $(this).children('.fa');
  286. if (icon.is('.fa-chevron-up')) {
  287. icon.removeClass('fa-chevron-up').addClass('fa-chevron-down');
  288. return;
  289. }
  290. icon.removeClass('fa-chevron-down').addClass('fa-chevron-up');
  291. });
  292. LPViewUtils.setHeightLPToc();
  293. $('.image-avatar img').load(function () {
  294. LPViewUtils.setHeightLPToc();
  295. });
  296. $('.scorm_item_normal a, #scorm-previous, #scorm-next').on('click', function () {
  297. $('.lp-view-tabs').animate({opacity: 0}, 500);
  298. });
  299. $('#learning_path_right_zone #lp-view-content iframe').on('load', function () {
  300. $('.lp-view-tabs a[href="#lp-view-content"]').tab('show');
  301. $('.lp-view-tabs').animate({opacity: 1}, 500);
  302. });
  303. loadForumThread({{ lp_id }}, {{ lp_current_item_id }});
  304. checkCurrentItemPosition({{ lp_current_item_id }});
  305. {% if glossary_extra_tools in glossary_tool_available_list %}
  306. // Loads the glossary library.
  307. (function () {
  308. {% if show_glossary_in_documents == 'ismanual' %}
  309. $.frameReady(
  310. function(){
  311. // $("<div>I am a div courses</div>").prependTo("body");
  312. },
  313. "#content_id",
  314. [
  315. { type:"script", id:"_fr1", src:"{{ jquery_web_path }}", deps: [
  316. { type:"script", id:"_fr4", src:"{{ jquery_ui_js_web_path }}"},
  317. { type:"script", id:"_fr2", src:"{{ _p.web_lib }}javascript/jquery.highlight.js"},
  318. {{ fix_link }}
  319. ]},
  320. { type:"stylesheet", id:"_fr5", src:"{{ jquery_ui_css_web_path }}"},
  321. ]
  322. );
  323. {% elseif show_glossary_in_documents == 'isautomatic' %}
  324. $.frameReady(
  325. function(){
  326. // $("<div>I am a div courses</div>").prependTo("body");
  327. },
  328. "#content_id",
  329. [
  330. { type:"script", id:"_fr1", src:"{{ jquery_web_path }}", deps: [
  331. { type:"script", id:"_fr4", src:"{{ jquery_ui_js_web_path }}"},
  332. { type:"script", id:"_fr2", src:"{{ _p.web_lib }}javascript/jquery.highlight.js"},
  333. {{ fix_link }}
  334. ]},
  335. { type:"stylesheet", id:"_fr5", src:"{{ jquery_ui_css_web_path }}"},
  336. ]
  337. );
  338. {% elseif fix_link != '' %}
  339. $.frameReady(
  340. function(){
  341. // $("<div>I am a div courses</div>").prependTo("body");
  342. },
  343. "#content_id",
  344. [
  345. { type:"script", id:"_fr1", src:"{{ jquery_web_path }}", deps: [
  346. { type:"script", id:"_fr4", src:"{{ jquery_ui_js_web_path }}"},
  347. {{ fix_link }}
  348. ]},
  349. { type:"stylesheet", id:"_fr5", src:"{{ jquery_ui_css_web_path }}"},
  350. ]
  351. );
  352. {% endif %}
  353. })();
  354. {% endif %}
  355. {% if disable_js_in_lp_view == 0 %}
  356. $(function() {
  357. var arr = ['link', 'sco'];
  358. if ($.inArray(olms.lms_item_type, arr) == -1) {
  359. {{ frame_ready }}
  360. }
  361. });
  362. {% endif %}
  363. $(window).on('resize', function () {
  364. LPViewUtils.setHeightLPToc();
  365. });
  366. });
  367. </script>