ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilSCORMResource Class Reference

SCORM Resource. More...

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

Public Member Functions

 ilSCORMResource ($a_id=0)
 Constructor.
 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)
 _lookupIdByIdRef ($a_id_ref, $a_slm_id)
 _lookupScormType ($a_obj_id)
 create ()
 Create database record for SCORM object.
 update ()
 Updates database record for SCORM object.
 delete ()
- Public Member Functions inherited from ilSCORMObject
 ilSCORMObject ($a_id=0)
 Constructor.
 getId ()
 setId ($a_id)
 getType ()
 setType ($a_type)
 getTitle ()
 setTitle ($a_title)
 getSLMId ()
 setSLMId ($a_slm_id)
 _lookupPresentableItems ($a_slm_id)
 Count number of presentable SCOs/Assets of SCORM learning module.
_getInstance ($a_id, $a_slm_id)
 get instance of specialized GUI class

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:
class.ilSCORMResource.php 15697 2008-01-08 20:04:33Z hschottm

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

Member Function Documentation

ilSCORMResource::_lookupIdByIdRef (   $a_id_ref,
  $a_slm_id 
)

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

References $ilBench, and DB_FETCHMODE_ASSOC.

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

{
global $ilBench, $ilDB;
$q = "SELECT ob.obj_id AS id FROM sc_resource AS res, scorm_object as ob ".
"WHERE ob.obj_id = res.obj_id ".
"AND res.import_id = ".$ilDB->quote($a_id_ref)." ".
"AND ob.slm_id = ".$ilDB->quote($a_slm_id);
$id_set = $ilDB->query($q);
if ($id_rec = $id_set->fetchRow(DB_FETCHMODE_ASSOC))
{
return $id_rec["id"];
}
return 0;
}

+ Here is the caller graph for this function:

ilSCORMResource::_lookupScormType (   $a_obj_id)

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

References DB_FETCHMODE_ASSOC.

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

{
global $ilDB;
$q = "SELECT scormtype FROM sc_resource WHERE obj_id = ".$ilDB->quote($a_obj_id);
$st_set = $ilDB->query($q);
if ($st_rec = $st_set->fetchRow(DB_FETCHMODE_ASSOC))
{
return $st_rec["scormtype"];
}
return "";
}

+ Here is the caller graph for this function:

ilSCORMResource::addDependency ( $a_dependency)

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

Referenced by read().

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

+ Here is the caller graph for this function:

ilSCORMResource::addFile ( $a_file_obj)

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

Referenced by read().

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

+ Here is the caller graph for this function:

ilSCORMResource::create ( )

Create database record for SCORM object.

Reimplemented from ilSCORMObject.

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

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

{
global $ilDB;
$q = "INSERT INTO sc_resource (obj_id, import_id, resourcetype, scormtype, href, ".
"xml_base) VALUES ".
"(".$ilDB->quote($this->getId()).", ".$ilDB->quote($this->getImportId()).",".
$ilDB->quote($this->getResourceType()).",".$ilDB->quote($this->getScormType()).",".
$ilDB->quote($this->getHref()).
",".$ilDB->quote($this->getXmlBase()).")";
$this->ilias->db->query($q);
// save files
for($i=0; $i<count($this->files); $i++)
{
$q = "INSERT INTO sc_resource_file (res_id, href, nr) VALUES ".
"(".$ilDB->quote($this->getId()).", ".$ilDB->quote($this->files[$i]->getHref()).
",".$ilDB->quote(($i + 1)).")";
$this->ilias->db->query($q);
}
// save dependencies
for($i=0; $i<count($this->dependencies); $i++)
{
$q = "INSERT INTO sc_resource_dependency (res_id, identifierref, nr) VALUES ".
"(".$ilDB->quote($this->getId()).", ".$ilDB->quote($this->dependencies[$i]->getIdentifierRef()).
",".$ilDB->quote(($i + 1)).")";
$this->ilias->db->query($q);
}
}

+ Here is the call graph for this function:

ilSCORMResource::delete ( )

Reimplemented from ilSCORMObject.

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

References ilSCORMObject\getId().

{
global $ilDB;
$q = "DELETE FROM sc_resource WHERE obj_id =".$ilDB->quote($this->getId());
$ilDB->query($q);
$q = "DELETE FROM sc_resource_file WHERE res_id =".$ilDB->quote($this->getId());
$ilDB->query($q);
$q = "DELETE FROM sc_resource_dependency WHERE res_id =".$ilDB->quote($this->getId());
$ilDB->query($q);
}

+ Here is the call graph for this function:

& ilSCORMResource::getDependencies ( )

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

References $dependencies.

{
}
& ilSCORMResource::getFiles ( )

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

References $files.

{
return $this->files;
}
ilSCORMResource::getHRef ( )

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

References $href.

Referenced by update().

{
return $this->href;
}

+ Here is the caller graph for this function:

ilSCORMResource::getImportId ( )

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

References $import_id.

Referenced by create(), and update().

{
}

+ Here is the caller graph for this function:

ilSCORMResource::getResourceType ( )

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

References $resourcetype.

Referenced by create(), and update().

{
}

+ Here is the caller graph for this function:

ilSCORMResource::getScormType ( )

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

References $scormtype.

Referenced by create(), and update().

{
}

+ Here is the caller graph for this function:

ilSCORMResource::getXmlBase ( )

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

References $xml_base.

Referenced by create(), and update().

{
}

+ Here is the caller graph for this function:

ilSCORMResource::ilSCORMResource (   $a_id = 0)

Constructor.

Parameters
int$a_idObject ID public

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

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

