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

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

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

@@ 3991-4007 (lines=17) @@
3988
     * @param string $userId
3989
     * @return array containing all the titles of the user defined courses with the id as key of the array
3990
     */
3991
    public static function get_user_course_categories($userId = '')
3992
    {
3993
        if ($userId == '') {
3994
            $realUserId = api_get_user_id();
3995
        } else {
3996
            $realUserId = $userId;
3997
        }
3998
3999
        $output = array();
4000
        $table_category = Database::get_main_table(TABLE_USER_COURSE_CATEGORY);
4001
        $sql = "SELECT * FROM $table_category 
4002
                WHERE user_id = '".intval($realUserId)."'";
4003
        $result = Database::query($sql);
4004
        while ($row = Database::fetch_array($result)) {
4005
            $output[$row['id']] = $row['title'];
4006
        }
4007
        return $output;
4008
    }
4009
4010
    /**