ILIAS  Release_5_0_x_branch Revision 61816
 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
 setLearningProgressSettingsAtUpload ()
 set settings for learning progress determination per default at upload
 getTrackedItems ()
 get all tracked items of current user
 getTrackedUsers ($a_search)
 getAttemptsForUsers ()
 Get attempts for all users ilDB $ilDB.
 getAttemptsForUser ($a_user_id)
 get number of atttempts for a certain user and package
 getModuleVersionForUsers ()
 Get module version for users.
 getModuleVersionForUser ($a_user_id)
 get module version that tracking data for a user was recorded on
 getTrackingDataPerUser ($a_sco_id, $a_user_id)
 Get tracking data per user ilDB $ilDB.
 getTrackingDataAgg ($a_user_id)
 getTrackingDataAggSco ($a_sco_id)
 exportSelected ($a_all, $a_users=array())
 Export selected user tracking data ilDB $ilDB ilObjUser $ilUser.
 importTrackingData ($a_file)
 importSuccess ($a_file)
 importSuccessForSahsUser ($user_id, $last_access, $status, $attempts=null, $percentage_completed=null, $sco_total_time_sec=null)
 decreaseAttemptsForUser ($a_user_id)
 Decrease attempts for user ilDB $ilDB.
 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
 getAllScoIds ()
 getStatusForUser ($a_user, $a_allScoIds, $a_numerical=false)
 getCourseCompletionForUser ($a_user)
 _getScoresForUser ($a_item_id, $a_user_id)
 getLastVisited ($user_id)
 deleteTrackingDataOfUsers ($a_users)
- Public Member Functions inherited from ilObjSAHSLearningModule
 ilObjSAHSLearningModule ($a_id=0, $a_call_by_reference=true)
 Constructor public.
 create ($upload=false)
 create file based lm
 read ()
 read object
 _lookupOnline ($a_id)
 check wether scorm module is online
 getAffectiveLocalization ($a_id)
 Get affective localization.
 _lookupSubType ($a_obj_id)
 lookup subtype id (scorm, aicc, hacp)
 setEditable ($a_editable)
 Set Editable.
 getEditable ()
 Get Editable.
 setTries ($a_tries)
 Set default tries for questions.
 getTries ()
 Get Tries.
 setLocalization ($a_val)
 Set localization.
 getLocalization ()
 Get localization.
 getDiskUsage ()
 Gets the disk usage of the object in bytes.
 createDataDirectory ()
 creates data directory for package files ("./data/lm_data/lm_<id>")
 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
 getStyleSheetId ()
 get ID of assigned style sheet object
 setStyleSheetId ($a_style_id)
 set ID of assigned style sheet object
 setAutoReview ($a_auto_review)
 set auto review as true/false for SCORM 1.2, HACP, SAHS, AICC
 getAutoReview ()
 get auto review as true/false for SCORM 1.2, HACP, SAHS, AICC
 setAutoReviewChar ($a_auto_review)
 set auto review as Char for SCORM 2004
 getAutoReviewChar ()
 get auto review as Char for SCORM 2004
 getMaxAttempt ()
 get max attempt
 setMaxAttempt ($a_max_attempt)
 set max attempt
 getModuleVersion ()
 get max attempt
 getAssignedGlossary ()
 get assigned glossary
 setAssignedGlossary ($a_assigned_glossary)
 set assigned glossary
 setModuleVersion ($a_module_version)
 set max attempt
 getSession ()
 get session setting
 setSession ($a_session)
 set session setting
 getNoMenu ()
 disable menu
 setNoMenu ($a_no_menu)
 disable menu
 getHideNavig ()
 hide navigation tree
 setHideNavig ($a_hide_navig)
 disable menu
 getCacheDeactivated ()
 BrowserCacheDisabled for SCORM 2004 / ENABLE_JS_DEBUG.
 getSessionDeactivated ()
 sessionDisabled for SCORM 2004
 getDebugActivated ()
 debugActivated
 getIe_compatibility ()
 set compatibility mode for Internet Exlorer manually
 setIe_compatibility ($a_ie_compatibility)
 getIe_force_render ()
 force Internet Explorer to render again after some Milliseconds - useful for learning Modules with a lot of iframesor frames and IE >=10
 setIe_force_render ($a_ie_force_render)
 getFourth_Edition ()
 SCORM 2004 4th edition features.
 setFourth_edition ($a_fourth_edition)
 getSequencing ()
 sequencing
 setSequencing ($a_sequencing)
 getInteractions ()
 interactions
 setInteractions ($a_interactions)
 getObjectives ()
 objectives
 setObjectives ($a_objectives)
 getComments ()
 comments
 setComments ($a_comments)
 getTime_from_lms ()
 time_from_lms
 setTime_from_lms ($a_time_from_lms)
 getCheck_values ()
 check_values
 setCheck_values ($a_check_values)
 getOfflineMode ()
 offlineMode
 setOfflineMode ($a_offline_mode)
 getDebug ()
 debug
 setDebug ($a_debug)
 debug
 getDebugPw ()
 debug pw
 setDebugPw ($a_debug_pw)
 debug pw
 setAutoContinue ($a_auto_continue)
 get auto continue
 getAutoContinue ()
 set auto continue
 getAuto_last_visited ()
 auto_last_visited
 setAuto_last_visited ($a_auto_last_visited)
 setSequencingExpertMode ($a_val)
 Set sequencing expert mode.
 getSequencingExpertMode ()
 Get sequencing expert mode.
 setAutoSuspend ($a_auto_suspend)
 get auto continue
 getAutoSuspend ()
 set auto continue
 getOpenMode ()
 open_mode 0: in Tab/new Window like in previous versions 1: in iFrame with width=100% and heigth=100% 2: in iFrame with specified width and height 3: 4: 5: in new Window without specified width and height 6: in new Window with specified width and height
 setOpenMode ($a_open_mode)
 getWidth ()
 width
 setWidth ($a_width)
 getHeight ()
 height
 setHeight ($a_height)
 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.
 getPointsInPercent ()
 Returns the points in percent for the learning module This is called by the certificate generator if [SCORM_POINTS] is inserted.
 getMaxPoints ()
 Returns score.max for the learning module, refered to the last sco where score.max is set.
 populateByDirectoy ($a_dir, $a_filename="")
 Populate by directory.
 cloneObject ($a_target_id, $a_copy_id=0)
 Clone scorm object.
 zipLmForOfflineMode ()
