Code Duplication    Length = 6-8 lines in 3 locations

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

@@ 348-353 (lines=6) @@
345
            $session_condition = '(session_id = 0 OR session_id IS NULL)';
346
        }
347
348
        if (!isset($this->exercise_data)) {
349
            $sql = 'SELECT * FROM '.$this->get_forum_thread_table().'
350
                    WHERE c_id = '.$this->course_id.' AND  thread_id = '.$this->get_ref_id().' AND '.$session_condition;
351
            $query = Database::query($sql);
352
            $this->exercise_data = Database::fetch_array($query);
353
        }
354
        return $this->exercise_data;
355
    }
356

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

@@ 373-380 (lines=8) @@
370
            $this->exercise_data = Database::fetch_array($query);
371
372
            // Try with iid
373
            if (empty($this->exercise_data)) {
374
                $sql = 'SELECT * FROM '.$this->get_studpub_table()."
375
                        WHERE
376
                            c_id ='".$course_info['real_id']."' AND
377
                            iid = '".$this->get_ref_id()."' ";
378
                $query = Database::query($sql);
379
                $this->exercise_data = Database::fetch_array($query);
380
            }
381
        }
382
383
        return $this->exercise_data;

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

@@ 266-271 (lines=6) @@
263
     */
264
    private function get_learnpath_data()
265
    {
266
        if (!isset($this->learnpath_data)) {
267
            $sql = 'SELECT * FROM '.$this->get_learnpath_table().'
268
                    WHERE c_id = ' . $this->course_id.' AND id = '.$this->get_ref_id().' ';
269
            $result = Database::query($sql);
270
            $this->learnpath_data = Database::fetch_array($result);
271
        }
272
        return $this->learnpath_data;
273
    }
274