banner.inc.php 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * This script contains the actual html code to display the "header"
  5. * or "banner" on top of every Chamilo page.
  6. * @todo this should be remove we should only use header.inc.php
  7. *
  8. * @package chamilo.include
  9. */
  10. require_once api_get_path(LIBRARY_PATH).'banner.lib.php';
  11. $session_id = api_get_session_id();
  12. $session_name = api_get_session_name($my_session_id);
  13. echo '<div id="wrapper">';
  14. ?>
  15. <ul id="navigation">
  16. <?php
  17. if (!empty($help)) {
  18. ?>
  19. <li class="help"><a href="<?php echo api_get_path(WEB_CODE_PATH); ?>help/help.php?open=Home&height=400&width=600" class="thickbox" title="<?php echo get_lang('Help'); ?>"><img src="<?php echo api_get_path(WEB_IMG_PATH);?>help.large.png" alt="<?php echo get_lang('Help');?>" title="<?php echo get_lang('Help');?>" /></a> </li>
  20. <?php
  21. }
  22. if (api_get_setting('show_link_bug_notification') == 'true') {
  23. ?>
  24. <li class="report"><a href="http://support.chamilo.org/projects/chamilo-18/wiki/How_to_report_bugs" target="_blank"><img src="<?php echo api_get_path(WEB_IMG_PATH) ?>bug.large.png" style="vertical-align: middle;" alt="<?php echo get_lang('ReportABug') ?>" title="<?php echo get_lang('ReportABug');?>"/></a></li>
  25. </ul>
  26. <?php
  27. }
  28. echo '<div id="header">';
  29. function show_header_1($language_file, $nameTools) {
  30. $_course = api_get_course_info();
  31. echo '<div id="header1">';
  32. echo '<div id="top_corner"></div>';
  33. $logo = api_get_path(SYS_CODE_PATH).'css/'.api_get_visual_theme().'/images/header-logo.png';
  34. $site_name = api_get_setting('siteName');
  35. if (file_exists($logo)) {
  36. echo '<div id="logo">';
  37. $image_url = api_get_path(WEB_CSS_PATH).api_get_visual_theme().'/images/header-logo.png';
  38. $logo = Display::img($image_url, $site_name, array('title'=>$site_name));
  39. echo Display::url($logo, api_get_path(WEB_PATH).'index.php');
  40. echo '</div>';
  41. } else {
  42. echo '<a href="'.api_get_path(WEB_PATH).'index.php" target="_top">'.$site_name.'</a>';
  43. $iurl = api_get_setting('InstitutionUrl');
  44. $iname = api_get_setting('Institution');
  45. if (!empty($iname)) {
  46. echo '-&nbsp;<a href="'.$iurl.'" target="_top">'.$iname.'</a>';
  47. }
  48. // External link section a.k.a Department - Department URL
  49. if (isset($_course['extLink']) && $_course['extLink']['name'] != '') {
  50. echo '<span class="extLinkSeparator"> - </span>';
  51. if ($_course['extLink']['url'] != '') {
  52. echo '<a class="extLink" href="'.$_course['extLink']['url'].'" target="_top">';
  53. echo $_course['extLink']['name'];
  54. echo '</a>';
  55. } else {
  56. echo $_course['extLink']['name'];
  57. }
  58. }
  59. }
  60. /* Course title section */
  61. if (!empty($_cid) and $_cid != -1 and isset($_course)) {
  62. //Put the name of the course in the header
  63. echo '<div id="my_courses">';
  64. /* <div id="my_courses"><a href="<?php echo api_get_path(WEB_COURSE_PATH).$_course['path']; ?>/index.php" target="_top">&nbsp;
  65. echo $_course['name'].' ';
  66. if (api_get_setting('display_coursecode_in_courselist') == 'true') {
  67. echo $_course['official_code'];
  68. }
  69. if (api_get_setting('use_session_mode') == 'true' && isset($_SESSION['session_name'])) {
  70. echo '&nbsp;('.$_SESSION['session_name'].')&nbsp;';
  71. }
  72. if (api_get_setting('display_coursecode_in_courselist') == 'true' && api_get_setting('display_teacher_in_courselist') == 'true') {
  73. echo ' - ';
  74. }
  75. if (api_get_setting('display_teacher_in_courselist') == 'true') {
  76. //This is still necessary? There is the course teacher in the footer
  77. echo stripslashes($_course['titular']);
  78. }
  79. echo '</a>';*/
  80. echo '</div>';
  81. } elseif (isset($nameTools) && $language_file != 'course_home') {
  82. //Put the name of the user-tools in the header
  83. if (!isset($_user['user_id'])) {
  84. //echo '<div id="my_courses"></div>';
  85. } elseif (!$noPHP_SELF) {
  86. echo '<div id="my_courses"><a href="'.api_get_self().'?'.api_get_cidreq(), '" target="_top">'.$nameTools.'</a></div>';
  87. } else {
  88. echo '<div id="my_courses">'.$nameTools.'</div>';
  89. }
  90. } else {
  91. //echo '<div id="my_courses"></div>';
  92. }
  93. echo '<div id="plugin-header">';
  94. api_plugin('header');
  95. echo '</div>';
  96. //Don't let the header disappear if there's nothing on the left
  97. //echo '<div class="clear">&nbsp;</div>';
  98. echo '</div>';
  99. }
  100. function show_header_2($help) {
  101. $_course = api_get_course_info();
  102. $course_id = api_get_course_id();
  103. $user_id = api_get_user_id();
  104. echo '<div id="header2">';
  105. echo '<div id="Header2Right">';
  106. echo '<ul>';
  107. if ((api_get_setting('showonline', 'world') == 'true' AND !$user_id) OR (api_get_setting('showonline', 'users') == 'true' AND $user_id) OR (api_get_setting('showonline', 'course') == 'true' AND $user_id AND $course_id)) {
  108. $number = who_is_online_count(api_get_setting('time_limit_whosonline'));
  109. $number_online_in_course = 0;
  110. if(!empty($_course['id'])) {
  111. $number_online_in_course = who_is_online_in_this_course_count($user_id, api_get_setting('time_limit_whosonline'), $_course['id']);
  112. }
  113. echo '<li>';
  114. // Display the who's online of the platform
  115. if ($number) {
  116. if ((api_get_setting('showonline', 'world') == 'true' AND !$user_id) OR (api_get_setting('showonline', 'users') == 'true' AND $user_id)) {
  117. echo '<li><a href="'.api_get_path(WEB_PATH).'whoisonline.php" target="_top" title="'.get_lang('UsersOnline').'" ><img width="13px" src="'.api_get_path(WEB_IMG_PATH).'members.gif" title="'.get_lang('UsersOnline').'"> '.$number.'</a></li>';
  118. }
  119. }
  120. // Display the who's online for the course
  121. if ($number_online_in_course) {
  122. if (is_array($_course) AND api_get_setting('showonline', 'course') == 'true' AND isset($_course['sysCode'])) {
  123. echo '<li>| <a href="'.api_get_path(WEB_PATH).'whoisonline.php?cidReq='.$_course['sysCode'].'" target="_top">'.Display::return_icon('course.gif', get_lang('UsersOnline').' '.get_lang('InThisCourse'), array('width'=>'13px')).' '.$number_online_in_course.' </a></li>';
  124. }
  125. }
  126. // Display the who's online for the session
  127. if (api_get_setting('use_session_mode') == 'true' && isset($user_id) && api_get_session_id() != 0) {
  128. //echo '<li><a href="'.api_get_path(WEB_PATH).'whoisonlinesession.php?id_coach='.$user_id.'&amp;referer='.urlencode($_SERVER['REQUEST_URI']).'" target="_top">'.get_lang('UsersConnectedToMySessions').'</a></li>';
  129. echo '<li>| <a href="'.api_get_path(WEB_PATH).'whoisonlinesession.php?id_coach='.$user_id.'&amp;referer='.urlencode($_SERVER['REQUEST_URI']).'" target="_top">'.Display::return_icon('session.png', get_lang('UsersConnectedToMySessions'), array('width'=>'13px')).' </a></li>';
  130. }
  131. echo '</li>';
  132. }
  133. if ($user_id && isset($course_id)) {
  134. if ((api_is_course_admin() || api_is_platform_admin()) && api_get_setting('student_view_enabled') == 'true') {
  135. echo '<li>&nbsp;|&nbsp;';
  136. api_display_tool_view_option();
  137. echo '</li>';
  138. }
  139. }
  140. if (api_is_allowed_to_edit()) {
  141. if (!empty($help)) {
  142. echo '<li>';
  143. // Show help
  144. if (api_get_setting('show_link_bug_notification') != 'true') {
  145. echo '|';
  146. }
  147. echo "</li>";
  148. }
  149. }
  150. if (api_get_setting('accessibility_font_resize') == 'true') {
  151. echo '<li class="resize_font">';
  152. echo '<span class="decrease_font" title="'.get_lang('DecreaseFontSize').'">A</span> <span class="reset_font" title="'.get_lang('ResetFontSize').'">A</span> <span class="increase_font" title="'.get_lang('IncreaseFontSize').'">A</span>';
  153. echo '</li>';
  154. }
  155. echo '</ul>';
  156. echo '</div>';
  157. echo '</div>';
  158. }
  159. function show_header_3() {
  160. $navigation = $menu_navigation = array();
  161. $possible_tabs = get_tabs();
  162. // Campus Homepage
  163. if (api_get_setting('show_tabs', 'campus_homepage') == 'true') {
  164. $navigation[SECTION_CAMPUS] = $possible_tabs[SECTION_CAMPUS];
  165. } else {
  166. $menu_navigation[SECTION_CAMPUS] = $possible_tabs[SECTION_CAMPUS];
  167. }
  168. if (api_get_user_id() && !api_is_anonymous()) {
  169. // My Courses
  170. if (api_get_setting('show_tabs', 'my_courses') == 'true') {
  171. $navigation['mycourses'] = $possible_tabs['mycourses'];
  172. } else {
  173. $menu_navigation['mycourses'] = $possible_tabs['mycourses'];
  174. }
  175. // My Profile
  176. if (api_get_setting('show_tabs', 'my_profile') == 'true' && api_get_setting('allow_social_tool') != 'true') {
  177. $navigation['myprofile'] = $possible_tabs['myprofile'];
  178. } else {
  179. $menu_navigation['myprofile'] = $possible_tabs['myprofile'];
  180. }
  181. // My Agenda
  182. if (api_get_setting('show_tabs', 'my_agenda') == 'true') {
  183. $navigation['myagenda'] = $possible_tabs['myagenda'];
  184. } else {
  185. $menu_navigation['myagenda'] = $possible_tabs['myagenda'];
  186. }
  187. // Gradebook
  188. if (api_get_setting('gradebook_enable') == 'true') {
  189. if (api_get_setting('show_tabs', 'my_gradebook') == 'true') {
  190. $navigation['mygradebook'] = $possible_tabs['mygradebook'];
  191. } else{
  192. $menu_navigation['mygradebook'] = $possible_tabs['mygradebook'];
  193. }
  194. }
  195. // Reporting
  196. if (api_get_setting('show_tabs', 'reporting') == 'true') {
  197. if (api_is_allowed_to_create_course() || api_is_drh() || api_is_session_admin()) {
  198. $navigation['session_my_space'] = $possible_tabs['session_my_space'];
  199. } else {
  200. $navigation['session_my_space'] = $possible_tabs['session_my_progress'];
  201. }
  202. } else {
  203. if (api_is_allowed_to_create_course() || api_is_drh() || api_is_session_admin()) {
  204. $menu_navigation['session_my_space'] = $possible_tabs['session_my_space'];
  205. } else {
  206. $menu_navigation['session_my_space'] = $possible_tabs['session_my_progress'];
  207. }
  208. }
  209. // Social Networking
  210. if (api_get_setting('show_tabs', 'social') == 'true') {
  211. if (api_get_setting('allow_social_tool') == 'true') {
  212. $navigation['social'] = $possible_tabs['social'];
  213. }
  214. } else{
  215. $menu_navigation['social'] = $possible_tabs['social'];
  216. }
  217. // Dashboard
  218. if (api_get_setting('show_tabs', 'dashboard') == 'true') {
  219. if (api_is_platform_admin() || api_is_drh() || api_is_session_admin()) {
  220. $navigation['dashboard'] = $possible_tabs['dashboard'];
  221. }
  222. } else{
  223. $menu_navigation['dashboard'] = $possible_tabs['dashboard'];
  224. }
  225. // Administration
  226. if (api_is_platform_admin(true)) {
  227. if (api_get_setting('show_tabs', 'platform_administration') == 'true') {
  228. $navigation['platform_admin'] = $possible_tabs['platform_admin'];
  229. } else {
  230. $menu_navigation['platform_admin'] = $possible_tabs['platform_admin'];
  231. }
  232. }
  233. }
  234. // Displaying the tabs
  235. $lang = ''; //el for "Edit Language"
  236. if (!empty($_SESSION['user_language_choice'])) {
  237. $lang = $_SESSION['user_language_choice'];
  238. } elseif (!empty($_SESSION['_user']['language'])) {
  239. $lang = $_SESSION['_user']['language'];
  240. } else {
  241. $lang = get_setting('platformLanguage');
  242. }
  243. //Preparing home folder for multiple urls
  244. global $_configuration;
  245. if ($_configuration['multiple_access_urls']) {
  246. $access_url_id = api_get_current_access_url_id();
  247. if ($access_url_id != -1) {
  248. $url_info = api_get_access_url($access_url_id);
  249. $url = api_remove_trailing_slash(preg_replace('/https?:\/\//i', '', $url_info['url']));
  250. $clean_url = replace_dangerous_char($url);
  251. $clean_url = str_replace('/', '-', $clean_url);
  252. $clean_url .= '/';
  253. $homep = api_get_path(SYS_PATH).'home/'.$clean_url; //homep for Home Path
  254. //we create the new dir for the new sites
  255. if (!is_dir($homep)) {
  256. mkdir($homep, api_get_permissions_for_new_directories());
  257. }
  258. }
  259. } else {
  260. $homep = api_get_path(SYS_PATH).'home/';
  261. }
  262. $ext = '.html';
  263. $menutabs = 'home_tabs';
  264. if (is_file($homep.$menutabs.'_'.$lang.$ext) && is_readable($homep.$menutabs.'_'.$lang.$ext)) {
  265. $home_top = @(string)file_get_contents($homep.$menutabs.'_'.$lang.$ext);
  266. } elseif (is_file($homep.$menutabs.$lang.$ext) && is_readable($homep.$menutabs.$lang.$ext)) {
  267. $home_top = @(string)file_get_contents($homep.$menutabs.$lang.$ext);
  268. } else {
  269. $errorMsg = get_lang('HomePageFilesNotReadable');
  270. }
  271. $home_top = api_to_system_encoding($home_top, api_detect_encoding(strip_tags($home_top)));
  272. if (api_get_self() != '/main/admin/configure_homepage.php') {
  273. $open = str_replace('{rel_path}',api_get_path(REL_PATH), $home_top);
  274. $open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
  275. if (!empty($open)) {
  276. $lis .= Display::tag('li', $open);
  277. $show_bar = true;
  278. }
  279. } else {
  280. $home_menu = '';
  281. if (file_exists($homep.$menutabs.'_'.$lang.$ext)) {
  282. $home_menu = @file($homep.$menutabs.'_'.$lang.$ext);
  283. } else {
  284. $home_menu = @file($homep.$menutabs.$ext);
  285. }
  286. if (empty($home_menu)) {
  287. $home_menu = array();
  288. }
  289. if (!empty($home_menu)) {
  290. $home_menu = implode("\n", $home_menu);
  291. $home_menu = api_to_system_encoding($home_menu, api_detect_encoding(strip_tags($home_menu)));
  292. $home_menu = explode("\n", $home_menu);
  293. }
  294. $tab_counter = 0;
  295. if (!empty($home_menu)) {
  296. $show_bar = true;
  297. }
  298. foreach ($home_menu as $enreg) {
  299. $enreg = trim($enreg);
  300. if (!empty($enreg)) {
  301. $edit_link = '<a href="'.api_get_self().'?action=edit_tabs&amp;link_index='.$tab_counter.'" ><span>'.Display::return_icon('edit.gif', get_lang('Edit')).'</span></a>';
  302. $delete_link = '<a href="'.api_get_self().'?action=delete_tabs&amp;link_index='.$tab_counter.'" onclick="javascript: if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)).'\')) return false;"><span>'.Display::return_icon('delete.gif', get_lang('Delete')).'</span></a>';
  303. $tab_string = str_replace(array('href="'.api_get_path(WEB_PATH).'index.php?include=', '</li>'), array('href="'.api_get_path(WEB_CODE_PATH).'admin/'.basename(api_get_self()).'?action=open_link&link=', $edit_link.$delete_link.'</li>'), $enreg);
  304. $lis .= $tab_string;
  305. $tab_counter++;
  306. }
  307. }
  308. $lis .= '<li id="insert-link"><a href="'.api_get_self().'?action=insert_tabs" style="padding-right:0px;"><span>'. Display::return_icon('addd.gif', get_lang('InsertLink'), array('style' => 'vertical-align:middle')).' '.get_lang('InsertLink').'</span></a></li>';
  309. }
  310. if (count($navigation) > 1 || !empty($lis)) {
  311. $pre_lis = '';
  312. foreach ($navigation as $section => $navigation_info) {
  313. if (isset($GLOBALS['this_section'])) {
  314. $current = $section == $GLOBALS['this_section'] ? ' id="current"' : '';
  315. } else {
  316. $current = '';
  317. }
  318. $pre_lis .= '<li'.$current.'><a href="'.$navigation_info['url'].'" target="_top"><span id="tab_active">'.$navigation_info['title'].'</span></a></li>';
  319. }
  320. $lis = $pre_lis.$lis;
  321. $show_bar = true;
  322. }
  323. // Logout
  324. if ($show_bar) {
  325. echo '<div id="header3">';
  326. if (api_get_user_id()) {
  327. $login = '';
  328. if (api_is_anonymous()) {
  329. $login = get_lang('Anonymous');
  330. } else {
  331. $uinfo = api_get_user_info(api_get_user_id());
  332. $login = $uinfo['username'];
  333. }
  334. //start user section line with name, my course, my profile, scorm info, etc
  335. echo '<ul id="logout">';
  336. //echo '<li><span>'.get_lang('LoggedInAsX').' '.$login.'</span></li>';
  337. //echo '<li><a href="'.api_get_path(WEB_PATH).'main/auth/profile.php" target="_top"><span>'.get_lang('Profile').'</span></a></li>';
  338. echo '<li><a href="'.api_get_path(WEB_PATH).'index.php?logout=logout&uid='.api_get_user_id().'" target="_top"><span>'.get_lang('Logout').' ('.$login.')</span></a></li>';
  339. echo '</ul>';
  340. }
  341. echo '<ul>';
  342. echo $lis;
  343. echo '</ul>';
  344. echo '</div>';
  345. }
  346. }
  347. //Header 4
  348. function show_header_4($interbreadcrumb, $language_file, $nameTools) {
  349. $session_id = api_get_session_id();
  350. $session_name = api_get_session_name($session_id);
  351. $_course = api_get_course_info();
  352. /* Plugins for banner section */
  353. $web_course_path = api_get_path(WEB_COURSE_PATH);
  354. /*
  355. * if the user is a coach he can see the users who are logged in its session
  356. */
  357. $navigation = array();
  358. // part 1: Course Homepage. If we are in a course then the first breadcrumb is a link to the course homepage
  359. // hide_course_breadcrumb the parameter has been added to hide the name of the course, that appeared in the default $interbreadcrumb
  360. $my_session_name = is_null($session_name) ? '' : '&nbsp;('.$session_name.')';
  361. if (!empty($_course) && !isset($_GET['hide_course_breadcrumb'])) {
  362. $navigation_item['url'] = $web_course_path . $_course['path'].'/index.php'.(!empty($session_id) ? '?id_session='.$session_id : '');
  363. switch (api_get_setting('breadcrumbs_course_homepage')) {
  364. case 'get_lang':
  365. $navigation_item['title'] = get_lang('CourseHomepageLink');
  366. break;
  367. case 'course_code':
  368. $navigation_item['title'] = $_course['official_code'];
  369. break;
  370. case 'session_name_and_course_title':
  371. $navigation_item['title'] = $_course['name'].$my_session_name;
  372. break;
  373. default:
  374. if (api_get_setting('use_session_mode') == 'true' && api_get_session_id() != -1 ) {
  375. $navigation_item['title'] = $_course['name'].$my_session_name;
  376. } else {
  377. $navigation_item['title'] = $_course['name'];
  378. }
  379. break;
  380. }
  381. $navigation[] = $navigation_item;
  382. }
  383. // part 2: Interbreadcrumbs. If there is an array $interbreadcrumb defined then these have to appear before the last breadcrumb (which is the tool itself)
  384. if (isset($interbreadcrumb) && is_array($interbreadcrumb)) {
  385. foreach ($interbreadcrumb as $breadcrumb_step) {
  386. $sep = (strrchr($breadcrumb_step['url'], '?') ? '&amp;' : '?');
  387. $navigation_item['url'] = $breadcrumb_step['url'].$sep.api_get_cidreq();
  388. $navigation_item['title'] = $breadcrumb_step['name'];
  389. // titles for shared folders
  390. if ($breadcrumb_step['name'] == 'shared_folder') {
  391. $navigation_item['title'] = get_lang('UserFolders');
  392. } elseif(strstr($breadcrumb_step['name'], 'shared_folder_session_')) {
  393. $navigation_item['title'] = get_lang('UserFolders');
  394. } elseif(strstr($breadcrumb_step['name'], 'sf_user_')) {
  395. $userinfo = Database::get_user_info_from_id(substr($breadcrumb_step['name'], 8));
  396. $navigation_item['title'] = api_get_person_name($userinfo['firstname'], $userinfo['lastname']);
  397. } elseif($breadcrumb_step['name'] == 'chat_files') {
  398. $navigation_item['title'] = get_lang('ChatFiles');
  399. } elseif($breadcrumb_step['name'] == 'images') {
  400. $navigation_item['title'] = get_lang('Images');
  401. } elseif($breadcrumb_step['name'] == 'video') {
  402. $navigation_item['title'] = get_lang('Video');
  403. } elseif($breadcrumb_step['name'] == 'audio') {
  404. $navigation_item['title'] = get_lang('Audio');
  405. } elseif($breadcrumb_step['name'] == 'flash') {
  406. $navigation_item['title'] = get_lang('Flash');
  407. } elseif($breadcrumb_step['name'] == 'gallery') {
  408. $navigation_item['title'] = get_lang('Gallery');
  409. }
  410. $navigation[] = $navigation_item;
  411. }
  412. }
  413. // part 3: The tool itself. If we are on the course homepage we do not want to display the title of the course because this
  414. // is the same as the first part of the breadcrumbs (see part 1)
  415. if (isset($nameTools) && $language_file != 'course_home') { // TODO: This condition $language_file != 'course_home' might bring surprises.
  416. $navigation_item['url'] = '#';
  417. $navigation_item['title'] = $nameTools;
  418. $navigation[] = $navigation_item;
  419. }
  420. $final_navigation = array();
  421. $counter = 0;
  422. foreach ($navigation as $index => $navigation_info) {
  423. if (!empty($navigation_info['title'])) {
  424. if ($navigation_info['url'] == '#') {
  425. $final_navigation[$index] = '<span>'.$navigation_info['title'].'</span>';
  426. } else {
  427. $final_navigation[$index] = '<a href="'.$navigation_info['url'].'" class="breadcrumb breadcrumb'.$index.'" target="_top"><span>'.$navigation_info['title'].'</span></a>';
  428. }
  429. $counter++;
  430. }
  431. }
  432. if (in_array(api_get_visual_theme(), array('chamilo','chamilo_red','chamilo_blue','chamilo_orange','chamilo_green','chamilo_electric_blue'))) {
  433. //@todo move this in CSS
  434. $style = '<style>
  435. #header3 {
  436. background:none;
  437. //padding:2px;
  438. border-bottom:1px solid #ccc;
  439. width: 92%;
  440. margin-bottom:0px;
  441. padding:0px;
  442. }
  443. #header2 {
  444. min-height: 28px;
  445. }
  446. #current {
  447. margin-right: 2px;
  448. }
  449. #current #tab_active {
  450. //background:none;
  451. }
  452. #header3 a {
  453. //background:none;
  454. }
  455. #header3 li {
  456. //background:none;
  457. //background-color: #CCCCCC;
  458. //border-radius:5px;
  459. //margin:0px 1px 0px 1px;
  460. }
  461. #header3 li a span {
  462. //background:none;
  463. }
  464. #header4 {
  465. height:26px;
  466. padding:0px;
  467. background:none;
  468. width: 92%;
  469. }
  470. #main {
  471. border : 1px solid #ddd;
  472. }
  473. }</style>';
  474. echo $style;
  475. if (!empty($final_navigation)) {
  476. echo '<div id="header4">';
  477. $lis = '';
  478. $i = 0;
  479. $lis.= Display::tag('li', Display::url(Display::img(api_get_path(WEB_CSS_PATH).'home.png', get_lang('Homepage'), array('align'=>'middle')), api_get_path(WEB_PATH), array('class'=>'home')));
  480. foreach ($final_navigation as $bread) {
  481. $lis.= Display::tag('li', $bread);
  482. $i++;
  483. }
  484. echo Display::tag('ul',$lis, array('class'=>'bread'));
  485. echo '</div>';
  486. } else {
  487. echo '<div id="header4">';
  488. echo '</div>';
  489. }
  490. } else {
  491. if (!empty($final_navigation)) {
  492. echo '<div id="header4">';
  493. $i = 0;
  494. $count = count($final_navigation);
  495. foreach($final_navigation as $bread) {
  496. if ($i < $count -1 && $count != 1) {
  497. $bread .=' > ';
  498. }
  499. echo $bread;
  500. $i++;
  501. }
  502. echo '</div>';
  503. } else {
  504. echo '<div id="header4">';
  505. echo '</div>';
  506. }
  507. }
  508. echo '<div class="clear"></div>';
  509. if (api_get_setting('show_toolshortcuts') == 'true') {
  510. echo '<div id="toolshortcuts">';
  511. require_once 'tool_navigation_menu.inc.php';
  512. show_navigation_tool_shortcuts();
  513. echo '</div>';
  514. }
  515. }
  516. show_header_1($language_file, $nameTools);
  517. show_header_2($help);
  518. show_header_3();
  519. show_header_4($interbreadcrumb, $language_file, $nameTools);
  520. if (isset($database_connection)) {
  521. // connect to the main database.
  522. // if single database, don't pefix table names with the main database name in SQL queries
  523. // (ex. SELECT * FROM table)
  524. // if multiple database, prefix table names with the course database name in SQL queries (or no prefix if the table is in
  525. // the main database)
  526. // (ex. SELECT * FROM table_from_main_db - SELECT * FROM courseDB.table_from_course_db)
  527. Database::select_db($_configuration['main_database'], $database_connection);
  528. }
  529. echo '</div>'; // <!-- end of the whole #header section -->
  530. //to mask the main div, set $header_hide_main_div to true in any script just before calling Display::display_header();
  531. global $header_hide_main_div;
  532. if (!empty($header_hide_main_div) && $header_hide_main_div === true) {
  533. //do nothing
  534. } else {
  535. echo '<div id="main">'; //<!-- start of #main wrapper for #content and #menu divs -->
  536. }
  537. /* "call for chat" module section */
  538. $chat = strpos(api_get_self(), 'chat_banner.php');
  539. if (!$chat) {
  540. include_once api_get_path(LIBRARY_PATH).'online.inc.php';
  541. //echo $accept;
  542. $chatcall = chatcall();
  543. if ($chatcall) {
  544. Display :: display_normal_message($chatcall);
  545. }
  546. }
  547. /* Navigation menu section */
  548. if (api_get_setting('show_navigation_menu') != 'false' && api_get_setting('show_navigation_menu') != 'icons') {
  549. Display::show_course_navigation_menu($_GET['isHidden']);
  550. $course_id = api_get_course_id();
  551. if (!empty($course_id) && ($course_id != -1)) {
  552. echo '<div id="menuButton">';
  553. echo $output_string_menu;
  554. echo '</div>';
  555. if (isset($_SESSION['hideMenu'])) {
  556. if ($_SESSION['hideMenu'] == 'shown') {
  557. if (isset($_cid)) {
  558. echo '<div id="centerwrap">'; // <!-- start of #centerwrap -->
  559. echo '<div id="center">'; // <!-- start of #center -->
  560. }
  561. }
  562. } else {
  563. if (isset($_cid)) {
  564. echo '<div id="centerwrap">'; // <!-- start of #centerwrap -->
  565. echo '<div id="center">'; //<!-- start of #center -->
  566. }
  567. }
  568. }
  569. }
  570. //<!-- Begin Of script Output -->