- 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
 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)
 create ()
 create
 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)
 _lookupOwner ($a_id)
 lookup object owner
 _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update
 _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects.
 _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree
 _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes
 _lookupDeletedDate ($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)
 _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
 _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
 setParentRolePermissions ($a_parent_ref)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g courses, groups for building permission intersections with non_member templates.
 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
 applyDidacticTemplate ($a_tpl_id)
 Apply template.
 setRegisterMode ($a_bool)
 isUserRegistered ($a_user_id=0)
 requireRegistration ()
 getXMLZip ()
 getHTMLDirectory ()
 cloneObject ($a_target_id, $a_copy_id=0, $a_omit_tree=false)
 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.
 _lookupCreationDate ($a_id)
 Lookup creation date.

Static Public Member Functions

static _lookupLastAccess ($a_obj_id, $a_usr_id)
 Return the last access timestamp for a given user.
static _getAllScoIds ($a_id)
 Get an array of id's for all Sco's in the module.
static _getStatusForUser ($a_id, $a_user, $a_allScoIds, $a_numerical=false)
 Get the status of a SCORM module for a given user.
static _getCourseCompletionForUser ($a_id, $a_user)
 Get the completion of a SCORM module for a given user.
static _removeTrackingDataForUser ($user_id)
- Static Public Member Functions inherited from ilObjSAHSLearningModule
static _getTries ($a_id)
static getScormModulesForGlossary ($a_glo_id)
 Get SCORM modules that assign a certain glossary.
static lookupAssignedGlossary ($a_slm_id)
 Get SCORM modules that assign a certain glossary.
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId ($a_import_id)
static _getAllReferences ($a_id)
 get all reference ids of object
static _lookupTitle ($a_id)
 lookup object title
static _getIdsForTitle ($title, $type= '', $partialmatch=false)
static _lookupDescription ($a_id)
 lookup object description
static _lookupObjId ($a_id)
static setDeletedDates ($a_ref_ids)
 Set deleted date type $ilDB.
static _lookupType ($a_id, $a_reference=false)
 lookup object type
static _lookupObjectId ($a_ref_id)
 lookup object id
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type.
static _prepareCloneSelection ($a_ref_ids, $new_type, $show_path=true)
 Prepare copy wizard object selection.
static _getIcon ($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item.
static collectDeletionDependencies (&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
 Collect deletion dependencies.
static getDeletionDependencies ($a_obj_id)
 Get deletion dependencies.
static getLongDescriptions (array $a_obj_ids)
 Get long description data.
static getAllOwnedRepositoryObjects ($a_user_id)
 Get all ids of objects user owns.
static hasAutoRating ($a_type, $a_ref_id)
 Check if auto rating is active for parent group/course.

Data Fields

 $validator
- Data Fields inherited from ilObjSAHSLearningModule
 $validator
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 max length of object title
const DESC_LENGTH = 128
 $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

 parseUserId ($il_id)
 Parse il_usr_123_6 id.
 importRaw ($a_file)
 Import raw data ilDB $ilDB ilObjUser $ilUser.
 lookupSCOId ($a_referrer)
 resolves manifest SCOID to internal ILIAS SCO ID

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 58038 2015-02-15 14:48:34Z ukohnle

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

Member Function Documentation

static ilObjSCORMLearningModule::_getAllScoIds (   $a_id)
static

Get an array of id's for all Sco's in the module.

Parameters
int$a_idObject id
Returns
array Sco id's

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

References $ilDB.

Referenced by _getCourseCompletionForUser().

{
global $ilDB;
$scos = array();
$val_set = $ilDB->queryF('
SELECT scorm_object.obj_id,
scorm_object.title,
scorm_object.c_type,
scorm_object.slm_id,
scorm_object.obj_id scoid
FROM scorm_object,sc_item,sc_resource
WHERE(scorm_object.slm_id = %s
AND scorm_object.obj_id = sc_item.obj_id
AND sc_item.identifierref = sc_resource.import_id
AND sc_resource.scormtype = %s)
GROUP BY scorm_object.obj_id,
scorm_object.title,
scorm_object.c_type,
scorm_object.slm_id,
scorm_object.obj_id ',
array('integer', 'text'),
array($a_id,'sco'));
while ($val_rec = $ilDB->fetchAssoc($val_set))
{
array_push($scos,$val_rec['scoid']);
}
return $scos;
}

+ Here is the caller graph for this function:

static ilObjSCORMLearningModule::_getCourseCompletionForUser (   $a_id,
  $a_user 
)
static

Get the completion of a SCORM module for a given user.

Parameters
int$a_idObject id
int$a_userUser id
Returns
boolean Completion status

Reimplemented in ilObjSCORM2004LearningModule.

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

References _getAllScoIds(), and _getStatusForUser().

Referenced by ilObjSAHSLearningModuleAccess\_lookupUserCertificate(), and ilSCORMVerificationTableGUI\getItems().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSCORMLearningModule::_getScoresForUser (   $a_item_id,
  $a_user_id 
)

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

References $ilDB.

Referenced by ilLPCollectionOfSCOs\getScoresForUserAndCP_Node_Id().

{
global $ilDB;
$retAr = array("raw" => null, "max" => null, "scaled" => null);
$val_set = $ilDB->queryF("
SELECT lvalue, rvalue FROM scorm_tracking
WHERE sco_id = %s
AND user_id = %s
AND (lvalue = 'cmi.core.score.raw' OR lvalue = 'cmi.core.score.max')",
array('integer', 'integer'),
array($a_item_id, $a_user_id)
);
while ($val_rec = $ilDB->fetchAssoc($val_set))
{
if ($val_rec['lvalue'] == "cmi.core.score.raw") $retAr["raw"] = $val_rec["rvalue"];
if ($val_rec['lvalue'] == "cmi.core.score.max") $retAr["max"] = $val_rec["rvalue"];
}
if ($retAr["raw"] != null && $retAr["max"] != null) $retAr["scaled"] = ($retAr["raw"] / $retAr["max"]);
return $retAr;
}

+ Here is the caller graph for this function:

static ilObjSCORMLearningModule::_getStatusForUser (   $a_id,
  $a_user,
  $a_allScoIds,
  $a_numerical = false 
)
static

Get the status of a SCORM module for a given user.

Parameters
int$a_idObject id
int$a_userUser id
array$a_allScoIdsArray of Sco id's in this module
boolean$a_numericalText (false) or boolean result (true)
Returns
mixed Status result

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

References $ilDB, and ilObject\$lng.

Referenced by _getCourseCompletionForUser().

{
global $ilDB, $lng;
$scos = $a_allScoIds;
//check if all SCO's are completed
$scos_c = implode(',',$scos);
$val_set = $ilDB->queryF('
SELECT * FROM scorm_tracking
WHERE (user_id = %s
AND obj_id = %s
AND '.$ilDB->in('sco_id', $scos, false, 'integer').'
AND ((lvalue = %s AND '.$ilDB->like('rvalue', 'clob', 'completed').')
OR (lvalue = %s AND '.$ilDB->like('rvalue', 'clob', 'passed').')))',
array('integer','integer','text','text'),
array($a_user,$a_id,'cmi.core.lesson_status', 'cmi.core.lesson_status'));
while ($val_rec = $ilDB->fetchAssoc($val_set))
{
$key = array_search($val_rec['sco_id'], $scos);
unset ($scos[$key]);
}
//check for completion
if (count($scos) == 0) {
$completion = ($a_numerical===true) ? true: $lng->txt("cont_complete");
}
if (count($scos) > 0) {
$completion = ($a_numerical===true) ? false: $lng->txt("cont_incomplete");
}
return $completion;
}

+ Here is the caller graph for this function:

ilObjSCORMLearningModule::_getTrackingItems (   $a_obj_id)

get all tracking items of scorm object static

Reimplemented in ilObjSCORM2004LearningModule, and ilObjAICCLearningModule.

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

Referenced by ilLPCollectionOfSCOs\getPossibleItems(), 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["c_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:

static ilObjSCORMLearningModule::_lookupLastAccess (   $a_obj_id,
  $a_usr_id 
)
static

Return the last access timestamp for a given user.

Parameters
int$a_obj_idobject id
int$user_iduser id
Returns
timestamp

Reimplemented in ilObjSCORM2004LearningModule.

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

References $ilDB, $result, and $row.

Referenced by ilObjSCORMVerification\createFromSCORMLM(), and ilSCORMPresentationGUI\downloadCertificate().

{
global $ilDB;
$result = $ilDB->queryF('
SELECT last_access FROM sahs_user
WHERE obj_id = %s
AND user_id = %s',
array('integer','integer'), array($a_obj_id,$a_usr_id));
if ($ilDB->numRows($result))
{
$row = $ilDB->fetchAssoc($result);
return $row["last_access"];
}
return "";
}

+ Here is the caller graph for this function:

static ilObjSCORMLearningModule::_removeTrackingDataForUser (   $user_id)
static

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

References $ilDB.

Referenced by ilObjUser\delete().

{
global $ilDB;
//gobjective
$ilDB->manipulateF(
'DELETE FROM scorm_tracking WHERE user_id = %s',
array('integer'),
array($user_id)
);
$ilDB->manipulateF(
'DELETE FROM sahs_user WHERE user_id = %s',
array('integer'),
array($user_id)
);
}

+ Here is the caller graph for this function:

ilObjSCORMLearningModule::decreaseAttemptsForUser (   $a_user_id)

Decrease attempts for user ilDB $ilDB.

Parameters
array$a_user_id

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

References $ilDB, ilLPStatusWrapper\_updateStatus(), and ilObject\getId().

{
global $ilDB;
foreach ($a_user_id as $user)
{
//first check if there is a package_attempts entry
$val_set = $ilDB->queryF('SELECT package_attempts FROM sahs_user WHERE user_id = %s AND obj_id = %s',
array('integer','integer'),
array($user,$this->getID()));
$val_rec = $ilDB->fetchAssoc($val_set);
if ($val_rec["package_attempts"] != null && $val_rec["package_attempts"] != 0)
{
$new_rec = 0;
//decrease attempt by 1
if ((int)$val_rec["package_attempts"] > 0) $new_rec = (int)$val_rec["package_attempts"]-1;
$ilDB->manipulateF('UPDATE sahs_user SET package_attempts = %s WHERE user_id = %s AND obj_id = %s',
array('integer','integer','integer'),
array($new_rec,$user,$this->getID()));
//following 2 lines were before 4.4 only for SCORM 1.2
include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
}
}
}

+ Here is the call graph for this function:

ilObjSCORMLearningModule::deleteTrackingDataOfUsers (   $a_users)

Reimplemented in ilObjSCORM2004LearningModule.

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

References $ilDB, ilChangeEvent\_deleteReadEventsForUsers(), ilLPStatusWrapper\_updateStatus(), and ilObject\getId().

{
global $ilDB;
include_once("./Services/Tracking/classes/class.ilChangeEvent.php");
include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
foreach($a_users as $user)
{
$ilDB->manipulateF('
DELETE FROM scorm_tracking
WHERE user_id = %s
AND obj_id = %s',
array('integer', 'integer'),
array($user, $this->getID()));
$ilDB->manipulateF('
DELETE FROM sahs_user
WHERE user_id = %s
AND obj_id = %s',
array('integer', 'integer'),
array($user, $this->getID()));
}
}

+ Here is the call graph for this function:

ilObjSCORMLearningModule::exportSelected (   $a_all,
  $a_users = array() 
)

Export selected user tracking data ilDB $ilDB ilObjUser $ilUser.

Parameters
bool$a_all
array$a_users

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

References $ilDB, $ilUser, $query, $res, ilLearningProgressBaseGUI\__readStatus(), ilPrivacySettings\_getInstance(), ilObject\getId(), ilObject\getTitle(), sendExportFile(), ilSCORMTrackingItems\userDataArrayForExport(), and ilSCORMTrackingItems\userDataHeaderForExport().

{
global $ilDB, $ilUser;
include_once('./Modules/ScormAicc/classes/class.ilSCORMTrackingItems.php');
include_once("./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
include_once('./Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
$allowExportPrivacy = $privacy->enabledExportSCORM();
$csv = "";
$query = 'SELECT * FROM sahs_user WHERE obj_id = %s';
if (count($a_users) >0) $query .= ' AND '.$ilDB->in('user_id', $a_users, false, 'integer');
$res = $ilDB->queryF(
array('integer'),
array($this->getId())
);
while ($data = $ilDB->fetchAssoc($res)) {
$csv = $csv. $data["obj_id"]
. ";\"" . $this->getTitle() ."\""
. ";" . $data["module_version"]
. ";\"" . implode("\";\"",ilSCORMTrackingItems::userDataArrayForExport($data["user_id"], $allowExportPrivacy)) ."\""
. ";\"" . $data["last_access"] ."\""
. ";\"" . ilLearningProgressBaseGUI::__readStatus($data["obj_id"],$data["user_id"]) ."\"" //not $data["status"] because modifications to learning progress could have made before export
. ";" . $data["package_attempts"]
. ";" . $data["percentage_completed"]
. ";" . $data["sco_total_time_sec"]
// . ";\"" . $certificateDate ."\""
. "\n";
}
$header = "LearningModuleId;LearningModuleTitle;LearningModuleVersion;".str_replace(',',';',$udh["cols"]).";"
. "LastAccess;Status;Attempts;percentageCompletedSCOs;SumTotal_timeSeconds\n";
$this->sendExportFile($header, $csv);
}

+ Here is the call graph for this function:

ilObjSCORMLearningModule::get_user_id (   $a_login)

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

References $ilDB, and $ilUser.

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

{
global $ilDB, $ilUser;
$val_set = $ilDB->queryF('SELECT * FROM usr_data WHERE(login=%s)',
array('text'),array($a_login));
$val_rec = $ilDB->fetchAssoc($val_set);
if (count($val_rec)>0) {
return $val_rec['usr_id'];
} else {
return null;
}
}

+ Here is the caller graph for this function:

ilObjSCORMLearningModule::getAllScoIds ( )

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

References $ilDB, and ilObject\getId().

Referenced by getCourseCompletionForUser().

{
global $ilDB;
$scos = array();
//get all SCO's of this object
$val_set = $ilDB->queryF('
SELECT scorm_object.obj_id,
scorm_object.title,
scorm_object.c_type,
scorm_object.slm_id,
scorm_object.obj_id scoid
FROM scorm_object, sc_item,sc_resource
WHERE(scorm_object.slm_id = %s
AND scorm_object.obj_id = sc_item.obj_id
AND sc_item.identifierref = sc_resource.import_id
AND sc_resource.scormtype = %s )
GROUP BY scorm_object.obj_id,
scorm_object.title,
scorm_object.c_type,
scorm_object.slm_id,
scorm_object.obj_id',
array('integer','text'),
array($this->getId(),'sco'));
while ($val_rec = $ilDB->fetchAssoc($val_set))
{
array_push($scos,$val_rec['scoid']);
}
return $scos;
}

+ Here is the call graph for this function:

+ 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 355 of file class.ilObjSCORMLearningModule.php.

References $ilDB, and ilObject\getId().

{
global $ilDB;
$val_set = $ilDB->queryF('SELECT package_attempts FROM sahs_user WHERE obj_id = %s AND user_id = %s',
array('integer','integer'),
array($this->getId(),$a_user_id,0));
$val_rec = $ilDB->fetchAssoc($val_set);
if ($val_rec["package_attempts"] == null) {
$val_rec["package_attempts"]="";
}
return $val_rec["package_attempts"];
}

+ Here is the call graph for this function:

ilObjSCORMLearningModule::getAttemptsForUsers ( )

Get attempts for all users ilDB $ilDB.

Returns
array

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

References $ilDB, $query, $res, $row, DB_FETCHMODE_ASSOC, and ilObject\getId().

{
global $ilDB;
$query = 'SELECT user_id, package_attempts FROM sahs_user WHERE obj_id = ' . $ilDB->quote($this->getId(), 'integer') . ' ';
$res = $ilDB->query($query);
$attempts = array();
while($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
{
$attempts[$row['user_id']] = (int) $row['package_attempts'];
}
return $attempts;
}

+ Here is the call graph for this function:

ilObjSCORMLearningModule::getCourseCompletionForUser (   $a_user)

Reimplemented in ilObjSCORM2004LearningModule.

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

References getAllScoIds(), and getStatusForUser().

{
return $this->getStatusForUser($a_user,$this->getAllScoIds,true);
}

+ Here is the call graph for this function:

ilObjSCORMLearningModule::getLastVisited (   $user_id)

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

References $ilDB.

{
global $ilDB;
$val_set = $ilDB->queryF('SELECT last_visited FROM sahs_user WHERE obj_id = %s AND user_id = %s',
array('integer','integer'),
array($this->getID(),$user_id)
);
while ($val_rec = $ilDB->fetchAssoc($val_set))
{
if ($val_rec["last_visited"] != null) return "".$val_rec["last_visited"];
}
return '0';
}
ilObjSCORMLearningModule::getModuleVersionForUser (   $a_user_id)

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

Reimplemented in ilObjSCORM2004LearningModule.

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

References $ilDB, and ilObject\getId().

{
global $ilDB;
$val_set = $ilDB->queryF('SELECT module_version FROM sahs_user WHERE obj_id = %s AND user_id = %s',
array('integer','integer'),
array($this->getId(),$a_user_id,0));
$val_rec = $ilDB->fetchAssoc($val_set);
if ($val_rec["module_version"] == null) {
$val_rec["module_version"]="";
}
return $val_rec["module_version"];
}

+ Here is the call graph for this function:

ilObjSCORMLearningModule::getModuleVersionForUsers ( )

Get module version for users.

ilDB $ilDB

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

References $ilDB, $query, $res, $row, DB_FETCHMODE_ASSOC, and ilObject\getId().

{
global $ilDB;
$query = 'SELECT user_id, module_version FROM sahs_user WHERE obj_id = ' . $ilDB->quote($this->getId(), 'integer') . ' ';
$res = $ilDB->query($query);
$versions = array();
while($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
{
$versions[$row['user_id']] = (int) $row['module_version'];
}
return $versions;
}

+ Here is the call graph for this function:

ilObjSCORMLearningModule::getStatusForUser (   $a_user,
  $a_allScoIds,
  $a_numerical = false 
)

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

References $ilDB.

Referenced by getCourseCompletionForUser().

{
global $ilDB;
$scos = $a_allScoIds;
//loook up status
//check if all SCO's are completed
$scos_c = implode(',',$scos);
$val_set = $ilDB->queryF('
SELECT sco_id FROM scorm_tracking
WHERE (user_id = %s
AND obj_id = %s
AND '.$ilDB->in('sco_id', $scos, false, 'integer').'
AND ((lvalue = %s AND '.$ilDB->like('rvalue', 'clob', 'completed').') OR (lvalue = %s AND '.$ilDB->like('rvalue', 'clob', 'passed').') ) )',
array('integer','integer','text','text',),
array($a_user,$this->getID(),'cmi.core.lesson_status','cmi.core.lesson_status'));
while ($val_rec = $ilDB->fetchAssoc($val_set))
{
$key = array_search($val_rec['sco_id'], $scos);
unset ($scos[$key]);
}
//check for completion
if (count($scos) == 0) {
$completion = ($a_numerical===true) ? true: $this->lng->txt("cont_complete");
}
if (count($scos) > 0) {
$completion = ($a_numerical===true) ? false: $this->lng->txt("cont_incomplete");
}
return $completion;
}

+ 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 261 of file class.ilObjSCORMLearningModule.php.

References $ilDB, $ilUser, and ilObject\getId().

{
global $ilDB, $ilUser;
$sco_set = $ilDB->queryF('
SELECT DISTINCT sco_id FROM scorm_tracking WHERE obj_id = %s',
array('integer'),array($this->getId()));
$items = array();
while($sco_rec = $ilDB->fetchAssoc($sco_set))
{
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)

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

References $ilDB, $ilUser, $query, and ilObject\getId().

{
global $ilDB, $ilUser;
//TODO: UK last_access is not correct if no Commit or last_visited_sco
// $query = 'SELECT user_id,MAX(c_timestamp) last_access, lastname, firstname FROM scorm_tracking st ' .
$query = 'SELECT user_id, last_access, lastname, firstname FROM sahs_user st ' .
'JOIN usr_data ud ON st.user_id = ud.usr_id ' .
'WHERE obj_id = ' . $ilDB->quote($this->getId(), 'integer');
if($a_search) {
// $query .= ' AND (' . $ilDB->like('lastname', 'text', '%' . $a_search . '%') . ' OR ' . $ilDB->like('firstname', 'text', '%' . $a_search . '%') .')';
$query .= ' AND ' . $ilDB->like('lastname', 'text', '%' . $a_search . '%');
}
$query .= ' GROUP BY user_id, lastname, firstname, last_access';
$sco_set = $ilDB->query($query);
$items = array();
while($sco_rec = $ilDB->fetchAssoc($sco_set))
{
$items[] = $sco_rec;
}
return $items;
}

+ Here is the call graph for this function:

ilObjSCORMLearningModule::getTrackingDataAgg (   $a_user_id)

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

References $ilDB, and ilObject\getId().

{
global $ilDB;
// get all users with any tracking data
$sco_set = $ilDB->queryF('
SELECT DISTINCT sco_id FROM scorm_tracking
WHERE obj_id = %s
AND user_id = %s
AND sco_id <> %s',
array('integer','integer','integer'),
array($this->getId(),$a_user_id,0));
$data = array();
while($sco_rec = $ilDB->fetchAssoc($sco_set))
{
$data_set = $ilDB->queryF('
SELECT * FROM scorm_tracking
WHERE obj_id = %s
AND sco_id = %s
AND user_id = %s
AND lvalue <> %s
AND (lvalue = %s
OR lvalue = %s
OR lvalue = %s)',
array('integer','integer','integer','text','text','text','text'),
array($this->getId(),
$sco_rec["sco_id"],
$a_user_id,
"package_attempts",
"cmi.core.lesson_status",
"cmi.core.total_time",
"cmi.core.score.raw")
);
$score = $time = $status = "";
while($data_rec = $ilDB->fetchAssoc($data_set))
{
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
include_once './Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php';
$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 (array) $data;
}

+ Here is the call graph for this function:

ilObjSCORMLearningModule::getTrackingDataAggSco (   $a_sco_id)

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

References $ilDB, and ilObject\getId().

{
global $ilDB;
// get all users with any tracking data
$user_set = $ilDB->queryF('
SELECT DISTINCT user_id FROM scorm_tracking
WHERE obj_id = %s
AND sco_id = %s',
array('integer','integer'),
array($this->getId(),$a_sco_id));
$data = array();
while($user_rec = $ilDB->fetchAssoc($user_set))
{
$data_set = $ilDB->queryF('
SELECT * FROM scorm_tracking
WHERE obj_id = %s
AND sco_id = %s
AND user_id = %s
AND (lvalue = %s
OR lvalue = %s
OR lvalue = %s)',
array('integer','integer','integer','text','text','text'),
array($this->getId(),
$a_sco_id,
$user_rec["user_id"],
"cmi.core.lesson_status",
"cmi.core.total_time",
"cmi.core.score.raw")
);
$score = $time = $status = "";
while($data_rec = $ilDB->fetchAssoc($data_set))
{
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 
)

Get tracking data per user ilDB $ilDB.

Parameters
int$a_sco_id
int$a_user_id
Returns
array

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

References $ilDB, and ilObject\getId().

{
global $ilDB;
$data_set = $ilDB->queryF('
SELECT * FROM scorm_tracking
WHERE user_id = %s
AND sco_id = %s
AND obj_id = %s
ORDER BY lvalue',
array('integer','integer','integer'),
array($a_user_id,$a_sco_id,$this->getId()));
$data = array();
while($data_rec = $ilDB->fetchAssoc($data_set)) {
$data[] = $data_rec;
}
return $data;
}

+ Here is the call graph for this function:

ilObjSCORMLearningModule::getTrackingItems ( )

Reimplemented in ilObjAICCLearningModule.

Definition at line 56 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 1011 of file class.ilObjSCORMLearningModule.php.

References $ilDB, and $ilUser.

{
global $ilDB, $ilUser;
$val_set = $ilDB->queryF('SELECT usr_id FROM usr_data WHERE(email=%s)',
array('text'),array($a_mail));
$val_rec = $ilDB->fetchAssoc($val_set);
return $val_rec["usr_id"];
}
ilObjSCORMLearningModule::getValidationSummary ( )

Definition at line 47 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 27 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

Import raw data ilDB $ilDB ilObjUser $ilUser.

Parameters
string$a_file
Returns
void

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

References $ilDB, $ilUser, ilObject\$lng, ilLPStatusWrapper\_refreshStatus(), get_user_id(), ilObject\getId(), lookupSCOId(), and parseUserId().

Referenced by importTrackingData().

{
global $ilDB, $ilUser,$lng;
$lng->loadLanguageModule("scormtrac");
$fhandle = fopen($a_file, "r");
$fields = fgetcsv($fhandle, pow(2, 16), ';');
$users = array();
while(($csv_rows = fgetcsv($fhandle, pow(2, 16), ";")) !== FALSE)
{
$data = array_combine($fields, $csv_rows);
if ($data['Userid']) {
$user_id = $this->parseUserId($data['Userid']);
}
else if ($data[$lng->txt("user")])
{
if (is_int($data[$lng->txt("user")])) $user_id = $data[$lng->txt("user")];
}
if ($data[$lng->txt("login")])
{
$user_id = $this->get_user_id($data[$lng->txt("login")]);
}
if(!$user_id)
{
continue;
}
if ($data['Scoid'])
{
$il_sco_id = $this->lookupSCOId($data['Scoid']);
}
if ($data[$lng->txt("identifierref")])
{
$il_sco_id = $this->lookupSCOId($data[$lng->txt("identifierref")]);
}
if(!$il_sco_id)
{
continue;
}
$c_timestamp="";
if ($data['Timestamp'])
{
$c_timestamp = $data['Timestamp'];
}
if ($data[$lng->txt("c_timestamp")])
{
$c_timestamp = $data[$lng->txt("c_timestamp")];
}
if ($c_timestamp == "")
{
$date = new DateTime();
$c_timestamp = $date->getTimestamp();
}
if(!$data['Key'])
{
continue;
}
if(!$data['Value'])
{
$data['Value'] = "";
}
//do the actual import
if($il_sco_id > 0)
{
$statement = $ilDB->queryF('
SELECT * FROM scorm_tracking
WHERE user_id = %s
AND sco_id = %s
AND lvalue = %s
AND obj_id = %s',
array('integer', 'integer', 'text', 'integer'),
array($user_id, $il_sco_id, $data['Key'], $this->getID())
);
if($ilDB->numRows($statement) > 0)
{
$ilDB->update('scorm_tracking',
array(
'rvalue' => array('clob', $data['Value']),
'c_timestamp' => array('timestamp', $c_timestamp)
),
array(
'user_id' => array('integer', $user_id),
'sco_id' => array('integer', $il_sco_id),
'lvalue' => array('text', $data['Key']),
'obj_id' => array('integer', $this->getId())
)
);
}
else
{
$ilDB->insert('scorm_tracking', array(
'obj_id' => array('integer', $this->getId()),
'user_id' => array('integer', $user_id),
'sco_id' => array('integer', $il_sco_id),
'lvalue' => array('text', $data['Key']),
'rvalue' => array('clob', $data['Value']),
'c_timestamp' => array('timestamp', $data['Timestamp'])
));
}
}
$package_attempts = 1;
if($il_sco_id == 0)
{
if ($data['Key'] == "package_attempts") $package_attempts = $data['Value'];
}
//UK determineStatus, percentage_completed and syncGlobalStatus
}
fclose($fhandle);
include_once './Services/Tracking/classes/class.ilLPStatusWrapper.php';
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 638 of file class.ilObjSCORMLearningModule.php.

References $ilDB, $ilUser, ilLPStatusWrapper\_refreshStatus(), get_user_id(), ilObject\getId(), ilObjectLP\getInstance(), importSuccessForSahsUser(), ilLPStatus\LP_STATUS_COMPLETED_NUM, ilLPStatus\LP_STATUS_FAILED, ilLPStatus\LP_STATUS_FAILED_NUM, ilLPStatus\LP_STATUS_IN_PROGRESS, ilLPStatus\LP_STATUS_IN_PROGRESS_NUM, ilLPStatus\LP_STATUS_NOT_ATTEMPTED, ilLPStatus\LP_STATUS_NOT_ATTEMPTED_NUM, and ilUtil\now().

Referenced by importTrackingData().

{
global $ilDB, $ilUser;
include_once("./Services/Tracking/classes/class.ilLPStatus.php");
$scos = array();
//get all SCO's of this object ONLY RELEVANT!
include_once './Services/Object/classes/class.ilObjectLP.php';
$olp = ilObjectLP::getInstance($this->getId());
$collection = $olp->getCollectionInstance();
if($collection)
{
$scos = $collection->getItems();
}
$fhandle = fopen($a_file, "r");
$obj_id = $this->getID();
$fields = fgetcsv($fhandle, pow(2, 16), ';');
// $users = array();
while(($csv_rows = fgetcsv($fhandle, pow(2, 16), ";")) !== FALSE)
{
$data = array_combine($fields, $csv_rows);
//no check the format - sufficient to import users
if ($data["Login"]) $user_id = $this->get_user_id($data["Login"]);
if ($data["login"]) $user_id = $this->get_user_id($data["login"]);
//add mail in future
if ($data["user"] && is_int($data["user"])) $user_id = $data["user"];
if ($user_id>0) {
$last_access = ilUtil::now();
if ($data['Date']) {
$date_ex = explode('.', $data['Date']);
$last_access = implode('-', array($date_ex[2], $date_ex[1], $date_ex[0]));
}
if ($data['LastAccess']) {
$last_access = $data['LastAccess'];
}
// $users[] = $user_id;
if ($data["Status"]) {
if (is_int($data["Status"])) $status = $data["Status"];
else if ($data["Status"] == ilLPStatus::LP_STATUS_FAILED) $status = ilLPStatus::LP_STATUS_FAILED_NUM;
}
$attempts = null;
if($data["Attempts"]) $attempts = $data["Attempts"];
$percentage_completed = 0;
if ($status == ilLPStatus::LP_STATUS_COMPLETED_NUM) $percentage_completed = 100;
if ($data['percentageCompletedSCOs']) $percentage_completed = $data['percentageCompletedSCOs'];
$sco_total_time_sec = null;
if ($data['SumTotal_timeSeconds']) $sco_total_time_sec = $data['SumTotal_timeSeconds'];
$this->importSuccessForSahsUser($user_id, $last_access, $status, $attempts, $percentage_completed, $sco_total_time_sec);
foreach ($scos as $sco_id)
{
$statement = $ilDB->queryF('
SELECT * FROM scorm_tracking
WHERE user_id = %s
AND sco_id = %s
AND lvalue = %s
AND obj_id = %s',
array('integer','integer','text','integer'),
array($user_id, $sco_id, 'cmi.core.lesson_status',$obj_id)
);
if($ilDB->numRows($statement) > 0)
{
$ilDB->update('scorm_tracking',
array(
'rvalue' => array('clob', 'completed'),
'c_timestamp' => array('timestamp', $last_access)
),
array(
'user_id' => array('integer', $user_id),
'sco_id' => array('integer', $sco_id),
'lvalue' => array('text', 'cmi.core.lesson_status'),
'obj_id' => array('integer', $obj_id)
)
);
}
else
{
$ilDB->insert('scorm_tracking', array(
'obj_id' => array('integer', $obj_id),
'user_id' => array('integer', $user_id),
'sco_id' => array('integer', $sco_id),
'lvalue' => array('text', 'cmi.core.lesson_status'),
'rvalue' => array('clob', 'completed'),
'c_timestamp' => array('timestamp', $last_access)
));
}
}
}
} else {
//echo "Warning! User $csv_rows[0] does not exist in ILIAS. Data for this user was skipped.\n";
}
}
include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
// <4.2.6: foreach ($users as $user_id) {ilLPStatusWrapper::_updateStatus($obj_id, $user_id);}
return 0;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSCORMLearningModule::importSuccessForSahsUser (   $user_id,
  $last_access,
  $status,
  $attempts = null,
  $percentage_completed = null,
  $sco_total_time_sec = null 
)

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

References $ilDB.

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

{
global $ilDB;
$statement = $ilDB->queryF('SELECT * FROM sahs_user WHERE obj_id = %s AND user_id = %s',
array('integer','integer'),
array($this->getID(),$user_id)
);
if($ilDB->numRows($statement) > 0)
{
$ilDB->update('sahs_user',
array(
'last_access' => array('timestamp', $last_access),
'status' => array('integer', $status),
'package_attempts' => array('integer', $attempts),
'percentage_completed' => array('integer', $percentage_completed),
'sco_total_time_sec' => array('integer', $sco_total_time_sec)
),
array(
'obj_id' => array('integer', $this->getID()),
'user_id' => array('integer', $user_id)
)
);
}
else
{
$ilDB->insert('sahs_user', array(
'obj_id' => array('integer', $this->getID()),
'user_id' => array('integer', $user_id),
'last_access' => array('timestamp', $last_access),
'status' => array('integer', $status),
'package_attempts' => array('integer', $attempts),
'percentage_completed' => array('integer', $percentage_completed),
'sco_total_time_sec' => array('integer', $sco_total_time_sec)
));
}
}

+ Here is the caller graph for this function:

ilObjSCORMLearningModule::importTrackingData (   $a_file)

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

References $ilDB, $ilUser, 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, pow(2, 16), ';');
//lets check the import method
fclose($fhandle);
switch($fields[0])
{
case "Scoid":
case "SCO-Identifier":
$error = $this->importRaw($a_file);
break;
case "Department":
case "LearningModuleId":
$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 989 of file class.ilObjSCORMLearningModule.php.

References $ilDB, and $ilUser.

Referenced by importRaw().

{
global $ilDB, $ilUser;
//non specific SCO entries
if ($a_referrer=="0") {
return 0;
}
$val_set = $ilDB->queryF('
SELECT obj_id FROM sc_item,scorm_tree
WHERE (obj_id = child
AND identifierref = %s
AND slm_id = %s)',
array('text','integer'), array($a_referrer,$this->getID()));
$val_rec = $ilDB->fetchAssoc($val_set);
return $val_rec["obj_id"];
}

+ Here is the caller graph for this function:

ilObjSCORMLearningModule::parseUserId (   $il_id)
private

Parse il_usr_123_6 id.

Parameters
<type>$il_id
Returns
<type>

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

References $ilSetting.

Referenced by importRaw().

{
global $ilSetting;
$parts = explode('_', $il_id);
if(!count((array) $parts))
{
return 0;
}
if(!isset($parts[2]) or !isset($parts[3]))
{
return 0;
}
if($parts[2] != $ilSetting->get('inst_id',$parts[2]))
{
return 0;
}
return $parts[3];
}

+ Here is the caller graph for this function:

ilObjSCORMLearningModule::readObject ( )

read manifest file public

Reimplemented in ilObjSCORM2004LearningModule, and ilObjAICCLearningModule.

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

References $_POST, $ilErr, $n, ilObjSAHSLearningModule\getDataDirectory(), getValidationSummary(), and validate().

{
global $ilErr;
$needs_convert = false;
// convert imsmanifest.xml file in iso to utf8 if needed
$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))
if (@iconv('UTF-8', 'UTF-8', $mfa) != $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()))
{
$ilErr->raiseError("<b>Validation Error(s):</b><br>".$this->getValidationSummary(),$ilErr->MESSAGE);
}
}
// 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 1027 of file class.ilObjSCORMLearningModule.php.

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

Referenced by exportSelected().

{
$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::setLearningProgressSettingsAtUpload ( )

set settings for learning progress determination per default at upload

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

References $ilSetting, $lm_set, ilObjUserTracking\_enabledLearningProgress(), ilObject\getId(), and ilLPObjSettings\LP_MODE_SCORM.

{
global $ilSetting;
//condition 1
$lm_set = new ilSetting("lm");
if ($lm_set->get('scorm_lp_auto_activate') != 1) return;
//condition 2
include_once("./Services/Tracking/classes/class.ilObjUserTracking.php");
//set Learning Progress to Automatic by Collection of SCORM Items
include_once("./Services/Tracking/classes/class.ilLPObjSettings.php");
$lm_set = new ilLPObjSettings($this->getId());
$lm_set->insert();
//select all SCOs as relevant for Learning Progress
include_once("Services/Tracking/classes/collection/class.ilLPCollectionOfSCOs.php");
$scos = array();
foreach($collection->getPossibleItems() as $sco_id => $item)
{
$scos[] = $sco_id;
}
$collection->activateEntries($scos);
}

+ Here is the call 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 40 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 19 of file class.ilObjSCORMLearningModule.php.


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