Code Duplication    Length = 16-17 lines in 2 locations

main/exercise/answer.class.php 1 location

@@ 341-357 (lines=17) @@
338
     * return array answer by id else return a bool
339
     * @param integer $auto_id
340
     */
341
    public function selectAnswerByAutoId($auto_id)
342
    {
343
        $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER);
344
345
        $auto_id = intval($auto_id);
346
        $sql = "SELECT id, answer, id_auto FROM $TBL_ANSWER
347
                WHERE c_id = {$this->course_id} AND id_auto='$auto_id'";
348
        $rs = Database::query($sql);
349
350
        if (Database::num_rows($rs) > 0) {
351
            $row = Database::fetch_array($rs, 'ASSOC');
352
353
            return $row;
354
        }
355
356
        return false;
357
    }
358
359
    /**
360
     * returns the answer title from an answer's position

main/forum/forumfunction.inc.php 1 location

@@ 983-998 (lines=16) @@
980
 * @author Patrick Cool <[email protected]>, Ghent University
981
 * @version february 2006, dokeos 1.8
982
 */
983
function check_if_last_post_of_thread($thread_id)
984
{
985
    $table_posts = Database::get_course_table(TABLE_FORUM_POST);
986
    $course_id = api_get_course_int_id();
987
    $sql = "SELECT * FROM $table_posts
988
            WHERE c_id = $course_id AND thread_id = ".intval($thread_id)."
989
            ORDER BY post_date DESC";
990
    $result = Database::query($sql);
991
    if (Database::num_rows($result) > 0) {
992
        $row = Database::fetch_array($result);
993
994
        return $row;
995
    } else {
996
        return false;
997
    }
998
}
999
1000
/**
1001
 * @param $content what is it that we want to make (in)visible: forum category, forum, thread, post