|
@@ -2730,6 +2730,7 @@ class CourseManager
|
|
|
* whether he gets all the courses or just his. Note: This does *not* include all sessions
|
|
|
* @param bool $loadSpecialCourses
|
|
|
* @param array $skipCourseList List of course ids to skip
|
|
|
+ * @param bool $useUserLanguageFilterIfAvailable
|
|
|
* @return array List of codes and db name
|
|
|
* @author isaac flores paz
|
|
|
*/
|
|
@@ -2738,7 +2739,8 @@ class CourseManager
|
|
|
$include_sessions = false,
|
|
|
$adminGetsAllCourses = false,
|
|
|
$loadSpecialCourses = true,
|
|
|
- $skipCourseList = []
|
|
|
+ $skipCourseList = [],
|
|
|
+ $useUserLanguageFilterIfAvailable = true
|
|
|
) {
|
|
|
$user_id = intval($user_id);
|
|
|
$urlId = api_get_current_access_url_id();
|
|
@@ -2752,7 +2754,7 @@ class CourseManager
|
|
|
|
|
|
$languageCondition = '';
|
|
|
$onlyInUserLanguage = api_get_configuration_value('my_courses_show_courses_in_user_language_only');
|
|
|
- if ($onlyInUserLanguage) {
|
|
|
+ if ($useUserLanguageFilterIfAvailable && $onlyInUserLanguage) {
|
|
|
$userInfo = api_get_user_info(api_get_user_id());
|
|
|
if (!empty($userInfo['language'])) {
|
|
|
$languageCondition = " AND course.course_language = '".$userInfo['language']."' ";
|
|
@@ -3581,10 +3583,14 @@ class CourseManager
|
|
|
* in the sense that any user clicking them is registered as a student
|
|
|
* @param int $user_id User id
|
|
|
* @param bool $load_dirs Whether to show the document quick-loader or not
|
|
|
+ * @param bool $useUserLanguageFilterIfAvailable
|
|
|
* @return string
|
|
|
*/
|
|
|
- public static function returnSpecialCourses($user_id, $load_dirs = false)
|
|
|
- {
|
|
|
+ public static function returnSpecialCourses(
|
|
|
+ $user_id,
|
|
|
+ $load_dirs = false,
|
|
|
+ $useUserLanguageFilterIfAvailable = true
|
|
|
+ ) {
|
|
|
$user_id = intval($user_id);
|
|
|
$table = Database::get_main_table(TABLE_MAIN_COURSE);
|
|
|
$specialCourseList = self::get_special_course_list();
|
|
@@ -3596,7 +3602,7 @@ class CourseManager
|
|
|
// Filter by language
|
|
|
$languageCondition = '';
|
|
|
$onlyInUserLanguage = api_get_configuration_value('my_courses_show_courses_in_user_language_only');
|
|
|
- if ($onlyInUserLanguage) {
|
|
|
+ if ($useUserLanguageFilterIfAvailable && $onlyInUserLanguage) {
|
|
|
$userInfo = api_get_user_info(api_get_user_id());
|
|
|
if (!empty($userInfo['language'])) {
|
|
|
$languageCondition = " AND course_language = '".$userInfo['language']."' ";
|
|
@@ -3709,10 +3715,15 @@ class CourseManager
|
|
|
* @param int $user_id
|
|
|
* @param bool $load_dirs Whether to show the document quick-loader or not
|
|
|
* @param integer $user_id
|
|
|
+ * @param bool $useUserLanguageFilterIfAvailable
|
|
|
+ *
|
|
|
* @return array
|
|
|
*/
|
|
|
- public static function returnCourses($user_id, $load_dirs = false)
|
|
|
- {
|
|
|
+ public static function returnCourses(
|
|
|
+ $user_id,
|
|
|
+ $load_dirs = false,
|
|
|
+ $useUserLanguageFilterIfAvailable = true
|
|
|
+ ) {
|
|
|
$user_id = intval($user_id);
|
|
|
if (empty($user_id)) {
|
|
|
$user_id = api_get_user_id();
|
|
@@ -3733,7 +3744,8 @@ class CourseManager
|
|
|
$courseInCategory = self::returnCoursesCategories(
|
|
|
$row['id'],
|
|
|
$load_dirs,
|
|
|
- $user_id
|
|
|
+ $user_id,
|
|
|
+ $useUserLanguageFilterIfAvailable
|
|
|
);
|
|
|
|
|
|
$params = [
|
|
@@ -3748,7 +3760,8 @@ class CourseManager
|
|
|
$coursesNotCategory = self::returnCoursesCategories(
|
|
|
0,
|
|
|
$load_dirs,
|
|
|
- $user_id
|
|
|
+ $user_id,
|
|
|
+ $useUserLanguageFilterIfAvailable
|
|
|
);
|
|
|
|
|
|
if ($coursesNotCategory) {
|
|
@@ -3764,12 +3777,14 @@ class CourseManager
|
|
|
* @param int $user_category_id User category id
|
|
|
* @param bool $load_dirs Whether to show the document quick-loader or not
|
|
|
* @param int $user_id
|
|
|
+ * @param bool $useUserLanguageFilterIfAvailable
|
|
|
* @return string
|
|
|
*/
|
|
|
public static function returnCoursesCategories(
|
|
|
$user_category_id,
|
|
|
$load_dirs = false,
|
|
|
- $user_id = 0
|
|
|
+ $user_id = 0,
|
|
|
+ $useUserLanguageFilterIfAvailable = true
|
|
|
) {
|
|
|
$user_id = $user_id ?: api_get_user_id();
|
|
|
$user_category_id = (int) $user_category_id;
|
|
@@ -3794,7 +3809,7 @@ class CourseManager
|
|
|
|
|
|
$languageCondition = '';
|
|
|
$onlyInUserLanguage = api_get_configuration_value('my_courses_show_courses_in_user_language_only');
|
|
|
- if ($onlyInUserLanguage) {
|
|
|
+ if ($useUserLanguageFilterIfAvailable && $onlyInUserLanguage) {
|
|
|
$userInfo = api_get_user_info(api_get_user_id());
|
|
|
if (!empty($userInfo['language'])) {
|
|
|
$languageCondition = " AND course.course_language = '".$userInfo['language']."' ";
|