ILIAS  release_8 Revision v8.24
ilSCORMResource Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilSCORMResource:
+ Collaboration diagram for ilSCORMResource:

Public Member Functions

 __construct (int $a_id=0)
 
 getImportId ()
 
 setImportId (string $a_import_id)
 
 getResourceType ()
 
 setResourceType (string $a_type)
 
 getScormType ()
 
 setScormType (?string $a_scormtype)
 
 getHRef ()
 
 setHRef (?string $a_href)
 
 getXmlBase ()
 
 setXmlBase (?string $a_xml_base)
 
 addFile (ilSCORMResourceFile $a_file_obj)
 
getFiles ()
 
 addDependency (ilSCORMResourceDependency $a_dependency)
 
getDependencies ()
 
 read ()
 
 readByIdRef (string $a_id_ref, int $a_slm_id)
 
 create ()
 Create database record for SCORM object. More...
 
 update ()
 Updates database record for SCORM object. More...
 
 delete ()
 
- Public Member Functions inherited from ilSCORMObject
 __construct (int $a_id=0)
 Constructor. More...
 
 getId ()
 
 setId (int $a_id)
 
 getType ()
 
 setType (?string $a_type)
 
 getTitle ()
 
 setTitle (string $a_title)
 
 getSLMId ()
 
 setSLMId (int $a_slm_id)
 
 read ()
 
 create ()
 Create database record for SCORM object. More...
 
 update ()
 Updates database record for SCORM object. More...
 
 delete ()
 

Static Public Member Functions

static _lookupIdByIdRef (string $a_id_ref, int $a_slm_id)
 
static _lookupScormType (int $a_obj_id)
 
- Static Public Member Functions inherited from ilSCORMObject
static _lookupPresentableItems (int $a_slm_id)
 Count number of presentable SCOs/Assets of SCORM learning module. More...
 
static & _getInstance (int $a_id, int $a_slm_id)
 

Data Fields

string $import_id
 
string $resourcetype
 
string $scormtype = null
 
string $href = null
 
string $xml_base = null
 
array $files
 
array $dependencies
 
- Data Fields inherited from ilSCORMObject
int $id
 
string $title = ""
 
string $type = null
 
int $slm_id
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning SCORM Resource

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 28 of file class.ilSCORMResource.php.

Constructor & Destructor Documentation

◆ __construct()

ilSCORMResource::__construct ( int  $a_id = 0)
Parameters
int$a_idObject ID

Reimplemented from ilSCORMObject.

Definition at line 41 of file class.ilSCORMResource.php.

42 {
43 $this->files = array();
44 $this->dependencies = array();
45 $this->setType("sre");
47 }
setType(?string $a_type)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\GlobalScreen\Provider\__construct(), and ilSCORMObject\setType().

+ Here is the call graph for this function:

Member Function Documentation

◆ _lookupIdByIdRef()

static ilSCORMResource::_lookupIdByIdRef ( string  $a_id_ref,
int  $a_slm_id 
)
static

Definition at line 195 of file class.ilSCORMResource.php.

195 : int
196 {
197 global $DIC;
198 $ilBench = $DIC['ilBench'];
199 $ilDB = $DIC->database();
200
201 $id_set = $ilDB->queryF(
202 'SELECT ob.obj_id id FROM sc_resource res, scorm_object ob
203 WHERE ob.obj_id = res.obj_id
204 AND res.import_id = %s
205 AND ob.slm_id = %s',
206 array('text', 'integer'),
207 array($a_id_ref ,$a_slm_id)
208 );
209
210 if ($id_rec = $ilDB->fetchAssoc($id_set)) {
211 return (int) $id_rec["id"];
212 }
213 return 0;
214 }
global $DIC
Definition: feed.php:28

References $DIC, and $ilDB.

Referenced by ilSCORMExplorer\insertObject().

+ Here is the caller graph for this function:

◆ _lookupScormType()

static ilSCORMResource::_lookupScormType ( int  $a_obj_id)
static

Definition at line 216 of file class.ilSCORMResource.php.

216 : string
217 {
218 global $DIC;
219 $ilDB = $DIC->database();
220
221 $st_set = $ilDB->queryF(
222 'SELECT scormtype FROM sc_resource WHERE obj_id = %s',
223 array('integer'),
224 array($a_obj_id)
225 );
226 if ($st_rec = $ilDB->fetchAssoc($st_set)) {
227 return (string) $st_rec["scormtype"];//check UK usually null
228 }
229 return "";
230 }

