Code Duplication    Length = 7-7 lines in 6 locations

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

@@ 609-615 (lines=7) @@
606
     * @param int $locked 1 or unlocked 0
607
     *
608
     * */
609
    public function lock($locked)
610
    {
611
        $table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
612
        $sql = "UPDATE $table SET locked = '".intval($locked)."'
613
                WHERE id='".$this->id."'";
614
        Database::query($sql);
615
    }
616
617
    /**
618
     * Get current user ranking

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

@@ 747-753 (lines=7) @@
744
     * Not delete this category from the database,when visible=3 is category eliminated
745
     * @param int $courseId
746
     */
747
    public function update_category_delete($courseId)
748
    {
749
        $tbl_grade_categories = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
750
        $sql = 'UPDATE '.$tbl_grade_categories.' SET visible=3
751
                WHERE c_id ="'.intval($courseId).'"';
752
        Database::query($sql);
753
    }
754
755
     /**
756
     * Delete this category from the database
@@ 759-765 (lines=7) @@
756
     * Delete this category from the database
757
     * @param int $courseId
758
     */
759
    public static function deleteCategoryFromCourse($courseId)
760
    {
761
        $table = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
762
        $sql = 'DELETE FROM '.$table.' 
763
                WHERE c_id ="'.intval($courseId).'"';
764
        Database::query($sql);
765
    }
766
767
    /**
768
     * @param int $course_id
@@ 1907-1913 (lines=7) @@
1904
1905
     * @return boolean|null
1906
     * */
1907
    public function lock($locked)
1908
    {
1909
        $table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
1910
        $sql = "UPDATE $table SET locked = '".intval($locked)."'
1911
                WHERE id='".intval($this->id)."'";
1912
        Database::query($sql);
1913
    }
1914
1915
    /**
1916
     * @param $locked

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/inc/lib/course.lib.php 1 location

@@ 2508-2514 (lines=7) @@
2505
     * @param string $course_code
2506
     * @return integer if exists, false else
2507
     */
2508
    public static function course_exists($course_code)
2509
    {
2510
        $sql = 'SELECT 1 FROM ' . Database::get_main_table(TABLE_MAIN_COURSE) . '
2511
                WHERE code="' . Database::escape_string($course_code) . '"';
2512
2513
        return Database::num_rows(Database::query($sql));
2514
    }
2515
2516
    /**
2517
     * Send an email to tutor after the auth-suscription of a student in your course