ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 ()
 
_getInstance ($a_id, $a_slm_id)
 get instance of specialized GUI class More...
 

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

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, and ilSCORMObject\setType().

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

References $ilBench, $ilDB, and array.

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

203  {
204  global $ilBench, $ilDB;
205 
206  $id_set = $ilDB->queryF(
207  'SELECT ob.obj_id id FROM sc_resource res, scorm_object ob
208  WHERE ob.obj_id = res.obj_id
209  AND res.import_id = %s
210  AND ob.slm_id = %s',
211  array('text', 'integer'),
212  array($a_id_ref ,$a_slm_id)
213  );
214 
215  if ($id_rec = $ilDB->fetchAssoc($id_set))
216  {
217  return $id_rec["id"];
218  }
219  return 0;
220  }
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 222 of file class.ilSCORMResource.php.

References $ilDB, and array.

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

223  {
224  global $ilDB;
225 
226  $st_set = $ilDB->queryF(
227  'SELECT scormtype FROM sc_resource WHERE obj_id = %s',
228  array('integer'),
229  array($a_obj_id)
230  );
231  if ($st_rec = $ilDB->fetchAssoc($st_set))
232  {
233  return $st_rec["scormtype"];
234  }
235  return "";
236  }
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 123 of file class.ilSCORMResource.php.

Referenced by read().

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

◆ addFile()

ilSCORMResource::addFile ( $a_file_obj)

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

Referenced by read().

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

◆ create()

ilSCORMResource::create ( )

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

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

239  {
240  global $ilDB;
241 
242  parent::create();
243 
244  $ilDB->manipulateF('
245  INSERT INTO sc_resource
246  (obj_id, import_id, resourcetype, scormtype, href, xml_base)
247  VALUES(%s, %s, %s, %s, %s, %s)',
248  array('integer','text','text','text','text','text'),
249  array( $this->getId(),
250  $this->getImportId(),
251  $this->getResourceType(),
252  $this->getScormType(),
253  $this->getHref(),
254  $this->getXmlBase()
255  )
256  );
257 
258  // save files
259  for($i=0; $i<count($this->files); $i++)
260  {
261  $nextId = $ilDB->nextId('sc_resource_file');
262 
263  $ilDB->manipulateF('
264  INSERT INTO sc_resource_file (id,res_id, href, nr)
265  VALUES(%s, %s, %s, %s)',
266  array('integer', 'integer', 'text', 'integer'),
267  array($nextId, $this->getId(), $this->files[$i]->getHref(), ($i + 1))
268  );
269 
270  }
271 
272  // save dependencies
273  for($i=0; $i<count($this->dependencies); $i++)
274  {
275  $nextId = $ilDB->nextId('sc_resource_dependen');
276 
277  $ilDB->manipulateF('
278  INSERT INTO sc_resource_dependen (id, res_id, identifierref, nr)
279  VALUES(%s, %s, %s, %s)',
280  array('integer', 'integer', 'text', 'integer'),
281  array($nextId, $this->getId(), $this->files[$i]->getHref(), ($i + 1))
282  );
283  }
284  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ delete()

ilSCORMResource::delete ( )

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

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

349  {
350  global $ilDB;
351 
352  parent::delete();
353 
354  $ilDB->manipulateF(
355  'DELETE FROM sc_resource WHERE obj_id = %s',
356  array('integer'),
357  array($this->getId())
358  );
359 
360  $ilDB->manipulateF(
361  'DELETE FROM sc_resource_file WHERE res_id = %s',
362  array('integer'),
363  array($this->getId())
364  );
365 
366  $ilDB->manipulateF(
367  'DELETE FROM sc_resource_dependen WHERE res_id = %s',
368  array('integer'),
369  array($this->getId())
370  );
371  }
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 128 of file class.ilSCORMResource.php.

References $dependencies.

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

◆ getFiles()

& ilSCORMResource::getFiles ( )

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

References $files.

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

◆ getHRef()

ilSCORMResource::getHRef ( )

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

References $href.

Referenced by update().

93  {
94  return $this->href;
95  }
+ Here is the caller graph for this function:

◆ getImportId()

ilSCORMResource::getImportId ( )

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

References $import_id.

Referenced by create(), and update().

63  {
64  return $this->import_id;
65  }
+ Here is the caller graph for this function:

◆ getResourceType()

ilSCORMResource::getResourceType ( )

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

References $resourcetype.

Referenced by create(), and update().

73  {
74  return $this->resourcetype;
75  }
+ Here is the caller graph for this function:

◆ getScormType()

ilSCORMResource::getScormType ( )

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

References $scormtype.

Referenced by create(), and update().

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

◆ getXmlBase()

ilSCORMResource::getXmlBase ( )

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

References $xml_base.

Referenced by create(), and update().

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

◆ read()

ilSCORMResource::read ( )

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

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

Referenced by readByIdRef().

134  {
135  global $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  {
159  $res_file = new ilSCORMResourceFile();
160  $res_file->setHref($file_rec["href"]);
161  $this->addFile($res_file);
162  }
163  // read dependencies
164 
165  $dep_set = $ilDB->queryF(
166  'SELECT identifierref FROM sc_resource_dependen WHERE res_id = %s ORDER BY nr',
167  array('integer'),
168  array($this->getId())
169  );
170  while ($dep_rec =$ilDB->fetchAssoc($dep_set))
171  {
172  $res_dep = new ilSCORMResourceDependency();
173  $res_dep->setIdentifierRef($dep_rec["identifierref"]);
174  $this->addDependency($res_dep);
175  }
176  }
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 178 of file class.ilSCORMResource.php.

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

179  {
180  global $ilBench, $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  {
197  $this->setId($id_rec["id"]);
198  $this->read();
199  }
200  }
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 97 of file class.ilSCORMResource.php.

References ilSCORMObject\setTitle().

Referenced by read().

98  {
99  $this->href = $a_href;
100  $this->setTitle($a_href);
101  }
+ 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 67 of file class.ilSCORMResource.php.

Referenced by read().

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

◆ setResourceType()

ilSCORMResource::setResourceType (   $a_type)

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

References $a_type.

Referenced by read().

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

◆ setScormType()

ilSCORMResource::setScormType (   $a_scormtype)

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

Referenced by read().

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

◆ setXmlBase()

ilSCORMResource::setXmlBase (   $a_xml_base)

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

Referenced by read().

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

◆ update()

ilSCORMResource::update ( )

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

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

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