24 require_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMObject.php");
25 require_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMResourceFile.php");
26 require_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMResourceDependency.php");
55 $this->
files = array();
56 $this->dependencies = array();
58 parent::__construct($a_id);
68 $this->import_id = $a_import_id;
88 $this->scormtype = $a_scormtype;
98 $this->href = $a_href;
109 $this->xml_base = $a_xml_base;
114 $this->
files[] = &$a_file_obj;
124 $this->dependencies[] = &$a_dependency;
135 $ilDB = $DIC[
'ilDB'];
139 $obj_set =
$ilDB->queryF(
140 'SELECT * FROM sc_resource WHERE obj_id = %s',
142 array($this->
getId())
144 $obj_rec =
$ilDB->fetchAssoc($obj_set);
148 $this->
setHRef($obj_rec[
"href"]);
152 $file_set =
$ilDB->queryF(
153 'SELECT href FROM sc_resource_file WHERE res_id = %s ORDER BY nr',
155 array($this->
getId())
157 while ($file_rec =
$ilDB->fetchAssoc($file_set)) {
159 $res_file->setHref($file_rec[
"href"]);
164 $dep_set =
$ilDB->queryF(
165 'SELECT identifierref FROM sc_resource_dependen WHERE res_id = %s ORDER BY nr',
167 array($this->
getId())
169 while ($dep_rec =
$ilDB->fetchAssoc($dep_set)) {
171 $res_dep->setIdentifierRef($dep_rec[
"identifierref"]);
180 $ilDB = $DIC[
'ilDB'];
182 $ilBench->start(
"SCORMResource",
"readByIdRef_Query");
184 $id_set =
$ilDB->queryF(
185 'SELECT ob.obj_id id FROM sc_resource res, scorm_object ob 186 WHERE ob.obj_id = res.obj_id 187 AND res.import_id = %s 189 array(
'text',
'integer'),
190 array($a_id_ref, $a_slm_id)
193 $ilBench->stop(
"SCORMResource",
"readByIdRef_Query");
195 if ($id_rec =
$ilDB->fetchAssoc($id_set)) {
196 $this->
setId($id_rec[
"id"]);
205 $ilDB = $DIC[
'ilDB'];
207 $id_set =
$ilDB->queryF(
208 'SELECT ob.obj_id id FROM sc_resource res, scorm_object ob 209 WHERE ob.obj_id = res.obj_id 210 AND res.import_id = %s 212 array(
'text',
'integer'),
213 array($a_id_ref ,$a_slm_id)
216 if ($id_rec =
$ilDB->fetchAssoc($id_set)) {
217 return $id_rec[
"id"];
225 $ilDB = $DIC[
'ilDB'];
227 $st_set =
$ilDB->queryF(
228 'SELECT scormtype FROM sc_resource WHERE obj_id = %s',
232 if ($st_rec =
$ilDB->fetchAssoc($st_set)) {
233 return $st_rec[
"scormtype"];
241 $ilDB = $DIC[
'ilDB'];
247 INSERT INTO sc_resource 248 (obj_id, import_id, resourcetype, scormtype, href, xml_base) 249 VALUES(%s, %s, %s, %s, %s, %s)',
250 array(
'integer',
'text',
'text',
'text',
'text',
'text'),
251 array( $this->
getId(),
262 $nextId =
$ilDB->nextId(
'sc_resource_file');
266 INSERT INTO sc_resource_file (id,res_id, href, nr) 267 VALUES(%s, %s, %s, %s)',
268 array(
'integer',
'integer',
'text',
'integer'),
269 array($nextId, $this->
getId(), $this->
files[
$i]->getHref(), (
$i + 1))
274 for (
$i = 0;
$i < count($this->dependencies);
$i++) {
275 $nextId =
$ilDB->nextId(
'sc_resource_dependen');
279 INSERT INTO sc_resource_dependen (id, res_id, identifierref, nr) 280 VALUES(%s, %s, %s, %s)',
281 array(
'integer',
'integer',
'text',
'integer'),
282 array($nextId, $this->
getId(), $this->
files[
$i]->getHref(), (
$i + 1))
290 $ilDB = $DIC[
'ilDB'];
303 array(
'text',
'text',
'text',
'text',
'text',
'integer'),
314 'DELETE FROM sc_resource_file WHERE res_id = %s',
316 array($this->
getId())
320 $nextId =
$ilDB->nextId(
'sc_resource_file');
323 'INSERT INTO sc_resource_file (id, res_id, href, nr) 324 VALUES (%s, %s, %s, %s)',
325 array(
'integer',
'integer',
'text',
'integer'),
326 array($nextId, $this->
getId(), $this->
files[
$i]->getHref(), (
$i + 1))
332 'DELETE FROM sc_resource_dependen WHERE res_id = %s',
334 array($this->
getId())
337 for (
$i = 0;
$i < count($this->dependencies);
$i++) {
338 $nextId =
$ilDB->nextId(
'sc_resource_dependen');
342 INSERT INTO sc_resource_dependen (id, res_id, identifierref, nr) VALUES 344 array(
'integer',
'integer',
'text',
'integer'),
345 array($nextId, $this->
getId(), $this->dependencies[
$i]->getIdentifierRef(), (
$i + 1))
350 public function delete()
353 $ilDB = $DIC[
'ilDB'];
358 'DELETE FROM sc_resource WHERE obj_id = %s',
360 array($this->
getId())
364 'DELETE FROM sc_resource_file WHERE res_id = %s',
366 array($this->
getId())
370 'DELETE FROM sc_resource_dependen WHERE res_id = %s',
372 array($this->
getId())
SCORM Resource Dependency, DB accesses are done in ilSCORMResource.
setScormType($a_scormtype)
addDependency(&$a_dependency)
__construct($a_id=0)
Constructor.
static _lookupIdByIdRef($a_id_ref, $a_slm_id)
static _lookupScormType($a_obj_id)
readByIdRef($a_id_ref, $a_slm_id)
Parent object for all SCORM objects, that are stored in table scorm_object.
update($pash, $contents, Config $config)
setImportId($a_import_id)
SCORM Resource File, DB accesses are done in ilSCORMResource.