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

Class ilObjSCORMLearningModule. More...

+ 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 ()
 _getTrackingItems ($a_obj_id)
 get all tracking items of scorm object static
 readObject ()
 read manifest file public
 getTrackedItems ()
 get all tracked items of current user
 getTrackedUsers ($a_search)
 getAttemptsForUser ($a_user_id)
 get number of atttempts for a certain user and package
 getModuleVersionForUser ($a_user_id)
 get module version that tracking data for a user was recorded on
 getTrackingDataPerUser ($a_sco_id, $a_user_id)
 getTrackingDataAgg ($a_user_id)
 getTrackingDataAggSco ($a_sco_id)
 exportSelectedRaw ($a_exportall=0, $a_user)
 exportSelected ($a_exportall=0, $a_user)
 importTrackingData ($a_file)
 importSuccess ($a_file)
 get_user_id ($a_login)
 getUserIdEmail ($a_mail)
 assumes that only one account exists for a mailadress
 sendExportFile ($a_header, $a_content)
 send export file to browser
- Public Member Functions inherited from ilObjSAHSLearningModule
 ilObjSAHSLearningModule ($a_id=0, $a_call_by_reference=true)
 Constructor public.
 create ()
 create file based lm
 read ()
 read object
 _lookupOnline ($a_id)
 check wether scorm module is online
 _lookupSubType ($a_obj_id)
 lookup subtype id (scorm, aicc, hacp)
 createDataDirectory ()
 get title of content object
 getDataDirectory ($mode="filesystem")
 get data directory of lm
 getAPIAdapterName ()
 get api adapter name
 setAPIAdapterName ($a_api)
 set api adapter name
 getAPIFunctionsPrefix ()
 get api functions prefix
 setAPIFunctionsPrefix ($a_prefix)
 set api functions prefix
 getCreditMode ()
 get credit mode
 setCreditMode ($a_credit_mode)
 set credit mode
 setDefaultLessonMode ($a_lesson_mode)
 set default lesson mode
 getDefaultLessonMode ()
 get default lesson mode
 setAutoReview ($a_auto_review)
 get auto review
 getAutoReview ()
 set auto review
 getMaxAttempt ()
 get max attempt
 setMaxAttempt ($a_max_attempt)
 set max attempt
 getModuleVersion ()
 get max attempt
 setModuleVersion ($a_module_version)
 set max attempt
 update ()
 update meta data only
 setOnline ($a_online)
 get online
 getOnline ()
 set online
 setSubType ($a_sub_type)
 get sub type
 getSubType ()
 set sub type
 delete ()
 delete SCORM learning module and all related data
 notify ($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
 notifys an object about an event occured Based on the event happend, each object may decide how it reacts.
- Public Member Functions inherited from ilObject
 ilObject ($a_id=0, $a_reference=true)
 Constructor public.
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not)
 read ($a_force_db=false)
 read object data from db into object
 getId ()
 get object id public
 setId ($a_id)
 set object id public
 setRefId ($a_id)
 set reference id public
 getRefId ()
 get reference id public
 getType ()
 get object type public
 setType ($a_type)
 set object type public
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions
 getTitle ()
 get object title public
 getUntranslatedTitle ()
 get untranslated object title public
 setTitle ($a_title)
 set object title
 getDescription ()
 get object description
 setDescription ($a_desc)
 set object description
 getLongDescription ()
 get object long description (stored in object_description)
 getImportId ()
 get import id
 setImportId ($a_import_id)
 set import id
 _lookupObjIdByImportId ($a_import_id)
 getOwner ()
 get object owner
 getOwnerName ()
 _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id
 setOwner ($a_owner)
 set object owner
 getCreateDate ()
 get create date public
 getLastUpdateDate ()
 get last update date public
 setObjDataRecord ($a_record)
 set object_data record (note: this method should only be called from the ilObjectFactory class)
 MDUpdateListener ($a_element)
 Meta data update listener.
 createMetaData ()
 create meta data entry
 updateMetaData ()
 update meta data entry
 deleteMetaData ()
 delete meta data entry
 updateOwner ()
 update owner of object in db
 _getIdForImportId ($a_import_id)
 get current object id for import id (static)
 _getAllReferences ($a_id)
 get all reference ids of object
 _lookupTitle ($a_id)
 lookup object title
 _lookupDescription ($a_id)
 lookup object description
 _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update
 _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects.
 _lookupObjId ($a_id)
 _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree
 _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes
 _writeTitle ($a_obj_id, $a_title)
 write title to db (static)
 _writeDescription ($a_obj_id, $a_desc)
 write description to db (static)
 _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static)
 _lookupType ($a_id, $a_reference=false)
 lookup object type
 _isInTrash ($a_ref_id)
 checks wether object is in trash
 _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash
 _lookupObjectId ($a_ref_id)
 lookup object id
 _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!?
 setPermissions ($a_parent_ref)
 set permissions of object
 createReference ()
 creates reference for object
 countReferences ()
 count references of object
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type If you want to setup default local roles you MUST overwrite this method in derived object classes (see ilObjForum for an example) public
 createRoleFolder ()
 creates a local role folder
 setRegisterMode ($a_bool)
 isUserRegistered ($a_user_id=0)
 requireRegistration ()
 getXMLZip ()
 getHTMLDirectory ()
 cloneObject ($a_target_id, $a_copy_id=0)
 Clone object permissions, put in tree ...
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container.
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies.
 cloneMetaData ($target_obj)
 Copy meta data.

