ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilSCORM2004NodeFactory.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 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/Scorm2004/classes/class.ilSCORM2004PageNode.php");
25 require_once ("./Modules/Scorm2004/classes/class.ilSCORM2004Chapter.php");
26 require_once ("./Modules/Scorm2004/classes/class.ilSCORM2004SeqChapter.php");
27 require_once ("./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
28 
40 {
41  static function getInstance($a_slm_object, $a_id = 0, $a_halt = true)
42  {
43  global $ilias, $ilDB;
44 
45  $query = "SELECT * FROM sahs_sc13_tree_node WHERE obj_id = ".
46  $ilDB->quote($a_id, "integer");
47  $obj_set = $ilDB->query($query);
48  $obj_rec = $ilDB->fetchAssoc($obj_set);
49  $obj = null;
50  switch($obj_rec["type"])
51  {
52  case "chap":
53  $obj =& new ilSCORM2004Chapter($a_slm_object);
54  $obj->setId($obj_rec["obj_id"]);
55  $obj->setDataRecord($obj_rec);
56  $obj->read();
57  break;
58 
59  case "seqc":
60  $obj =& new ilSCORM2004SeqChapter($a_slm_object);
61  $obj->setId($obj_rec["obj_id"]);
62  $obj->setDataRecord($obj_rec);
63  $obj->read();
64  break;
65 
66  case "sco":
67  $obj =& new ilSCORM2004Sco($a_slm_object);
68  $obj->setId($obj_rec["obj_id"]);
69  $obj->setDataRecord($obj_rec);
70  $obj->read();
71  break;
72 
73  case "page":
74  $obj =& new ilSCORM2004PageNode($a_slm_object, 0, $a_halt);
75  $obj->setId($obj_rec["obj_id"]);
76  $obj->setDataRecord($obj_rec);
77  $obj->read();
78  break;
79  }
80  return $obj;
81  }
82 
83 }
84 ?>