Code Duplication    Length = 11-16 lines in 2 locations

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

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

@@ 2735-2750 (lines=16) @@
2732
     *
2733
     * @return array
2734
     */
2735
    public function getAllUserPerTag($fieldId, $tag)
2736
    {
2737
        $tagRelUserTable = Database::get_main_table(TABLE_MAIN_USER_REL_TAG);
2738
        $tag = Database::escape_string($tag);
2739
        $fieldId = (int) $fieldId;
2740
2741
        $sql = "SELECT user_id 
2742
                FROM {$this->table_field_tag} f INNER JOIN $tagRelUserTable ft 
2743
                ON tag_id = f.id 
2744
                WHERE tag = '$tag' AND f.field_id = $fieldId;
2745
        ";
2746
2747
        $result = Database::query($sql);
2748
2749
        return Database::store_result($result, 'ASSOC');
2750
    }
2751
2752
    /**
2753
     * @param int $fieldId