24require_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMObject.php");
 
   25require_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMResourceFile.php");
 
   26require_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMResourceDependency.php");
 
   55        $this->files = array();
 
   56        $this->dependencies = array();
 
   58        parent::__construct($a_id);
 
   68        $this->import_id = $a_import_id;
 
   88        $this->scormtype = $a_scormtype;
 
   98        $this->href = $a_href;
 
  109        $this->xml_base = $a_xml_base;
 
  114        $this->files[] =&$a_file_obj;
 
  124        $this->dependencies[] =&$a_dependency;
 
  138        $obj_set = 
$ilDB->queryF(
 
  139            'SELECT * FROM sc_resource WHERE obj_id = %s',
 
  141            array($this->
getId())
 
  143        $obj_rec = 
$ilDB->fetchAssoc($obj_set);
 
  147        $this->
setHRef($obj_rec[
"href"]);
 
  151        $file_set = 
$ilDB->queryF(
 
  152            'SELECT href FROM sc_resource_file WHERE res_id = %s ORDER BY nr',
 
  154            array($this->
getId())
 
  156        while ($file_rec =
$ilDB->fetchAssoc($file_set)) {
 
  158            $res_file->setHref($file_rec[
"href"]);
 
  163        $dep_set = 
$ilDB->queryF(
 
  164            'SELECT identifierref FROM sc_resource_dependen WHERE res_id = %s ORDER BY nr',
 
  166            array($this->
getId())
 
  168        while ($dep_rec =
$ilDB->fetchAssoc($dep_set)) {
 
  170            $res_dep->setIdentifierRef($dep_rec[
"identifierref"]);
 
  179        $ilBench->start(
"SCORMResource", 
"readByIdRef_Query");
 
  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  
  186            array(
'text', 
'integer'),
 
  187            array($a_id_ref, $a_slm_id)
 
  190        $ilBench->stop(
"SCORMResource", 
"readByIdRef_Query");
 
  192        if ($id_rec = 
$ilDB->fetchAssoc($id_set)) {
 
  193            $this->
setId($id_rec[
"id"]);
 
  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  
  207            array(
'text', 
'integer'),
 
  208            array($a_id_ref ,$a_slm_id)
 
  211        if ($id_rec = 
$ilDB->fetchAssoc($id_set)) {
 
  212            return $id_rec[
"id"];
 
  221        $st_set = 
$ilDB->queryF(
 
  222            'SELECT scormtype FROM sc_resource WHERE obj_id = %s',
 
  226        if ($st_rec = 
$ilDB->fetchAssoc($st_set)) {
 
  227            return $st_rec[
"scormtype"];
 
  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(),
 
  254        for (
$i=0; 
$i<count($this->files); 
$i++) {
 
  255            $nextId = 
$ilDB->nextId(
'sc_resource_file');
 
  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))
 
  267        for (
$i=0; 
$i<count($this->dependencies); 
$i++) {
 
  268            $nextId = 
$ilDB->nextId(
'sc_resource_dependen');
 
  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))
 
  295            array(
'text', 
'text', 
'text', 
'text', 
'text', 
'integer'),
 
  306            'DELETE FROM sc_resource_file WHERE res_id = %s',
 
  308            array($this->
getId())
 
  311        for (
$i=0; 
$i<count($this->files); 
$i++) {
 
  312            $nextId = 
$ilDB->nextId(
'sc_resource_file');
 
  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))
 
  324            'DELETE FROM sc_resource_dependen WHERE res_id = %s',
 
  326            array($this->
getId())
 
  329        for (
$i = 0; 
$i < count($this->dependencies); 
$i++) {
 
  330            $nextId = 
$ilDB->nextId(
'sc_resource_dependen');
 
  334                                INSERT INTO sc_resource_dependen (id, res_id, identifierref, nr) VALUES 
  336                array(
'integer', 
'integer', 
'text', 
'integer'),
 
  337                array($nextId, $this->
getId(), $this->dependencies[
$i]->getIdentifierRef(), (
$i + 1))
 
  342    public function delete()
 
  349            'DELETE FROM sc_resource WHERE obj_id = %s',
 
  351            array($this->
getId())
 
  355            'DELETE FROM sc_resource_file WHERE res_id = %s',
 
  357            array($this->
getId())
 
  361            'DELETE FROM sc_resource_dependen WHERE res_id = %s',
 
  363            array($this->
getId())
 
An exception for terminatinating execution or to throw for unit testing.
Parent object for all SCORM objects, that are stored in table scorm_object.
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)
update()
Updates database record for SCORM object.
static _lookupIdByIdRef($a_id_ref, $a_slm_id)
static _lookupScormType($a_obj_id)
setScormType($a_scormtype)
readByIdRef($a_id_ref, $a_slm_id)
__construct($a_id=0)
Constructor.
create()
Create database record for SCORM object.
update($pash, $contents, Config $config)