ILIAS  Release_4_2_x_branch Revision 61807
 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= '')
 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)
 exportSelectedRaw ($a_exportall, $a_user=array())
 Export ilDB $ilDB ilObjUser $ilUser.
 exportSelected ($a_all, $a_users=array())
 Export selected user tracking data ilDB $ilDB ilObjUser $ilUser.
 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
 getAllScoIds ()
 getStatusForUser ($a_user, $a_allScoIds, $a_numerical=false)
 getCourseCompletionForUser ($a_user)
 _getScoresForUser ($a_item_id, $a_user_id)
- 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)
 get auto review
 getAutoReview ()
 set auto review
 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.
 getDebugActivated ()
 debugActivated
 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)
 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
 setSequencingExpertMode ($a_val)
 Set sequencing expert mode.
 getSequencingExpertMode ()
 Get sequencing expert mode.
 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.
- 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
 _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
 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.

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 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 _lookupType ($a_id, $a_reference=false)
 lookup object type
 _exists ($a_id, $a_reference=false)
 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.

Data Fields

 $validator
- Data Fields inherited from ilObjSAHSLearningModule
 $validator
- Data Fields inherited from ilObject
const TITLE_LENGTH = 128
 max length of object title
 $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 35449 2012-07-09 17:55:30Z ukohnle

Definition at line 18 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 1124 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 1204 of file class.ilObjSCORMLearningModule.php.

References _getAllScoIds(), and _getStatusForUser().

Referenced by ilObjSAHSLearningModuleAccess\_lookupUserCertificate().

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

References $ilDB.

Referenced by ilLPCollections\_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 1164 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 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["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 261 of file class.ilObjSCORMLearningModule.php.

References $ilDB, $result, and $row.

Referenced by ilSCORMPresentationGUI\downloadCertificate().

{
global $ilDB;
$result = $ilDB->queryF('
SELECT user_id,c_timestamp last_access FROM scorm_tracking
WHERE obj_id = %s
AND user_id = %s
ORDER BY c_timestamp DESC',
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 1280 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)
);
}

+ Here is the caller 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

Reimplemented in ilObjSCORM2004LearningModule.

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

References $ilDB, $ilSetting, $query, $res, $row, ilObjSCORMTracking\_getCompleted(), DB_FETCHMODE_OBJECT, ilUtil\deliverData(), ilObject\getId(), ilObject\getRefId(), IL_CAL_DATETIME, IL_CAL_FKT_DATE, and ilObjSCORMTracking\lookupLastAccessTimes().

{
global $ilDB, $ilUser, $ilSetting;
$inst_id = $ilSetting->get('inst_id',0);
// Get all scos
$scos = array();
//get all SCO's of this object
$query = '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 ';
$res = $ilDB->queryF(
array('integer', 'text'),
array($this->getId(), 'sco')
);
while($row = $ilDB->fetchAssoc($res))
{
$scos[] = $row['scoid'];
}
$users = array();
if($a_all)
{
$query = 'SELECT user_id FROM scorm_tracking ' .
'WHERE obj_id = ' . $ilDB->quote($this->getId(), 'integer') . ' ' .
'GROUP BY user_id';
$res = $ilDB->query($query);
while($row = $ilDB->fetchAssoc($res))
{
$users[] = $row['user_id'];
}
}
else
{
$users = $a_users;
}
// get all completed
include_once './Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php';
$completed = ilObjSCORMTracking::_getCompleted($scos, $this->getId());
include_once './Services/Utilities/classes/class.ilCSVWriter.php';
$csv = new ilCSVWriter();
$csv->setSeparator(';');
foreach(array('Department', 'Login', 'Lastname', 'Firstname', 'Email', 'Date', 'Status') as $col)
{
$csv->addColumn($col);
}
// Read user data
$query = 'SELECT usr_id,login,firstname,lastname,department,email ' .
'FROM usr_data ' .
'WHERE ' . $ilDB->in('usr_id', $users, false, 'integer');
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$csv->addRow();
$csv->addColumn((string) $row->department);
$csv->addColumn((string) $row->login);
$csv->addColumn((string) $row->lastname);
$csv->addColumn((string) $row->firstname);
$csv->addColumn((string) $row->email);
if(isset($last[$row->usr_id]))
{
$dt = new ilDateTime($last[$row->usr_id], IL_CAL_DATETIME);
$csv->addColumn((string) $dt->get(IL_CAL_FKT_DATE, 'd.m.Y'));
}
else
{
$csv->addColumn('');
}
$csv->addColumn(in_array($row->usr_id, $completed) ? 1 : 0);
}
$csv->getCSVString(),
'scorm_tracking_' . $this->getRefId() . '_' . time() . '.csv'
);
}

