Code Duplication    Length = 16-17 lines in 3 locations

main/inc/lib/social.lib.php 1 location

@@ 30-46 (lines=17) @@
27
     * @author isaac flores paz
28
     * @return array
29
     */
30
    public static function show_list_type_friends()
31
    {
32
        $friend_relation_list = array();
33
        $tbl_my_friend_relation_type = Database :: get_main_table(TABLE_MAIN_USER_FRIEND_RELATION_TYPE);
34
        $sql = 'SELECT id,title FROM '.$tbl_my_friend_relation_type.'
35
                WHERE id<>6 ORDER BY id ASC';
36
        $result = Database::query($sql);
37
        while ($row = Database::fetch_array($result, 'ASSOC')) {
38
            $friend_relation_list[] = $row;
39
        }
40
        $count_list = count($friend_relation_list);
41
        if ($count_list == 0) {
42
            $friend_relation_list[] = get_lang('Unknown');
43
        } else {
44
            return $friend_relation_list;
45
        }
46
    }
47
48
    /**
49
     * Get relation type contact by name

main/inc/lib/tracking.lib.php 1 location

@@ 3956-3971 (lines=16) @@
3953
     * @param    int        Drh id
3954
     * @return    array    Student list
3955
     */
3956
    public static function get_student_followed_by_drh($hr_dept_id)
3957
    {
3958
        $hr_dept_id = intval($hr_dept_id);
3959
        $a_students = array();
3960
        $tbl_user     = Database :: get_main_table(TABLE_MAIN_USER);
3961
3962
        $sql = 'SELECT DISTINCT user_id FROM '.$tbl_user.' as user
3963
                WHERE hr_dept_id='.$hr_dept_id;
3964
        $rs = Database::query($sql);
3965
3966
        while($user = Database :: fetch_array($rs)) {
3967
            $a_students[$user['user_id']] = $user['user_id'];
3968
        }
3969
3970
        return $a_students;
3971
    }
3972
3973
3974

main/inc/lib/course.lib.php 1 location

@@ 3939-3955 (lines=17) @@
3936
     * @param string $userId
3937
     * @return array containing all the titles of the user defined courses with the id as key of the array
3938
     */
3939
    public static function get_user_course_categories($userId = '')
3940
    {
3941
        if ($userId == '') {
3942
            $realUserId = api_get_user_id();
3943
        } else {
3944
            $realUserId = $userId;
3945
        }
3946
3947
        $output = array();
3948
        $table_category = Database::get_main_table(TABLE_USER_COURSE_CATEGORY);
3949
        $sql = "SELECT * FROM $table_category WHERE user_id = '".intval($realUserId)."'";
3950
        $result = Database::query($sql);
3951
        while ($row = Database::fetch_array($result)) {
3952
            $output[$row['id']] = $row['title'];
3953
        }
3954
        return $output;
3955
    }
3956
3957
    /**
3958
     * Return an array the user_category id and title for the course $courseId for user $userId