ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilSCORM2004Sco.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2011 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5require_once("./Modules/Scorm2004/classes/class.ilSCORM2004Asset.php");
6
18{
19 protected $hide_obj_page = false;
20
26 function __construct($a_slm_object, $a_id = 0)
27 {
28 parent::__construct($a_slm_object, $a_id);
29 $this->setType("sco");
30 }
31
35 public function setHideObjectivePage($a_val)
36 {
37 $this->hide_obj_page = $a_val;
38 }
39
43 public function getHideObjectivePage()
44 {
46 }
47
51 function create($a_upload = false, $a_template = false)
52 {
53 global $ilDB;
54
55 parent::create($a_upload, $a_template);
56 if (!$a_template)
57 {
58 $obj = new ilSCORM2004Objective($this->getId());
59// $obj->setObjectiveID("Objective SCO ".$this->getId());
60 $obj->setId("local_obj_".$this->getID()."_0");
61 $obj->update();
62 }
63 $ilDB->manipulate("INSERT INTO sahs_sc13_sco ".
64 "(id, hide_obj_page) VALUES (".
65 $ilDB->quote($this->getId(), "integer").",".
66 $ilDB->quote($this->getHideObjectivePage(), "integer").
67 ")");
68 }
69
73 function read()
74 {
75 global $ilDB;
76
77 parent::read();
78 $set = $ilDB->query("SELECT * FROM sahs_sc13_sco WHERE ".
79 " id = ".$ilDB->quote($this->getId(), "integer")
80 );
81 $rec = $ilDB->fetchAssoc($set);
82 $this->setHideObjectivePage($rec["hide_obj_page"]);
83 }
84
88 function update()
89 {
90 global $ilDB;
91
92 parent::update();
93 $ilDB->manipulate("UPDATE sahs_sc13_sco SET ".
94 " hide_obj_page = ".$ilDB->quote($this->getHideObjectivePage(), "integer").
95 " WHERE id = ".$ilDB->quote($this->getId(), "integer")
96 );
97 }
98
102 function delete()
103 {
104 global $ilDB;
105
106 parent::delete();
107 $ilDB->manipulate("DELETE FROM sahs_sc13_sco WHERE "
108 . " id = " . $ilDB->quote($this->getId(), "integer")
109 );
110 }
111
115 function copy($a_target_slm)
116 {
117 $sco = new ilSCORM2004Sco($a_target_slm);
118 $sco->setTitle($this->getTitle());
119 $sco->setHideObjectivePage($this->getHideObjectivePage());
120 if ($this->getSLMId() != $a_target_slm->getId())
121 {
122 $sco->setImportId("il__sco_".$this->getId());
123 }
124 $sco->setSLMId($a_target_slm->getId());
125 $sco->setType($this->getType());
126 $sco->setDescription($this->getDescription());
127 $sco->create(true);
128 $a_copied_nodes[$this->getId()] = $sco->getId();
129
130 // copy meta data
131 include_once("Services/MetaData/classes/class.ilMD.php");
132 $md = new ilMD($this->getSLMId(), $this->getId(), $this->getType());
133 $new_md =& $md->cloneMD($a_target_slm->getId(), $sco->getId(), $this->getType());
134
135 return $sco;
136 }
137
144 {
145 $objectives = $this->getObjectives();
146
147 foreach ($objectives as $ob)
148 {
149 // map info
150 $mappings = $ob->getMappings();
151 $mapinfo = null;
152 foreach($mappings as $map)
153 {
154 $mapinfo .= $map->getTargetObjectiveID();
155 }
156
157 if ($mapinfo == null)
158 {
159 $mapinfo = "local";
160 }
161 else
162 {
163 $mapinfo = "global to ".$mapinfo;
164 }
165
166 if ($mapinfo == "local")
167 {
168 return $ob->getObjectiveID();
169 }
170 }
171 }
172
173
174}
175?>
Class ilSCORM2004Asset.
getSLMId()
Get ID of parent Scorm Learning Module Object.
setType($a_type)
Set type.
getDescription()
Get description.
Class ilSCORM2004Objective.
Class ilSCORM2004Sco.
read()
Read data from database.
create($a_upload=false, $a_template=false)
Create sco.
getMainObjectiveText()
Get main objective.
setHideObjectivePage($a_val)
Set hide objective page.
copy($a_target_slm)
Copy sco.
getHideObjectivePage()
Get hide objective page.
__construct($a_slm_object, $a_id=0)
Constructor.
global $ilDB