, Ghent University
*/
- function get_tabs() {
+ function get_tabs()
+ {
global $_course;
$navigation = array();
@@ -854,7 +909,7 @@ class Template {
// My Courses
- if(api_is_allowed_to_create_course()) {
+ if (api_is_allowed_to_create_course()) {
// Link to my courses for teachers
$navigation['mycourses']['url'] = api_get_path(WEB_PATH).'user_portal.php?nosession=true';
$navigation['mycourses']['title'] = get_lang('MyCourses');
@@ -865,7 +920,9 @@ class Template {
}
// My Profile
- $navigation['myprofile']['url'] = api_get_path(WEB_CODE_PATH).'auth/profile.php'.(!empty($_course['path']) ? '?coursePath='.$_course['path'].'&courseCode='.$_course['official_code'] : '' );
+ $navigation['myprofile']['url'] = api_get_path(
+ WEB_CODE_PATH
+ ).'auth/profile.php'.(!empty($_course['path']) ? '?coursePath='.$_course['path'].'&courseCode='.$_course['official_code'] : '');
$navigation['myprofile']['title'] = get_lang('ModifyProfile');
// Link to my agenda
@@ -874,7 +931,9 @@ class Template {
// Gradebook
if (api_get_setting('gradebook_enable') == 'true') {
- $navigation['mygradebook']['url'] = api_get_path(WEB_CODE_PATH).'gradebook/gradebook.php'.(!empty($_course['path']) ? '?coursePath='.$_course['path'].'&courseCode='.$_course['official_code'] : '' );
+ $navigation['mygradebook']['url'] = api_get_path(
+ WEB_CODE_PATH
+ ).'gradebook/gradebook.php'.(!empty($_course['path']) ? '?coursePath='.$_course['path'].'&courseCode='.$_course['official_code'] : '');
$navigation['mygradebook']['title'] = get_lang('MyGradebook');
}
@@ -890,9 +949,8 @@ class Template {
}
-
// Social
- if (api_get_setting('allow_social_tool')=='true') {
+ if (api_get_setting('allow_social_tool') == 'true') {
$navigation['social']['url'] = api_get_path(WEB_CODE_PATH).'social/home.php';
/*
// get count unread message and total invitations
@@ -923,11 +981,12 @@ class Template {
}*/
// Custom tabs
- for ($i = 1; $i<=3; $i++)
+ for ($i = 1; $i <= 3; $i++) {
if (api_get_setting('custom_tab_'.$i.'_name') && api_get_setting('custom_tab_'.$i.'_url')) {
$navigation['custom_tab_'.$i]['url'] = api_get_setting('custom_tab_'.$i.'_url');
$navigation['custom_tab_'.$i]['title'] = api_get_setting('custom_tab_'.$i.'_name');
}
+ }
// Platform administration
if (api_is_platform_admin(true)) {
@@ -937,7 +996,8 @@ class Template {
return $navigation;
}
- function return_logo($theme) {
+ function return_logo($theme)
+ {
$_course = api_get_course_info();
$html = '';
$logo = api_get_path(SYS_CODE_PATH).'css/'.$theme.'/images/header-logo.png';
@@ -946,13 +1006,13 @@ class Template {
if (file_exists($logo)) {
$site_name = api_get_setting('Institution').' - '.$site_name;
$html .= '';
- $image_url = api_get_path(WEB_CSS_PATH).$theme.'/images/header-logo.png';
- $logo = Display::img($image_url, $site_name, array('title'=>$site_name));
- $html .= Display::url($logo, api_get_path(WEB_PATH).'index.php');
+ $image_url = api_get_path(WEB_CSS_PATH).$theme.'/images/header-logo.png';
+ $logo = Display::img($image_url, $site_name, array('title' => $site_name));
+ $html .= Display::url($logo, api_get_path(WEB_PATH).'index.php');
$html .= '
';
} else {
$html .= ''.$site_name.'';
- $iurl = api_get_setting('InstitutionUrl');
+ $iurl = api_get_setting('InstitutionUrl');
$iname = api_get_setting('Institution');
if (!empty($iname)) {
@@ -971,78 +1031,121 @@ class Template {
}
}
- /* // Course title section
- if (!empty($_cid) and $_cid != -1 and isset($_course)) {
- //Put the name of the course in the header
- $html .= '';
- $html .= '
';
- } elseif (isset($nameTools) && $language_file != 'course_home') {
- //Put the name of the user-tools in the header
- if (!isset($user_id)) {
- //echo '';
- } elseif (!$noPHP_SELF) {
- $html .= '';
- } else {
- $html .= ''.$nameTools.'
';
- }
- }*/
+ /* // Course title section
+ if (!empty($_cid) and $_cid != -1 and isset($_course)) {
+ //Put the name of the course in the header
+ $html .= '';
+ $html .= '
';
+ } elseif (isset($nameTools) && $language_file != 'course_home') {
+ //Put the name of the user-tools in the header
+ if (!isset($user_id)) {
+ //echo '';
+ } elseif (!$noPHP_SELF) {
+ $html .= '';
+ } else {
+ $html .= ''.$nameTools.'
';
+ }
+ }*/
return $html;
}
- function return_notification_menu() {
+ function return_notification_menu()
+ {
- $_course = api_get_course_info();
- $course_id = api_get_course_id();
- $user_id = api_get_user_id();
+ $_course = api_get_course_info();
+ $course_id = api_get_course_id();
+ $user_id = api_get_user_id();
$html = '';
- 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)) {
+ 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)
+ ) {
$number = who_is_online_count(api_get_setting('time_limit_whosonline'));
$number_online_in_course = 0;
- if(!empty($_course['id'])) {
- $number_online_in_course = who_is_online_in_this_course_count($user_id, api_get_setting('time_limit_whosonline'), $_course['id']);
+ if (!empty($_course['id'])) {
+ $number_online_in_course = who_is_online_in_this_course_count(
+ $user_id,
+ api_get_setting('time_limit_whosonline'),
+ $_course['id']
+ );
}
// Display the who's online of the platform
if ($number) {
- if ((api_get_setting('showonline', 'world') == 'true' AND !$user_id) OR (api_get_setting('showonline', 'users') == 'true' AND $user_id)) {
- $html .= ''.
- Display::return_icon('user.png', get_lang('UsersOnline'), array(), ICON_SIZE_TINY).' '.$number.'';
+ if ((api_get_setting('showonline', 'world') == 'true' AND !$user_id) OR (api_get_setting(
+ 'showonline',
+ 'users'
+ ) == 'true' AND $user_id)
+ ) {
+ $html .= ''.
+ Display::return_icon(
+ 'user.png',
+ get_lang('UsersOnline'),
+ array(),
+ ICON_SIZE_TINY
+ ).' '.$number.'';
}
}
// Display the who's online for the course
if ($number_online_in_course) {
- if (is_array($_course) AND api_get_setting('showonline', 'course') == 'true' AND isset($_course['sysCode'])) {
- $html .= ''.
- Display::return_icon('course.png', get_lang('UsersOnline').' '.get_lang('InThisCourse'), array(), ICON_SIZE_TINY).' '.$number_online_in_course.' ';
+ if (is_array($_course) AND api_get_setting(
+ 'showonline',
+ 'course'
+ ) == 'true' AND isset($_course['sysCode'])
+ ) {
+ $html .= ''.
+ Display::return_icon(
+ 'course.png',
+ get_lang('UsersOnline').' '.get_lang('InThisCourse'),
+ array(),
+ ICON_SIZE_TINY
+ ).' '.$number_online_in_course.' ';
}
}
// Display the who's online for the session
if (isset($user_id) && api_get_session_id() != 0) {
if (api_is_allowed_to_edit()) {
- $html .= ''.
- Display::return_icon('session.png', get_lang('UsersConnectedToMySessions'), array(), ICON_SIZE_TINY).' ';
+ $html .= ''.
+ Display::return_icon(
+ 'session.png',
+ get_lang('UsersConnectedToMySessions'),
+ array(),
+ ICON_SIZE_TINY
+ ).' ';
}
}
}
if (api_get_setting('accessibility_font_resize') == 'true') {
$html .= '';
- $html .= 'A A A';
+ $html .= 'A A A';
$html .= '';
}
return $html;
}
- function return_navigation_array() {
+ function return_navigation_array()
+ {
- $navigation = array();
- $menu_navigation = array();
- $possible_tabs = $this->get_tabs();
+ $navigation = array();
+ $menu_navigation = array();
+ $possible_tabs = $this->get_tabs();
// Campus Homepage
if (api_get_setting('show_tabs', 'campus_homepage') == 'true') {
@@ -1061,7 +1164,10 @@ class Template {
}
// My Profile
- if (api_get_setting('show_tabs', 'my_profile') == 'true' && api_get_setting('allow_social_tool') != 'true') {
+ if (api_get_setting('show_tabs', 'my_profile') == 'true' && api_get_setting(
+ 'allow_social_tool'
+ ) != 'true'
+ ) {
$navigation['myprofile'] = $possible_tabs['myprofile'];
} else {
$menu_navigation['myprofile'] = $possible_tabs['myprofile'];
@@ -1078,7 +1184,7 @@ class Template {
if (api_get_setting('gradebook_enable') == 'true') {
if (api_get_setting('show_tabs', 'my_gradebook') == 'true') {
$navigation['mygradebook'] = $possible_tabs['mygradebook'];
- } else{
+ } else {
$menu_navigation['mygradebook'] = $possible_tabs['mygradebook'];
}
}
@@ -1103,7 +1209,7 @@ class Template {
if (api_get_setting('allow_social_tool') == 'true') {
$navigation['social'] = $possible_tabs['social'];
}
- } else{
+ } else {
$menu_navigation['social'] = isset($possible_tabs['social']) ? $possible_tabs['social'] : null;
}
@@ -1112,7 +1218,7 @@ class Template {
if (api_is_platform_admin() || api_is_drh() || api_is_session_admin()) {
$navigation['dashboard'] = $possible_tabs['dashboard'];
}
- } else{
+ } else {
$menu_navigation['dashboard'] = isset($possible_tabs['dashboard']) ? $possible_tabs['dashboard'] : null;
}
@@ -1128,7 +1234,10 @@ class Template {
// Reports
if (!empty($possible_tabs['reports'])) {
if (api_get_setting('show_tabs', 'reports') == 'true') {
- if ((api_is_platform_admin() || api_is_drh() || api_is_session_admin()) && Rights::hasRight('show_tabs:reports')) {
+ if ((api_is_platform_admin() || api_is_drh() || api_is_session_admin()) && Rights::hasRight(
+ 'show_tabs:reports'
+ )
+ ) {
$navigation['reports'] = $possible_tabs['reports'];
}
} else {
@@ -1137,7 +1246,7 @@ class Template {
}
// Custom tabs
- for ($i=1;$i<=3;$i++)
+ for ($i = 1; $i <= 3; $i++) {
if (api_get_setting('show_tabs', 'custom_tab_'.$i) == 'true') {
$navigation['custom_tab_'.$i] = $possible_tabs['custom_tab_'.$i];
} else {
@@ -1145,18 +1254,24 @@ class Template {
$menu_navigation['custom_tab_'.$i] = $possible_tabs['custom_tab_'.$i];
}
}
+ }
}
- $return = array('menu_navigation' => $menu_navigation, 'navigation' => $navigation, 'possible_tabs' => $possible_tabs);
+ $return = array(
+ 'menu_navigation' => $menu_navigation,
+ 'navigation' => $navigation,
+ 'possible_tabs' => $possible_tabs
+ );
return $return;
}
- function return_breadcrumb($interbreadcrumb, $language_file, $nameTools) {
+ function return_breadcrumb($interbreadcrumb, $language_file, $nameTools)
+ {
- $session_id = api_get_session_id();
- $session_name = api_get_session_name($session_id);
- $_course = api_get_course_info();
- $user_id = api_get_user_id();
- $course_id = api_get_course_id();
+ $session_id = api_get_session_id();
+ $session_name = api_get_session_name($session_id);
+ $_course = api_get_course_info();
+ $user_id = api_get_user_id();
+ $course_id = api_get_course_id();
/* Plugins for banner section */
@@ -1172,24 +1287,39 @@ class Template {
if (!empty($_course) && !isset($_GET['hide_course_breadcrumb'])) {
- $navigation_item['url'] = $web_course_path . $_course['path'].'/index.php'.(!empty($session_id) ? '?id_session='.$session_id : '');
+ $navigation_item['url'] = $web_course_path.$_course['path'].'/index.php'.(!empty($session_id) ? '?id_session='.$session_id : '');
$course_title = cut($_course['name'], MAX_LENGTH_BREADCRUMB);
switch (api_get_setting('breadcrumbs_course_homepage')) {
case 'get_lang':
- $navigation_item['title'] = Display::img(api_get_path(WEB_CSS_PATH).'home.png', get_lang('CourseHomepageLink')).' '.get_lang('CourseHomepageLink');
+ $navigation_item['title'] = Display::img(
+ api_get_path(WEB_CSS_PATH).'home.png',
+ get_lang('CourseHomepageLink')
+ ).' '.get_lang('CourseHomepageLink');
break;
case 'course_code':
- $navigation_item['title'] = Display::img(api_get_path(WEB_CSS_PATH).'home.png', $_course['official_code']).' '.$_course['official_code'];
+ $navigation_item['title'] = Display::img(
+ api_get_path(WEB_CSS_PATH).'home.png',
+ $_course['official_code']
+ ).' '.$_course['official_code'];
break;
case 'session_name_and_course_title':
- $navigation_item['title'] = Display::img(api_get_path(WEB_CSS_PATH).'home.png', $_course['name'].$my_session_name).' '.$course_title.$my_session_name;
+ $navigation_item['title'] = Display::img(
+ api_get_path(WEB_CSS_PATH).'home.png',
+ $_course['name'].$my_session_name
+ ).' '.$course_title.$my_session_name;
break;
default:
- if (api_get_session_id() != -1 ) {
- $navigation_item['title'] = Display::img(api_get_path(WEB_CSS_PATH).'home.png', $_course['name'].$my_session_name).' '.$course_title.$my_session_name;
+ if (api_get_session_id() != -1) {
+ $navigation_item['title'] = Display::img(
+ api_get_path(WEB_CSS_PATH).'home.png',
+ $_course['name'].$my_session_name
+ ).' '.$course_title.$my_session_name;
} else {
- $navigation_item['title'] = Display::img(api_get_path(WEB_CSS_PATH).'home.png', $_course['name']).' '.$course_title;
+ $navigation_item['title'] = Display::img(
+ api_get_path(WEB_CSS_PATH).'home.png',
+ $_course['name']
+ ).' '.$course_title;
}
break;
}
@@ -1198,7 +1328,7 @@ class Template {
$navigation_item_my_courses['title'] = get_lang('MyCourses');
$navigation_item_my_courses['url'] = api_get_path(WEB_PATH).'user_portal.php';
$navigation[] = $navigation_item_my_courses;
- */
+ */
$navigation[] = $navigation_item;
}
@@ -1215,22 +1345,22 @@ class Template {
// titles for shared folders
if ($breadcrumb_step['name'] == 'shared_folder') {
$navigation_item['title'] = get_lang('UserFolders');
- } elseif(strstr($breadcrumb_step['name'], 'shared_folder_session_')) {
+ } elseif (strstr($breadcrumb_step['name'], 'shared_folder_session_')) {
$navigation_item['title'] = get_lang('UserFolders');
- } elseif(strstr($breadcrumb_step['name'], 'sf_user_')) {
+ } elseif (strstr($breadcrumb_step['name'], 'sf_user_')) {
$userinfo = Database::get_user_info_from_id(substr($breadcrumb_step['name'], 8));
$navigation_item['title'] = api_get_person_name($userinfo['firstname'], $userinfo['lastname']);
- } elseif($breadcrumb_step['name'] == 'chat_files') {
+ } elseif ($breadcrumb_step['name'] == 'chat_files') {
$navigation_item['title'] = get_lang('ChatFiles');
- } elseif($breadcrumb_step['name'] == 'images') {
+ } elseif ($breadcrumb_step['name'] == 'images') {
$navigation_item['title'] = get_lang('Images');
- } elseif($breadcrumb_step['name'] == 'video') {
+ } elseif ($breadcrumb_step['name'] == 'video') {
$navigation_item['title'] = get_lang('Video');
- } elseif($breadcrumb_step['name'] == 'audio') {
+ } elseif ($breadcrumb_step['name'] == 'audio') {
$navigation_item['title'] = get_lang('Audio');
- } elseif($breadcrumb_step['name'] == 'flash') {
+ } elseif ($breadcrumb_step['name'] == 'flash') {
$navigation_item['title'] = get_lang('Flash');
- } elseif($breadcrumb_step['name'] == 'gallery') {
+ } elseif ($breadcrumb_step['name'] == 'gallery') {
$navigation_item['title'] = get_lang('Gallery');
}
//Fixes breadcrumb title now we applied the Security::remove_XSS and we cut the string depending of the MAX_LENGTH_BREADCRUMB value
@@ -1270,7 +1400,10 @@ class Template {
/* Part 4 . Show the teacher view/student view button at the right of the breadcrumb */
$view_as_student_link = null;
if ($user_id && isset($course_id)) {
- if ((api_is_course_admin() || api_is_platform_admin()) && api_get_setting('student_view_enabled') == 'true') {
+ if ((api_is_course_admin() || api_is_platform_admin()) && api_get_setting(
+ 'student_view_enabled'
+ ) == 'true'
+ ) {
$view_as_student_link = api_display_tool_view_option();
}
}
@@ -1286,34 +1419,38 @@ class Template {
// $home_link.= '/';
if (!empty($home_link)) {
- $lis.= Display::tag('li', $home_link);
+ $lis .= Display::tag('li', $home_link);
}
foreach ($final_navigation as $bread) {
$bread_check = trim(strip_tags($bread));
if (!empty($bread_check)) {
- if ($final_navigation_count-1 > $i) {
+ if ($final_navigation_count - 1 > $i) {
$bread .= '/';
}
- $lis.= Display::tag('li', $bread);
+ $lis .= Display::tag('li', $bread);
$i++;
}
}
} else {
if (!empty($home_link)) {
- $lis.= Display::tag('li', $home_link);
+ $lis .= Display::tag('li', $home_link);
}
}
// View as student/teacher link
if (!empty($view_as_student_link)) {
- $lis.= Display::tag('li', $view_as_student_link, array('id' => 'view_as_link','class' => 'pull-right'));
+ $lis .= Display::tag(
+ 'li',
+ $view_as_student_link,
+ array('id' => 'view_as_link', 'class' => 'pull-right')
+ );
}
if (!empty($lis)) {
- $html .= Display::tag('ul', $lis, array('class'=>'breadcrumb'));
+ $html .= Display::tag('ul', $lis, array('class' => 'breadcrumb'));
}
}
- return $html ;
+ return $html;
}
}
\ No newline at end of file