Code Duplication    Length = 8-11 lines in 3 locations

main/exercise/question.class.php 1 location

@@ 458-467 (lines=10) @@
455
     * delete any category entry for question id
456
     * delete the category for question
457
     */
458
    public function deleteCategory()
459
    {
460
        $table = Database::get_course_table(TABLE_QUIZ_QUESTION_REL_CATEGORY);
461
        $question_id = intval($this->id);
462
        $sql = "DELETE FROM $table
463
                WHERE
464
                    question_id = $question_id AND
465
                    c_id = " . api_get_course_int_id();
466
        Database::query($sql);
467
    }
468
469
    /**
470
     * changes the question position

main/survey/survey.lib.php 1 location

@@ 1573-1580 (lines=8) @@
1570
     * @author Patrick Cool <[email protected]>, Ghent University
1571
     * @version January 2007,december 2008
1572
     */
1573
    public static function delete_all_survey_answers($survey_id)
1574
    {
1575
        $course_id = api_get_course_int_id();
1576
        $table_survey_answer = Database :: get_course_table(TABLE_SURVEY_ANSWER);
1577
        $survey_id = intval($survey_id);
1578
        Database::query("DELETE FROM $table_survey_answer WHERE c_id = $course_id AND survey_id=$survey_id");
1579
        return true;
1580
    }
1581
1582
    /**
1583
     * @param int $user_id

main/forum/forumfunction.inc.php 1 location

@@ 3899-3909 (lines=11) @@
3896
 * @author Patrick Cool <[email protected]>, Ghent University
3897
 * @version february 2006, dokeos 1.8
3898
 */
3899
function increase_thread_view($thread_id)
3900
{
3901
    $table_threads = Database :: get_course_table(TABLE_FORUM_THREAD);
3902
    $course_id = api_get_course_int_id();
3903
3904
    $sql = "UPDATE $table_threads SET thread_views=thread_views+1
3905
            WHERE 
3906
                c_id = $course_id AND  
3907
                thread_id = '".intval($thread_id)."'";
3908
    Database::query($sql);
3909
}
3910
3911
/**
3912
 * The relies counter gets increased every time somebody replies to the thread