From bb647f4cb078b98da51cc2c090dd9e788ee8f994 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Loguercio?= Date: Thu, 19 May 2016 16:44:45 -0500 Subject: [PATCH] Added a Link to Course catalog in main navbar if its public - Refs #8243 --- main/auth/courses.php | 2 +- main/inc/lib/api.lib.php | 1 + main/inc/lib/banner.lib.php | 9 +++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/main/auth/courses.php b/main/auth/courses.php index dd9a254860..736ea09825 100755 --- a/main/auth/courses.php +++ b/main/auth/courses.php @@ -21,7 +21,7 @@ $ctok = Security::get_existing_token(); $limit = CourseCategory::getLimitArray(); // Section for the tabs. -$this_section = SECTION_COURSES; +$this_section = SECTION_CATALOG; if (api_get_setting('course_catalog_published') !== 'true') { // Access rights: anonymous users can't do anything useful here. diff --git a/main/inc/lib/api.lib.php b/main/inc/lib/api.lib.php index 536575aa3b..2b0f110bb5 100644 --- a/main/inc/lib/api.lib.php +++ b/main/inc/lib/api.lib.php @@ -147,6 +147,7 @@ define('TOOL_COURSE_PROGRESS', 'course_progress'); // CONSTANTS defining Chamilo interface sections define('SECTION_CAMPUS', 'mycampus'); define('SECTION_COURSES', 'mycourses'); +define('SECTION_CATALOG', 'catalog'); define('SECTION_MYPROFILE', 'myprofile'); define('SECTION_MYAGENDA', 'myagenda'); define('SECTION_COURSE_ADMIN', 'course_admin'); diff --git a/main/inc/lib/banner.lib.php b/main/inc/lib/banner.lib.php index 1fe7119e59..25aa371043 100755 --- a/main/inc/lib/banner.lib.php +++ b/main/inc/lib/banner.lib.php @@ -26,6 +26,11 @@ function get_tabs($courseId = null) $navigation[SECTION_CAMPUS]['title'] = get_lang('CampusHomepage'); $navigation[SECTION_CAMPUS]['key'] = 'homepage'; + $navigation[SECTION_CATALOG]['url'] = api_get_path(WEB_PATH).'main/auth/courses.php'; + $navigation[SECTION_CATALOG]['title'] = get_lang('Courses'); + $navigation[SECTION_CATALOG]['key'] = 'catalog'; + + // My Courses if (api_is_allowed_to_create_course()) { @@ -287,6 +292,10 @@ function return_navigation_array() $menu_navigation[SECTION_CAMPUS] = $possible_tabs[SECTION_CAMPUS]; } + if (api_get_setting('course_catalog_published') == 'true' && api_is_anonymous()) { + $navigation[SECTION_CATALOG] = $possible_tabs[SECTION_CATALOG]; + } + if (api_get_user_id() && !api_is_anonymous()) { // My Courses if (api_get_setting('show_tabs', 'my_courses') == 'true') {