References $DIC, and $ilDB.

Referenced by ilSCORMExplorer\insertObject().

+ Here is the caller graph for this function:

◆ addDependency()

ilSCORMResource::addDependency ( ilSCORMResourceDependency  $a_dependency)

Definition at line 113 of file class.ilSCORMResource.php.

113 : void
114 {
115 $this->dependencies[] = &$a_dependency;
116 }

Referenced by read().

+ Here is the caller graph for this function:

◆ addFile()

ilSCORMResource::addFile ( ilSCORMResourceFile  $a_file_obj)

Definition at line 100 of file class.ilSCORMResource.php.

100 : void
101 {
102 $this->files[] = &$a_file_obj;
103 }

Referenced by read().

+ Here is the caller graph for this function:

◆ create()

ilSCORMResource::create ( )

Create database record for SCORM object.

Reimplemented from ilSCORMObject.

Definition at line 232 of file class.ilSCORMResource.php.

232 : void
233 {
234 global $DIC;
235 $ilDB = $DIC->database();
236
237 parent::create();
238
239 $ilDB->manipulateF(
240 '
241 INSERT INTO sc_resource
242 (obj_id, import_id, resourcetype, scormtype, href, xml_base)
243 VALUES(%s, %s, %s, %s, %s, %s)',
244 array('integer','text','text','text','text','text'),
245 array( $this->getId(),
246 $this->getImportId(),
247 $this->getResourceType(),
248 $this->getScormType(),
249 $this->getHref(),
250 $this->getXmlBase()
251 )
252 );
253
254 // save files
255 foreach ($this->files as $i => $value) {
256 $nextId = $ilDB->nextId('sc_resource_file');
257
258 $ilDB->manipulateF(
259 '
260 INSERT INTO sc_resource_file (id,res_id, href, nr)
261 VALUES(%s, %s, %s, %s)',
262 array('integer', 'integer', 'text', 'integer'),
263 array($nextId, $this->getId(), $value->getHref(), ($i + 1))
264 );
265 }
266
267 // save dependencies
268 for ($i = 0, $max = count($this->dependencies); $i < $max; $i++) {
269 $nextId = $ilDB->nextId('sc_resource_dependen');
270
271 $ilDB->manipulateF(
272 '
273 INSERT INTO sc_resource_dependen (id, res_id, identifierref, nr)
274 VALUES(%s, %s, %s, %s)',
275 array('integer', 'integer', 'text', 'integer'),
276 array($nextId, $this->getId(), $this->files[$i]->getHref(), ($i + 1))
277 );
278 }
279 }
$i
Definition: metadata.php:41

References $DIC, $i, $ilDB, ilSCORMObject\getId(), getImportId(), getResourceType(), getScormType(), and getXmlBase().

+ Here is the call graph for this function:

◆ delete()

ilSCORMResource::delete ( )

Reimplemented from ilSCORMObject.

Definition at line 344 of file class.ilSCORMResource.php.

344 : void
345 {
346 global $DIC;
347 $ilDB = $DIC->database();
348
349 parent::delete();
350
351 $ilDB->manipulateF(
352 'DELETE FROM sc_resource WHERE obj_id = %s',
353 array('integer'),
354 array($this->getId())
355 );
356
357 $ilDB->manipulateF(
358 'DELETE FROM sc_resource_file WHERE res_id = %s',
359 array('integer'),
360 array($this->getId())
361 );
362
363 $ilDB->manipulateF(
364 'DELETE FROM sc_resource_dependen WHERE res_id = %s',
365 array('integer'),
366 array($this->getId())
367 );
368 }

References $DIC, $ilDB, and ilSCORMObject\getId().

+ Here is the call graph for this function:

◆ getDependencies()

& ilSCORMResource::getDependencies ( )
Returns
mixed[]

Definition at line 121 of file class.ilSCORMResource.php.

121 : array
122 {
123 return $this->dependencies;
124 }

References $dependencies.

◆ getFiles()

& ilSCORMResource::getFiles ( )
Returns
mixed[]

Definition at line 108 of file class.ilSCORMResource.php.

108 : array
109 {
110 return $this->files;
111 }

References $files.

◆ getHRef()

ilSCORMResource::getHRef ( )

Definition at line 79 of file class.ilSCORMResource.php.

79 : ?string
80 {
81 return $this->href;
82 }

References $href.

Referenced by update().

+ Here is the caller graph for this function:

◆ getImportId()

ilSCORMResource::getImportId ( )

