Code Duplication    Length = 7-7 lines in 6 locations

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

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

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

@@ 753-759 (lines=7) @@
750
     * Not delete this category from the database,when visible=3 is category eliminated
751
     * @param int $courseId
752
     */
753
    public function update_category_delete($courseId)
754
    {
755
        $tbl_grade_categories = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
756
        $sql = 'UPDATE '.$tbl_grade_categories.' SET visible=3
757
                WHERE c_id ="'.intval($courseId).'"';
758
        Database::query($sql);
759
    }
760
761
     /**
762
     * Delete this category from the database
@@ 765-771 (lines=7) @@
762
     * Delete this category from the database
763
     * @param int $courseId
764
     */
765
    public static function deleteCategoryFromCourse($courseId)
766
    {
767
        $table = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
768
        $sql = 'DELETE FROM '.$table.' 
769
                WHERE c_id ="'.intval($courseId).'"';
770
        Database::query($sql);
771
    }
772
773
    /**
774
     * @param int $course_id
@@ 2015-2021 (lines=7) @@
2012
2013
     * @return boolean|null
2014
     * */
2015
    public function lock($locked)
2016
    {
2017
        $table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
2018
        $sql = "UPDATE $table SET locked = '".intval($locked)."'
2019
                WHERE id='".intval($this->id)."'";
2020
        Database::query($sql);
2021
    }
2022
2023
    /**
2024
     * @param $locked

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

@@ 2569-2575 (lines=7) @@
2566
     * @param string $course_code
2567
     * @return integer if exists, false else
2568
     */
2569
    public static function course_exists($course_code)
2570
    {
2571
        $sql = 'SELECT 1 FROM '.Database::get_main_table(TABLE_MAIN_COURSE).'
2572
                WHERE code="' . Database::escape_string($course_code).'"';
2573
2574
        return Database::num_rows(Database::query($sql));
2575
    }
2576
2577
    /**
2578
     * Send an email to tutor after the auth-suscription of a student in your course

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

@@ 626-632 (lines=7) @@
623
     * @param int $locked 1 or unlocked 0
624
     *
625
     * */
626
    public function lock($locked)
627
    {
628
        $table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
629
        $sql = "UPDATE $table SET locked = '".intval($locked)."'
630
                WHERE id='".$this->id."'";
631
        Database::query($sql);
632
    }
633
634
    /**
635
     * Get current user ranking