ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 ()
 
 update ()
 
 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 public

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

References array, files, and ilSCORMObject\setType().

54  {
55  $this->files = array();
56  $this->dependencies = array();
57  $this->setType("sre");
58  parent::__construct($a_id);
59  }
Create styles array
The data for the language used.
Done writing files
+ 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 198 of file class.ilSCORMResource.php.

References $ilBench, $ilDB, and array.

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

199  {
200  global $ilBench, $ilDB;
201 
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
206  AND ob.slm_id = %s',
207  array('text', 'integer'),
208  array($a_id_ref ,$a_slm_id)
209  );
210 
211  if ($id_rec = $ilDB->fetchAssoc($id_set)) {
212  return $id_rec["id"];
213  }
214  return 0;
215  }
Create styles array
The data for the language used.
global $ilBench
Definition: ilias.php:18
global $ilDB
+ Here is the caller graph for this function:

◆ _lookupScormType()

static ilSCORMResource::_lookupScormType (   $a_obj_id)
static

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

References $ilDB, and array.

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

218  {
219  global $ilDB;
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 $st_rec["scormtype"];
228  }
229  return "";
230  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ addDependency()

ilSCORMResource::addDependency ( $a_dependency)

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

Referenced by read().

123  {
124  $this->dependencies[] =&$a_dependency;
125  }
+ Here is the caller graph for this function:

◆ addFile()

ilSCORMResource::addFile ( $a_file_obj)

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

References files.

Referenced by read().

113  {
114  $this->files[] =&$a_file_obj;
115  }
Done writing files
+ Here is the caller graph for this function:

◆ create()

ilSCORMResource::create ( )

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

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

233  {
234  global $ilDB;
235 
236  parent::create();
237 
238  $ilDB->manipulateF(
239  '
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'),
244  array( $this->getId(),
245  $this->getImportId(),
246  $this->getResourceType(),
247  $this->getScormType(),
248  $this->getHref(),
249  $this->getXmlBase()
250  )
251  );
252 
253  // save files
254  for ($i=0; $i<count($this->files); $i++) {
255  $nextId = $ilDB->nextId('sc_resource_file');
256 
257  $ilDB->manipulateF(
258  '
259  INSERT INTO sc_resource_file (id,res_id, href, nr)
260  VALUES(%s, %s, %s, %s)',
261  array('integer', 'integer', 'text', 'integer'),
262  array($nextId, $this->getId(), $this->files[$i]->getHref(), ($i + 1))
263  );
264  }
265 
266  // save dependencies
267  for ($i=0; $i<count($this->dependencies); $i++) {
268  $nextId = $ilDB->nextId('sc_resource_dependen');
269 
270  $ilDB->manipulateF(
271  '
272  INSERT INTO sc_resource_dependen (id, res_id, identifierref, nr)
273  VALUES(%s, %s, %s, %s)',
274  array('integer', 'integer', 'text', 'integer'),
275  array($nextId, $this->getId(), $this->files[$i]->getHref(), ($i + 1))
276  );
277  }
278  }
Create styles array
The data for the language used.
global $ilDB
$i
Definition: disco.tpl.php:19
Done writing files
+ Here is the call graph for this function:

◆ delete()

ilSCORMResource::delete ( )

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

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

343  {
344  global $ilDB;
345 
346  parent::delete();
347 
348  $ilDB->manipulateF(
349  'DELETE FROM sc_resource WHERE obj_id = %s',
350  array('integer'),
351  array($this->getId())
352  );
353 
354  $ilDB->manipulateF(
355  'DELETE FROM sc_resource_file WHERE res_id = %s',
356  array('integer'),
357  array($this->getId())
358  );
359 
360  $ilDB->manipulateF(
361  'DELETE FROM sc_resource_dependen WHERE res_id = %s',
362  array('integer'),
363  array($this->getId())
364  );
365  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ getDependencies()

& ilSCORMResource::getDependencies ( )

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

References $dependencies.

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

◆ getFiles()

& ilSCORMResource::getFiles ( )

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

References $files.

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

◆ getHRef()

ilSCORMResource::getHRef ( )

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

References $href.

Referenced by update().

92  {
93  return $this->href;
94  }
+ 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().

62  {
63  return $this->import_id;
64  }
+ 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().

72  {
73  return $this->resourcetype;
74  }
+ 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().

82  {
83  return $this->scormtype;
84  }
+ Here is the caller graph for this function:

◆ getXmlBase()

ilSCORMResource::getXmlBase ( )

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

References $xml_base.

Referenced by create(), and update().

103  {
104  return $this->xml_base;
105  }
+ Here is the caller graph for this function:

◆ read()

ilSCORMResource::read ( )

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

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

Referenced by readByIdRef().

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

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

176  {
177  global $ilBench, $ilDB;
178 
179  $ilBench->start("SCORMResource", "readByIdRef_Query");
180 
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
185  AND ob.slm_id = %s',
186  array('text', 'integer'),
187  array($a_id_ref, $a_slm_id)
188  );
189 
190  $ilBench->stop("SCORMResource", "readByIdRef_Query");
191 
192  if ($id_rec = $ilDB->fetchAssoc($id_set)) {
193  $this->setId($id_rec["id"]);
194  $this->read();
195  }
196  }
Create styles array
The data for the language used.
global $ilBench
Definition: ilias.php:18
global $ilDB
+ Here is the call graph for this function:

◆ setHRef()

ilSCORMResource::setHRef (   $a_href)

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

References ilSCORMObject\setTitle().

Referenced by read().

97  {
98  $this->href = $a_href;
99  $this->setTitle($a_href);
100  }
+ 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.

Referenced by read().

67  {
68  $this->import_id = $a_import_id;
69  }
+ Here is the caller graph for this function:

◆ setResourceType()

ilSCORMResource::setResourceType (   $a_type)

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

References $a_type.

Referenced by read().

77  {
78  $this->resourcetype = $a_type;
79  }
$a_type
Definition: workflow.php:92
+ Here is the caller graph for this function:

◆ setScormType()

ilSCORMResource::setScormType (   $a_scormtype)

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

Referenced by read().

87  {
88  $this->scormtype = $a_scormtype;
89  }
+ Here is the caller graph for this function:

◆ setXmlBase()

ilSCORMResource::setXmlBase (   $a_xml_base)

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

Referenced by read().

108  {
109  $this->xml_base = $a_xml_base;
110  }
+ Here is the caller graph for this function:

◆ update()

ilSCORMResource::update ( )

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

References $i, $ilDB, array, files, getHRef(), ilSCORMObject\getId(), getImportId(), getResourceType(), getScormType(), getXmlBase(), and League\Flysystem\Adapter\Polyfill\update().

281  {
282  global $ilDB;
283 
284  parent::update();
285 
286  $ilDB->manipulateF(
287  '
288  UPDATE sc_resource
289  SET import_id = %s,
290  resourcetype = %s,
291  scormtype = %s,
292  href = %s,
293  xml_base = %s
294  WHERE obj_id = %s',
295  array('text', 'text', 'text', 'text', 'text', 'integer'),
296  array( $this->getImportId(),
297  $this->getResourceType(),
298  $this->getScormType(),
299  $this->getHRef(),
300  $this->getXmlBase(),
301  $this->getId())
302  );
303 
304  // save files
305  $ilDB->manipulateF(
306  'DELETE FROM sc_resource_file WHERE res_id = %s',
307  array('integer'),
308  array($this->getId())
309  );
310 
311  for ($i=0; $i<count($this->files); $i++) {
312  $nextId = $ilDB->nextId('sc_resource_file');
313 
314  $ilDB->manipulateF(
315  'INSERT INTO sc_resource_file (id, res_id, href, nr)
316  VALUES (%s, %s, %s, %s)',
317  array('integer', 'integer', 'text', 'integer'),
318  array($nextId, $this->getId(), $this->files[$i]->getHref(), ($i + 1))
319  );
320  }
321 
322  // save dependencies
323  $ilDB->manipulateF(
324  'DELETE FROM sc_resource_dependen WHERE res_id = %s',
325  array('integer'),
326  array($this->getId())
327  );
328 
329  for ($i = 0; $i < count($this->dependencies); $i++) {
330  $nextId = $ilDB->nextId('sc_resource_dependen');
331 
332  $ilDB->manipulateF(
333  '
334  INSERT INTO sc_resource_dependen (id, res_id, identifierref, nr) VALUES
335  (%s, %s, %s, %s) ',
336  array('integer', 'integer', 'text', 'integer'),
337  array($nextId, $this->getId(), $this->dependencies[$i]->getIdentifierRef(), ($i + 1))
338  );
339  }
340  }
Create styles array
The data for the language used.
update($pash, $contents, Config $config)
global $ilDB
$i
Definition: disco.tpl.php:19
Done writing files
+ 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: