ILIAS  release_7 Revision v7.30-3-g800a261c036
ilSCORMResource Class Reference

SCORM Resource. More...

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

Public Member Functions

 __construct ($a_id=0)
 Constructor. More...
 
 getImportId ()
 
 setImportId ($a_import_id)
 
 getResourceType ()
 
 setResourceType ($a_type)
 
 getScormType ()
 
 setScormType ($a_scormtype)
 
 getHRef ()
 
 setHRef ($a_href)
 
 getXmlBase ()
 
 setXmlBase ($a_xml_base)
 
 addFile (&$a_file_obj)
 
getFiles ()
 
 addDependency (&$a_dependency)
 
getDependencies ()
 
 read ()
 
 readByIdRef ($a_id_ref, $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 ($a_id=0)
 Constructor. More...
 
 getId ()
 
 setId ($a_id)
 
 getType ()
 
 setType ($a_type)
 
 getTitle ()
 
 setTitle ($a_title)
 
 getSLMId ()
 
 setSLMId ($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 ($a_id_ref, $a_slm_id)
 
static _lookupScormType ($a_obj_id)
 
- Static Public Member Functions inherited from ilSCORMObject
static _lookupPresentableItems ($a_slm_id)
 Count number of presentable SCOs/Assets of SCORM learning module. More...
 
static & _getInstance ($a_id, $a_slm_id)
 get instance of specialized GUI class More...
 

Data Fields

 $import_id
 
 $resourcetype
 
 $scormtype
 
 $href
 
 $xml_base
 
 $files
 
 $dependencies
 
- Data Fields inherited from ilSCORMObject
 $id
 
 $title
 
 $type
 
 $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 36 of file class.ilSCORMResource.php.

Constructor & Destructor Documentation

◆ __construct()

ilSCORMResource::__construct (   $a_id = 0)

Constructor.

Parameters
int$a_idObject ID @access public

Reimplemented from ilSCORMObject.

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

54 {
55 $this->files = array();
56 $this->dependencies = array();
57 $this->setType("sre");
59 }
__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 (   $a_id_ref,
  $a_slm_id 
)
static

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

202 {
203 global $DIC;
204 $ilBench = $DIC['ilBench'];
205 $ilDB = $DIC['ilDB'];
206
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
211 AND ob.slm_id = %s',
212 array('text', 'integer'),
213 array($a_id_ref ,$a_slm_id)
214 );
215
216 if ($id_rec = $ilDB->fetchAssoc($id_set)) {
217 return $id_rec["id"];
218 }
219 return 0;
220 }
global $DIC
Definition: goto.php:24
global $ilBench
Definition: ilias.php:21
global $ilDB

References $DIC, $ilBench, and $ilDB.

Referenced by ilSCORMPresentationGUI\api(), and ilSCORMExplorer\insertObject().

+ Here is the caller graph for this function:

◆ _lookupScormType()

static ilSCORMResource::_lookupScormType (   $a_obj_id)
static

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

223 {
224 global $DIC;
225 $ilDB = $DIC['ilDB'];
226
227 $st_set = $ilDB->queryF(
228 'SELECT scormtype FROM sc_resource WHERE obj_id = %s',
229 array('integer'),
230 array($a_obj_id)
231 );
232 if ($st_rec = $ilDB->fetchAssoc($st_set)) {
233 return $st_rec["scormtype"];
234 }
235 return "";
236 }

References $DIC, and $ilDB.

Referenced by ilSCORMPresentationGUI\api(), and ilSCORMExplorer\insertObject().

+ Here is the caller graph for this function:

◆ addDependency()

ilSCORMResource::addDependency ( $a_dependency)

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

123 {
124 $this->dependencies[] = &$a_dependency;
125 }

Referenced by read().

+ Here is the caller graph for this function:

◆ addFile()

ilSCORMResource::addFile ( $a_file_obj)

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

113 {
114 $this->files[] = &$a_file_obj;
115 }

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

239 {
240 global $DIC;
241 $ilDB = $DIC['ilDB'];
242
243 parent::create();
244
245 $ilDB->manipulateF(
246 '
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(),
252 $this->getImportId(),
253 $this->getResourceType(),
254 $this->getScormType(),
255 $this->getHref(),
256 $this->getXmlBase()
257 )
258 );
259
260 // save files
261 for ($i = 0; $i < count($this->files); $i++) {
262 $nextId = $ilDB->nextId('sc_resource_file');
263
264 $ilDB->manipulateF(
265 '
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))
270 );
271 }
272
273 // save dependencies
274 for ($i = 0; $i < count($this->dependencies); $i++) {
275 $nextId = $ilDB->nextId('sc_resource_dependen');
276
277 $ilDB->manipulateF(
278 '
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))
283 );
284 }
285 }
$i
Definition: metadata.php:24

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

351 {
352 global $DIC;
353 $ilDB = $DIC['ilDB'];
354
355 parent::delete();
356
357 $ilDB->manipulateF(
358 'DELETE FROM sc_resource WHERE obj_id = %s',
359 array('integer'),
360 array($this->getId())
361 );
362
363 $ilDB->manipulateF(
364 'DELETE FROM sc_resource_file WHERE res_id = %s',
365 array('integer'),
366 array($this->getId())
367 );
368
369 $ilDB->manipulateF(
370 'DELETE FROM sc_resource_dependen WHERE res_id = %s',
371 array('integer'),
372 array($this->getId())
373 );
374 }

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

+ Here is the call graph for this function:

◆ getDependencies()

& ilSCORMResource::getDependencies ( )

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

128 {
129 return $this->dependencies;
130 }

References $dependencies.

◆ getFiles()

& ilSCORMResource::getFiles ( )

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

118 {
119 return $this->files;
120 }

References $files.

◆ getHRef()

ilSCORMResource::getHRef ( )

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

92 {
93 return $this->href;
94 }

References $href.

Referenced by update().

+ Here is the caller graph for this function:

◆ getImportId()

ilSCORMResource::getImportId ( )

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

References $import_id.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getResourceType()

ilSCORMResource::getResourceType ( )

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

References $resourcetype.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getScormType()

ilSCORMResource::getScormType ( )

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

References $scormtype.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getXmlBase()

ilSCORMResource::getXmlBase ( )

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

103 {
104 return $this->xml_base;
105 }

References $xml_base.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ read()

ilSCORMResource::read ( )

Reimplemented from ilSCORMObject.

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

133 {
134 global $DIC;
135 $ilDB = $DIC['ilDB'];
136
137 parent::read();
138
139 $obj_set = $ilDB->queryF(
140 'SELECT * FROM sc_resource WHERE obj_id = %s',
141 array('integer'),
142 array($this->getId())
143 );
144 $obj_rec = $ilDB->fetchAssoc($obj_set);
145 $this->setImportId($obj_rec["import_id"]);
146 $this->setResourceType($obj_rec["resourcetype"]);
147 $this->setScormType($obj_rec["scormtype"]);
148 $this->setHRef($obj_rec["href"]);
149 $this->setXmlBase($obj_rec["xml_base"]);
150
151 // read files
152 $file_set = $ilDB->queryF(
153 'SELECT href FROM sc_resource_file WHERE res_id = %s ORDER BY nr',
154 array('integer'),
155 array($this->getId())
156 );
157 while ($file_rec = $ilDB->fetchAssoc($file_set)) {
158 $res_file = new ilSCORMResourceFile();
159 $res_file->setHref($file_rec["href"]);
160 $this->addFile($res_file);
161 }
162 // read dependencies
163
164 $dep_set = $ilDB->queryF(
165 'SELECT identifierref FROM sc_resource_dependen WHERE res_id = %s ORDER BY nr',
166 array('integer'),
167 array($this->getId())
168 );
169 while ($dep_rec = $ilDB->fetchAssoc($dep_set)) {
170 $res_dep = new ilSCORMResourceDependency();
171 $res_dep->setIdentifierRef($dep_rec["identifierref"]);
172 $this->addDependency($res_dep);
173 }
174 }
SCORM Resource Dependency, DB accesses are done in ilSCORMResource.
SCORM Resource File, DB accesses are done in ilSCORMResource.
addDependency(&$a_dependency)
setImportId($a_import_id)
setScormType($a_scormtype)

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 (   $a_id_ref,
  $a_slm_id 
)

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

