ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilSCORMResource Class Reference

SCORM Resource. 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

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 189 of file class.ilSCORMResource.php.

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

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 210 of file class.ilSCORMResource.php.

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

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 110 of file class.ilSCORMResource.php.

110 : void
111 {
112 $this->dependencies[] = &$a_dependency;
113 }

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 226 of file class.ilSCORMResource.php.

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

References $DIC, $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 338 of file class.ilSCORMResource.php.

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

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

+ Here is the call graph for this function:

◆ getDependencies()

& ilSCORMResource::getDependencies ( )

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

115 : array
116 {
117 return $this->dependencies;
118 }

References $dependencies.

◆ getFiles()

& ilSCORMResource::getFiles ( )

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

105 : array
106 {
107 return $this->files;
108 }

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 120 of file class.ilSCORMResource.php.

120 : void
121 {
122 global $DIC;
123 $ilDB = $DIC->database();
124
125 parent::read();
126
127 $obj_set = $ilDB->queryF(
128 'SELECT * FROM sc_resource WHERE obj_id = %s',
129 array('integer'),
130 array($this->getId())
131 );
132 $obj_rec = $ilDB->fetchAssoc($obj_set);
133 $this->setImportId($obj_rec["import_id"]);
134 $this->setResourceType($obj_rec["resourcetype"]);
135 $this->setScormType($obj_rec["scormtype"]);
136 $this->setHRef($obj_rec["href"]);
137 $this->setXmlBase($obj_rec["xml_base"]);
138
139 // read files
140 $file_set = $ilDB->queryF(
141 'SELECT href FROM sc_resource_file WHERE res_id = %s ORDER BY nr',
142 array('integer'),
143 array($this->getId())
144 );
145 while ($file_rec = $ilDB->fetchAssoc($file_set)) {
146 $res_file = new ilSCORMResourceFile();
147 $res_file->setHref($file_rec["href"]);
148 $this->addFile($res_file);
149 }
150 // read dependencies
151
152 $dep_set = $ilDB->queryF(
153 'SELECT identifierref FROM sc_resource_dependen WHERE res_id = %s ORDER BY nr',
154 array('integer'),
155 array($this->getId())
156 );
157 while ($dep_rec = $ilDB->fetchAssoc($dep_set)) {
158 $res_dep = new ilSCORMResourceDependency();
159 $res_dep->setIdentifierRef($dep_rec["identifierref"]);
160 $this->addDependency($res_dep);
161 }
162 }
SCORM Resource Dependency, DB accesses are done in ilSCORMResource.
SCORM Resource File, DB accesses are done in ilSCORMResource.
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 164 of file class.ilSCORMResource.php.

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

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 275 of file class.ilSCORMResource.php.

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

References $DIC, $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: