ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilLMObjectFactory.php
Go to the documentation of this file.
1<?php
2
26{
27 public static function getInstance(
28 ilObjLearningModule $a_content_obj,
29 int $a_id = 0,
30 bool $a_halt = true
31 ): ?ilLMObject {
32 global $DIC;
33
34 $ilDB = $DIC->database();
35
36 $query = "SELECT * FROM lm_data WHERE obj_id = " .
37 $ilDB->quote($a_id, "integer");
38 $obj_set = $ilDB->query($query);
39 $obj_rec = $ilDB->fetchAssoc($obj_set);
40
41 $obj = null;
42 if ($obj_rec) {
43 switch ($obj_rec["type"]) {
44 case "st":
45 $obj = new ilStructureObject($a_content_obj);
46 $obj->setId($obj_rec["obj_id"]);
47 $obj->setDataRecord($obj_rec);
48 $obj->read();
49 break;
50
51 case "pg":
52 $obj = new ilLMPageObject($a_content_obj, 0, $a_halt);
53 $obj->setId($obj_rec["obj_id"]);
54 $obj->setDataRecord($obj_rec);
55 $obj->read();
56 break;
57 }
58 }
59 return $obj;
60 }
61}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance(ilObjLearningModule $a_content_obj, int $a_id=0, bool $a_halt=true)
Class ilLMObject.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: shib_login.php:26