header.inc.php 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <?php
  2. /**
  3. ==============================================================================
  4. * This script displays the Dokeos header.
  5. *
  6. * @package dokeos.include
  7. ==============================================================================
  8. */
  9. /*----------------------------------------
  10. HEADERS SECTION
  11. --------------------------------------*/
  12. /*
  13. * HTTP HEADER
  14. */
  15. //Give a default value to $charset. Should change to UTF-8 some time in the future.
  16. //This parameter should be set in the platform configuration interface in time.
  17. $charset = api_get_setting('platform_charset');
  18. if(empty($charset))
  19. {
  20. $charset = 'ISO-8859-15';
  21. }
  22. //header('Content-Type: text/html; charset='. $charset)
  23. // or die ("WARNING : it remains some characters before &lt;?php bracket or after ?&gt end");
  24. header('Content-Type: text/html; charset='. $charset);
  25. if ( isset($httpHeadXtra) && $httpHeadXtra )
  26. {
  27. foreach($httpHeadXtra as $thisHttpHead)
  28. {
  29. header($thisHttpHead);
  30. }
  31. }
  32. // Get language iso-code for this page - ignore errors
  33. // The error ignorance is due to the non compatibility of function_exists()
  34. // with the object syntax of Database::get_language_isocode()
  35. @$document_language = Database::get_language_isocode($language_interface);
  36. if(empty($document_language))
  37. {
  38. //if there was no valid iso-code, use the english one
  39. $document_language = 'en';
  40. }
  41. /*
  42. * HTML HEADER
  43. */
  44. ?>
  45. <!DOCTYPE html
  46. PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  47. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  48. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $document_language; ?>" lang="<?php echo $document_language; ?>">
  49. <head>
  50. <title>
  51. <?php
  52. if(!empty($nameTools))
  53. {
  54. echo $nameTools.' - ';
  55. }
  56. if(!empty($_course['official_code']))
  57. {
  58. echo $_course['official_code'].' - ';
  59. }
  60. echo get_setting('siteName');
  61. ?>
  62. </title>
  63. <style type="text/css" media="screen, projection">
  64. /*<![CDATA[*/
  65. <?php
  66. $platform_theme= api_get_setting('stylesheets'); // plataform's css
  67. $my_style=$platform_theme;
  68. if(api_get_setting('user_selected_theme') == 'true')
  69. {
  70. $useri = api_get_user_info();
  71. $user_theme = $useri['theme'];
  72. if(!empty($user_theme) && $user_theme != $my_style)
  73. {
  74. $my_style = $user_theme; // user's css
  75. }
  76. }
  77. $mycourseid = api_get_course_id();
  78. if (!empty($mycourseid) && $mycourseid != -1)
  79. {
  80. if (api_get_setting('allow_course_theme') == 'true')
  81. {
  82. $mycoursetheme=api_get_course_setting('course_theme');
  83. if (!empty($mycoursetheme) && $mycoursetheme!=-1)
  84. {
  85. if(!empty($mycoursetheme) && $mycoursetheme != $my_style)
  86. {
  87. $my_style = $mycoursetheme; // course's css
  88. }
  89. }
  90. $mycourselptheme=api_get_course_setting('allow_learning_path_theme');
  91. if (!empty($mycourselptheme) && $mycourselptheme!=-1 && $mycourselptheme== 1)
  92. {
  93. global $lp_theme_css; // it comes from the lp_controller.php
  94. global $lp_theme_config; // it comes from the lp_controller.php
  95. if (!$lp_theme_config)
  96. {
  97. if ($lp_theme_css!='')
  98. {
  99. $theme=$lp_theme_css;
  100. if(!empty($theme) && $theme != $my_style)
  101. {
  102. $my_style = $theme; // LP's css
  103. }
  104. }
  105. }
  106. }
  107. }
  108. }
  109. global $show_learn_path;
  110. if ($show_learn_path) {
  111. $htmlHeadXtra[] = '<link rel="stylesheet" type="text/css" href="'.api_get_path(WEB_CODE_PATH).'css/'.$my_style.'/learnpath.css"/>';
  112. $htmlHeadXtra[] = "<link rel='stylesheet' type='text/css' href='dtree.css' />"; //will be moved
  113. $htmlHeadXtra[] = "<script src='dtree.js' type='text/javascript'></script>"; //will be moved
  114. }
  115. $my_code_path = api_get_path(WEB_CODE_PATH);
  116. if(empty($my_style)){$my_style = 'default';}
  117. echo '@import "'.$my_code_path.'css/'.$my_style.'/default.css";'."\n";
  118. echo '@import "'.$my_code_path.'css/'.$my_style.'/course.css";'."\n";
  119. ?>
  120. /*]]>*/
  121. </style>
  122. <style type="text/css" media="print">
  123. /*<![CDATA[*/
  124. <?php
  125. echo '@import "'.$my_code_path.'css/'.$my_style.'/print.css";'."\n";
  126. ?>
  127. /*]]>*/
  128. </style>
  129. <link rel="top" href="<?php echo api_get_path(WEB_PATH); ?>index.php" title="" />
  130. <link rel="courses" href="<?php echo api_get_path(WEB_CODE_PATH) ?>auth/courses.php" title="<?php echo htmlentities(get_lang('OtherCourses'),ENT_QUOTES,$charset); ?>" />
  131. <link rel="profil" href="<?php echo api_get_path(WEB_CODE_PATH) ?>auth/profile.php" title="<?php echo htmlentities(get_lang('ModifyProfile'),ENT_QUOTES,$charset); ?>" />
  132. <link href="http://www.dokeos.com/documentation.php" rel="Help" />
  133. <link href="http://www.dokeos.com/team.php" rel="Author" />
  134. <link href="http://www.dokeos.com" rel="Copyright" />
  135. <link rel="shortcut icon" href="<?php echo api_get_path(WEB_PATH); ?>favicon.ico" type="image/x-icon" />
  136. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset ?>" />
  137. <?php
  138. if ( isset($htmlHeadXtra) && $htmlHeadXtra )
  139. {
  140. foreach($htmlHeadXtra as $this_html_head)
  141. {
  142. echo($this_html_head);
  143. }
  144. }
  145. if ( isset($htmlIncHeadXtra) && $htmlIncHeadXtra )
  146. {
  147. foreach($htmlIncHeadXtra as $this_html_head)
  148. {
  149. include($this_html_head);
  150. }
  151. }
  152. //the following include might be subject to a setting proper to the course or platform
  153. include(api_get_path(LIBRARY_PATH).'/javascript/email_links.lib.js.php');
  154. ?>
  155. </head>
  156. <body dir="<?php echo $text_dir ?>" <?php
  157. if(defined('DOKEOS_HOMEPAGE') && DOKEOS_HOMEPAGE)
  158. echo 'onload="javascript:if(document.formLogin) { document.formLogin.login.focus(); }"'; ?>>
  159. <div class="skip">
  160. <ul>
  161. <li><a href="#menu"><?php echo ( get_lang('WCAGGoMenu') )?></a></li>
  162. <li><a href="#content" accesskey="2"><?php echo ( get_lang('WCAGGoContent') )?></a></li>
  163. </ul>
  164. </div>
  165. <!-- #outerframe container to control some general layout of all pages -->
  166. <div id="outerframe">
  167. <?php
  168. // Banner
  169. include(api_get_path(INCLUDE_PATH)."banner.inc.php");