Code Duplication    Length = 17-17 lines in 2 locations

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

@@ 3724-3740 (lines=17) @@
3721
     * @param string $userId
3722
     * @return array containing all the titles of the user defined courses with the id as key of the array
3723
     */
3724
    public static function get_user_course_categories($userId = '')
3725
    {
3726
        if ($userId == '') {
3727
            $realUserId = api_get_user_id();
3728
        } else {
3729
            $realUserId = $userId;
3730
        }
3731
3732
        $output = array();
3733
        $table_category = Database::get_main_table(TABLE_USER_COURSE_CATEGORY);
3734
        $sql = "SELECT * FROM $table_category WHERE user_id = '".intval($realUserId)."'";
3735
        $result = Database::query($sql);
3736
        while ($row = Database::fetch_array($result)) {
3737
            $output[$row['id']] = $row['title'];
3738
        }
3739
        return $output;
3740
    }
3741
3742
    /**
3743
     * Return an array the user_category id and title for the course $courseId for user $userId

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

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