header.inc.php 5.9 KB

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