ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 public function __construct($a_slm_object, $a_id = 0)
27 {
28 global $DIC;
29
30 $this->db = $DIC->database();
31 parent::__construct($a_slm_object, $a_id);
32 $this->setType("sco");
33 }
34
38 public function setHideObjectivePage($a_val)
39 {
40 $this->hide_obj_page = $a_val;
41 }
42
46 public function getHideObjectivePage()
47 {
49 }
50
54 public function create($a_upload = false, $a_template = false)
55 {
57
58 parent::create($a_upload, $a_template);
59 if (!$a_template) {
60 $obj = new ilSCORM2004Objective($this->getId());
61 // $obj->setObjectiveID("Objective SCO ".$this->getId());
62 $obj->setId("local_obj_" . $this->getID() . "_0");
63 $obj->update();
64 }
65 $ilDB->manipulate("INSERT INTO sahs_sc13_sco " .
66 "(id, hide_obj_page) VALUES (" .
67 $ilDB->quote($this->getId(), "integer") . "," .
68 $ilDB->quote($this->getHideObjectivePage(), "integer") .
69 ")");
70 }
71
72
73
77 public function read()
78 {
80
81 parent::read();
82 $set = $ilDB->query(
83 "SELECT * FROM sahs_sc13_sco WHERE " .
84 " id = " . $ilDB->quote($this->getId(), "integer")
85 );
86 $rec = $ilDB->fetchAssoc($set);
87 $this->setHideObjectivePage($rec["hide_obj_page"]);
88 }
89
93 public function update()
94 {
96
98 $ilDB->manipulate(
99 "UPDATE sahs_sc13_sco SET " .
100 " hide_obj_page = " . $ilDB->quote($this->getHideObjectivePage(), "integer") .
101 " WHERE id = " . $ilDB->quote($this->getId(), "integer")
102 );
103 }
104
108 public function delete($a_delete_meta_data = true)
109 {
111
112 parent::delete($a_delete_meta_data);
113 $ilDB->manipulate(
114 "DELETE FROM sahs_sc13_sco WHERE "
115 . " id = " . $ilDB->quote($this->getId(), "integer")
116 );
117 }
118
122 public function copy($a_target_slm)
123 {
124 $sco = new ilSCORM2004Sco($a_target_slm);
125 $sco->setTitle($this->getTitle());
126 $sco->setHideObjectivePage($this->getHideObjectivePage());
127 if ($this->getSLMId() != $a_target_slm->getId()) {
128 $sco->setImportId("il__sco_" . $this->getId());
129 }
130 $sco->setSLMId($a_target_slm->getId());
131 $sco->setType($this->getType());
132 $sco->setDescription($this->getDescription());
133 $sco->create(true);
134 $a_copied_nodes[$this->getId()] = $sco->getId();
135
136 // copy meta data
137 include_once("Services/MetaData/classes/class.ilMD.php");
138 $md = new ilMD($this->getSLMId(), $this->getId(), $this->getType());
139 $new_md = $md->cloneMD($a_target_slm->getId(), $sco->getId(), $this->getType());
140
141 return $sco;
142 }
143
149 public function getMainObjectiveText()
150 {
151 $objectives = $this->getObjectives();
152
153 foreach ($objectives as $ob) {
154 // map info
155 $mappings = $ob->getMappings();
156 $mapinfo = null;
157 foreach ($mappings as $map) {
158 $mapinfo .= $map->getTargetObjectiveID();
159 }
160
161 if ($mapinfo == null) {
162 $mapinfo = "local";
163 } else {
164 $mapinfo = "global to " . $mapinfo;
165 }
166
167 if ($mapinfo == "local") {
168 return $ob->getObjectiveID();
169 }
170 }
171 }
172}
An exception for terminatinating execution or to throw for unit testing.
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.
update($pash, $contents, Config $config)
global $DIC
Definition: saml.php:7
global $ilDB