Definition at line 49 of file class.ilSCORMResource.php.

49 : string
50 {
51 return $this->import_id;
52 }

References $import_id.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getResourceType()

ilSCORMResource::getResourceType ( )

Definition at line 59 of file class.ilSCORMResource.php.

59 : string
60 {
62 }

References $resourcetype.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getScormType()

ilSCORMResource::getScormType ( )

Definition at line 69 of file class.ilSCORMResource.php.

69 : ?string
70 {
71 return $this->scormtype;
72 }

References $scormtype.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getXmlBase()

ilSCORMResource::getXmlBase ( )

Definition at line 90 of file class.ilSCORMResource.php.

90 : ?string
91 {
92 return $this->xml_base;
93 }

References $xml_base.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ read()

ilSCORMResource::read ( )
Returns
void

Reimplemented from ilSCORMObject.

Definition at line 126 of file class.ilSCORMResource.php.

126 : void
127 {
128 global $DIC;
129 $ilDB = $DIC->database();
130
131 parent::read();
132
133 $obj_set = $ilDB->queryF(
134 'SELECT * FROM sc_resource WHERE obj_id = %s',
135 array('integer'),
136 array($this->getId())
137 );
138 $obj_rec = $ilDB->fetchAssoc($obj_set);
139 $this->setImportId($obj_rec["import_id"]);
140 $this->setResourceType($obj_rec["resourcetype"]);
141 $this->setScormType($obj_rec["scormtype"]);
142 $this->setHRef($obj_rec["href"]);
143 $this->setXmlBase($obj_rec["xml_base"]);
144
145 // read files
146 $file_set = $ilDB->queryF(
147 'SELECT href FROM sc_resource_file WHERE res_id = %s ORDER BY nr',
148 array('integer'),
149 array($this->getId())
150 );
151 while ($file_rec = $ilDB->fetchAssoc($file_set)) {
152 $res_file = new ilSCORMResourceFile();
153 $res_file->setHref($file_rec["href"]);
154 $this->addFile($res_file);
155 }
156 // read dependencies
157
158 $dep_set = $ilDB->queryF(
159 'SELECT identifierref FROM sc_resource_dependen WHERE res_id = %s ORDER BY nr',
160 array('integer'),
161 array($this->getId())
162 );
163 while ($dep_rec = $ilDB->fetchAssoc($dep_set)) {
164 $res_dep = new ilSCORMResourceDependency();
165 $res_dep->setIdentifierRef($dep_rec["identifierref"]);
166 $this->addDependency($res_dep);
167 }
168 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setImportId(string $a_import_id)
addFile(ilSCORMResourceFile $a_file_obj)
setScormType(?string $a_scormtype)
setXmlBase(?string $a_xml_base)
setHRef(?string $a_href)
addDependency(ilSCORMResourceDependency $a_dependency)
setResourceType(string $a_type)

References $DIC, $ilDB, addDependency(), addFile(), ilSCORMObject\getId(), setHRef(), setImportId(), setResourceType(), setScormType(), and setXmlBase().

Referenced by readByIdRef().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readByIdRef()

ilSCORMResource::readByIdRef ( string  $a_id_ref,
int  $a_slm_id 
)

Definition at line 170 of file class.ilSCORMResource.php.

170 : void
171 {
172 global $DIC;
173 $ilBench = $DIC['ilBench'];
174 $ilDB = $DIC->database();
175
176 $ilBench->start("SCORMResource", "readByIdRef_Query");
177
178 $id_set = $ilDB->queryF(
179 'SELECT ob.obj_id id FROM sc_resource res, scorm_object ob
180 WHERE ob.obj_id = res.obj_id
181 AND res.import_id = %s
182 AND ob.slm_id = %s',
183 array('text', 'integer'),
184 array($a_id_ref, $a_slm_id)
185 );
186
187 $ilBench->stop("SCORMResource", "readByIdRef_Query");
188
189 if ($id_rec = $ilDB->fetchAssoc($id_set)) {
190 $this->setId($id_rec["id"]);
191 $this->read();
192 }
193 }

References $DIC, $ilDB, read(), and ilSCORMObject\setId().

+ Here is the call graph for this function:

◆ setHRef()

ilSCORMResource::setHRef ( ?string  $a_href)

Definition at line 84 of file class.ilSCORMResource.php.

84 : void
85 {
86 $this->href = $a_href;
87 $this->setTitle("" . $a_href);
88 }
setTitle(string $a_title)

References ilSCORMObject\setTitle().

Referenced by read().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setImportId()

ilSCORMResource::setImportId ( string  $a_import_id)

Definition at line 54 of file class.ilSCORMResource.php.

54 : void
55 {
56 $this->import_id = $a_import_id;
57 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setResourceType()

ilSCORMResource::setResourceType ( string  $a_type)

Definition at line 64 of file class.ilSCORMResource.php.

64 : void
65 {
66 $this->resourcetype = $a_type;
67 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setScormType()

ilSCORMResource::setScormType ( ?string  $a_scormtype)

Definition at line 74 of file class.ilSCORMResource.php.

74 : void
75 {
76 $this->scormtype = $a_scormtype;
77 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setXmlBase()

ilSCORMResource::setXmlBase ( ?string  $a_xml_base)

Definition at line 95 of file class.ilSCORMResource.php.

95 : void
96 {
97 $this->xml_base = $a_xml_base;
98 }

Referenced by read().

+ Here is the caller graph for this function:

◆ update()

ilSCORMResource::update ( )

Updates database record for SCORM object.

Reimplemented from ilSCORMObject.

Definition at line 281 of file class.ilSCORMResource.php.

281 : void
282 {
283 global $DIC;
284 $ilDB = $DIC->database();
285
286 parent::update();
287
288 $ilDB->manipulateF(
289 '
290 UPDATE sc_resource
291 SET import_id = %s,
292 resourcetype = %s,
293 scormtype = %s,
294 href = %s,
295 xml_base = %s
296 WHERE obj_id = %s',
297 array('text', 'text', 'text', 'text', 'text', 'integer'),
298 array( $this->getImportId(),
299 $this->getResourceType(),
300 $this->getScormType(),
301 $this->getHRef(),
302 $this->getXmlBase(),
303 $this->getId())
304 );
305
306 // save files
307 $ilDB->manipulateF(
308 'DELETE FROM sc_resource_file WHERE res_id = %s',
309 array('integer'),
310 array($this->getId())
311 );
312
313 foreach ($this->files as $i => $value) {
314 $nextId = $ilDB->nextId('sc_resource_file');
315
316 $ilDB->manipulateF(
317 'INSERT INTO sc_resource_file (id, res_id, href, nr)
318 VALUES (%s, %s, %s, %s)',
319 array('integer', 'integer', 'text', 'integer'),
320 array($nextId, $this->getId(), $value->getHref(), ($i + 1))
321 );
322 }
323
324 // save dependencies
325 $ilDB->manipulateF(
326 'DELETE FROM sc_resource_dependen WHERE res_id = %s',
327 array('integer'),
328 array($this->getId())
329 );
330
331 foreach ($this->dependencies as $i => $value) {
332 $nextId = $ilDB->nextId('sc_resource_dependen');
333
334 $ilDB->manipulateF(
335 '
336 INSERT INTO sc_resource_dependen (id, res_id, identifierref, nr) VALUES
337 (%s, %s, %s, %s) ',
338 array('integer', 'integer', 'text', 'integer'),
339 array($nextId, $this->getId(), $value->getIdentifierRef(), ($i + 1))
340 );
341 }
342 }

References $DIC, $i, $ilDB, getHRef(), ilSCORMObject\getId(), getImportId(), getResourceType(), getScormType(), and getXmlBase().

+ Here is the call graph for this function:

Field Documentation

◆ $dependencies

array ilSCORMResource::$dependencies

Definition at line 36 of file class.ilSCORMResource.php.

Referenced by getDependencies().

◆ $files

array ilSCORMResource::$files

Definition at line 35 of file class.ilSCORMResource.php.

Referenced by getFiles().

◆ $href

string ilSCORMResource::$href = null

Definition at line 33 of file class.ilSCORMResource.php.

Referenced by getHRef().

◆ $import_id

string ilSCORMResource::$import_id

Definition at line 30 of file class.ilSCORMResource.php.

Referenced by getImportId().

◆ $resourcetype

string ilSCORMResource::$resourcetype

Definition at line 31 of file class.ilSCORMResource.php.

Referenced by getResourceType().

◆ $scormtype

string ilSCORMResource::$scormtype = null

Definition at line 32 of file class.ilSCORMResource.php.

Referenced by getScormType().

◆ $xml_base

string ilSCORMResource::$xml_base = null

Definition at line 34 of file class.ilSCORMResource.php.

Referenced by getXmlBase().


The documentation for this class was generated from the following file: