ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilSCORM2004NodeFactory.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 require_once("./Modules/Scorm2004/classes/class.ilSCORM2004PageNode.php");
6 require_once("./Modules/Scorm2004/classes/class.ilSCORM2004Chapter.php");
7 require_once("./Modules/Scorm2004/classes/class.ilSCORM2004SeqChapter.php");
8 require_once("./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
9 require_once("./Modules/Scorm2004/classes/class.ilSCORM2004Asset.php");
10 
22 {
23  public static function getInstance($a_slm_object, $a_id = 0, $a_halt = true)
24  {
25  global $DIC;
26 
27  $ilDB = $DIC->database();
28 
29  $query = "SELECT * FROM sahs_sc13_tree_node WHERE obj_id = " .
30  $ilDB->quote($a_id, "integer");
31  $obj_set = $ilDB->query($query);
32  $obj_rec = $ilDB->fetchAssoc($obj_set);
33  $obj = null;
34  switch ($obj_rec["type"]) {
35  case "chap":
36  $obj = new ilSCORM2004Chapter($a_slm_object);
37  $obj->setId($obj_rec["obj_id"]);
38  $obj->setDataRecord($obj_rec);
39  $obj->read();
40  break;
41 
42  case "seqc":
43  $obj = new ilSCORM2004SeqChapter($a_slm_object);
44  $obj->setId($obj_rec["obj_id"]);
45  $obj->setDataRecord($obj_rec);
46  $obj->read();
47  break;
48 
49  case "sco":
50  $obj = new ilSCORM2004Sco($a_slm_object);
51  $obj->setId($obj_rec["obj_id"]);
52  $obj->setDataRecord($obj_rec);
53  $obj->read();
54  break;
55 
56  case "ass":
57  $obj = new ilSCORM2004Asset($a_slm_object);
58  $obj->setId($obj_rec["obj_id"]);
59  $obj->setDataRecord($obj_rec);
60  $obj->read();
61  break;
62 
63  case "page":
64  $obj = new ilSCORM2004PageNode($a_slm_object, 0, $a_halt);
65  $obj->setId($obj_rec["obj_id"]);
66  $obj->setDataRecord($obj_rec);
67  $obj->read();
68  break;
69  }
70  return $obj;
71  }
72 }
Class ilSCORM2004PageNode.
Class ilSCORM2004Sco.
Class ilSCORM2004NodeFactory.
global $DIC
Definition: saml.php:7
Class ilSCORM2004Chapter.
Class ilSCORM2004Chapter.
static getInstance($a_slm_object, $a_id=0, $a_halt=true)
$query
global $ilDB
Class ilSCORM2004Asset.