view.tpl 19 KB

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