Browse Source

Convert array.lib into a class

Julio Montoya 9 years ago
parent
commit
02a7bf43f6

+ 1 - 1
main/admin/sub_language.php

@@ -282,7 +282,7 @@ function search_language_term(
 		}
 	}
 
-	$list_info = array_unique_dimensional($list_info);
+	$list_info = ArrayClass::array_unique_dimensional($list_info);
 	return $list_info;
 }
 

+ 1 - 1
main/admin/teacher_time_report.php

@@ -85,7 +85,7 @@ if (!empty($selectedCourse)) {
     $withFilter = true;
     $course = api_get_course_info($selectedCourse);
     $reportTitle = sprintf(get_lang('TimeReportForCourseX'), $course['title']);
-    $teachers = CourseManager::get_teacher_list_from_course_code($selectedCourse);
+    $teachers = CourseManager::getTeacherListFromCourse($course['real_id']);
 
     foreach ($teachers as $teacher) {
         $totalTime = UserManager::getTimeSpentInCourses(

+ 3 - 1
main/attendance/attendance_controller.php

@@ -498,7 +498,9 @@ class AttendanceController
 
         // Set headers pdf.
         $courseCategory = CourseManager::get_course_category($courseInfo['category_code']);
-        $teacherInfo = CourseManager::get_teacher_list_from_course_code($courseInfo['code']);
+        $teacherInfo = CourseManager::getTeacherListFromCourse(
+            $courseInfo['real_id']
+        );
         $teacherName = null;
         foreach ($teacherInfo as $teacherData) {
             if ($teacherName != null) {

+ 2 - 2
main/coursecopy/classes/CourseRestorer.class.php

@@ -150,8 +150,8 @@ class CourseRestorer
         $this->destination_course_id = $course_info['real_id'];
 
         //Getting first teacher (for the forums)
-        $teacher_list = CourseManager::get_teacher_list_from_course_code(
-            $course_info['code']
+        $teacher_list = CourseManager::getTeacherListFromCourse(
+            $this->destination_course_id
         );
         $this->first_teacher_id = api_get_user_id();
 

+ 2 - 2
main/dropbox/dropbox_functions.inc.php

@@ -614,8 +614,8 @@ function display_add_form($dropbox_unid, $viewReceivedCategory, $viewSentCategor
                 api_get_session_id()
             );
         } else {
-            $complete_user_list_for_dropbox = CourseManager::get_teacher_list_from_course_code(
-                $course_info['code'],
+            $complete_user_list_for_dropbox = CourseManager::getTeacherListFromCourse(
+                $course_info['real_id'],
                 false
             );
         }

+ 7 - 3
main/exercice/exercise.class.php

@@ -4254,7 +4254,7 @@ class Exercise
         if (!empty($sessionId)) {
             $teachers = CourseManager::get_coach_list_from_course_code($courseCode, $sessionId);
         } else {
-            $teachers = CourseManager::get_teacher_list_from_course_code($courseCode);
+            $teachers = CourseManager::getTeacherListFromCourse($courseCode);
         }
 
         if (!empty($teachers)) {
@@ -4353,7 +4353,9 @@ class Exercise
             if (api_get_session_id()) {
                 $teachers = CourseManager::get_coach_list_from_course_code($courseCode, api_get_session_id());
             } else {
-                $teachers = CourseManager::get_teacher_list_from_course_code($courseCode);
+                $teachers = CourseManager::getTeacherListFromCourse(
+                    $course_info['real_id']
+                );
             }
 
             if (!empty($teachers)) {
@@ -4444,7 +4446,9 @@ class Exercise
             if (api_get_session_id()) {
                 $teachers = CourseManager::get_coach_list_from_course_code($courseCode, api_get_session_id());
             } else {
-                $teachers = CourseManager::get_teacher_list_from_course_code($courseCode);
+                $teachers = CourseManager::getTeacherListFromCourse(
+                    $course_info['real_id']
+                );
             }
 
             if (!empty($teachers)) {

+ 3 - 3
main/inc/ajax/course_home.ajax.php

@@ -199,7 +199,7 @@ switch ($action) {
             }
         }
 
-        $temp = msort($temp, $sidx, $sord);
+        $temp = ArrayClass::msort($temp, $sidx, $sord);
 
         $i =0;
         $response = new stdClass();
@@ -329,7 +329,7 @@ switch ($action) {
             }
         }
         if (!empty($sidx)) {
-            $temp = msort($temp, $sidx, $sord);
+            $temp = ArrayClass::msort($temp, $sidx, $sord);
         }
 
         $response = new stdClass();
@@ -456,7 +456,7 @@ switch ($action) {
             }
         }
 
-        $temp = msort($temp, $sidx, $sord);
+        $temp = ArrayClass::msort($temp, $sidx, $sord);
 
         $response = new stdClass();
         $i =0;

+ 2 - 2
main/inc/ajax/model.ajax.php

@@ -720,7 +720,7 @@ switch ($action) {
 	case 'get_user_skill_ranking':
         $columns = array('photo', 'firstname', 'lastname', 'skills_acquired', 'currently_learning', 'rank');
         $result = $skill->get_user_list_skill_ranking($start, $limit, $sidx, $sord, $whereCondition);
-        $result = msort($result, 'skills_acquired', 'asc');
+        $result = ArrayClass::msort($result, 'skills_acquired', 'asc');
 
         $skills_in_course = array();
         if (!empty($result)) {
@@ -1540,7 +1540,7 @@ switch ($action) {
             $sidx = 'name';
         }
         // Multidimensional sort
-        $result = msort($result, $sidx, $sord);
+        $result = ArrayClass::msort($result, $sidx, $sord);
         break;
     default:
         exit;

+ 3 - 1
main/inc/lib/AnnouncementManager.php

@@ -46,7 +46,9 @@ class AnnouncementManager
     {
         $readerInfo = api_get_user_info($userId);
         $courseInfo = api_get_course_info($course_code);
-        $teacher_list = CourseManager::get_teacher_list_from_course_code($courseInfo['code']);
+        $teacher_list = CourseManager::getTeacherListFromCourse(
+            $courseInfo['real_id']
+        );
 
         $teacher_name = '';
         if (!empty($teacher_list)) {

+ 4 - 4
main/inc/lib/agenda.lib.php

@@ -1498,7 +1498,7 @@ class Agenda
                 (
                     agenda.session_id = $session_id AND
                     ip.session_id = $session_id
-                ) ";                
+                ) ";
             }
 
             $sql = "SELECT DISTINCT
@@ -1545,7 +1545,7 @@ class Agenda
                 (
                     agenda.session_id = $session_id AND
                     ip.session_id = $session_id
-                ) ";                
+                ) ";
             }
 
             $sql = "SELECT DISTINCT
@@ -3187,8 +3187,8 @@ class Agenda
                     echo "<td ".$class.">".$dayheader;
 
                     if (!empty($agendaitems[$curday])) {
-                        $items =  $agendaitems[$curday];
-                        $items =  msort($items, 'start_date_tms');
+                        $items = $agendaitems[$curday];
+                        $items = ArrayClass::msort($items, 'start_date_tms');
 
                         foreach($items  as $value) {
                             $value['title'] = Security::remove_XSS($value['title']);

+ 17 - 0
main/inc/lib/api.lib.php

@@ -1831,14 +1831,26 @@ function api_get_course_info($course_code = null, $strict = false)
                 WHERE course.id = $courseId";
         $result = Database::query($sql);
         $courseInfo = array();
+
         if (Database::num_rows($result) > 0) {
             $data = Database::fetch_array($result);
+
+            $data['teacher_list'] = CourseManager::getTeacherListFromCourse(
+                $courseId
+            );
+            $data['teacher_list_formatted'] = CourseManager::formatUserListToString(
+                $data['teacher_list'],
+                null,
+                true
+            );
+
             $courseInfo = api_format_course_array($data);
         }
 
         return $courseInfo;
     }
 
+
     $_course = Session::read('_course');
     if ($_course == '-1') {
         $_course = array();
@@ -1955,6 +1967,11 @@ function api_format_course_array($course_data)
     }
     $_course['course_image_large'] = $url_image;
 
+    $_course['extra_fields'] = isset($course_data['extra_fields']) ? $course_data['extra_fields'] : array();
+    $_course['settings'] = isset($course_data['settings']) ? $course_data['settings'] : array();
+    $_course['teacher_list'] = isset($course_data['teacher_list']) ? $course_data['teacher_list'] : array();
+    $_course['teacher_list_formatted'] = isset($course_data['teacher_list_formatted']) ? $course_data['teacher_list_formatted'] : array();
+
     return $_course;
 }
 

+ 160 - 117
main/inc/lib/array.lib.php

@@ -1,143 +1,186 @@
 <?php
 /* For licensing terms, see /license.txt */
 /**
-*	This is the array library for Chamilo.
-*	Include/require it in your code to use its functionality.
-*
-*	@package chamilo.library
-*/
-
-
-/**
- * Removes duplicate values from a dimensional array
- *
- * @param array $array dimensional array
- * @return array an array with unique values
+ *    This is the array library for Chamilo.
+ *    Include/require it in your code to use its functionality.
  *
+ * @package chamilo.library
  */
-function array_unique_dimensional($array)
+class ArrayClass
 {
-    if (!is_array($array)) {
-        return $array;
-    }
+    /**
+     * Removes duplicate values from a dimensional array
+     *
+     * @param array a dimensional array
+     * @return array an array with unique values
+     *
+     */
+    public static function array_unique_dimensional($array)
+    {
+        if (!is_array($array)) {
+            return $array;
+        }
 
-    foreach ($array as &$myvalue) {
-        $myvalue = serialize($myvalue);
-    }
+        foreach ($array as &$myvalue) {
+            $myvalue = serialize($myvalue);
+        }
 
-    $array = array_unique($array);
+        $array = array_unique($array);
 
-    foreach ($array as &$myvalue) {
-        $myvalue = unserialize($myvalue);
-    }
-    return $array;
-}
+        foreach ($array as &$myvalue) {
+            $myvalue = unserialize($myvalue);
+        }
 
-/**
- *
- * Sort multidimensional arrays
- *
- * @param    array    unsorted multidimensional array
- * @param    string    key to be sorted
- * @return    array    result array
- * @author    found in http://php.net/manual/en/function.sort.php
- */
-function msort($array, $id = 'id', $order = 'desc')
-{
-    if (empty($array)) {
         return $array;
     }
-    $temp_array = array();
-    while (count($array) > 0) {
-        $lowest_id = 0;
-        $index = 0;
-        foreach ($array as $item) {
-            if ($order == 'desc') {
-                if ($item[$id] < $array[$lowest_id][$id]) {
-                    $lowest_id = $index;
-                }
-            } else {
-                if ($item[$id] > $array[$lowest_id][$id]) {
-                    $lowest_id = $index;
+
+    /**
+     *
+     * Sort multidimensional arrays
+     *
+     * @param    array    unsorted multidimensional array
+     * @param    string    key to be sorted
+     * @return    array    result array
+     * @author    found in http://php.net/manual/en/function.sort.php
+     */
+    public static function msort($array, $id = 'id', $order = 'desc')
+    {
+        if (empty($array)) {
+            return $array;
+        }
+        $temp_array = array();
+        while (count($array) > 0) {
+            $lowest_id = 0;
+            $index = 0;
+            foreach ($array as $item) {
+                if ($order == 'desc') {
+                    if ($item[$id] < $array[$lowest_id][$id]) {
+                        $lowest_id = $index;
+                    }
+                } else {
+                    if ($item[$id] > $array[$lowest_id][$id]) {
+                        $lowest_id = $index;
+                    }
                 }
+                $index++;
             }
-            $index++;
+            $temp_array[] = $array[$lowest_id];
+            $array = array_merge(
+                array_slice($array, 0, $lowest_id),
+                array_slice($array, $lowest_id + 1)
+            );
         }
-        $temp_array[] = $array[$lowest_id];
-        $array = array_merge(
-            array_slice($array, 0, $lowest_id),
-            array_slice($array, $lowest_id + 1)
-        );
+
+        return $temp_array;
     }
-    return $temp_array;
-}
 
-function array_walk_recursive_limited(
-    &$array,
-    $function,
-    $apply_to_keys_also = false
-) {
-    static $recursive_counter = 0;
-    if (++$recursive_counter > 1000) {
-        die('possible deep recursion attack');
+    /**
+     * @param $array
+     * @return mixed
+     */
+    public static function utf8_sort($array)
+    {
+        $old_locale = setlocale(LC_ALL, null);
+        $code = api_get_language_isocode();
+        $locale_list = array(
+            $code.'.utf8',
+            'en.utf8',
+            'en_US.utf8',
+            'en_GB.utf8',
+        );
+        $try_sort = false;
+
+        foreach ($locale_list as $locale) {
+            $my_local = setlocale(LC_COLLATE, $locale);
+            if ($my_local) {
+                $try_sort = true;
+                break;
+            }
+        }
+
+        if ($try_sort) {
+            uasort($array, 'strcoll');
+        }
+        setlocale(LC_COLLATE, $old_locale);
+
+        return $array;
     }
-    foreach ($array as $key => $value) {
-        if (is_array($value)) {
-            array_walk_recursive_limited(
-                $array[$key],
-                $function,
-                $apply_to_keys_also
-            );
-        } else {
-            $array[$key] = $function($value);
+
+    /**
+     * @param $array
+     * @param string $separator
+     * @return string
+     */
+    public static function array_to_string($array, $separator = ',')
+    {
+        if (empty($array)) {
+            return '';
         }
-        if ($apply_to_keys_also && is_string($key)) {
-            $new_key = $function($key);
-            if ($new_key != $key) {
-                $array[$new_key] = $array[$key];
-                unset($array[$key]);
+
+        return implode($separator.' ', $array);
+    }
+
+    /**
+     * @param array $array
+     * @return array
+     */
+    public static function array_flatten(array $array)
+    {
+        $flatten = array();
+        array_walk_recursive(
+            $array,
+            function ($value) use (&$flatten) {
+                $flatten[] = $value;
             }
-        }
+        );
+
+        return $flatten;
     }
-    $recursive_counter--;
-}
 
-/**
- * @param $array
- * @return mixed
- */
-function utf8_sort($array)
-{
-	$old_locale = setlocale(LC_ALL, null);
-	$code = api_get_language_isocode();
-	$locale_list = array($code.'.utf8', 'en.utf8','en_US.utf8','en_GB.utf8');
-	$try_sort = false;
-
-	foreach($locale_list as $locale) {
-		$my_local = setlocale(LC_COLLATE, $locale);
-		if ($my_local) {
-			$try_sort = true;
-			break;
-		}
-	}
-
-	if ($try_sort) {
-		uasort($array, 'strcoll');
-	}
-	setlocale(LC_COLLATE, $old_locale);
-	return $array;
-}
+    /**
+     * Shuffles an array keeping the associations
+     * @param $array
+     * @return bool
+     */
+    public static function shuffle_assoc(&$array)
+    {
+        $keys = array_keys($array);
+        shuffle($keys);
+        foreach ($keys as $key) {
+            $new[$key] = $array[$key];
+        }
+        $array = $new;
 
-/**
- * @param array $array
- * @param string $separator
- * @return string
- */
-function array_to_string($array, $separator = ',')
-{
-    if (empty($array)) {
-        return '';
+        return true;
     }
 
-    return implode($separator.' ', $array);
+    public static function array_walk_recursive_limited(
+        &$array,
+        $function,
+        $apply_to_keys_also = false
+    ) {
+        static $recursive_counter = 0;
+        if (++$recursive_counter > 1000) {
+            die('possible deep recursion attack');
+        }
+        foreach ($array as $key => $value) {
+            if (is_array($value)) {
+                array_walk_recursive_limited(
+                    $array[$key],
+                    $function,
+                    $apply_to_keys_also
+                );
+            } else {
+                $array[$key] = $function($value);
+            }
+            if ($apply_to_keys_also && is_string($key)) {
+                $new_key = $function($key);
+                if ($new_key != $key) {
+                    $array[$new_key] = $array[$key];
+                    unset($array[$key]);
+                }
+            }
+        }
+        $recursive_counter--;
+    }
 }

+ 71 - 19
main/inc/lib/course.lib.php

@@ -1846,13 +1846,12 @@ class CourseManager
      * Return user info array of all teacher-users registered in a course
      * This only returns the users that are registered in this actual course, not linked courses.
      *
-     * @param string $course_code
+     * @param int $courseId
      * @return array with user id
      */
-    public static function get_teacher_list_from_course_code($course_code)
+    public static function getTeacherListFromCourse($courseId)
     {
-        $courseInfo = api_get_course_info($course_code);
-        $courseId = $courseInfo['real_id'];
+        $courseId = intval($courseId);
         if (empty($courseId)) {
             return false;
         }
@@ -1879,20 +1878,65 @@ class CourseManager
         return $teachers;
     }
 
+    /**
+     * @param $userList
+     * @param null $separator
+     * @param bool|false $add_link_to_profile
+     * @return string
+     */
+    public static function formatUserListToString(
+        $userList,
+        $separator = null,
+        $add_link_to_profile = false
+    ) {
+        if (empty($separator)) {
+            $separator = self::USER_SEPARATOR;
+        }
+        $teacher_string = '';
+        $list = array();
+        if (!empty($userList)) {
+            foreach ($userList as $teacher) {
+                $teacher_name = api_get_person_name(
+                    $teacher['firstname'],
+                    $teacher['lastname']
+                );
+                if ($add_link_to_profile) {
+                    $url = api_get_path(
+                            WEB_AJAX_PATH
+                        ).'user_manager.ajax.php?a=get_user_popup&resizable=0&height=300&user_id='.$teacher['user_id'];
+                    $teacher_name = Display::url(
+                        $teacher_name,
+                        $url,
+                        array('class' => 'ajax')
+                    );
+                }
+                $list[] = $teacher_name;
+            }
+            if (!empty($list)) {
+                $teacher_string = ArrayClass::array_to_string(
+                    $list,
+                    $separator
+                );
+            }
+        }
+
+        return $teacher_string;
+    }
+
     /**
      * Returns a string list of teachers assigned to the given course
-     * @param string $course_code
+     * @param int $courseId
      * @param string $separator between teachers names
      * @param bool $add_link_to_profile Whether to add a link to the teacher's profile
      * @return string List of teachers teaching the course
      */
-    public static function get_teacher_list_from_course_code_to_string(
-        $course_code,
+    public static function getTeacherListFromCourseToString(
+        $courseId,
         $separator = self::USER_SEPARATOR,
         $add_link_to_profile = false,
         $orderList = false
     ) {
-        $teacher_list = self::get_teacher_list_from_course_code($course_code);
+        $teacher_list = self::getTeacherListFromCourse($courseId);
         $teacher_string = '';
         $html = '';
         $list = array();
@@ -3188,7 +3232,7 @@ class CourseManager
         //Crop the image to adjust 4:3 ratio
         $image = new Image($source_file);
         $image->crop($cropParameters);
-        
+
         //Resize the images in two formats
         $medium = new Image($source_file);
         $medium->resize(85);
@@ -3196,7 +3240,7 @@ class CourseManager
         $normal = new Image($source_file);
         $normal->resize(300);
         $normal->send_image($course_image, -1, 'png');
-        
+
         $result = $medium && $normal;
 
         return $result ? $result : false;
@@ -3495,8 +3539,8 @@ class CourseManager
                         $course_title .= ' (' . $course_info['visual_code'] . ') ';
                     }
                     if (api_get_setting('display_teacher_in_courselist') == 'true') {
-                        $params['teachers'] = CourseManager::get_teacher_list_from_course_code_to_string(
-                            $course['code'],
+                        $params['teachers'] = CourseManager::getTeacherListFromCourseToString(
+                            $course['real_id'],
                             self::USER_SEPARATOR,
                             true
                         );
@@ -3733,8 +3777,8 @@ class CourseManager
             }
 
             if (api_get_setting('display_teacher_in_courselist') == 'true') {
-                $teachers = CourseManager::get_teacher_list_from_course_code_to_string(
-                    $course['code'],
+                $teachers = CourseManager::getTeacherListFromCourseToString(
+                    $course['real_id'],
                     self::USER_SEPARATOR,
                     true
                 );
@@ -3993,8 +4037,8 @@ class CourseManager
 
         if (api_get_setting('display_teacher_in_courselist') == 'true') {
 
-            $teacher_list = CourseManager::get_teacher_list_from_course_code_to_string(
-                $course_info['code'],
+            $teacher_list = CourseManager::getTeacherListFromCourseToString(
+                $course_info['real_id'],
                 self::USER_SEPARATOR,
                 true
             );
@@ -4692,7 +4736,9 @@ class CourseManager
                 );
             //}
             /* get_lang('Description') */
-            $my_course['extra_info']['teachers'] = CourseManager::get_teacher_list_from_course_code_to_string($course_info['code']);
+            $my_course['extra_info']['teachers'] = CourseManager::getTeacherListFromCourseToString(
+                $course_info['real_id']
+            );
             $point_info = self::get_course_ranking($course_info['real_id'], 0);
             $my_course['extra_info']['rating_html'] = Display::return_rating_system('star_' . $course_info['real_id'],
                 $ajax_url . '&course_id=' . $course_info['real_id'], $point_info);
@@ -4916,7 +4962,9 @@ class CourseManager
         $course_code = $courseInfo['code'];
 
         $course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
-        $alreadyAddedTeachers = CourseManager::get_teacher_list_from_course_code($course_code);
+        $alreadyAddedTeachers = CourseManager::getTeacherListFromCourse(
+            $course_code
+        );
 
         if ($deleteTeachersNotInList) {
 
@@ -5806,7 +5854,11 @@ class CourseManager
         }
         $teachers = '';
         if (api_get_setting('display_teacher_in_courselist') == 'true') {
-            $teachers = CourseManager::get_teacher_list_from_course_code_to_string($course['code'], self::USER_SEPARATOR, true);
+            $teachers = CourseManager::getTeacherListFromCourseToString(
+                $course['real_id'],
+                self::USER_SEPARATOR,
+                true
+            );
         }
         $params['link'] = $course_title_url;
         $params['icon'] = $status_icon;

+ 2 - 2
main/inc/lib/exercise.lib.php

@@ -1837,8 +1837,8 @@ HTML;
             return $rowx[0];
         }
 
-        $teacher_list = CourseManager::get_teacher_list_from_course_code(
-            api_get_course_id()
+        $teacher_list = CourseManager::getTeacherListFromCourse(
+            api_get_course_int_id()
         );
         $teacher_id_list = array();
         foreach ($teacher_list as $teacher) {

+ 1 - 1
main/inc/lib/pdf.lib.php

@@ -132,7 +132,7 @@ class PDF
 
                 );
             } else {
-                $teacher_list = CourseManager::get_teacher_list_from_course_code_to_string(
+                $teacher_list = CourseManager::getTeacherListFromCourseToString(
                     $this->params['course_code']
                 );
             }

+ 7 - 3
main/inc/lib/sessionmanager.lib.php

@@ -4464,7 +4464,7 @@ class SessionManager
                             if ($addTeachersToSession) {
                                 if ($addOriginalCourseTeachersAsCourseSessionCoaches) {
                                     // Adding course teachers as course session teachers.
-                                    $alreadyAddedTeachers = CourseManager::get_teacher_list_from_course_code(
+                                    $alreadyAddedTeachers = CourseManager::getTeacherListFromCourse(
                                         $course_code
                                     );
 
@@ -4510,7 +4510,9 @@ class SessionManager
                                 }
 
                                 // Un subscribe everyone that's not in the list.
-                                $teacherList = CourseManager::get_teacher_list_from_course_code($course_code);
+                                $teacherList = CourseManager::getTeacherListFromCourse(
+                                    $courseId
+                                );
                                 if (!empty($teacherList)) {
                                     foreach ($teacherList as $teacher) {
                                         if ($teacherToAdd != $teacher['user_id']) {
@@ -4617,7 +4619,9 @@ class SessionManager
 
                                 if (!empty($teacherToAdd)) {
                                     // Deleting all course teachers and adding the only coach as teacher.
-                                    $teacherList = CourseManager::get_teacher_list_from_course_code($course_code);
+                                    $teacherList = CourseManager::getTeacherListFromCourse(
+                                        $courseId
+                                    );
 
                                     if (!empty($teacherList)) {
                                         foreach ($teacherList as $teacher) {

+ 3 - 1
main/inc/lib/social.lib.php

@@ -931,7 +931,9 @@ class SocialManager extends UserManager
                         $i++;
                     }
                     // To avoid repeated courses
-                    $course_list_code = array_unique_dimensional($course_list_code);
+                    $course_list_code = ArrayClass::array_unique_dimensional(
+                        $course_list_code
+                    );
                 }
 
                 // Announcements

+ 2 - 2
main/inc/lib/tracking.lib.php

@@ -1173,7 +1173,7 @@ class Tracking
                 null,
                 null,
                 null
-            );  
+            );
             foreach ($platformCourses as $course) {
                 $courses[$course['code']] = $course['code'];
             }
@@ -4157,7 +4157,7 @@ class Tracking
             }
 
             if (empty($session_id)) {
-                $my_course_data = utf8_sort($my_course_data);
+                $my_course_data = ArrayClass::utf8_sort($my_course_data);
             }
 
             $final_course_data = array();

+ 1 - 1
main/inc/lib/usergroup.lib.php

@@ -858,7 +858,7 @@ class UserGroup extends Model
         }
 
         // Multidimensional sort
-        $result = msort($result, $sidx, $sord);
+        $result = ArrayClass::msort($result, $sidx, $sord);
 
         return $result;
     }

+ 1 - 1
main/inc/lib/userportal.lib.php

@@ -62,7 +62,7 @@ class IndexManager
                 }
             }
             if (!empty($exercise_list)) {
-                $exercise_list = msort($exercise_list, 'tms');
+                $exercise_list = ArrayClass::msort($exercise_list, 'tms');
                 $my_exercise = $exercise_list[0];
                 $url = Display::url($my_exercise['title'], api_get_path(WEB_CODE_PATH).'exercice/overview.php?exerciseId='.$my_exercise['id'].'&cidReq='.$my_exercise['course_code'].'&id_session='.$my_exercise['session_id']);
                 $this->tpl->assign('exercise_url', $url);

+ 1 - 1
main/mySpace/current_courses.php

@@ -33,7 +33,7 @@ if (!empty($my_courses)) {
 			continue;
 		}
 
-		$teachers = CourseManager::get_teacher_list_from_course_code($course_code);
+		$teachers = CourseManager::getTeacherListFromCourse($course_id);
 		$teacher_list =  array();
 
 		if (!empty($teachers)) {

+ 1 - 1
main/session/index.php

@@ -378,7 +378,7 @@ foreach ($final_array as $session_data) {
     }
 }
 
-$my_real_array = msort($my_real_array, 'date', 'asc');
+$my_real_array = ArrayClass::msort($my_real_array, 'date', 'asc');
 
 if (!empty($new_exercises)) {
     $my_real_array = array_merge($new_exercises, $my_real_array);

+ 1 - 1
main/social/profile.php

@@ -250,7 +250,7 @@ if (is_array($personal_course_list)) {
         $i++;
     }
     //to avoid repeted courses
-    $course_list_code = array_unique_dimensional($course_list_code);
+    $course_list_code = ArrayClass::array_unique_dimensional($course_list_code);
 }
 
 //Social Block Menu

+ 1 - 1
main/template/default/auth/courses_categories.php

@@ -326,7 +326,7 @@ function return_title($course)
     $linkCourse = api_get_course_url($course['code']);
     $title = cut($course['title'], 70);
     $ajax_url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=add_course_vote';
-    $teachers = CourseManager::get_teacher_list_from_course_code_to_string($course['code']);
+    $teachers = CourseManager::getTeacherListFromCourseToString($course['real_id']);
     $rating = Display::return_rating_system('star_'.$course['real_id'], $ajax_url.'&course_id='.$course['real_id'], $course['point_info']);
     $html .=  '<h4 class="title"><a href="' . $linkCourse . '">' . cut($title, 60) . '</a></h4>';
     $html .= '<div class="teachers">'.$teachers.'</div>';

+ 2 - 3
main/tracking/courseLog.php

@@ -274,9 +274,8 @@ if ($session_id) {
     $titleSession = Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL).' '.$courseInfo['name'];
 }
 
-
-$teacherList = CourseManager::get_teacher_list_from_course_code_to_string(
-    $courseInfo['code'],
+$teacherList = CourseManager::getTeacherListFromCourseToString(
+    $courseInfo['real_id'],
     ',',
     false,
     true

+ 4 - 4
main/work/work.lib.php

@@ -3281,8 +3281,8 @@ function addWorkComment($courseInfo, $userId, $parentWork, $work, $data)
     } else {
         $sessionId = api_get_session_id();
         if (empty($sessionId)) {
-            $teachers = CourseManager::get_teacher_list_from_course_code(
-                $courseInfo['code']
+            $teachers = CourseManager::getTeacherListFromCourse(
+                $courseInfo['real_id']
             );
             if (!empty($teachers)) {
                 $userIdListToSend = array_keys($teachers);
@@ -4807,8 +4807,8 @@ function exportAllStudentWorkFromPublication(
 
     $courseCode = $courseInfo['code'];
     $header = get_lang('Course').': '.$courseInfo['title'];
-    $teachers = CourseManager::get_teacher_list_from_course_code_to_string(
-        $courseCode
+    $teachers = CourseManager::getTeacherListFromCourseToString(
+        $courseInfo['real_id']
     );
 
     if (!empty($sessionId)) {