Code Duplication    Length = 16-17 lines in 2 locations

main/exercise/answer.class.php 1 location

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

main/forum/forumfunction.inc.php 1 location

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