Code Duplication    Length = 12-14 lines in 2 locations

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

@@ 396-407 (lines=12) @@
393
     * @param int $id              The id (an integer number) of the corresponding database record.
394
     * @return string|bool              Returns the requested data as an array or FALSE on failure.
395
     */
396
    public static function get_course_request_info($id)
397
    {
398
        $id = (int) $id;
399
        $sql = "SELECT *
400
                FROM ".Database::get_main_table(TABLE_MAIN_COURSE_REQUEST)."
401
                WHERE id = ".$id;
402
        $result = Database::query($sql);
403
        if (Database::num_rows($result) > 0) {
404
            return Database::fetch_array($result);
405
        }
406
        return false;
407
    }
408
409
    /**
410
     * Gets the code of a given course request using its database id as an access key.

src/Chamilo/CourseBundle/Component/CourseCopy/CourseRestorer.php 1 location

@@ 2383-2396 (lines=14) @@
2380
     * @param string $survey_code
2381
     * @return bool
2382
     */
2383
    public function is_survey_code_available($survey_code)
2384
    {
2385
        $table_sur = Database::get_course_table(TABLE_SURVEY);
2386
        $sql = "SELECT * FROM $table_sur
2387
                WHERE
2388
                    c_id = ".$this->destination_course_id." AND
2389
                    code = '".self::DBUTF8escapestring($survey_code)."'";
2390
        $result = Database::query($sql);
2391
        if (Database::num_rows($result) > 0) {
2392
            return false;
2393
        } else {
2394
            return true;
2395
        }
2396
    }
2397
2398
    /**
2399
     * Restore survey-questions