177 {
178 global $DIC;
179 $ilBench = $DIC['ilBench'];
180 $ilDB = $DIC['ilDB'];
181
182 $ilBench->start("SCORMResource", "readByIdRef_Query");
183
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
188 AND ob.slm_id = %s',
189 array('text', 'integer'),
190 array($a_id_ref, $a_slm_id)
191 );
192
193 $ilBench->stop("SCORMResource", "readByIdRef_Query");
194
195 if ($id_rec = $ilDB->fetchAssoc($id_set)) {
196 $this->setId($id_rec["id"]);
197 $this->read();
198 }
199 }

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

+ Here is the call graph for this function:

◆ setHRef()

ilSCORMResource::setHRef (   $a_href)

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

97 {
98 $this->href = $a_href;
99 $this->setTitle($a_href);
100 }

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 (   $a_import_id)

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

67 {
68 $this->import_id = $a_import_id;
69 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setResourceType()

ilSCORMResource::setResourceType (   $a_type)

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

77 {
78 $this->resourcetype = $a_type;
79 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setScormType()

ilSCORMResource::setScormType (   $a_scormtype)

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

87 {
88 $this->scormtype = $a_scormtype;
89 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setXmlBase()

ilSCORMResource::setXmlBase (   $a_xml_base)

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

108 {
109 $this->xml_base = $a_xml_base;
110 }

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

288 {
289 global $DIC;
290 $ilDB = $DIC['ilDB'];
291
292 parent::update();
293
294 $ilDB->manipulateF(
295 '
296 UPDATE sc_resource
297 SET import_id = %s,
298 resourcetype = %s,
299 scormtype = %s,
300 href = %s,
301 xml_base = %s
302 WHERE obj_id = %s',
303 array('text', 'text', 'text', 'text', 'text', 'integer'),
304 array( $this->getImportId(),
305 $this->getResourceType(),
306 $this->getScormType(),
307 $this->getHRef(),
308 $this->getXmlBase(),
309 $this->getId())
310 );
311
312 // save files
313 $ilDB->manipulateF(
314 'DELETE FROM sc_resource_file WHERE res_id = %s',
315 array('integer'),
316 array($this->getId())
317 );
318
319 for ($i = 0; $i < count($this->files); $i++) {
320 $nextId = $ilDB->nextId('sc_resource_file');
321
322 $ilDB->manipulateF(
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))
327 );
328 }
329
330 // save dependencies
331 $ilDB->manipulateF(
332 'DELETE FROM sc_resource_dependen WHERE res_id = %s',
333 array('integer'),
334 array($this->getId())
335 );
336
337 for ($i = 0; $i < count($this->dependencies); $i++) {
338 $nextId = $ilDB->nextId('sc_resource_dependen');
339
340 $ilDB->manipulateF(
341 '
342 INSERT INTO sc_resource_dependen (id, res_id, identifierref, nr) VALUES
343 (%s, %s, %s, %s) ',
344 array('integer', 'integer', 'text', 'integer'),
345 array($nextId, $this->getId(), $this->dependencies[$i]->getIdentifierRef(), ($i + 1))
346 );
347 }
348 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $dependencies

ilSCORMResource::$dependencies

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

Referenced by getDependencies().

◆ $files

ilSCORMResource::$files

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

Referenced by getFiles().

◆ $href

ilSCORMResource::$href

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

Referenced by getHRef().

◆ $import_id

ilSCORMResource::$import_id

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

Referenced by getImportId().

◆ $resourcetype

ilSCORMResource::$resourcetype

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

Referenced by getResourceType().

◆ $scormtype

ilSCORMResource::$scormtype

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

Referenced by getScormType().

◆ $xml_base

ilSCORMResource::$xml_base

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

Referenced by getXmlBase().


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