+ Here is the call graph for this function:

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

Export ilDB $ilDB ilObjUser $ilUser.

Parameters
bool$a_exportall
array$a_user

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

References $ilDB, $ilSetting, $query, $res, $row, DB_FETCHMODE_OBJECT, ilUtil\deliverData(), ilObject\getId(), and ilObject\getRefId().

{
global $ilDB, $ilUser, $ilSetting;
$inst_id = $ilSetting->get('inst_id',0);
include_once './Services/Utilities/classes/class.ilCSVWriter.php';
$csv = new ilCSVWriter();
$csv->setSeparator(';');
$csv->addColumn('Scoid');
$csv->addColumn('Key');
$csv->addColumn('Value');
$csv->addColumn('Email');
$csv->addColumn('Timestamp');
$csv->addColumn('Userid');
// Collect users
$user_array = array();
if($a_exportall)
{
$res = $ilDB->queryF(
'SELECT user_id FROM scorm_tracking WHERE obj_id = %s GROUP BY user_id',
array('integer'),
array($this->getId())
);
while($row = $ilDB->fetchAssoc($res))
{
$user_array[] = $row['user_id'];
}
}
else
{
$user_array = $a_user;
}
// Read user data
$query = "SELECT usr_id,email FROM usr_data ".
"WHERE ".$ilDB->in('usr_id', $user_array, FALSE, 'integer');
$res = $ilDB->query($query);
$emails = array();
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$emails[$row->usr_id] = $row->email;
}
foreach($user_array as $user_id)
{
// Sco related information
$query = 'SELECT rvalue, lvalue, identifierref, c_timestamp FROM scorm_tracking st '.
'JOIN sc_item si ON st.sco_id = si.obj_id '.
'WHERE user_id = '.$ilDB->quote($user_id,'integer'). ' '.
'AND st.obj_id = '.$ilDB->quote($this->getId(),'integer');
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$csv->addRow();
$csv->addColumn($row->identifierref);
$csv->addColumn($row->lvalue);
$csv->addColumn($row->rvalue);
$csv->addColumn(isset($emails[$user_id]) ? (string) $emails[$user_id] : '');
$csv->addColumn($row->c_timestamp);
$csv->addColumn('il_usr_'.$inst_id.'_'.$user_id);
}
// Sco unrelated information
$query = 'SELECT rvalue, lvalue, c_timestamp FROM scorm_tracking '.
'WHERE sco_id = 0 AND user_id = '.$ilDB->quote($user_id,'integer').' '.
'AND obj_id = '.$ilDB->quote($this->getId(),'integer');
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$csv->addRow();
$csv->addColumn(0);
$csv->addColumn($row->lvalue);
$csv->addColumn($row->rvalue);
$csv->addColumn(isset($emails[$user_id]) ? (string) $emails[$user_id] : '');
$csv->addColumn($row->c_timestamp);
$csv->addColumn('il_usr_'.$inst_id.'_'.$user_id);
}
}
$csv->getCSVString(),
'scorm_tracking_raw_' . $this->getRefId() . '_' . time() . '.csv'
);
return;
}

+ Here is the call graph for this function:

ilObjSCORMLearningModule::get_user_id (   $a_login)

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

References $ilDB.

Referenced by 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 1209 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 327 of file class.ilObjSCORMLearningModule.php.

References $ilDB, and ilObject\getId().

{
global $ilDB;
$val_set = $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($a_user_id, 0, 'package_attempts', $this->getId()));
$val_rec = $ilDB->fetchAssoc($val_set);
$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:

ilObjSCORMLearningModule::getAttemptsForUsers ( )

Get attempts for all users ilDB $ilDB.

Returns
array

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

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

{
global $ilDB;
$query = 'SELECT user_id,rvalue FROM scorm_tracking ' .
'WHERE lvalue = ' . $ilDB->quote('package_attempts', 'text') . ' ' .
'AND 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['rvalue'];
}
return $attempts;
}

+ Here is the call graph for this function:

ilObjSCORMLearningModule::getCourseCompletionForUser (   $a_user)

Reimplemented in ilObjSCORM2004LearningModule.

Definition at line 1274 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::getModuleVersionForUser (   $a_user_id)

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

Reimplemented in ilObjSCORM2004LearningModule.

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

References $ilDB, and ilObject\getId().

{
global $ilDB;
$val_set = $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($a_user_id, 0, 'module_version', $this->getId()));
$val_rec = $ilDB->fetchAssoc($val_set);
$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:

ilObjSCORMLearningModule::getModuleVersionForUsers ( )

Get module version for users.

ilDB $ilDB

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

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

{
global $ilDB;
$query = 'SELECT user_id,rvalue FROM scorm_tracking ' .
'WHERE lvalue = ' . $ilDB->quote('module_version', 'text') . ' ' .
'AND 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['rvalue'];
}
return $versions;
}

+ Here is the call graph for this function:

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

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

References $ilDB, 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 = '')

Reimplemented in ilObjSCORM2004LearningModule.

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

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

{
global $ilDB, $ilUser;
$query = 'SELECT user_id,MAX(c_timestamp) last_access, lastname, firstname FROM scorm_tracking 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';
$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 427 of file class.ilObjSCORMLearningModule.php.

References $data, $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 490 of file class.ilObjSCORMLearningModule.php.

References $data, $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 405 of file class.ilObjSCORMLearningModule.php.

References $data, $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 57 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 1088 of file class.ilObjSCORMLearningModule.php.

References $ilDB.

{
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 48 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 29 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 974 of file class.ilObjSCORMLearningModule.php.

References $data, $ilDB, ilLPStatusWrapper\_refreshStatus(), ilObject\getId(), lookupSCOId(), and parseUserId().

Referenced by importTrackingData().

{
global $ilDB, $ilUser;
$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);
$user_id = $this->parseUserId($data['Userid']);
if(!$user_id)
{
continue;
}
$il_sco_id = $this->lookupSCOId($data['Scoid']);
//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', $data['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'])
));
}
}
}
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 775 of file class.ilObjSCORMLearningModule.php.

References $data, $ilDB, ilLPStatusWrapper\_refreshStatus(), get_user_id(), and ilObject\getId().

Referenced by importTrackingData().

{
global $ilDB, $ilUser;
$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')
);
if(count($val_set) < 1)
{
return -1;
}
while($rows_sco = $ilDB->fetchAssoc($val_set))
{
array_push($scos, $rows_sco['scoid']);
}
$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);
//check the format
$statuscheck = 0;
if(count($csv_rows) == 6)
{
$statuscheck = 1;
}
if($this->get_user_id($data["Login"]) > 0)
{
$user_id = $this->get_user_id($data["Login"]);
$users[] = $user_id;
$import = $data["Status"];
if($import == "")
{
$import = 1;
}
//iterate over all SCO's
if($import == 1)
{
foreach($scos as $sco)
{
$sco_id = $sco;
$date_ex = explode('.', $data['Date']);
$date = implode('-', array($date_ex[2], $date_ex[1], $date_ex[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, $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', $date)
),
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', $date)
));
}
$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.entry', $obj_id)
);
if($ilDB->numRows($statement) > 0)
{
$ilDB->update('scorm_tracking',
array(
'rvalue' => array('clob', 'completed'),
'c_timestamp' => array('timestamp', $date)
),
array(
'user_id' => array('integer', $user_id),
'sco_id' => array('integer', $sco_id),
'lvalue' => array('text', 'cmi.core.entry'),
'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.entry'),
'rvalue' => array('clob', 'completed'),
'c_timestamp' => array('timestamp', $date)
));
}
}
}
}
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");
/*
foreach ($users as $user_id)
{
ilLPStatusWrapper::_updateStatus($this->getId(), $user_id);
}
*/
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 744 of file class.ilObjSCORMLearningModule.php.

References $ilDB, 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":
$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 1064 of file class.ilObjSCORMLearningModule.php.

References $ilDB.

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 946 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(), seems_not_utf8(), and validate().

{
global $ilErr;
// 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()))
{
$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 1103 of file class.ilObjSCORMLearningModule.php.

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

Referenced by ilObjSCORM2004LearningModule\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;
}

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


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