{
$this->files = array();
$this->dependencies = array();
$this->setType("sre");
}

+ Here is the call graph for this function:

ilSCORMResource::read ( )

Reimplemented from ilSCORMObject.

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

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

Referenced by readByIdRef().

{
global $ilDB;
$q = "SELECT * FROM sc_resource WHERE obj_id = ".$ilDB->quote($this->getId());
$obj_set = $this->ilias->db->query($q);
$obj_rec = $obj_set->fetchRow(DB_FETCHMODE_ASSOC);
$this->setImportId($obj_rec["import_id"]);
$this->setResourceType($obj_rec["resourcetype"]);
$this->setScormType($obj_rec["scormtype"]);
$this->setHRef($obj_rec["href"]);
$this->setXmlBase($obj_rec["xml_base"]);
// read files
$q = "SELECT * FROM sc_resource_file WHERE res_id = ".$ilDB->quote($this->getId()).
" ORDER BY nr";
$file_set = $this->ilias->db->query($q);
while ($file_rec = $file_set->fetchRow(DB_FETCHMODE_ASSOC))
{
$res_file =& new ilSCORMResourceFile();
$res_file->setHref($file_rec["href"]);
$this->addFile($res_file);
}
// read dependencies
$q = "SELECT * FROM sc_resource_dependency WHERE res_id = ".$ilDB->quote($this->getId()).
" ORDER BY nr";
$dep_set = $this->ilias->db->query($q);
while ($dep_rec = $dep_set->fetchRow(DB_FETCHMODE_ASSOC))
{
$res_dep =& new ilSCORMResourceDependency();
$res_dep->setIdentifierRef($dep_rec["identifierref"]);
$this->addDependency($res_dep);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSCORMResource::readByIdRef (   $a_id_ref,
  $a_slm_id 
)

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

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

{
global $ilBench, $ilDB;
$ilBench->start("SCORMResource", "readByIdRef_Query");
$q = "SELECT ob.obj_id AS id FROM sc_resource AS res, scorm_object as ob ".
"WHERE ob.obj_id = res.obj_id ".
"AND res.import_id = ".$ilDB->quote($a_id_ref)." ".
"AND ob.slm_id = ".$ilDB->quote($a_slm_id);
$id_set = $this->ilias->db->query($q);
$ilBench->stop("SCORMResource", "readByIdRef_Query");
if ($id_rec = $id_set->fetchRow(DB_FETCHMODE_ASSOC))
{
$this->setId($id_rec["id"]);
$this->read();
}
}

+ Here is the call graph for this function:

ilSCORMResource::setHRef (   $a_href)

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

References ilSCORMObject\setTitle().

Referenced by read().

{
$this->href = $a_href;
$this->setTitle($a_href);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSCORMResource::setImportId (   $a_import_id)

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

Referenced by read().

{
$this->import_id = $a_import_id;
}

+ Here is the caller graph for this function:

ilSCORMResource::setResourceType (   $a_type)

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

Referenced by read().

{
$this->resourcetype = $a_type;
}

+ Here is the caller graph for this function:

ilSCORMResource::setScormType (   $a_scormtype)

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

Referenced by read().

{
$this->scormtype = $a_scormtype;
}

+ Here is the caller graph for this function:

ilSCORMResource::setXmlBase (   $a_xml_base)

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

Referenced by read().

{
$this->xml_base = $a_xml_base;
}

+ Here is the caller graph for this function:

ilSCORMResource::update ( )

Updates database record for SCORM object.

Reimplemented from ilSCORMObject.

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

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

{
global $ilDB;
$q = "UPDATE sc_resource SET ".
"import_id = ".$ilDB->quote($this->getImportId()).", ".
"resourcetype = ".$ilDB->quote($this->getResourceType()).", ".
"scormtype = ".$ilDB->quote($this->getScormType()).", ".
"href = ".$ilDB->quote($this->getHRef()).", ".
"xml_base = ".$ilDB->quote($this->getXmlBase())." ".
"WHERE obj_id = ".$ilDB->quote($this->getId());
$this->ilias->db->query($q);
// save files
$q = "DELETE FROM sc_resource_file WHERE res_id = ".
$ilDB->quote($this->getId());
$this->ilias->db->query($q);
for($i=0; $i<count($this->files); $i++)
{
$q = "INSERT INTO sc_resource_file (res_id, href, nr) VALUES ".
"(".$ilDB->quote($this->getId()).", ".$ilDB->quote($this->files[$i]->getHref()).
",".$ilDB->quote(($i + 1)).")";
$this->ilias->db->query($q);
}
// save dependencies
$q = "DELETE FROM sc_resource_dependency WHERE res_id = ".$ilDB->quote($this->getId());
$this->ilias->db->query($q);
for($i=0; $i<count($this->dependencies); $i++)
{
$q = "INSERT INTO sc_resource_dependency (res_id, identifierref, nr) VALUES ".
"(".$ilDB->quote($this->getId()).", ".$ilDB->quote($this->dependencies[$i]->getIdentifierRef()).
",".$ilDB->quote(($i + 1)).")";
$this->ilias->db->query($q);
}
}

+ Here is the call graph for this function:

Field Documentation

ilSCORMResource::$dependencies

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

Referenced by getDependencies().

ilSCORMResource::$files

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

Referenced by getFiles().

ilSCORMResource::$href

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

Referenced by getHRef().

ilSCORMResource::$import_id

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

Referenced by getImportId().

ilSCORMResource::$resourcetype

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

Referenced by getResourceType().

ilSCORMResource::$scormtype

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

Referenced by getScormType().

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: