Code Duplication    Length = 7-7 lines in 6 locations

main/gradebook/lib/be/evaluation.class.php 1 location

@@ 515-521 (lines=7) @@
512
	/**
513
	 * Delete all results for this evaluation
514
	 */
515
	public function delete_results()
516
	{
517
		$tbl_grade_results = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_RESULT);
518
		$sql = 'DELETE FROM '.$tbl_grade_results.'
519
				WHERE evaluation_id = '.intval($this->id);
520
		Database::query($sql);
521
	}
522
523
	/**
524
	 * Delete this evaluation and all underlying results.

main/gradebook/lib/be/abstractlink.class.php 1 location

@@ 617-623 (lines=7) @@
614
     * @param int $locked 1 or unlocked 0
615
     *
616
     * */
617
    public function lock($locked)
618
    {
619
        $table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
620
        $sql = "UPDATE $table SET locked = '".intval($locked)."'
621
                WHERE id='".$this->id."'";
622
        Database::query($sql);
623
    }
624
625
    /**
626
     * Get current user ranking

main/gradebook/lib/be/category.class.php 3 locations

@@ 748-754 (lines=7) @@
745
     * Not delete this category from the database,when visible=3 is category eliminated
746
     * @param int $courseId
747
     */
748
    public function update_category_delete($courseId)
749
    {
750
        $tbl_grade_categories = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
751
        $sql = 'UPDATE '.$tbl_grade_categories.' SET visible=3
752
                WHERE c_id ="'.intval($courseId).'"';
753
        Database::query($sql);
754
    }
755
756
     /**
757
     * Delete this category from the database
@@ 760-766 (lines=7) @@
757
     * Delete this category from the database
758
     * @param int $courseId
759
     */
760
    public static function deleteCategoryFromCourse($courseId)
761
    {
762
        $table = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
763
        $sql = 'DELETE FROM '.$table.' 
764
                WHERE c_id ="'.intval($courseId).'"';
765
        Database::query($sql);
766
    }
767
768
    /**
769
     * @param int $course_id
@@ 1952-1958 (lines=7) @@
1949
1950
     * @return boolean|null
1951
     * */
1952
    public function lock($locked)
1953
    {
1954
        $table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
1955
        $sql = "UPDATE $table SET locked = '".intval($locked)."'
1956
                WHERE id='".intval($this->id)."'";
1957
        Database::query($sql);
1958
    }
1959
1960
    /**
1961
     * @param $locked

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

@@ 2523-2529 (lines=7) @@
2520
     * @param string $course_code
2521
     * @return integer if exists, false else
2522
     */
2523
    public static function course_exists($course_code)
2524
    {
2525
        $sql = 'SELECT 1 FROM ' . Database::get_main_table(TABLE_MAIN_COURSE) . '
2526
                WHERE code="' . Database::escape_string($course_code) . '"';
2527
2528
        return Database::num_rows(Database::query($sql));
2529
    }
2530
2531
    /**
2532
     * Send an email to tutor after the auth-suscription of a student in your course