Code Duplication    Length = 11-16 lines in 2 locations

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

@@ 2775-2790 (lines=16) @@
2772
     *
2773
     * @return array
2774
     */
2775
    public function getAllUserPerTag($fieldId, $tag)
2776
    {
2777
        $tagRelUserTable = Database::get_main_table(TABLE_MAIN_USER_REL_TAG);
2778
        $tag = Database::escape_string($tag);
2779
        $fieldId = (int) $fieldId;
2780
2781
        $sql = "SELECT user_id 
2782
                FROM {$this->table_field_tag} f INNER JOIN $tagRelUserTable ft 
2783
                ON tag_id = f.id 
2784
                WHERE tag = '$tag' AND f.field_id = $fieldId;
2785
        ";
2786
2787
        $result = Database::query($sql);
2788
2789
        return Database::store_result($result, 'ASSOC');
2790
    }
2791
2792
    /**
2793
     * @param int $fieldId

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

@@ 5406-5416 (lines=11) @@
5403
     * @param int $courseId
5404
     * @return bool
5405
     */
5406
    public static function hasCourseSetting($variable, $courseId)
5407
    {
5408
        $courseSetting = Database::get_course_table(TABLE_COURSE_SETTING);
5409
        $courseId = intval($courseId);
5410
        $variable = Database::escape_string($variable);
5411
        $sql = "SELECT variable FROM $courseSetting
5412
                WHERE c_id = $courseId AND variable = '$variable'";
5413
        $result = Database::query($sql);
5414
5415
        return Database::num_rows($result) > 0;
5416
    }
5417
5418
    /**
5419
     * Get information from the track_e_course_access table