ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilLMObjectFactory.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4
16{
17 public static function getInstance(&$a_content_obj, $a_id = 0, $a_halt = true)
18 {
19 global $DIC;
20
21 $ilDB = $DIC->database();
22
23 $query = "SELECT * FROM lm_data WHERE obj_id = " .
24 $ilDB->quote($a_id, "integer");
25 $obj_set = $ilDB->query($query);
26 $obj_rec = $ilDB->fetchAssoc($obj_set);
27
28 switch ($obj_rec["type"]) {
29 case "st":
30 $obj = new ilStructureObject($a_content_obj);
31 $obj->setId($obj_rec["obj_id"]);
32 $obj->setDataRecord($obj_rec);
33 $obj->read();
34 break;
35
36 case "pg":
37 $obj = new ilLMPageObject($a_content_obj, 0, $a_halt);
38 $obj->setId($obj_rec["obj_id"]);
39 $obj->setDataRecord($obj_rec);
40 $obj->read();
41 break;
42 }
43 return $obj;
44 }
45}
An exception for terminatinating execution or to throw for unit testing.
Class ilLMObjectFactory.
static getInstance(&$a_content_obj, $a_id=0, $a_halt=true)
Class ilLMPageObject.
Class ilStructreObject.
$query
global $ilDB
$DIC
Definition: xapitoken.php:46