banner.lib.php 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. //require_once(api_get_path(SYS_CODE_PATH).'inc/banner.inc.php'); ?? The banner.inc.php calls the banner.lib.php
  4. /**
  5. * Determines the possible tabs (=sections) that are available.
  6. * This function is used when creating the tabs in the third header line and all the sections
  7. * that do not appear there (as determined by the platform admin on the Dokeos configuration settings page)
  8. * will appear in the right hand menu that appears on several other pages
  9. *
  10. * @return array containing all the possible tabs
  11. *
  12. * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
  13. */
  14. function get_tabs() {
  15. global $_course;
  16. // Campus Homepage
  17. $navigation[SECTION_CAMPUS]['url'] = api_get_path(WEB_PATH).'index.php';
  18. $navigation[SECTION_CAMPUS]['title'] = get_lang('CampusHomepage');
  19. // My Courses
  20. if(api_get_setting('use_session_mode')=='true') {
  21. if(api_is_allowed_to_create_course()) {
  22. // Link to my courses for teachers
  23. $navigation['mycourses']['url'] = api_get_path(WEB_PATH).'user_portal.php?nosession=true';
  24. $navigation['mycourses']['title'] = get_lang('MyCourses');
  25. } else {
  26. // Link to my courses for students
  27. $navigation['mycourses']['url'] = api_get_path(WEB_PATH).'user_portal.php';
  28. $navigation['mycourses']['title'] = get_lang('MyCourses');
  29. }
  30. } else {
  31. // Link to my courses
  32. $navigation['mycourses']['url'] = api_get_path(WEB_PATH).'user_portal.php';
  33. $navigation['mycourses']['title'] = get_lang('MyCourses');
  34. }
  35. // My Profile
  36. $navigation['myprofile']['url'] = api_get_path(WEB_CODE_PATH).'auth/profile.php'.(!empty($_course['path']) ? '?coursePath='.$_course['path'].'&amp;courseCode='.$_course['official_code'] : '' );
  37. $navigation['myprofile']['title'] = get_lang('ModifyProfile');
  38. // Link to my agenda
  39. $navigation['myagenda']['url'] = api_get_path(WEB_CODE_PATH).'calendar/myagenda.php?view=month&'.(!empty($_course['path']) ? 'coursePath='.$_course['path'].'&amp;courseCode='.$_course['official_code'] : '' );
  40. $navigation['myagenda']['title'] = get_lang('MyAgenda');
  41. // Gradebook
  42. if (api_get_setting('gradebook_enable') == 'true') {
  43. $navigation['mygradebook']['url'] = api_get_path(WEB_CODE_PATH).'gradebook/gradebook.php'.(!empty($_course['path']) ? '?coursePath='.$_course['path'].'&amp;courseCode='.$_course['official_code'] : '' );
  44. $navigation['mygradebook']['title'] = get_lang('MyGradebook');
  45. }
  46. // Reporting
  47. if(api_is_allowed_to_create_course() || api_is_drh() || api_is_session_admin()) {
  48. // Link to my space
  49. $navigation['session_my_space']['url'] = api_get_path(WEB_CODE_PATH).'mySpace/';
  50. $navigation['session_my_space']['title'] = get_lang('MySpace');
  51. } else {
  52. // Link to my progress
  53. $navigation['session_my_progress']['url'] = api_get_path(WEB_CODE_PATH).'auth/my_progress.php';
  54. $navigation['session_my_progress']['title'] = get_lang('MyProgress');
  55. }
  56. // Social
  57. if (api_get_setting('allow_social_tool')=='true') {
  58. $navigation['social']['url'] = api_get_path(WEB_CODE_PATH).'social/home.php';
  59. require_once api_get_path(LIBRARY_PATH).'message.lib.php';
  60. require_once api_get_path(LIBRARY_PATH).'social.lib.php';
  61. // get count unread message and total invitations
  62. $count_unread_message = MessageManager::get_number_of_messages(true);
  63. $number_of_new_messages_of_friend = SocialManager::get_message_number_invitation_by_user_id(api_get_user_id());
  64. $group_pending_invitations = GroupPortalManager::get_groups_by_user(api_get_user_id(), GROUP_USER_PERMISSION_PENDING_INVITATION,false);
  65. $group_pending_invitations = 0;
  66. if (!empty($group_pending_invitations )) {
  67. $group_pending_invitations = count($group_pending_invitations);
  68. }
  69. $total_invitations = intval($number_of_new_messages_of_friend) + $group_pending_invitations + intval($count_unread_message);
  70. $total_invitations = (!empty($total_invitations)?' ('.$total_invitations.')':'');
  71. $navigation['social']['title'] = get_lang('SocialNetwork'). $total_invitations;
  72. }
  73. // Dashboard
  74. if (api_is_platform_admin() || api_is_drh() || api_is_session_admin()) {
  75. $navigation['dashboard']['url'] = api_get_path(WEB_CODE_PATH).'dashboard/index.php';
  76. $navigation['dashboard']['title'] = get_lang('Dashboard');
  77. }
  78. // Platform administration
  79. if (api_is_platform_admin(true)) {
  80. //$navigation['platform_admin']['url'] = $rootAdminWeb;
  81. $navigation['platform_admin']['url'] = api_get_path(WEB_CODE_PATH).'admin/';
  82. $navigation['platform_admin']['title'] = get_lang('PlatformAdmin');
  83. }
  84. return $navigation;
  85. }
  86. function show_header_1($language_file, $nameTools) {
  87. $_course = api_get_course_info();
  88. echo '<div id="header1">';
  89. echo '<div id="top_corner"></div>';
  90. $logo = api_get_path(SYS_CODE_PATH).'css/'.api_get_visual_theme().'/images/header-logo.png';
  91. $site_name = api_get_setting('siteName');
  92. if (file_exists($logo)) {
  93. $site_name = api_get_setting('Institution').' - '.$site_name;
  94. echo '<div id="logo">';
  95. $image_url = api_get_path(WEB_CSS_PATH).api_get_visual_theme().'/images/header-logo.png';
  96. $logo = Display::img($image_url, $site_name, array('title'=>$site_name));
  97. echo Display::url($logo, api_get_path(WEB_PATH).'index.php');
  98. echo '</div>';
  99. } else {
  100. echo '<a href="'.api_get_path(WEB_PATH).'index.php" target="_top">'.$site_name.'</a>';
  101. $iurl = api_get_setting('InstitutionUrl');
  102. $iname = api_get_setting('Institution');
  103. if (!empty($iname)) {
  104. echo '-&nbsp;<a href="'.$iurl.'" target="_top">'.$iname.'</a>';
  105. }
  106. // External link section a.k.a Department - Department URL
  107. if (isset($_course['extLink']) && $_course['extLink']['name'] != '') {
  108. echo '<span class="extLinkSeparator"> - </span>';
  109. if ($_course['extLink']['url'] != '') {
  110. echo '<a class="extLink" href="'.$_course['extLink']['url'].'" target="_top">';
  111. echo $_course['extLink']['name'];
  112. echo '</a>';
  113. } else {
  114. echo $_course['extLink']['name'];
  115. }
  116. }
  117. }
  118. /* Course title section */
  119. if (!empty($_cid) and $_cid != -1 and isset($_course)) {
  120. //Put the name of the course in the header
  121. echo '<div id="my_courses">';
  122. /* <div id="my_courses"><a href="<?php echo api_get_path(WEB_COURSE_PATH).$_course['path']; ?>/index.php" target="_top">&nbsp;
  123. echo $_course['name'].' ';
  124. if (api_get_setting('display_coursecode_in_courselist') == 'true') {
  125. echo $_course['official_code'];
  126. }
  127. if (api_get_setting('use_session_mode') == 'true' && isset($_SESSION['session_name'])) {
  128. echo '&nbsp;('.$_SESSION['session_name'].')&nbsp;';
  129. }
  130. if (api_get_setting('display_coursecode_in_courselist') == 'true' && api_get_setting('display_teacher_in_courselist') == 'true') {
  131. echo ' - ';
  132. }
  133. if (api_get_setting('display_teacher_in_courselist') == 'true') {
  134. //This is still necessary? There is the course teacher in the footer
  135. echo stripslashes($_course['titular']);
  136. }
  137. echo '</a>';*/
  138. echo '</div>';
  139. } elseif (isset($nameTools) && $language_file != 'course_home') {
  140. //Put the name of the user-tools in the header
  141. if (!isset($_user['user_id'])) {
  142. //echo '<div id="my_courses"></div>';
  143. } elseif (!$noPHP_SELF) {
  144. echo '<div id="my_courses"><a href="'.api_get_self().'?'.api_get_cidreq(), '" target="_top">'.$nameTools.'</a></div>';
  145. } else {
  146. echo '<div id="my_courses">'.$nameTools.'</div>';
  147. }
  148. } else {
  149. //echo '<div id="my_courses"></div>';
  150. }
  151. echo '<div id="plugin-header">';
  152. api_plugin('header');
  153. echo '</div>';
  154. //Don't let the header disappear if there's nothing on the left
  155. //echo '<div class="clear">&nbsp;</div>';
  156. echo '</div>';
  157. }
  158. function show_header_2() {
  159. $_course = api_get_course_info();
  160. $course_id = api_get_course_id();
  161. $user_id = api_get_user_id();
  162. echo '<div id="header2">';
  163. echo '<div id="Header2Right">';
  164. echo '<ul>';
  165. 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)) {
  166. $number = who_is_online_count(api_get_setting('time_limit_whosonline'));
  167. $number_online_in_course = 0;
  168. if(!empty($_course['id'])) {
  169. $number_online_in_course = who_is_online_in_this_course_count($user_id, api_get_setting('time_limit_whosonline'), $_course['id']);
  170. }
  171. echo '<li>';
  172. // Display the who's online of the platform
  173. if ($number) {
  174. if ((api_get_setting('showonline', 'world') == 'true' AND !$user_id) OR (api_get_setting('showonline', 'users') == 'true' AND $user_id)) {
  175. 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>';
  176. }
  177. }
  178. // Display the who's online for the course
  179. if ($number_online_in_course) {
  180. if (is_array($_course) AND api_get_setting('showonline', 'course') == 'true' AND isset($_course['sysCode'])) {
  181. 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>';
  182. }
  183. }
  184. // Display the who's online for the session
  185. if (api_get_setting('use_session_mode') == 'true' && isset($user_id) && api_get_session_id() != 0) {
  186. //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>';
  187. 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>';
  188. }
  189. echo '</li>';
  190. }
  191. if ($user_id && isset($course_id)) {
  192. if ((api_is_course_admin() || api_is_platform_admin()) && api_get_setting('student_view_enabled') == 'true') {
  193. echo '<li>&nbsp;|&nbsp;';
  194. api_display_tool_view_option();
  195. echo '</li>';
  196. }
  197. }
  198. if (api_get_setting('accessibility_font_resize') == 'true') {
  199. echo '<li class="resize_font">';
  200. 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>';
  201. echo '</li>';
  202. }
  203. echo '</ul>';
  204. echo '</div>';
  205. echo '</div>';
  206. }
  207. function show_header_3() {
  208. $navigation = $menu_navigation = array();
  209. $possible_tabs = get_tabs();
  210. // Campus Homepage
  211. if (api_get_setting('show_tabs', 'campus_homepage') == 'true') {
  212. $navigation[SECTION_CAMPUS] = $possible_tabs[SECTION_CAMPUS];
  213. } else {
  214. $menu_navigation[SECTION_CAMPUS] = $possible_tabs[SECTION_CAMPUS];
  215. }
  216. if (api_get_user_id() && !api_is_anonymous()) {
  217. // My Courses
  218. if (api_get_setting('show_tabs', 'my_courses') == 'true') {
  219. $navigation['mycourses'] = $possible_tabs['mycourses'];
  220. } else {
  221. $menu_navigation['mycourses'] = $possible_tabs['mycourses'];
  222. }
  223. // My Profile
  224. if (api_get_setting('show_tabs', 'my_profile') == 'true' && api_get_setting('allow_social_tool') != 'true') {
  225. $navigation['myprofile'] = $possible_tabs['myprofile'];
  226. } else {
  227. $menu_navigation['myprofile'] = $possible_tabs['myprofile'];
  228. }
  229. // My Agenda
  230. if (api_get_setting('show_tabs', 'my_agenda') == 'true') {
  231. $navigation['myagenda'] = $possible_tabs['myagenda'];
  232. } else {
  233. $menu_navigation['myagenda'] = $possible_tabs['myagenda'];
  234. }
  235. // Gradebook
  236. if (api_get_setting('gradebook_enable') == 'true') {
  237. if (api_get_setting('show_tabs', 'my_gradebook') == 'true') {
  238. $navigation['mygradebook'] = $possible_tabs['mygradebook'];
  239. } else{
  240. $menu_navigation['mygradebook'] = $possible_tabs['mygradebook'];
  241. }
  242. }
  243. // Reporting
  244. if (api_get_setting('show_tabs', 'reporting') == 'true') {
  245. if (api_is_allowed_to_create_course() || api_is_drh() || api_is_session_admin()) {
  246. $navigation['session_my_space'] = $possible_tabs['session_my_space'];
  247. } else {
  248. $navigation['session_my_space'] = $possible_tabs['session_my_progress'];
  249. }
  250. } else {
  251. if (api_is_allowed_to_create_course() || api_is_drh() || api_is_session_admin()) {
  252. $menu_navigation['session_my_space'] = $possible_tabs['session_my_space'];
  253. } else {
  254. $menu_navigation['session_my_space'] = $possible_tabs['session_my_progress'];
  255. }
  256. }
  257. // Social Networking
  258. if (api_get_setting('show_tabs', 'social') == 'true') {
  259. if (api_get_setting('allow_social_tool') == 'true') {
  260. $navigation['social'] = $possible_tabs['social'];
  261. }
  262. } else{
  263. $menu_navigation['social'] = $possible_tabs['social'];
  264. }
  265. // Dashboard
  266. if (api_get_setting('show_tabs', 'dashboard') == 'true') {
  267. if (api_is_platform_admin() || api_is_drh() || api_is_session_admin()) {
  268. $navigation['dashboard'] = $possible_tabs['dashboard'];
  269. }
  270. } else{
  271. $menu_navigation['dashboard'] = $possible_tabs['dashboard'];
  272. }
  273. // Administration
  274. if (api_is_platform_admin(true)) {
  275. if (api_get_setting('show_tabs', 'platform_administration') == 'true') {
  276. $navigation['platform_admin'] = $possible_tabs['platform_admin'];
  277. } else {
  278. $menu_navigation['platform_admin'] = $possible_tabs['platform_admin'];
  279. }
  280. }
  281. }
  282. // Displaying the tabs
  283. $lang = ''; //el for "Edit Language"
  284. if (!empty($_SESSION['user_language_choice'])) {
  285. $lang = $_SESSION['user_language_choice'];
  286. } elseif (!empty($_SESSION['_user']['language'])) {
  287. $lang = $_SESSION['_user']['language'];
  288. } else {
  289. $lang = get_setting('platformLanguage');
  290. }
  291. //Preparing home folder for multiple urls
  292. if (api_get_multiple_access_url()) {
  293. $access_url_id = api_get_current_access_url_id();
  294. if ($access_url_id != -1) {
  295. $url_info = api_get_access_url($access_url_id);
  296. $url = api_remove_trailing_slash(preg_replace('/https?:\/\//i', '', $url_info['url']));
  297. $clean_url = replace_dangerous_char($url);
  298. $clean_url = str_replace('/', '-', $clean_url);
  299. $clean_url .= '/';
  300. $homep = api_get_path(SYS_PATH).'home/'.$clean_url; //homep for Home Path
  301. //we create the new dir for the new sites
  302. if (!is_dir($homep)) {
  303. mkdir($homep, api_get_permissions_for_new_directories());
  304. }
  305. }
  306. } else {
  307. $homep = api_get_path(SYS_PATH).'home/';
  308. }
  309. $ext = '.html';
  310. $menutabs = 'home_tabs';
  311. $home_top = '';
  312. if (is_file($homep.$menutabs.'_'.$lang.$ext) && is_readable($homep.$menutabs.'_'.$lang.$ext)) {
  313. $home_top = @(string)file_get_contents($homep.$menutabs.'_'.$lang.$ext);
  314. } elseif (is_file($homep.$menutabs.$lang.$ext) && is_readable($homep.$menutabs.$lang.$ext)) {
  315. $home_top = @(string)file_get_contents($homep.$menutabs.$lang.$ext);
  316. } else {
  317. $errorMsg = get_lang('HomePageFilesNotReadable');
  318. }
  319. $home_top = api_to_system_encoding($home_top, api_detect_encoding(strip_tags($home_top)));
  320. //if (api_get_self() != '/main/admin/configure_homepage.php') {
  321. $open = str_replace('{rel_path}',api_get_path(REL_PATH), $home_top);
  322. $open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
  323. $lis = '';
  324. if (!empty($open)) {
  325. $lis .= Display::tag('li', $open);
  326. $show_bar = true;
  327. }
  328. //} else {
  329. //This code was moved in the admin/configure_homepage.php file
  330. /*
  331. $home_menu = '';
  332. if (file_exists($homep.$menutabs.'_'.$lang.$ext)) {
  333. $home_menu = @file($homep.$menutabs.'_'.$lang.$ext);
  334. } else {
  335. $home_menu = @file($homep.$menutabs.$ext);
  336. }
  337. if (empty($home_menu)) {
  338. $home_menu = array();
  339. }
  340. if (!empty($home_menu)) {
  341. $home_menu = implode("\n", $home_menu);
  342. $home_menu = api_to_system_encoding($home_menu, api_detect_encoding(strip_tags($home_menu)));
  343. $home_menu = explode("\n", $home_menu);
  344. }
  345. $tab_counter = 0;
  346. if (!empty($home_menu)) {
  347. $show_bar = true;
  348. }
  349. foreach ($home_menu as $enreg) {
  350. $enreg = trim($enreg);
  351. if (!empty($enreg)) {
  352. $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>';
  353. $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>';
  354. $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);
  355. $lis .= $tab_string;
  356. $tab_counter++;
  357. }
  358. }
  359. $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>';
  360. */
  361. //}
  362. if (count($navigation) > 1 || !empty($lis)) {
  363. $pre_lis = '';
  364. foreach ($navigation as $section => $navigation_info) {
  365. if (isset($GLOBALS['this_section'])) {
  366. $current = $section == $GLOBALS['this_section'] ? ' id="current"' : '';
  367. } else {
  368. $current = '';
  369. }
  370. $pre_lis .= '<li'.$current.'><a href="'.$navigation_info['url'].'" target="_top"><span id="tab_active">'.$navigation_info['title'].'</span></a></li>';
  371. }
  372. $lis = $pre_lis.$lis;
  373. $show_bar = true;
  374. }
  375. // Logout
  376. if ($show_bar) {
  377. echo '<div id="header3">';
  378. if (api_get_user_id()) {
  379. $login = '';
  380. if (api_is_anonymous()) {
  381. $login = get_lang('Anonymous');
  382. } else {
  383. $uinfo = api_get_user_info(api_get_user_id());
  384. $login = $uinfo['username'];
  385. }
  386. //start user section line with name, my course, my profile, scorm info, etc
  387. echo '<ul id="logout">';
  388. //echo '<li><span>'.get_lang('LoggedInAsX').' '.$login.'</span></li>';
  389. //echo '<li><a href="'.api_get_path(WEB_PATH).'main/auth/profile.php" target="_top"><span>'.get_lang('Profile').'</span></a></li>';
  390. 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>';
  391. echo '</ul>';
  392. }
  393. echo '<ul>';
  394. echo $lis;
  395. echo '</ul>';
  396. echo '</div>';
  397. }
  398. return $menu_navigation;
  399. }
  400. //Header 4
  401. function show_header_4($interbreadcrumb, $language_file, $nameTools) {
  402. $session_id = api_get_session_id();
  403. $session_name = api_get_session_name($session_id);
  404. $_course = api_get_course_info();
  405. /* Plugins for banner section */
  406. $web_course_path = api_get_path(WEB_COURSE_PATH);
  407. /*
  408. * if the user is a coach he can see the users who are logged in its session
  409. */
  410. $navigation = array();
  411. // part 1: Course Homepage. If we are in a course then the first breadcrumb is a link to the course homepage
  412. // hide_course_breadcrumb the parameter has been added to hide the name of the course, that appeared in the default $interbreadcrumb
  413. $my_session_name = is_null($session_name) ? '' : '&nbsp;('.$session_name.')';
  414. if (!empty($_course) && !isset($_GET['hide_course_breadcrumb'])) {
  415. $navigation_item['url'] = $web_course_path . $_course['path'].'/index.php'.(!empty($session_id) ? '?id_session='.$session_id : '');
  416. switch (api_get_setting('breadcrumbs_course_homepage')) {
  417. case 'get_lang':
  418. $navigation_item['title'] = get_lang('CourseHomepageLink');
  419. break;
  420. case 'course_code':
  421. $navigation_item['title'] = $_course['official_code'];
  422. break;
  423. case 'session_name_and_course_title':
  424. $navigation_item['title'] = $_course['name'].$my_session_name;
  425. break;
  426. default:
  427. if (api_get_setting('use_session_mode') == 'true' && api_get_session_id() != -1 ) {
  428. $navigation_item['title'] = $_course['name'].$my_session_name;
  429. } else {
  430. $navigation_item['title'] = $_course['name'];
  431. }
  432. break;
  433. }
  434. $navigation[] = $navigation_item;
  435. }
  436. // part 2: Interbreadcrumbs. If there is an array $interbreadcrumb defined then these have to appear before the last breadcrumb (which is the tool itself)
  437. if (isset($interbreadcrumb) && is_array($interbreadcrumb)) {
  438. foreach ($interbreadcrumb as $breadcrumb_step) {
  439. if ($breadcrumb_step['url'] != '#') {
  440. $sep = (strrchr($breadcrumb_step['url'], '?') ? '&amp;' : '?');
  441. $navigation_item['url'] = $breadcrumb_step['url'].$sep.api_get_cidreq();
  442. } else {
  443. $navigation_item['url'] = '#';
  444. }
  445. $navigation_item['title'] = $breadcrumb_step['name'];
  446. // titles for shared folders
  447. if ($breadcrumb_step['name'] == 'shared_folder') {
  448. $navigation_item['title'] = get_lang('UserFolders');
  449. } elseif(strstr($breadcrumb_step['name'], 'shared_folder_session_')) {
  450. $navigation_item['title'] = get_lang('UserFolders');
  451. } elseif(strstr($breadcrumb_step['name'], 'sf_user_')) {
  452. $userinfo = Database::get_user_info_from_id(substr($breadcrumb_step['name'], 8));
  453. $navigation_item['title'] = api_get_person_name($userinfo['firstname'], $userinfo['lastname']);
  454. } elseif($breadcrumb_step['name'] == 'chat_files') {
  455. $navigation_item['title'] = get_lang('ChatFiles');
  456. } elseif($breadcrumb_step['name'] == 'images') {
  457. $navigation_item['title'] = get_lang('Images');
  458. } elseif($breadcrumb_step['name'] == 'video') {
  459. $navigation_item['title'] = get_lang('Video');
  460. } elseif($breadcrumb_step['name'] == 'audio') {
  461. $navigation_item['title'] = get_lang('Audio');
  462. } elseif($breadcrumb_step['name'] == 'flash') {
  463. $navigation_item['title'] = get_lang('Flash');
  464. } elseif($breadcrumb_step['name'] == 'gallery') {
  465. $navigation_item['title'] = get_lang('Gallery');
  466. }
  467. $navigation[] = $navigation_item;
  468. }
  469. }
  470. // 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
  471. // is the same as the first part of the breadcrumbs (see part 1)
  472. if (isset($nameTools) && $language_file != 'course_home') { // TODO: This condition $language_file != 'course_home' might bring surprises.
  473. $navigation_item['url'] = '#';
  474. $navigation_item['title'] = $nameTools;
  475. $navigation[] = $navigation_item;
  476. }
  477. $final_navigation = array();
  478. $counter = 0;
  479. foreach ($navigation as $index => $navigation_info) {
  480. if (!empty($navigation_info['title'])) {
  481. if ($navigation_info['url'] == '#') {
  482. $final_navigation[$index] = '<span>'.$navigation_info['title'].'</span>';
  483. } else {
  484. $final_navigation[$index] = '<a href="'.$navigation_info['url'].'" class="breadcrumb breadcrumb'.$index.'" target="_top"><span>'.$navigation_info['title'].'</span></a>';
  485. }
  486. $counter++;
  487. }
  488. }
  489. if (!empty($final_navigation)) {
  490. echo '<div id="header4">';
  491. $lis = '';
  492. $i = 0;
  493. $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')));
  494. foreach ($final_navigation as $bread) {
  495. $lis.= Display::tag('li', $bread);
  496. $i++;
  497. }
  498. echo Display::tag('ul',$lis, array('class'=>'bread'));
  499. echo '</div>';
  500. } else {
  501. echo '<div id="header4">';
  502. echo '</div>';
  503. }
  504. echo '<div class="clear"></div>';
  505. }
  506. function load_navigation_menu() {
  507. }