ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilLMObjectFactory.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2009 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 require_once("./Modules/LearningModule/classes/class.ilLMPageObject.php");
25 require_once("./Modules/LearningModule/classes/class.ilStructureObject.php");
26 
38 {
39  public static function getInstance(&$a_content_obj, $a_id = 0, $a_halt = true)
40  {
41  global $DIC;
42 
43  $ilDB = $DIC->database();
44 
45  $query = "SELECT * FROM lm_data WHERE obj_id = " .
46  $ilDB->quote($a_id, "integer");
47  $obj_set = $ilDB->query($query);
48  $obj_rec = $ilDB->fetchAssoc($obj_set);
49 
50  switch ($obj_rec["type"]) {
51  case "st":
52  $obj = new ilStructureObject($a_content_obj);
53  $obj->setId($obj_rec["obj_id"]);
54  $obj->setDataRecord($obj_rec);
55  $obj->read();
56  break;
57 
58  case "pg":
59  $obj = new ilLMPageObject($a_content_obj, 0, $a_halt);
60  $obj->setId($obj_rec["obj_id"]);
61  $obj->setDataRecord($obj_rec);
62  $obj->read();
63  break;
64  }
65  return $obj;
66  }
67 }
global $DIC
Definition: saml.php:7
Class ilLMObjectFactory.
Class ilLMPageObject.
static getInstance(&$a_content_obj, $a_id=0, $a_halt=true)
$query
Class ilStructreObject.
global $ilDB