header.inc.php 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <?php // $Id: header.inc.php 16728 2008-11-12 15:49:54Z pcool $
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2004-2008 Dokeos SPRL
  6. Copyright (c) 2003 Ghent University (UGent)
  7. Copyright (c) 2001 Universite catholique de Louvain (UCL)
  8. Copyright (c) various contributors
  9. For a full list of contributors, see "credits.txt".
  10. The full license can be read in "license.txt".
  11. This program is free software; you can redistribute it and/or
  12. modify it under the terms of the GNU General Public License
  13. as published by the Free Software Foundation; either version 2
  14. of the License, or (at your option) any later version.
  15. See the GNU General Public License for more details.
  16. Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
  17. Mail: info@dokeos.com
  18. ==============================================================================
  19. */
  20. /**
  21. ==============================================================================
  22. * This script displays the Dokeos header.
  23. *
  24. * @package dokeos.include
  25. ==============================================================================
  26. */
  27. /*----------------------------------------
  28. HEADERS SECTION
  29. --------------------------------------*/
  30. /*
  31. * HTTP HEADER
  32. */
  33. //Give a default value to $charset. Should change to UTF-8 some time in the future.
  34. //This parameter should be set in the platform configuration interface in time.
  35. $charset = api_get_setting('platform_charset');
  36. if(empty($charset))
  37. {
  38. $charset = 'ISO-8859-15';
  39. }
  40. //header('Content-Type: text/html; charset='. $charset)
  41. // or die ("WARNING : it remains some characters before &lt;?php bracket or after ?&gt end");
  42. header('Content-Type: text/html; charset='. $charset);
  43. if ( isset($httpHeadXtra) && $httpHeadXtra )
  44. {
  45. foreach($httpHeadXtra as $thisHttpHead)
  46. {
  47. header($thisHttpHead);
  48. }
  49. }
  50. // Get language iso-code for this page - ignore errors
  51. // The error ignorance is due to the non compatibility of function_exists()
  52. // with the object syntax of Database::get_language_isocode()
  53. @$document_language = Database::get_language_isocode($language_interface);
  54. if(empty($document_language))
  55. {
  56. //if there was no valid iso-code, use the english one
  57. $document_language = 'en';
  58. }
  59. /*
  60. * HTML HEADER
  61. */
  62. ?>
  63. <!DOCTYPE html
  64. PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  65. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  66. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $document_language; ?>" lang="<?php echo $document_language; ?>">
  67. <head>
  68. <title>
  69. <?php
  70. if(!empty($nameTools))
  71. {
  72. echo $nameTools.' - ';
  73. }
  74. if(!empty($_course['official_code']))
  75. {
  76. echo $_course['official_code'].' - ';
  77. }
  78. echo get_setting('siteName');
  79. ?>
  80. </title>
  81. <style type="text/css" media="screen, projection">
  82. /*<![CDATA[*/
  83. <?php
  84. $platform_theme= api_get_setting('stylesheets'); // plataform's css
  85. $my_style=$platform_theme;
  86. if(api_get_setting('user_selected_theme') == 'true')
  87. {
  88. $useri = api_get_user_info();
  89. $user_theme = $useri['theme'];
  90. if(!empty($user_theme) && $user_theme != $my_style)
  91. {
  92. $my_style = $user_theme; // user's css
  93. }
  94. }
  95. $mycourseid = api_get_course_id();
  96. if (!empty($mycourseid) && $mycourseid != -1)
  97. {
  98. if (api_get_setting('allow_course_theme') == 'true')
  99. {
  100. $mycoursetheme=api_get_course_setting('course_theme');
  101. if (!empty($mycoursetheme) && $mycoursetheme!=-1)
  102. {
  103. if(!empty($mycoursetheme) && $mycoursetheme != $my_style)
  104. {
  105. $my_style = $mycoursetheme; // course's css
  106. }
  107. }
  108. $mycourselptheme=api_get_course_setting('allow_learning_path_theme');
  109. if (!empty($mycourselptheme) && $mycourselptheme!=-1 && $mycourselptheme== 1)
  110. {
  111. global $lp_theme_css; // it comes from the lp_controller.php
  112. global $lp_theme_config; // it comes from the lp_controller.php
  113. if (!$lp_theme_config)
  114. {
  115. if ($lp_theme_css!='')
  116. {
  117. $theme=$lp_theme_css;
  118. if(!empty($theme) && $theme != $my_style)
  119. {
  120. $my_style = $theme; // LP's css
  121. }
  122. }
  123. }
  124. }
  125. }
  126. }
  127. global $show_learn_path;
  128. if ($show_learn_path)
  129. {
  130. $htmlHeadXtra[] = '<link rel="stylesheet" type="text/css" href="'.api_get_path(WEB_CODE_PATH).'css/'.$my_style.'/learnpath.css"/>';
  131. $htmlHeadXtra[] = "<link rel='stylesheet' type='text/css' href='dtree.css' />"; //will be moved
  132. $htmlHeadXtra[] = "<script src='dtree.js' type='text/javascript'></script>"; //will be moved
  133. }
  134. $my_code_path = api_get_path(WEB_CODE_PATH);
  135. if(empty($my_style))
  136. {
  137. $my_style = 'dokeos_classic';
  138. }
  139. echo '@import "'.$my_code_path.'css/'.$my_style.'/default.css";'."\n";
  140. echo '@import "'.$my_code_path.'css/'.$my_style.'/course.css";'."\n";
  141. ?>
  142. /*]]>*/
  143. </style>
  144. <style type="text/css" media="print">
  145. /*<![CDATA[*/
  146. <?php
  147. echo '@import "'.$my_code_path.'css/'.$my_style.'/print.css";'."\n";
  148. ?>
  149. /*]]>*/
  150. </style>
  151. <link rel="top" href="<?php echo api_get_path(WEB_PATH); ?>index.php" title="" />
  152. <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); ?>" />
  153. <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); ?>" />
  154. <link href="http://www.dokeos.com/documentation.php" rel="Help" />
  155. <link href="http://www.dokeos.com/team.php" rel="Author" />
  156. <link href="http://www.dokeos.com" rel="Copyright" />
  157. <link rel="shortcut icon" href="<?php echo api_get_path(WEB_PATH); ?>favicon.ico" type="image/x-icon" />
  158. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset ?>" />
  159. <?php
  160. if ( isset($htmlHeadXtra) && $htmlHeadXtra )
  161. {
  162. foreach($htmlHeadXtra as $this_html_head)
  163. {
  164. echo($this_html_head);
  165. }
  166. }
  167. if ( isset($htmlIncHeadXtra) && $htmlIncHeadXtra )
  168. {
  169. foreach($htmlIncHeadXtra as $this_html_head)
  170. {
  171. include($this_html_head);
  172. }
  173. }
  174. //the following include might be subject to a setting proper to the course or platform
  175. include(api_get_path(LIBRARY_PATH).'/javascript/email_links.lib.js.php');
  176. ?>
  177. </head>
  178. <body dir="<?php echo $text_dir ?>" <?php
  179. if(defined('DOKEOS_HOMEPAGE') && DOKEOS_HOMEPAGE)
  180. echo 'onload="javascript:if(document.formLogin) { document.formLogin.login.focus(); }"'; ?>>
  181. <div class="skip">
  182. <ul>
  183. <li><a href="#menu"><?php echo ( get_lang('WCAGGoMenu') )?></a></li>
  184. <li><a href="#content" accesskey="2"><?php echo ( get_lang('WCAGGoContent') )?></a></li>
  185. </ul>
  186. </div>
  187. <?php
  188. // Banner
  189. include(api_get_path(INCLUDE_PATH)."banner.inc.php");