|
@@ -2750,24 +2750,27 @@ class CourseManager
|
|
|
$tbl_user_course_category = Database::get_main_table(TABLE_USER_COURSE_CATEGORY);
|
|
|
$tableCourseUrl = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
|
|
|
|
|
|
+ $languageCondition = '';
|
|
|
+ $onlyInUserLanguage = api_get_configuration_value('my_courses_show_courses_in_user_language_only');
|
|
|
+ if ($onlyInUserLanguage) {
|
|
|
+ $userInfo = api_get_user_info(api_get_user_id());
|
|
|
+ if (!empty($userInfo['language'])) {
|
|
|
+ $languageCondition = " AND course.course_language = '".$userInfo['language']."' ";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if ($adminGetsAllCourses && UserManager::is_admin($user_id)) {
|
|
|
// get the whole courses list
|
|
|
$sql = "SELECT DISTINCT(course.code), course.id as real_id
|
|
|
FROM $tbl_course course
|
|
|
INNER JOIN $tableCourseUrl url
|
|
|
ON (course.id = url.c_id)
|
|
|
- WHERE url.access_url_id = $urlId
|
|
|
+ WHERE
|
|
|
+ url.access_url_id = $urlId
|
|
|
+ $languageCondition
|
|
|
";
|
|
|
} else {
|
|
|
$withSpecialCourses = $withoutSpecialCourses = '';
|
|
|
- $languageCondition = '';
|
|
|
- $onlyInUserLanguage = api_get_configuration_value('my_courses_show_courses_in_user_language_only');
|
|
|
- if ($onlyInUserLanguage) {
|
|
|
- $userInfo = api_get_user_info(api_get_user_id());
|
|
|
- if (!empty($userInfo['language'])) {
|
|
|
- $languageCondition = " AND course.course_language = '".$userInfo['language']."' ";
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
if ($loadSpecialCourses) {
|
|
|
$specialCourseList = self::get_special_course_list();
|