Code Duplication    Length = 7-7 lines in 6 locations

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

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

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

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

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

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

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

@@ 2532-2538 (lines=7) @@
2529
     * @param string $course_code
2530
     * @return integer if exists, false else
2531
     */
2532
    public static function course_exists($course_code)
2533
    {
2534
        $sql = 'SELECT 1 FROM ' . Database::get_main_table(TABLE_MAIN_COURSE) . '
2535
                WHERE code="' . Database::escape_string($course_code) . '"';
2536
2537
        return Database::num_rows(Database::query($sql));
2538
    }
2539
2540
    /**
2541
     * Send an email to tutor after the auth-suscription of a student in your course