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

@@ 5456-5466 (lines=11) @@
5453
     * @param int $courseId
5454
     * @return bool
5455
     */
5456
    public static function hasCourseSetting($variable, $courseId)
5457
    {
5458
        $courseSetting = Database::get_course_table(TABLE_COURSE_SETTING);
5459
        $courseId = intval($courseId);
5460
        $variable = Database::escape_string($variable);
5461
        $sql = "SELECT variable FROM $courseSetting
5462
                WHERE c_id = $courseId AND variable = '$variable'";
5463
        $result = Database::query($sql);
5464
5465
        return Database::num_rows($result) > 0;
5466
    }
5467
5468
    /**
5469
     * Get information from the track_e_course_access table