Code Duplication    Length = 11-16 lines in 2 locations

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

@@ 2762-2777 (lines=16) @@
2759
     *
2760
     * @return array
2761
     */
2762
    public function getAllUserPerTag($fieldId, $tag)
2763
    {
2764
        $tagRelUserTable = Database::get_main_table(TABLE_MAIN_USER_REL_TAG);
2765
        $tag = Database::escape_string($tag);
2766
        $fieldId = (int) $fieldId;
2767
2768
        $sql = "SELECT user_id 
2769
                FROM {$this->table_field_tag} f INNER JOIN $tagRelUserTable ft 
2770
                ON tag_id = f.id 
2771
                WHERE tag = '$tag' AND f.field_id = $fieldId;
2772
        ";
2773
2774
        $result = Database::query($sql);
2775
2776
        return Database::store_result($result, 'ASSOC');
2777
    }
2778
2779
    /**
2780
     * @param int $fieldId

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

@@ 5359-5369 (lines=11) @@
5356
     * @param int $courseId
5357
     * @return bool
5358
     */
5359
    public static function hasCourseSetting($variable, $courseId)
5360
    {
5361
        $courseSetting = Database::get_course_table(TABLE_COURSE_SETTING);
5362
        $courseId = intval($courseId);
5363
        $variable = Database::escape_string($variable);
5364
        $sql = "SELECT variable FROM $courseSetting
5365
                WHERE c_id = $courseId AND variable = '$variable'";
5366
        $result = Database::query($sql);
5367
5368
        return Database::num_rows($result) > 0;
5369
    }
5370
5371
    /**
5372
     * Get information from the track_e_course_access table