Code Duplication    Length = 9-14 lines in 3 locations

main/gradebook/lib/be/forumthreadlink.class.php 1 location

@@ 127-140 (lines=14) @@
124
    * Has anyone done this exercise yet ?
125
    * @return boolean
126
    */
127
    public function has_results()
128
    {
129
        $table = Database::get_course_table(TABLE_FORUM_POST);
130
131
        $sql = "SELECT count(*) AS number FROM $table
132
                WHERE
133
                    c_id = ".$this->course_id." AND
134
                    thread_id = '".$this->get_ref_id()."'                    
135
                ";
136
        $result = Database::query($sql);
137
        $number = Database::fetch_row($result);
138
139
        return $number[0] != 0;
140
    }
141
142
    /**
143
     * @param int    $stud_id

main/gradebook/lib/be/learnpathlink.class.php 1 location

@@ 88-96 (lines=9) @@
85
    /**
86
     * Has anyone used this learnpath yet ?
87
     */
88
    public function has_results()
89
    {
90
        $tbl_stats = Database::get_course_table(TABLE_LP_VIEW);
91
        $sql = "SELECT count(id) AS number FROM $tbl_stats
92
				WHERE c_id = ".$this->course_id." AND lp_id = ".$this->get_ref_id();
93
        $result = Database::query($sql);
94
        $number = Database::fetch_array($result, 'NUM');
95
        return ($number[0] != 0);
96
    }
97
98
    /**
99
     * Get the progress of this learnpath. Only the last attempt are taken into account.

main/gradebook/lib/be/evaluation.class.php 1 location

@@ 501-511 (lines=11) @@
498
     * The 'max' property should not be changed then.
499
     * @return bool
500
     */
501
    public function has_results()
502
    {
503
        $table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_RESULT);
504
        $sql = 'SELECT count(id) AS number
505
                FROM '.$table.'
506
                WHERE evaluation_id = '.intval($this->id);
507
        $result = Database::query($sql);
508
        $number = Database::fetch_row($result);
509
510
        return $number[0] != 0;
511
    }
512
513
    /**
514
     * Delete all results for this evaluation