3 declare(strict_types=1);
    43         $this->files = array();
    44         $this->dependencies = array();
    56         $this->import_id = $a_import_id;
    66         $this->resourcetype = $a_type;
    76         $this->scormtype = $a_scormtype;
    84     public function setHRef(?
string $a_href): void
    86         $this->href = $a_href;
    97         $this->xml_base = $a_xml_base;
   102         $this->files[] = &$a_file_obj;
   112         $this->dependencies[] = &$a_dependency;
   123         $ilDB = $DIC->database();
   127         $obj_set = 
$ilDB->queryF(
   128             'SELECT * FROM sc_resource WHERE obj_id = %s',
   130             array($this->
getId())
   132         $obj_rec = 
$ilDB->fetchAssoc($obj_set);
   136         $this->
setHRef($obj_rec[
"href"]);
   140         $file_set = 
$ilDB->queryF(
   141             'SELECT href FROM sc_resource_file WHERE res_id = %s ORDER BY nr',
   143             array($this->
getId())
   145         while ($file_rec = 
$ilDB->fetchAssoc($file_set)) {
   147             $res_file->setHref($file_rec[
"href"]);
   152         $dep_set = 
$ilDB->queryF(
   153             'SELECT identifierref FROM sc_resource_dependen WHERE res_id = %s ORDER BY nr',
   155             array($this->
getId())
   157         while ($dep_rec = 
$ilDB->fetchAssoc($dep_set)) {
   159             $res_dep->setIdentifierRef($dep_rec[
"identifierref"]);
   164     public function readByIdRef(
string $a_id_ref, 
int $a_slm_id): void
   167         $ilBench = $DIC[
'ilBench'];
   168         $ilDB = $DIC->database();
   170         $ilBench->start(
"SCORMResource", 
"readByIdRef_Query");
   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    177             array(
'text', 
'integer'),
   178             array($a_id_ref, $a_slm_id)
   181         $ilBench->stop(
"SCORMResource", 
"readByIdRef_Query");
   183         if ($id_rec = 
$ilDB->fetchAssoc($id_set)) {
   184             $this->
setId($id_rec[
"id"]);
   192         $ilBench = $DIC[
'ilBench'];
   193         $ilDB = $DIC->database();
   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    200             array(
'text', 
'integer'),
   201             array($a_id_ref ,$a_slm_id)
   204         if ($id_rec = 
$ilDB->fetchAssoc($id_set)) {
   205             return (
int) $id_rec[
"id"];
   213         $ilDB = $DIC->database();
   215         $st_set = 
$ilDB->queryF(
   216             'SELECT scormtype FROM sc_resource WHERE obj_id = %s',
   220         if ($st_rec = 
$ilDB->fetchAssoc($st_set)) {
   221             return (
string) $st_rec[
"scormtype"];
   229         $ilDB = $DIC->database();
   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(),
   249         foreach ($this->files as $i => $value) {
   250             $nextId = 
$ilDB->nextId(
'sc_resource_file');
   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))
   262         for ($i = 0, $max = count($this->dependencies); $i < $max; $i++) {
   263             $nextId = 
$ilDB->nextId(
'sc_resource_dependen');
   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))
   278         $ilDB = $DIC->database();
   291             array(
'text', 
'text', 
'text', 
'text', 
'text', 
'integer'),
   302             'DELETE FROM sc_resource_file WHERE res_id = %s',
   304             array($this->
getId())
   307         foreach ($this->files as $i => $value) {
   308             $nextId = 
$ilDB->nextId(
'sc_resource_file');
   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))
   320             'DELETE FROM sc_resource_dependen WHERE res_id = %s',
   322             array($this->
getId())
   325         foreach ($this->dependencies as $i => $value) {
   326             $nextId = 
$ilDB->nextId(
'sc_resource_dependen');
   330                                 INSERT INTO sc_resource_dependen (id, res_id, identifierref, nr) VALUES   332                 array(
'integer', 
'integer', 
'text', 
'integer'),
   333                 array($nextId, $this->
getId(), $value->getIdentifierRef(), ($i + 1))
   338     public function delete(): 
void   341         $ilDB = $DIC->database();
   346             'DELETE FROM sc_resource WHERE obj_id = %s',
   348             array($this->
getId())
   352             'DELETE FROM sc_resource_file WHERE res_id = %s',
   354             array($this->
getId())
   358             'DELETE FROM sc_resource_dependen WHERE res_id = %s',
   360             array($this->
getId())
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
setResourceType(string $a_type)
 
static _lookupScormType(int $a_obj_id)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
addFile(ilSCORMResourceFile $a_file_obj)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
setScormType(?string $a_scormtype)
 
setTitle(string $a_title)
 
addDependency(ilSCORMResourceDependency $a_dependency)
 
setXmlBase(?string $a_xml_base)
 
static _lookupIdByIdRef(string $a_id_ref, int $a_slm_id)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
readByIdRef(string $a_id_ref, int $a_slm_id)
 
setImportId(string $a_import_id)