Inheritance diagram for ilObjSCORMLearningModule:
Collaboration diagram for ilObjSCORMLearningModule:Public Member Functions | |
| ilObjSCORMLearningModule ($a_id=0, $a_call_by_reference=true) | |
| Constructor public. | |
| validate ($directory) | |
| Validate all XML-Files in a SCOM-Directory. | |
| getValidationSummary () | |
| getTrackingItems () | |
| get all tracking items of scorm object | |
| readObject () | |
| read manifest file public | |
| getTrackedItems () | |
| get all tracked items of current user | |
| getTrackingDataPerUser ($a_sco_id, $a_user_id) | |
| getTrackingDataAgg ($a_sco_id) | |
Data Fields | |
| $validator | |
Definition at line 39 of file class.ilObjSCORMLearningModule.php.
| ilObjSCORMLearningModule::getTrackedItems | ( | ) |
get all tracked items of current user
Reimplemented in ilObjAICCLearningModule.
Definition at line 225 of file class.ilObjSCORMLearningModule.php.
References $ilUser, $query, and ilObject::getRefId().
{
global $ilUser, $ilDB, $ilUser;
$query = "SELECT DISTINCT sco_id FROM scorm_tracking WHERE".
" ref_id = ".$ilDB->quote($this->getRefId());
$sco_set = $ilDB->query($query);
$items = array();
while($sco_rec = $sco_set->fetchRow(DB_FETCHMODE_ASSOC))
{
include_once("content/classes/SCORM/class.ilSCORMItem.php");
$sc_item =& new ilSCORMItem($sco_rec["sco_id"]);
if ($sc_item->getIdentifierRef() != "")
{
$items[count($items)] =& $sc_item;
}
}
return $items;
}
Here is the call graph for this function:| ilObjSCORMLearningModule::getTrackingDataAgg | ( | $ | a_sco_id | ) |
Definition at line 268 of file class.ilObjSCORMLearningModule.php.
References $data, $query, $status, $user_set, and ilObject::getRefId().
{
global $ilDB;
// get all users with any tracking data
$query = "SELECT DISTINCT user_id FROM scorm_tracking WHERE".
" ref_id = ".$ilDB->quote($this->getRefId()).
" AND sco_id = ".$ilDB->quote($a_sco_id);
//" ORDER BY user_id, lvalue";
$user_set = $ilDB->query($query);
$data = array();
while($user_rec = $user_set->fetchRow(DB_FETCHMODE_ASSOC))
{
$query = "SELECT * FROM scorm_tracking WHERE".
" ref_id = ".$ilDB->quote($this->getRefId()).
" AND sco_id = ".$ilDB->quote($a_sco_id).
" AND user_id =".$ilDB->quote($user_rec["user_id"]).
" AND (lvalue =".$ilDB->quote("cmi.core.lesson_status").
" OR lvalue =".$ilDB->quote("cmi.core.total_time").
" OR lvalue =".$ilDB->quote("cmi.core.score.raw").")";
$data_set = $ilDB->query($query);
$score = $time = $status = "";
while($data_rec = $data_set->fetchRow(DB_FETCHMODE_ASSOC))
{
switch($data_rec["lvalue"])
{
case "cmi.core.lesson_status":
$status = $data_rec["rvalue"];
break;
case "cmi.core.total_time":
$time = $data_rec["rvalue"];
break;
case "cmi.core.score.raw":
$score = $data_rec["rvalue"];
break;
}
}
$data[] = array("user_id" => $user_rec["user_id"],
"score" => $score, "time" => $time, "status" => $status);
}
return $data;
}
Here is the call graph for this function:| ilObjSCORMLearningModule::getTrackingDataPerUser | ( | $ | a_sco_id, | |
| $ | a_user_id | |||
| ) |
Definition at line 248 of file class.ilObjSCORMLearningModule.php.
References $data, $query, and ilObject::getRefId().
{
global $ilDB;
$query = "SELECT * FROM scorm_tracking WHERE".
" ref_id = ".$ilDB->quote($this->getRefId()).
" AND sco_id = ".$ilDB->quote($a_sco_id).
" AND user_id = ".$ilDB->quote($a_user_id).
" ORDER BY lvalue";
$data_set = $ilDB->query($query);
$data = array();
while($data_rec = $data_set->fetchRow(DB_FETCHMODE_ASSOC))
{
$data[] = $data_rec;
}
return $data;
}
Here is the call graph for this function:| ilObjSCORMLearningModule::getTrackingItems | ( | ) |
get all tracking items of scorm object
Reimplemented in ilObjAICCLearningModule.
Definition at line 90 of file class.ilObjSCORMLearningModule.php.
References $tree, and ilObject::getId().
{
include_once("content/classes/SCORM/class.ilSCORMTree.php");
$tree = new ilSCORMTree($this->getId());
$root_id = $tree->readRootId();
$items = array();
$childs = $tree->getSubTree($tree->getNodeData($root_id));
foreach($childs as $child)
{
if($child["type"] == "sit")
{
include_once("content/classes/SCORM/class.ilSCORMItem.php");
$sc_item =& new ilSCORMItem($child["obj_id"]);
if ($sc_item->getIdentifierRef() != "")
{
$items[count($items)] =& $sc_item;
}
}
}
return $items;
}
Here is the call graph for this function:| ilObjSCORMLearningModule::getValidationSummary | ( | ) |
Definition at line 78 of file class.ilObjSCORMLearningModule.php.
Referenced by readObject().
{
if(is_object($this->validator))
{
return $this->validator->getSummary();
}
return "";
}
Here is the caller graph for this function:| ilObjSCORMLearningModule::ilObjSCORMLearningModule | ( | $ | a_id = 0, |
|
| $ | a_call_by_reference = true | |||
| ) |
Constructor public.
| integer | reference_id or object_id | |
| boolean | treat the id as reference_id (true) or object_id (false) |
Definition at line 50 of file class.ilObjSCORMLearningModule.php.
References ilObject::ilObject().
{
$this->type = "sahs";
parent::ilObject($a_id,$a_call_by_reference);
/*
if ($a_id == 0)
{
$new_meta =& new ilMetaData();
$this->assignMetaData($new_meta);
}
*/
}
Here is the call graph for this function:| ilObjSCORMLearningModule::readObject | ( | ) |
read manifest file public
Reimplemented in ilObjAICCLearningModule.
Definition at line 118 of file class.ilObjSCORMLearningModule.php.
References $_POST, ilObjSAHSLearningModule::getDataDirectory(), getValidationSummary(), seems_not_utf8(), and validate().
{
// the seems_utf8($str) function
include_once("include/inc.utf8checker.php");
$needs_convert = false;
// convert imsmanifest.xml file in iso to utf8 if needed
// include_once("include/inc.convertcharset.php");
$manifest_file = $this->getDataDirectory()."/imsmanifest.xml";
// check if manifestfile exists and space left on device...
$check_for_manifest_file = is_file($manifest_file);
// if no manifestfile
if (!$check_for_manifest_file)
{
$this->ilias->raiseError($this->lng->txt("Manifestfile $manifest_file not found!"), $this->ilias->error_obj->MESSAGE);
return;
}
if ($check_for_manifest_file)
{
$manifest_file_array = file($manifest_file);
foreach($manifest_file_array as $mfa)
{
if (!seems_not_utf8($mfa))
{
$needs_convert = true;
break;
}
}
// to copy the file we need some extraspace, counted in bytes *2 ... we need 2 copies....
$estimated_manifest_filesize = filesize($manifest_file) * 2;
$check_disc_free = disk_free_space($this->getDataDirectory()) - $estimated_manifest_filesize;
}
// if $manifest_file needs to be converted to UTF8
if ($needs_convert)
{
// if file exists and enough space left on device
if ($check_for_manifest_file && ($check_disc_free > 1))
{
// create backup from original
if (!copy($manifest_file, $manifest_file.".old"))
{
echo "Failed to copy $manifest_file...<br>\n";
}
// read backupfile, convert each line to utf8, write line to new file
// php < 4.3 style
$f_write_handler = fopen($manifest_file.".new", "w");
$f_read_handler = fopen($manifest_file.".old", "r");
while (!feof($f_read_handler))
{
$zeile = fgets($f_read_handler);
//echo mb_detect_encoding($zeile);
fputs($f_write_handler, utf8_encode($zeile));
}
fclose($f_read_handler);
fclose($f_write_handler);
// copy new utf8-file to imsmanifest.xml
if (!copy($manifest_file.".new", $manifest_file))
{
echo "Failed to copy $manifest_file...<br>\n";
}
if (!@is_file($manifest_file))
{
$this->ilias->raiseError($this->lng->txt("cont_no_manifest"),
$this->ilias->error_obj->WARNING);
}
}
else
{
// gives out the specific error
if (!($check_disc_free > 1))
$this->ilias->raiseError($this->lng->txt("Not enough space left on device!"),$this->ilias->error_obj->MESSAGE);
return;
}
}
//validate the XML-Files in the SCORM-Package
if ($_POST["validate"] == "y")
{
if (!$this->validate($this->getDataDirectory()))
{
$this->ilias->raiseError("<b>Validation Error(s):</b><br>".$this->getValidationSummary(),
$this->ilias->error_obj->WARNING);
}
}
// start SCORM package parser
include_once ("content/classes/SCORM/class.ilSCORMPackageParser.php");
// todo determine imsmanifest.xml path here...
$slmParser = new ilSCORMPackageParser($this, $manifest_file);
$slmParser->startParsing();
}
Here is the call graph for this function:| ilObjSCORMLearningModule::validate | ( | $ | directory | ) |
Validate all XML-Files in a SCOM-Directory.
public
Definition at line 71 of file class.ilObjSCORMLearningModule.php.
Referenced by readObject().
{
$this->validator =& new ilObjSCORMValidator($directory);
$returnValue = $this->validator->validate();
return $returnValue;
}
Here is the caller graph for this function:| ilObjSCORMLearningModule::$validator |
Reimplemented from ilObjSAHSLearningModule.
Definition at line 41 of file class.ilObjSCORMLearningModule.php.
1.7.1