header.inc.php 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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. // The error ignorance is due to the non compatibility of function_exists()
  35. // with the object syntax of Database::get_language_isocode()
  36. @$document_language = Database::get_language_isocode($language_interface);
  37. if(empty($document_language))
  38. {
  39. //if there was no valid iso-code, use the english one
  40. $document_language = 'en';
  41. }
  42. /*
  43. * HTML HEADER
  44. */
  45. ?>
  46. <!DOCTYPE html
  47. PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  48. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  49. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $document_language; ?>" lang="<?php echo $document_language; ?>">
  50. <head>
  51. <title>
  52. <?php
  53. if(!empty($nameTools))
  54. {
  55. echo $nameTools.' - ';
  56. }
  57. if(!empty($_course['official_code']))
  58. {
  59. echo $_course['official_code'].' - ';
  60. }
  61. echo api_get_setting('siteName');
  62. ?>
  63. </title>
  64. <style type="text/css" media="screen, projection">
  65. /*<![CDATA[*/
  66. <?php
  67. $platform_theme= api_get_setting('stylesheets'); // plataform's css
  68. $my_style=$platform_theme;
  69. if(api_get_setting('user_selected_theme') == 'true')
  70. {
  71. $useri = api_get_user_info();
  72. $user_theme = $useri['theme'];
  73. if(!empty($user_theme) && $user_theme != $my_style)
  74. {
  75. $my_style = $user_theme; // user's css
  76. }
  77. }
  78. $mycourseid = api_get_course_id();
  79. if (!empty($mycourseid) && $mycourseid != -1)
  80. {
  81. if (api_get_setting('allow_course_theme') == 'true')
  82. {
  83. $mycoursetheme=api_get_course_setting('course_theme');
  84. if (!empty($mycoursetheme) && $mycoursetheme!=-1)
  85. {
  86. if(!empty($mycoursetheme) && $mycoursetheme != $my_style)
  87. {
  88. $my_style = $mycoursetheme; // course's css
  89. }
  90. }
  91. $mycourselptheme=api_get_course_setting('allow_learning_path_theme');
  92. if (!empty($mycourselptheme) && $mycourselptheme!=-1 && $mycourselptheme== 1)
  93. {
  94. global $lp_theme_css; // it comes from the lp_controller.php
  95. global $lp_theme_config; // it comes from the lp_controller.php
  96. if (!$lp_theme_config)
  97. {
  98. if ($lp_theme_css!='')
  99. {
  100. $theme=$lp_theme_css;
  101. if(!empty($theme) && $theme != $my_style)
  102. {
  103. $my_style = $theme; // LP's css
  104. }
  105. }
  106. }
  107. }
  108. }
  109. }
  110. global $show_learn_path;
  111. if ($show_learn_path)
  112. {
  113. $htmlHeadXtra[] = '<link rel="stylesheet" type="text/css" href="'.api_get_path(WEB_CODE_PATH).'css/'.$my_style.'/learnpath.css"/>';
  114. $htmlHeadXtra[] = "<link rel='stylesheet' type='text/css' href='dtree.css' />"; //will be moved
  115. $htmlHeadXtra[] = "<script src='dtree.js' type='text/javascript'></script>"; //will be moved
  116. }
  117. $my_code_path = api_get_path(WEB_CODE_PATH);
  118. if(empty($my_style))
  119. {
  120. $my_style = 'dokeos_classic';
  121. }
  122. echo '@import "'.$my_code_path.'css/'.$my_style.'/default.css";'."\n";
  123. echo '@import "'.$my_code_path.'css/'.$my_style.'/course.css";'."\n";
  124. ?>
  125. /*]]>*/
  126. </style>
  127. <style type="text/css" media="print">
  128. /*<![CDATA[*/
  129. <?php
  130. echo '@import "'.$my_code_path.'css/'.$my_style.'/print.css";'."\n";
  131. ?>
  132. /*]]>*/
  133. </style>
  134. <link rel="top" href="<?php echo api_get_path(WEB_PATH); ?>index.php" title="" />
  135. <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); ?>" />
  136. <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); ?>" />
  137. <link href="http://www.dokeos.com/documentation.php" rel="Help" />
  138. <link href="http://www.dokeos.com/team.php" rel="Author" />
  139. <link href="http://www.dokeos.com" rel="Copyright" />
  140. <link rel="shortcut icon" href="<?php echo api_get_path(WEB_PATH); ?>favicon.ico" type="image/x-icon" />
  141. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset ?>" />
  142. <script type="text/javascript">
  143. //<![CDATA[
  144. // This is a patch for the "__flash__removeCallback" bug, see FS#4378.
  145. if ( ( navigator.userAgent.toLowerCase().indexOf('msie') != -1 ) && ( navigator.userAgent.toLowerCase().indexOf( 'opera' ) == -1 ) )
  146. {
  147. window.attachEvent( 'onunload', function()
  148. {
  149. window['__flash__removeCallback'] = function ( instance, name )
  150. {
  151. try
  152. {
  153. if ( instance )
  154. {
  155. instance[name] = null ;
  156. }
  157. }
  158. catch ( flashEx )
  159. {
  160. }
  161. } ;
  162. }
  163. ) ;
  164. }
  165. //]]>
  166. </script>
  167. <?php
  168. if ( isset($htmlHeadXtra) && $htmlHeadXtra )
  169. {
  170. foreach($htmlHeadXtra as $this_html_head)
  171. {
  172. echo($this_html_head);
  173. }
  174. }
  175. if ( isset($htmlIncHeadXtra) && $htmlIncHeadXtra )
  176. {
  177. foreach($htmlIncHeadXtra as $this_html_head)
  178. {
  179. include($this_html_head);
  180. }
  181. }
  182. //the following include might be subject to a setting proper to the course or platform
  183. include(api_get_path(LIBRARY_PATH).'/javascript/email_links.lib.js.php');
  184. ?>
  185. </head>
  186. <body dir="<?php echo $text_dir ?>" <?php
  187. if(defined('DOKEOS_HOMEPAGE') && DOKEOS_HOMEPAGE)
  188. echo 'onload="javascript:if(document.formLogin) { document.formLogin.login.focus(); }"'; ?>>
  189. <div class="skip">
  190. <ul>
  191. <li><a href="#menu"><?php echo ( get_lang('WCAGGoMenu') )?></a></li>
  192. <li><a href="#content" accesskey="2"><?php echo ( get_lang('WCAGGoContent') )?></a></li>
  193. </ul>
  194. </div>
  195. <?php
  196. // Banner
  197. include(api_get_path(INCLUDE_PATH)."banner.inc.php");