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 () | |
Data Fields | |
| $import_id | |
| $resourcetype | |
| $scormtype | |
| $href | |
| $xml_base | |
| $files | |
| $dependencies | |
SCORM Resource.
Definition at line 36 of file class.ilSCORMResource.php.
| ilSCORMResource::_lookupIdByIdRef | ( | $ | a_id_ref, | |
| $ | a_slm_id | |||
| ) |
Definition at line 192 of file class.ilSCORMResource.php.
References $ilBench.
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.
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;
parent::create();
$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;
parent::delete();
$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.
{
return $this->dependencies;
}
| & ilSCORMResource::getFiles | ( | ) |
Definition at line 118 of file class.ilSCORMResource.php.
{
return $this->files;
}
| ilSCORMResource::getHRef | ( | ) |
Definition at line 92 of file class.ilSCORMResource.php.
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.
Referenced by create(), and update().
{
return $this->import_id;
}
Here is the caller graph for this function:| ilSCORMResource::getResourceType | ( | ) |
Definition at line 72 of file class.ilSCORMResource.php.
Referenced by create(), and update().
{
return $this->resourcetype;
}
Here is the caller graph for this function:| ilSCORMResource::getScormType | ( | ) |
Definition at line 82 of file class.ilSCORMResource.php.
Referenced by create(), and update().
{
return $this->scormtype;
}
Here is the caller graph for this function:| ilSCORMResource::getXmlBase | ( | ) |
Definition at line 103 of file class.ilSCORMResource.php.
Referenced by create(), and update().
{
return $this->xml_base;
}
Here is the caller graph for this function:| ilSCORMResource::ilSCORMResource | ( | $ | a_id = 0 |
) |
Constructor.
| int | $a_id Object 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");
parent::ilSCORMObject($a_id);
}
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(), ilSCORMObject::getId(), setHRef(), setImportId(), setResourceType(), setScormType(), and setXmlBase().
Referenced by readByIdRef().
{
global $ilDB;
parent::read();
$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, 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;
parent::update();
$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:| ilSCORMResource::$dependencies |
Definition at line 44 of file class.ilSCORMResource.php.
| ilSCORMResource::$files |
Definition at line 43 of file class.ilSCORMResource.php.
| ilSCORMResource::$href |
Definition at line 41 of file class.ilSCORMResource.php.
| ilSCORMResource::$import_id |
Definition at line 38 of file class.ilSCORMResource.php.
| ilSCORMResource::$resourcetype |
Definition at line 39 of file class.ilSCORMResource.php.
| ilSCORMResource::$scormtype |
Definition at line 40 of file class.ilSCORMResource.php.
| ilSCORMResource::$xml_base |
Definition at line 42 of file class.ilSCORMResource.php.
1.7.1