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

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