ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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 if ($this->getSLMId() != $a_target_slm->getId())
120 {
121 $sco->setImportId("il__sco_".$this->getId());
122 }
123 $sco->setSLMId($a_target_slm->getId());
124 $sco->setType($this->getType());
125 $sco->setDescription($this->getDescription());
126 $sco->create(true);
127 $a_copied_nodes[$this->getId()] = $sco->getId();
128
129 // copy meta data
130 include_once("Services/MetaData/classes/class.ilMD.php");
131 $md = new ilMD($this->getSLMId(), $this->getId(), $this->getType());
132 $new_md =& $md->cloneMD($a_target_slm->getId(), $sco->getId(), $this->getType());
133
134 return $sco;
135 }
136
143 {
144 $objectives = $this->getObjectives();
145
146 foreach ($objectives as $ob)
147 {
148 // map info
149 $mappings = $ob->getMappings();
150 $mapinfo = null;
151 foreach($mappings as $map)
152 {
153 $mapinfo .= $map->getTargetObjectiveID();
154 }
155
156 if ($mapinfo == null)
157 {
158 $mapinfo = "local";
159 }
160 else
161 {
162 $mapinfo = "global to ".$mapinfo;
163 }
164
165 if ($mapinfo == "local")
166 {
167 return $ob->getObjectiveID();
168 }
169 }
170 }
171
172
173}
174?>
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