Code Duplication    Length = 6-8 lines in 3 locations

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

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

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

@@ 255-260 (lines=6) @@
252
	 */
253
	private function get_learnpath_data()
254
	{
255
		if (!isset($this->learnpath_data)) {
256
			$sql = 'SELECT * FROM '.$this->get_learnpath_table().'
257
                    WHERE c_id = '.$this->course_id.' AND id = '.$this->get_ref_id().' ';
258
			$result = Database::query($sql);
259
			$this->learnpath_data = Database::fetch_array($result);
260
		}
261
		return $this->learnpath_data;
262
	}
263

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

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