Data Fields

 $validator
- Data Fields inherited from ilObjSAHSLearningModule
 $validator
- Data Fields inherited from ilObject
 $ilias
 $lng
 $id
 $ref_id
 $type
 $title
 $untranslatedTitle
 $desc
 $long_desc
 $owner
 $create_date
 $last_update
 $import_id
 $register = false
 $referenced
 $objectList
 $max_title
 $max_desc
 $add_dots
 $obj_data_record
 object_data record

Private Member Functions

 importRaw ($a_file)
 lookupSCOId ($a_referrer)
 resolves manifest SCOID to internal ILIAS SCO ID

Additional Inherited Members

- Static Public Member Functions inherited from ilObject
static _getIdsForTitle ($title, $type= '')
 _exists ($a_id, $a_reference=false)
 checks if an object exists in object_data
static _getObjectsByType ($a_obj_type="")
 Get objects by type.
static _prepareCloneSelection ($a_ref_ids, $new_type)
 Prepare copy wizard object selection.
static _getIcon ($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)

Detailed Description

Class ilObjSCORMLearningModule.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Id:
class.ilObjSCORMLearningModule.php 18021 2008-11-20 22:53:25Z hholtmann

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

Member Function Documentation

ilObjSCORMLearningModule::_getTrackingItems (   $a_obj_id)

get all tracking items of scorm object static

Reimplemented in ilObjSCORM2004LearningModule, and ilObjAICCLearningModule.

Definition at line 88 of file class.ilObjSCORMLearningModule.php.

Referenced by ilLPCollections\_getPossibleSAHSItems(), and getTrackingItems().

