ILIAS  Release_4_0_x_branch Revision 61816
 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 21316 2009-08-27 13:03:07Z mjansen

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

Member Function Documentation

ilSCORMResource::_lookupIdByIdRef (   $a_id_ref,
  $a_slm_id 
)

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

References $ilBench, and $ilDB.

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

{
global $ilBench, $ilDB;
$id_set = $ilDB->queryF(
'SELECT ob.obj_id id FROM sc_resource res, scorm_object ob
WHERE ob.obj_id = res.obj_id
AND res.import_id = %s
AND ob.slm_id = %s',
array('text', 'integer'),
array($a_id_ref ,$a_slm_id)
);
if ($id_rec = $ilDB->fetchAssoc($id_set))
{
return $id_rec["id"];
}
return 0;
}

+ Here is the caller graph for this function:

ilSCORMResource::_lookupScormType (   $a_obj_id)

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

References $ilDB.

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

{
global $ilDB;
$st_set = $ilDB->queryF(
'SELECT scormtype FROM sc_resource WHERE obj_id = %s',
array('integer'),
array($a_obj_id)
);
if ($st_rec = $ilDB->fetchAssoc($st_set))
{
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 238 of file class.ilSCORMResource.php.

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

{
global $ilDB;
$ilDB->manipulateF('
INSERT INTO sc_resource
(obj_id, import_id, resourcetype, scormtype, href, xml_base)
VALUES(%s, %s, %s, %s, %s, %s)',
array('integer','text','text','text','text','text'),
array( $this->getId(),
$this->getImportId(),
$this->getResourceType(),
$this->getScormType(),
$this->getHref(),
$this->getXmlBase()
)
);
// save files
for($i=0; $i<count($this->files); $i++)
{
$nextId = $ilDB->nextId('sc_resource_file');
$ilDB->manipulateF('
INSERT INTO sc_resource_file (id,res_id, href, nr)
VALUES(%s, %s, %s, %s)',
array('integer', 'integer', 'text', 'integer'),
array($nextId, $this->getId(), $this->files[$i]->getHref(), ($i + 1))
);
}
// save dependencies
for($i=0; $i<count($this->dependencies); $i++)
{
$nextId = $ilDB->nextId('sc_resource_dependen');
$ilDB->manipulateF('
INSERT INTO sc_resource_dependen (id, res_id, identifierref, nr)
VALUES(%s, %s, %s, %s)',
array('integer', 'integer', 'text', 'integer'),
array($nextId, $this->getId(), $this->files[$i]->getHref(), ($i + 1))
);
}
}

+ Here is the call graph for this function:

ilSCORMResource::delete ( )

Reimplemented from ilSCORMObject.

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

References $ilDB, and ilSCORMObject\getId().

{
global $ilDB;
$ilDB->manipulateF(
'DELETE FROM sc_resource WHERE obj_id = %s',
array('integer'),
array($this->getId())
);
$ilDB->manipulateF(
'DELETE FROM sc_resource_file WHERE res_id = %s',
array('integer'),
array($this->getId())
);
$ilDB->manipulateF(
'DELETE FROM sc_resource_dependen WHERE res_id = %s',
array('integer'),
array($this->getId())
);
}

+ 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 $ilDB, addDependency(), addFile(), ilSCORMObject\getId(), setHRef(), setImportId(), setResourceType(), setScormType(), and setXmlBase().

Referenced by readByIdRef().

{
global $ilDB;
$obj_set = $ilDB->queryF(
'SELECT * FROM sc_resource WHERE obj_id = %s',
array('integer'),
array($this->getId())
);
$obj_rec = $ilDB->fetchAssoc($obj_set);
$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
$file_set = $ilDB->queryF(
'SELECT href FROM sc_resource_file WHERE res_id = %s ORDER BY nr',
array('integer'),
array($this->getId())
);
while ($file_rec =$ilDB->fetchAssoc($file_set))
{
$res_file =& new ilSCORMResourceFile();
$res_file->setHref($file_rec["href"]);
$this->addFile($res_file);
}
// read dependencies
$dep_set = $ilDB->queryF(
'SELECT identifierref FROM sc_resource_dependen WHERE res_id = %s ORDER BY nr',
array('integer'),
array($this->getId())
);
while ($dep_rec =$ilDB->fetchAssoc($dep_set))
{
$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 178 of file class.ilSCORMResource.php.

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

{
global $ilBench, $ilDB;
$ilBench->start("SCORMResource", "readByIdRef_Query");
$id_set = $ilDB->queryF(
'SELECT ob.obj_id id FROM sc_resource res, scorm_object ob
WHERE ob.obj_id = res.obj_id
AND res.import_id = %s
AND ob.slm_id = %s',
array('text', 'integer'),
array($a_id_ref, $a_slm_id)
);
$ilBench->stop("SCORMResource", "readByIdRef_Query");
if ($id_rec = $ilDB->fetchAssoc($id_set))
{
$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 286 of file class.ilSCORMResource.php.

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

{
global $ilDB;
$ilDB->manipulateF('
UPDATE sc_resource
SET import_id = %s,
resourcetype = %s,
scormtype = %s,
href = %s,
xml_base = %s
WHERE obj_id = %s',
array('text', 'text', 'text', 'text', 'text', 'integer'),
array( $this->getImportId(),
$this->getResourceType(),
$this->getScormType(),
$this->getHRef(),
$this->getXmlBase(),
$this->getId())
);
// save files
$ilDB->manipulateF(
'DELETE FROM sc_resource_file WHERE res_id = %s',
array('integer'),
array($this->getId())
);
for($i=0; $i<count($this->files); $i++)
{
$nextId = $ilDB->nextId('sc_resource_file');
$ilDB->manipulateF(
'INSERT INTO sc_resource_file (id, res_id, href, nr)
VALUES (%s, %s, %s, %s)',
array('integer', 'integer', 'text', 'integer'),
array($nextId, $this->getId(), $this->files[$i]->getHref(), ($i + 1))
);
}
// save dependencies
$ilDB->manipulateF(
'DELETE FROM sc_resource_dependen WHERE res_id = %s',
array('integer'),
array($this->getId())
);
for($i = 0; $i < count($this->dependencies); $i++)
{
$nextId = $ilDB->nextId('sc_resource_dependen');
$ilDB->manipulateF('
INSERT INTO sc_resource_dependen (id, res_id, identifierref, nr) VALUES
(%s, %s, %s, %s) ',
array('integer', 'integer', 'text', 'integer'),
array($nextId, $this->getId(), $this->dependencies[$i]->getIdentifierRef(), ($i + 1))
);
}
}

+ 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: