Code Duplication    Length = 8-11 lines in 3 locations

main/exercice/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/forum/forumfunction.inc.php 1 location

@@ 3912-3922 (lines=11) @@
3909
 * @author Patrick Cool <[email protected]>, Ghent University
3910
 * @version february 2006, dokeos 1.8
3911
 */
3912
function increase_thread_view($thread_id)
3913
{
3914
    $table_threads = Database :: get_course_table(TABLE_FORUM_THREAD);
3915
    $course_id = api_get_course_int_id();
3916
3917
    $sql = "UPDATE $table_threads SET thread_views=thread_views+1
3918
            WHERE 
3919
                c_id = $course_id AND  
3920
                thread_id = '".intval($thread_id)."'";
3921
    Database::query($sql);
3922
}
3923
3924
/**
3925
 * The relies counter gets increased every time somebody replies to the thread

main/survey/survey.lib.php 1 location

@@ 1581-1588 (lines=8) @@
1578
     * @author Patrick Cool <[email protected]>, Ghent University
1579
     * @version January 2007,december 2008
1580
     */
1581
    public static function delete_all_survey_answers($survey_id)
1582
    {
1583
        $course_id = api_get_course_int_id();
1584
        $table_survey_answer = Database :: get_course_table(TABLE_SURVEY_ANSWER);
1585
        $survey_id = intval($survey_id);
1586
        Database::query("DELETE FROM $table_survey_answer WHERE c_id = $course_id AND survey_id=$survey_id");
1587
        return true;
1588
    }
1589
1590
    /**
1591
     * @param int $user_id