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);
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;
138 $obj_set = $ilDB->queryF(
139 'SELECT * FROM sc_resource WHERE obj_id = %s',
143 $obj_rec = $ilDB->fetchAssoc($obj_set);
147 $this->
setHRef($obj_rec[
"href"]);
151 $file_set = $ilDB->queryF(
152 'SELECT href FROM sc_resource_file WHERE res_id = %s ORDER BY nr',
156 while ($file_rec =$ilDB->fetchAssoc($file_set)) {
158 $res_file->setHref($file_rec[
"href"]);
163 $dep_set = $ilDB->queryF(
164 'SELECT identifierref FROM sc_resource_dependen WHERE res_id = %s ORDER BY nr',
168 while ($dep_rec =$ilDB->fetchAssoc($dep_set)) {
170 $res_dep->setIdentifierRef($dep_rec[
"identifierref"]);
179 $ilBench->start(
"SCORMResource",
"readByIdRef_Query");
181 $id_set = $ilDB->queryF(
182 'SELECT ob.obj_id id FROM sc_resource res, scorm_object ob 183 WHERE ob.obj_id = res.obj_id 184 AND res.import_id = %s 186 array(
'text',
'integer'),
187 array($a_id_ref, $a_slm_id)
190 $ilBench->stop(
"SCORMResource",
"readByIdRef_Query");
192 if ($id_rec = $ilDB->fetchAssoc($id_set)) {
193 $this->
setId($id_rec[
"id"]);
202 $id_set = $ilDB->queryF(
203 'SELECT ob.obj_id id FROM sc_resource res, scorm_object ob 204 WHERE ob.obj_id = res.obj_id 205 AND res.import_id = %s 207 array(
'text',
'integer'),
208 array($a_id_ref ,$a_slm_id)
211 if ($id_rec = $ilDB->fetchAssoc($id_set)) {
212 return $id_rec[
"id"];
221 $st_set = $ilDB->queryF(
222 'SELECT scormtype FROM sc_resource WHERE obj_id = %s',
226 if ($st_rec = $ilDB->fetchAssoc($st_set)) {
227 return $st_rec[
"scormtype"];
240 INSERT INTO sc_resource 241 (obj_id, import_id, resourcetype, scormtype, href, xml_base) 242 VALUES(%s, %s, %s, %s, %s, %s)',
243 array(
'integer',
'text',
'text',
'text',
'text',
'text'),
255 $nextId = $ilDB->nextId(
'sc_resource_file');
259 INSERT INTO sc_resource_file (id,res_id, href, nr) 260 VALUES(%s, %s, %s, %s)',
261 array(
'integer',
'integer',
'text',
'integer'),
267 for (
$i=0;
$i<count($this->dependencies);
$i++) {
268 $nextId = $ilDB->nextId(
'sc_resource_dependen');
272 INSERT INTO sc_resource_dependen (id, res_id, identifierref, nr) 273 VALUES(%s, %s, %s, %s)',
274 array(
'integer',
'integer',
'text',
'integer'),
295 array(
'text',
'text',
'text',
'text',
'text',
'integer'),
306 'DELETE FROM sc_resource_file WHERE res_id = %s',
312 $nextId = $ilDB->nextId(
'sc_resource_file');
315 'INSERT INTO sc_resource_file (id, res_id, href, nr) 316 VALUES (%s, %s, %s, %s)',
317 array(
'integer',
'integer',
'text',
'integer'),
324 'DELETE FROM sc_resource_dependen WHERE res_id = %s',
329 for (
$i = 0;
$i < count($this->dependencies);
$i++) {
330 $nextId = $ilDB->nextId(
'sc_resource_dependen');
334 INSERT INTO sc_resource_dependen (id, res_id, identifierref, nr) VALUES 336 array(
'integer',
'integer',
'text',
'integer'),
337 array($nextId, $this->
getId(), $this->dependencies[
$i]->getIdentifierRef(), (
$i + 1))
342 public function delete()
349 'DELETE FROM sc_resource WHERE obj_id = %s',
355 'DELETE FROM sc_resource_file WHERE res_id = %s',
361 '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.
update($pash, $contents, Config $config)
setImportId($a_import_id)
SCORM Resource File, DB accesses are done in ilSCORMResource.