{
include_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMTree.php");
$tree = new ilSCORMTree($a_obj_id);
$root_id = $tree->readRootId();
$items = array();
$childs = $tree->getSubTree($tree->getNodeData($root_id));
foreach($childs as $child)
{
if($child["type"] == "sit")
{
include_once("./Modules/ScormAicc/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 caller graph for this function:

ilObjSCORMLearningModule::exportSelected (   $a_exportall = 0,
  $a_user 
)

Reimplemented in ilObjSCORM2004LearningModule.

Definition at line 537 of file class.ilObjSCORMLearningModule.php.

References $user, ilObject\_exists(), DB_FETCHMODE_ASSOC, and sendExportFile().

{
global $ilDB, $ilUser;
$scos = array();
//get all SCO's of this object
$query = "SELECT *,scorm_object.obj_id AS scoid FROM scorm_object,sc_item,sc_resource ".
"WHERE(scorm_object.slm_id=".$ilDB->quote($this->getID())." AND scorm_object.obj_id=sc_item.obj_id ".
"AND sc_item.identifierref=sc_resource.import_id AND sc_resource.scormtype='sco') ".
"GROUP BY scorm_object.obj_id";
$val_set = $ilDB->query($query);
while ($val_rec = $val_set->fetchRow(DB_FETCHMODE_ASSOC)) {
array_push($scos,$val_rec['scoid']);
}
$csv = null;
//a module is completed when all SCO's are completed
$user_array = array();
if ($a_exportall == 1) {
$query3 = "SELECT * FROM scorm_tracking WHERE (obj_id=".$ilDB->quote($this->getID()).") GROUP BY user_id";
$val_set3 = $ilDB->query($query3);
while ($val_rec3 = $val_set3->fetchRow(DB_FETCHMODE_ASSOC)) {
array_push($user_array,$val_rec3['user_id']);
}
} else {
$user_array = $a_user;
}
foreach ($user_array as $user)
{
$scos_c = $scos;
//copy SCO_array
//check if all SCO's are completed
for ($i=0;$i<count($scos);$i++){
$query = "SELECT * FROM scorm_tracking WHERE (user_id=".$ilDB->quote($user)." AND obj_id=".$ilDB->quote($this->getID()).
" AND sco_id=".$ilDB->quote($scos[$i]).
" AND ((lvalue='cmi.core.lesson_status' AND rvalue='completed') OR (lvalue='cmi.core.lesson_status' AND rvalue='passed') ) )";
$val_set = $ilDB->query($query);
if ($val_set->numRows()>0) {
//delete from array
$key = array_search($scos[$i], $scos_c);
unset ($scos_c[$key]);
}
}
//check for completion
if (count($scos_c) == 0) {
$completion = 1;
} else {
$completion = 0;
}
if (ilObject::_exists($user) && ilObject::_lookUpType($user)=="usr" ) {
//write export entry
$e_user = new ilObjUser($user);
$login = $e_user->getLogin();
$firstname = $e_user->getFirstname();
$lastname = $e_user->getLastname();
$email = $e_user->getEmail();
$department = $e_user->getDepartment();
//get the date for csv export
$query2 = "SELECT MAX(DATE_FORMAT(timestamp,\"%d.%m.%y\")) AS date FROM scorm_tracking WHERE (user_id=".$ilDB->quote($user).
" AND obj_id=".$ilDB->quote($this->getID()).")";
$val_set2 = $ilDB->query($query2);
$val_rec2 = $val_set2->fetchRow(DB_FETCHMODE_ASSOC);
if ($val_set2->numRows()>0) {
$date = $val_rec2['date'];
} else {
$date = "";
}
$csv = $csv. "$department;$login;$lastname;$firstname;$email;$date;$completion\n";
}
}
$header = "Department;Login;Lastname;Firstname;Email;Date;Status\n";
$this->sendExportFile($header,$csv);
}

+ Here is the call graph for this function:

ilObjSCORMLearningModule::exportSelectedRaw (   $a_exportall = 0,
  $a_user 
)

Definition at line 477 of file class.ilObjSCORMLearningModule.php.

References $timestamp, $user, ilObject\_exists(), DB_FETCHMODE_ASSOC, and sendExportFile().

{
global $ilDB, $ilUser;
$csv=null;
$user_array = array();
if (!isset($_POST["user"]) && $a_exportall==0 )
{
$this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
}
if ($a_exportall == 1) {
$query3 = "SELECT * FROM scorm_tracking WHERE (obj_id=".$ilDB->quote($this->getID()).") GROUP BY user_id";
$val_set3 = $ilDB->query($query3);
while ($val_rec3 = $val_set3->fetchRow(DB_FETCHMODE_ASSOC)) {
array_push($user_array,$val_rec3['user_id']);
}
} else {
$user_array = $a_user;
}
//loop through users and get all data
foreach ($user_array as $user)
{
//get user e-mail
if (ilObject::_exists($user) && ilObject::_lookUpType($user)=="usr" ) {
$e_user = new ilObjUser($user);
$email = $e_user->getEmail();
//get sco related information
$query = "SELECT rvalue,lvalue,identifierref,timestamp FROM scorm_tracking INNER JOIN sc_item ON sc_item.obj_id=scorm_tracking.sco_id ".
"WHERE (scorm_tracking.sco_id<>0 AND user_id=".$ilDB->quote($user)." AND scorm_tracking.obj_id=".$ilDB->quote($this->getID()).")";
$val_set = $ilDB->query($query);
while ($val_rec = $val_set->fetchRow(DB_FETCHMODE_ASSOC)) {
//get mail address for user-id
$sco_id = $val_rec["identifierref"];
$key = $val_rec["lvalue"];
$value = $val_rec["rvalue"];
$timestamp = $val_rec["timestamp"];
$csv = $csv. "$sco_id;$key;$value;$email;$timestamp;$user\n";
}
//get sco unrelated information
$query = "SELECT rvalue,lvalue,timestamp FROM scorm_tracking ".
"WHERE (sco_id=0 AND user_id=".$ilDB->quote($user)." AND obj_id=".$ilDB->quote($this->getID()).")";
$val_set = $ilDB->query($query);
while ($val_rec = $val_set->fetchRow(DB_FETCHMODE_ASSOC)) {
$key = $val_rec["lvalue"];
$value = $val_rec["rvalue"];
$timestamp = $val_rec["timestamp"];
$csv = $csv. "0;$key;$value;$email;$timestamp;$user\n";
}
}
}
$header = "Scoid;Key;Value;Email;Timestamp;Userid\n";
$this->sendExportFile($header,$csv);
}

+ Here is the call graph for this function:

ilObjSCORMLearningModule::get_user_id (   $a_login)

Definition at line 739 of file class.ilObjSCORMLearningModule.php.

References DB_FETCHMODE_ASSOC.

Referenced by ilObjSCORM2004LearningModule\importSuccess(), and importSuccess().

{
global $ilDB, $ilUser;
$a_login = $ilDB->quote($a_login);
$query = "SELECT * FROM usr_data WHERE(login=$a_login)";
$val_set = $ilDB->query($query);
$val_rec = $val_set->fetchRow(DB_FETCHMODE_ASSOC);
if (count($val_rec)>0) {
return $val_rec['usr_id'];
} else {
return null;
}
}

+ Here is the caller graph for this function:

ilObjSCORMLearningModule::getAttemptsForUser (   $a_user_id)

get number of atttempts for a certain user and package

Reimplemented in ilObjSCORM2004LearningModule.

Definition at line 317 of file class.ilObjSCORMLearningModule.php.

References DB_FETCHMODE_ASSOC, and ilObject\getId().

Referenced by getTrackedUsers().

{
global $ilDB;
$query = "SELECT * FROM scorm_tracking WHERE".
" user_id = ".$ilDB->quote($a_user_id).
" AND sco_id = 0".
" AND lvalue='package_attempts'".
" AND obj_id = ".$ilDB->quote($this->getId());
$val_set = $ilDB->query($query);
$val_rec = $val_set->fetchRow(DB_FETCHMODE_ASSOC);
$val_rec["rvalue"] = str_replace("\r\n", "\n", $val_rec["rvalue"]);
if ($val_rec["rvalue"] == null) {
$val_rec["rvalue"]="";
}
return $val_rec["rvalue"];
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSCORMLearningModule::getModuleVersionForUser (   $a_user_id)

get module version that tracking data for a user was recorded on

Reimplemented in ilObjSCORM2004LearningModule.

Definition at line 339 of file class.ilObjSCORMLearningModule.php.

References DB_FETCHMODE_ASSOC, and ilObject\getId().

Referenced by getTrackedUsers().

{
global $ilDB;
$query = "SELECT * FROM scorm_tracking WHERE".
" user_id = ".$ilDB->quote($a_user_id).
" AND sco_id = 0".
" AND lvalue='module_version'".
" AND obj_id = ".$ilDB->quote($this->getId());
$val_set = $ilDB->query($query);
$val_rec = $val_set->fetchRow(DB_FETCHMODE_ASSOC);
$val_rec["rvalue"] = str_replace("\r\n", "\n", $val_rec["rvalue"]);
if ($val_rec["rvalue"] == null) {
$val_rec["rvalue"]="";
}
return $val_rec["rvalue"];
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSCORMLearningModule::getTrackedItems ( )

get all tracked items of current user

Reimplemented in ilObjSCORM2004LearningModule, and ilObjAICCLearningModule.

Definition at line 254 of file class.ilObjSCORMLearningModule.php.

References DB_FETCHMODE_ASSOC, and ilObject\getId().

{
global $ilDB, $ilUser;
$query = "SELECT DISTINCT sco_id FROM scorm_tracking WHERE".
" obj_id = ".$ilDB->quote($this->getId());
$sco_set = $ilDB->query($query);
$items = array();
while($sco_rec = $sco_set->fetchRow(DB_FETCHMODE_ASSOC))
{
include_once("./Modules/ScormAicc/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::getTrackedUsers (   $a_search)

Reimplemented in ilObjSCORM2004LearningModule.

Definition at line 278 of file class.ilObjSCORMLearningModule.php.

References $user, ilObject\_exists(), DB_FETCHMODE_ASSOC, ilDatePresentation\formatDate(), getAttemptsForUser(), ilObject\getId(), getModuleVersionForUser(), and IL_CAL_UNIX.

{
global $ilUser, $ilDB, $ilUser;
$query = "SELECT user_id,UNIX_TIMESTAMP(TIMESTAMP) AS last_access FROM scorm_tracking WHERE".
" obj_id = ".$ilDB->quote($this->getId())."GROUP BY user_id";
$sco_set = $ilDB->query($query);
$items = array();
while($sco_rec = $sco_set->fetchRow(DB_FETCHMODE_ASSOC))
{
if ($sco_rec['last_access'] != 0) {
$sco_rec['last_access'] = ilDatePresentation::formatDate(new ilDateTime($sco_rec['last_access'],IL_CAL_UNIX));
} else {
$sco_rec['last_access'] = "";
}
if (ilObject::_exists($sco_rec['user_id']) && ilObject::_lookUpType($sco_rec["user_id"])=="usr" ) {
$user = new ilObjUser($sco_rec['user_id']);
//$sco_rec['status'] = $this->getStatusForUser($sco_rec["user_id"]);
$sco_rec['version'] = $this->getModuleVersionForUser($sco_rec["user_id"]);
$sco_rec['attempts'] = $this->getAttemptsForUser($sco_rec["user_id"]);
$sco_rec['username'] = $user->getLastname().", ".$user->getFirstname();
if ($a_search != "" && (strpos(strtolower($user->getLastname()), strtolower($a_search)) !== false || strpos(strtolower($user->getFirstname()), strtolower($a_search)) !== false ) ) {
$items[] = $sco_rec;
} else if ($a_search == "") {
$items[] = $sco_rec;
}
}
}
return $items;
}

+ Here is the call graph for this function:

ilObjSCORMLearningModule::getTrackingDataAgg (   $a_user_id)

Reimplemented in ilObjSCORM2004LearningModule.

Definition at line 377 of file class.ilObjSCORMLearningModule.php.

References $data, DB_FETCHMODE_ASSOC, and ilObject\getId().

{
global $ilDB;
// get all users with any tracking data
$query = "SELECT DISTINCT sco_id FROM scorm_tracking WHERE".
" obj_id = ".$ilDB->quote($this->getId()).
" AND user_id = ".$ilDB->quote($a_user_id).
" AND sco_id <> ".$ilDB->quote('0');
//" ORDER BY user_id, lvalue";
$sco_set = $ilDB->query($query);
$data = array();
while($sco_rec = $sco_set->fetchRow(DB_FETCHMODE_ASSOC))
{
$query = "SELECT * FROM scorm_tracking WHERE".
" obj_id = ".$ilDB->quote($this->getId()).
" AND sco_id = ".$ilDB->quote($sco_rec["sco_id"]).
" AND user_id =".$ilDB->quote($a_user_id).
" AND lvalue <>".$ilDB->quote("package_attempts").
" 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;
}
}
//create sco_object
$sc_item =& new ilSCORMItem($sco_rec["sco_id"]);
$data[] = array("sco_id"=>$sco_rec["sco_id"], "title" => $sc_item->getTitle(),
"score" => $score, "time" => $time, "status" => $status);
}
return $data;
}

+ Here is the call graph for this function:

ilObjSCORMLearningModule::getTrackingDataAggSco (   $a_sco_id)

Definition at line 429 of file class.ilObjSCORMLearningModule.php.

References $data, DB_FETCHMODE_ASSOC, and ilObject\getId().

{
global $ilDB;
// get all users with any tracking data
$query = "SELECT DISTINCT user_id FROM scorm_tracking WHERE".
" obj_id = ".$ilDB->quote($this->getId()).
" 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".
" obj_id = ".$ilDB->quote($this->getId()).
" 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 357 of file class.ilObjSCORMLearningModule.php.

References $data, DB_FETCHMODE_ASSOC, and ilObject\getId().

{
global $ilDB;
$query = "SELECT * FROM scorm_tracking WHERE".
" obj_id = ".$ilDB->quote($this->getId()).
" 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 ( )

Reimplemented in ilObjAICCLearningModule.

Definition at line 78 of file class.ilObjSCORMLearningModule.php.

References _getTrackingItems(), and ilObject\getId().

+ Here is the call graph for this function:

ilObjSCORMLearningModule::getUserIdEmail (   $a_mail)

assumes that only one account exists for a mailadress

Definition at line 774 of file class.ilObjSCORMLearningModule.php.

References DB_FETCHMODE_ASSOC.

Referenced by importRaw().

{
global $ilDB, $ilUser;
$query = "SELECT usr_id FROM usr_data WHERE (email=".$ilDB->quote($a_mail).")";
$val_set = $ilDB->query($query);
$val_rec = $val_set->fetchRow(DB_FETCHMODE_ASSOC);
return $val_rec["usr_id"];
}

+ Here is the caller graph for this function:

ilObjSCORMLearningModule::getValidationSummary ( )

Definition at line 69 of file class.ilObjSCORMLearningModule.php.

Referenced by ilObjSCORM2004LearningModule\readObject(), and 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.

Parameters
integerreference_id or object_id
booleantreat the id as reference_id (true) or object_id (false)

Definition at line 49 of file class.ilObjSCORMLearningModule.php.

References ilObject\ilObject().

{
$this->type = "sahs";
parent::ilObject($a_id,$a_call_by_reference);
}

+ Here is the call graph for this function:

ilObjSCORMLearningModule::importRaw (   $a_file)
private

Definition at line 704 of file class.ilObjSCORMLearningModule.php.

References $data, getUserIdEmail(), and lookupSCOId().

Referenced by importTrackingData().

{
global $ilDB, $ilUser;
$fhandle = fopen($a_file, "r");
$fields = fgetcsv($fhandle, 4096, ';');
while(($csv_rows = fgetcsv($fhandle, 4096, ";")) !== FALSE) {
$data = array_combine($fields, $csv_rows);
$il_sco_id = $this->lookupSCOId($data['Scoid']);
//look for required data for an import
$user_id = $data['Userid'];
if ($user_id == "" || $user_id == null) {
//look for Email
$user_id = $this->getUserIdEmail($data['Email']);
}
//do the actual import
if ($user_id != "" && $il_sco_id>=0){
$query = "REPLACE INTO scorm_tracking (rvalue,user_id,sco_id,obj_id,timestamp,lvalue) values(".
$ilDB->quote($data['Value']).",".
$user_id.",".
$il_sco_id.",".
$ilDB->quote($this->getID()).",".
$ilDB->quote($data['Timestamp']).",".
$ilDB->quote($data['Key']).")";
$val_set = $ilDB->query($query);
}
}
fclose($fhandle);
return 0;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSCORMLearningModule::importSuccess (   $a_file)

Reimplemented in ilObjSCORM2004LearningModule.

Definition at line 648 of file class.ilObjSCORMLearningModule.php.

References $data, DB_FETCHMODE_ASSOC, and get_user_id().

Referenced by importTrackingData().

{
global $ilDB, $ilUser;
$scos = array();
//get all SCO's of this object
$query = "SELECT *,scorm_object.obj_id AS scoid FROM scorm_object,sc_item,sc_resource ".
"WHERE(scorm_object.slm_id=".$ilDB->quote($this->getID())."AND scorm_object.obj_id=sc_item.obj_id ".
"AND sc_item.identifierref=sc_resource.import_id AND sc_resource.scormtype='sco') ".
"GROUP BY scorm_object.obj_id";
$val_set = $ilDB->query($query);
if (count($val_set)<1) {
return -1;
}
while($rows_sco = $val_set->fetchRow(DB_FETCHMODE_ASSOC)){
array_push($scos,$rows_sco['scoid']);
}
$fhandle = fopen($a_file, "r");
$obj_id = $ilDB->quote($this->getID());
$fields = fgetcsv($fhandle, 4096, ';');
while(($csv_rows = fgetcsv($fhandle, 4096, ";")) !== FALSE) {
$data = array_combine($fields, $csv_rows);
//check the format
$statuscheck = 0;
if (count($csv_rows) == 6) {$statuscheck = 1;}
if ($this->get_user_id($data["Login"])>0) {
$user_id = $ilDB->quote($this->get_user_id($data["Login"]));
$import = $data["Status"];
if ($import == "") {$import = 1;}
//iterate over all SCO's
if ($import == 1) {
foreach ($scos as $sco) {
$sco_id = $ilDB->quote($sco);
$date = $data['Date'];
$query = "REPLACE INTO scorm_tracking (obj_id,user_id,sco_id,lvalue,rvalue,timestamp)".
"values ($obj_id,$user_id,$sco,'cmi.core.lesson_status','completed',str_to_date(\"$date\", \"%d.%m.%Y\"))";
$val_set = $ilDB->query($query);
$query = "REPLACE INTO scorm_tracking (obj_id,user_id,sco_id,lvalue,rvalue,timestamp)".
"values ($obj_id,$user_id,$sco,'cmi.core.entry','',str_to_date(\"$date\",\"%d.%m.%Y\"))";
$val_set = $ilDB->query($query);
}
}
} else {
//echo "Warning! User $csv_rows[0] does not exist in ILIAS. Data for this user was skipped.\n";
}
}
return 0;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSCORMLearningModule::importTrackingData (   $a_file)

Definition at line 617 of file class.ilObjSCORMLearningModule.php.

References importRaw(), and importSuccess().

{
global $ilDB, $ilUser;
$error = 0;
//echo file_get_contents($a_file);
$method = null;
//lets import
$fhandle = fopen($a_file, "r");
//the top line is the field names
$fields = fgetcsv($fhandle, 4096, ';');
//lets check the import method
fclose($fhandle);
switch($fields[0])
{
case "Scoid":
$error = $this->importRaw($a_file);
break;
case "Department":
$error = $this->importSuccess($a_file);
break;
default:
return -1;
break;
}
return $error;
}

+ Here is the call graph for this function:

ilObjSCORMLearningModule::lookupSCOId (   $a_referrer)
private

resolves manifest SCOID to internal ILIAS SCO ID

Definition at line 757 of file class.ilObjSCORMLearningModule.php.

References DB_FETCHMODE_ASSOC.

Referenced by importRaw().

{
global $ilDB, $ilUser;
//non specific SCO entries
if ($a_referrer=="0") {
return 0;
}
$query = "SELECT obj_id FROM sc_item,scorm_tree WHERE (obj_id=child AND identifierref=".$ilDB->quote($a_referrer).
" AND slm_id=".$ilDB->quote($this->getID()).")";
$val_set = $ilDB->query($query);
$val_rec = $val_set->fetchRow(DB_FETCHMODE_ASSOC);
return $val_rec["obj_id"];
}

+ Here is the caller graph for this function:

ilObjSCORMLearningModule::readObject ( )

read manifest file public

Reimplemented in ilObjSCORM2004LearningModule, and ilObjAICCLearningModule.

Definition at line 116 of file class.ilObjSCORMLearningModule.php.

References $n, 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;
// i deactivated this, because it seems to fail on some windows systems (see bug #1795)
//$check_disc_free = disk_free_space($this->getDataDirectory()) - $estimated_manifest_filesize;
$check_disc_free = 2;
}
// 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;
}
}
else
{
// check whether file starts with BOM (that confuses some sax parsers, see bug #1795)
$hmani = fopen($manifest_file, "r");
$start = fread($hmani, 3);
if (strtolower(bin2hex($start)) == "efbbbf")
{
$f_write_handler = fopen($manifest_file.".new", "w");
while (!feof($hmani))
{
$n = fread($hmani, 900);
fputs($f_write_handler, $n);
}
fclose($f_write_handler);
fclose($hmani);
// copy new utf8-file to imsmanifest.xml
if (!copy($manifest_file.".new", $manifest_file))
{
echo "Failed to copy $manifest_file...<br>\n";
}
}
else
{
fclose($hmani);
}
}
//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 ("./Modules/ScormAicc/classes/SCORM/class.ilSCORMPackageParser.php");
// todo determine imsmanifest.xml path here...
$slmParser = new ilSCORMPackageParser($this, $manifest_file);
$slmParser->startParsing();
return $slmParser->getPackageTitle();
}

+ Here is the call graph for this function:

ilObjSCORMLearningModule::sendExportFile (   $a_header,
  $a_content 
)

send export file to browser

Definition at line 788 of file class.ilObjSCORMLearningModule.php.

References $filename, $timestamp, exit, and ilObject\getRefId().

Referenced by ilObjSCORM2004LearningModule\exportSelected(), exportSelected(), and exportSelectedRaw().

{
$timestamp = time();
$refid = $this->getRefId();
$filename = "scorm_tracking_".$refid."_".$timestamp.".csv";
//Header
header("Expires: 0");
header("Cache-control: private");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Description: File Transfer");
header("Content-Type: application/octet-stream");
header("Content-disposition: attachment; filename=$filename");
echo $a_header.$a_content;
exit;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSCORMLearningModule::validate (   $directory)

Validate all XML-Files in a SCOM-Directory.

public

Returns
boolean true if all XML-Files are wellfomred and valid

Reimplemented in ilObjSCORM2004LearningModule.

Definition at line 62 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:

Field Documentation

ilObjSCORMLearningModule::$validator

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


The documentation for this class was generated from the following file: