course_navigation.tpl 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. {# Course navigation icons - these are two optional features that have to be enabled through admin settings #}
  2. {% if show_header == true %}
  3. {% if show_course_shortcut is not null %}
  4. <div class="col-md-12">
  5. {{ show_course_shortcut }}
  6. </div>
  7. {% endif %}
  8. {% if show_course_navigation_menu is not null %}
  9. <script>
  10. $(document).ready( function() {
  11. if (readCookie('menu_state') == 0) {
  12. swap_menu();
  13. }
  14. });
  15. function createCookie(name, value, days) {
  16. if (days) {
  17. var date = new Date();
  18. date.setTime(date.getTime()+(days*24*60*60*1000));
  19. var expires = "; expires="+date.toGMTString();
  20. }
  21. else var expires = "";
  22. document.cookie = name+"="+value+expires+"; path=/";
  23. }
  24. function readCookie(name) {
  25. var nameEQ = name + "=";
  26. var ca = document.cookie.split(';');
  27. for (var i = 0; i < ca.length; i++)
  28. {
  29. var c = ca[i];
  30. while (c.charAt(0)==' ') c = c.substring(1,c.length);
  31. if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  32. }
  33. return null;
  34. }
  35. function swap_menu() {
  36. toolnavlist_el = document.getElementById('toolnav');
  37. center_el = document.getElementById('center');
  38. swap_menu_link_el = document.getElementById('swap_menu_link');
  39. if (toolnavlist_el.style.display == 'none') {
  40. toolnavlist_el.style.display = '';
  41. if (center_el) {
  42. center_el.style.margin = '0 190px 0 0';
  43. }
  44. swap_menu_link_el.innerHTML = '{{'Hide'|get_lang}}';
  45. createCookie('menu_state',1,10);
  46. } else {
  47. toolnavlist_el.style.display = 'none';
  48. if (center_el) {
  49. center_el.style.margin = '0 0 0 0';
  50. }
  51. swap_menu_link_el.innerHTML = '{{'Show'|get_lang}}';
  52. createCookie('menu_state',0,10);
  53. }
  54. }
  55. document.write('<div class="col-md-12 pull-right"> <a class="btn btn-default" href="javascript: void(0);" id="swap_menu_link" onclick="javascript: swap_menu();">{{'Hide'|get_lang}}<\/a></div>');
  56. </script>
  57. {{ show_course_navigation_menu }}
  58. {% endif %}
  59. {% endif %}