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");
56 $this->dependencies =
array();
58 parent::__construct($a_id);
69 $this->import_id = $a_import_id;
89 $this->scormtype = $a_scormtype;
99 $this->href = $a_href;
110 $this->xml_base = $a_xml_base;
115 $this->
files[] =& $a_file_obj;
125 $this->dependencies[] =& $a_dependency;
139 $obj_set = $ilDB->queryF(
140 'SELECT * FROM sc_resource WHERE obj_id = %s',
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',
157 while ($file_rec =$ilDB->fetchAssoc($file_set))
160 $res_file->setHref($file_rec[
"href"]);
165 $dep_set = $ilDB->queryF(
166 'SELECT identifierref FROM sc_resource_dependen WHERE res_id = %s ORDER BY nr',
170 while ($dep_rec =$ilDB->fetchAssoc($dep_set))
173 $res_dep->setIdentifierRef($dep_rec[
"identifierref"]);
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))
197 $this->
setId($id_rec[
"id"]);
206 $id_set = $ilDB->queryF(
207 'SELECT ob.obj_id id FROM sc_resource res, scorm_object ob 208 WHERE ob.obj_id = res.obj_id 209 AND res.import_id = %s 211 array(
'text',
'integer'),
212 array($a_id_ref ,$a_slm_id)
215 if ($id_rec = $ilDB->fetchAssoc($id_set))
217 return $id_rec[
"id"];
226 $st_set = $ilDB->queryF(
227 'SELECT scormtype FROM sc_resource WHERE obj_id = %s',
231 if ($st_rec = $ilDB->fetchAssoc($st_set))
233 return $st_rec[
"scormtype"];
245 INSERT INTO sc_resource 246 (obj_id, import_id, resourcetype, scormtype, href, xml_base) 247 VALUES(%s, %s, %s, %s, %s, %s)',
248 array(
'integer',
'text',
'text',
'text',
'text',
'text'),
259 for($i=0; $i<count($this->
files); $i++)
261 $nextId = $ilDB->nextId(
'sc_resource_file');
264 INSERT INTO sc_resource_file (id,res_id, href, nr) 265 VALUES(%s, %s, %s, %s)',
266 array(
'integer',
'integer',
'text',
'integer'),
273 for($i=0; $i<count($this->dependencies); $i++)
275 $nextId = $ilDB->nextId(
'sc_resource_dependen');
278 INSERT INTO sc_resource_dependen (id, res_id, identifierref, nr) 279 VALUES(%s, %s, %s, %s)',
280 array(
'integer',
'integer',
'text',
'integer'),
300 array(
'text',
'text',
'text',
'text',
'text',
'integer'),
311 'DELETE FROM sc_resource_file WHERE res_id = %s',
316 for($i=0; $i<count($this->
files); $i++)
318 $nextId = $ilDB->nextId(
'sc_resource_file');
321 'INSERT INTO sc_resource_file (id, res_id, href, nr) 322 VALUES (%s, %s, %s, %s)',
323 array(
'integer',
'integer',
'text',
'integer'),
330 'DELETE FROM sc_resource_dependen WHERE res_id = %s',
335 for($i = 0; $i < count($this->dependencies); $i++)
337 $nextId = $ilDB->nextId(
'sc_resource_dependen');
340 INSERT INTO sc_resource_dependen (id, res_id, identifierref, nr) VALUES 342 array(
'integer',
'integer',
'text',
'integer'),
343 array($nextId, $this->
getId(), $this->dependencies[$i]->getIdentifierRef(), ($i + 1))
355 'DELETE FROM sc_resource WHERE obj_id = %s',
361 'DELETE FROM sc_resource_file WHERE res_id = %s',
367 'DELETE FROM sc_resource_dependen WHERE res_id = %s',
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.
Create styles array
The data for the language used.
setImportId($a_import_id)
SCORM Resource File, DB accesses are done in ilSCORMResource.