ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilObjSCORM2004LearningModule Class Reference

Class ilObjSCORM2004LearningModule. More...

+ Inheritance diagram for ilObjSCORM2004LearningModule:
+ Collaboration diagram for ilObjSCORM2004LearningModule:

Public Member Functions

 ilObjSCORM2004LearningModule ($a_id=0, $a_call_by_reference=true)
 Constructor public.
 setImportSequencing ($a_val)
 Set import sequencing.
 getImportSequencing ()
 Get import sequencing.
 validate ($directory)
 Validate all XML-Files in a SCOM-Directory.
 readObject ()
 read manifest file public
 fixReload ()
 convert_1_2_to_2004 ($manifest)
 deleteTrackingDataOfUsers ($a_users)
 get all tracked items of current user
 getTrackedItems ()
 get all tracked items of current user
 getTrackingDataAgg ($a_user_id, $raw=false)
 getAttemptsForUser ($a_user_id)
 get number of atttempts for a certain user and package
 getModuleVersionForUser ($a_user_id)
 get module version that tracking data for a user was recorded on
 importSuccess ($a_file)
 _ISODurationToCentisec ($str)
 convert ISO 8601 Timeperiods to centiseconds ta
 getCourseCompletionForUser ($a_user)
 _getTrackingItems ($a_obj_id)
 get all tracking items of scorm object
 createScorm2004Tree ()
 Create Scorm 2004 Tree used by Editor.
 getTree ()
 getSequencingSettings ()
 updateSequencingSettings ()
 executeDragDrop ($source_id, $target_id, $first_child, $as_subitem=false, $movecopy="move")
 Execute Drag Drop Action.
 getExportFiles ()
 exportScorm ($a_inst, $a_target_dir, $ver, &$expLog)
 Export (authoring) scorm package.
 exportHTML4PDF ($a_inst, $a_target_dir, &$expLog)
 exportPDF ($a_inst, $a_target_dir, &$expLog)
 exportHTMLOne ($a_inst, $a_target_dir, &$expLog)
 exportHTML ($a_inst, $a_target_dir, &$expLog, $a_one_file="")
 Export SCORM package to HTML.
 exportXMLMetaData (&$a_xml_writer)
 export content objects meta data to xml (see ilias_co.dtd)
 exportXMLStructureObjects (&$a_xml_writer, $a_inst, &$expLog)
 export structure objects to xml (see ilias_co.dtd)
 exportXMLScoObjects ($a_inst, $a_target_dir, $ver, &$expLog)
 export page objects to xml (see ilias_co.dtd)
 exportHTMLScoObjects ($a_inst, $a_target_dir, &$expLog, $a_one_file="")
 prepareHTMLExporter ($a_target_dir)
 Prepare HTML exporter.
 getPublicExportFile ($a_type)
 get public export file
 exportFileItems ($a_target_dir, &$expLog)
 export files of file itmes
 setPublicExportFile ($a_type, $a_file)
 copyAuthoredContent ($a_new_obj)
 Copy authored content (everything done with the editor.
- Public Member Functions inherited from ilObjSCORMLearningModule
 ilObjSCORMLearningModule ($a_id=0, $a_call_by_reference=true)
 Constructor public.
 getValidationSummary ()
 getTrackingItems ()
 setLearningProgressSettingsAtUpload ()
 set settings for learning progress determination per default at upload
 getTrackedUsers ($a_search)
 getAttemptsForUsers ()
 Get attempts for all users ilDB $ilDB.
 getModuleVersionForUsers ()
 Get module version for users.
 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)
 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)
 _getScoresForUser ($a_item_id, $a_user_id)
 getLastVisited ($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)
 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 _getCourseCompletionForUser ($a_id, $a_user)
 Get the completion of a SCORM module for a given user.
static _getUniqueScaledScoreForUser ($a_id, $a_user)
 Get the Unique Scaled Score of a course Conditions: Only one SCO may set cmi.score.scaled.
static _getStatus ($a_obj_id, $a_user_id)
static _getSatisfied ($a_obj_id, $a_user_id)
static _getMeasure ($a_obj_id, $a_user_id)
static _lookupItemTitle ($a_node_id)
static _getMaxScoreForUser ($a_id, $a_user)
 Returns score.max for the learning module, refered to the last sco where score.max is set.
static _getScores2004ForUser ($a_cp_node_id, $a_user)
- Static Public Member Functions inherited from ilObjSCORMLearningModule
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 _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
const CONVERT_XSL = './Modules/Scorm2004/templates/xsl/op/scorm12To2004.xsl'
const WRAPPER_HTML = './Modules/Scorm2004/scripts/converter/GenericRunTimeWrapper1.0_aadlc/GenericRunTimeWrapper.htm'
const WRAPPER_JS = './Modules/Scorm2004/scripts/converter/GenericRunTimeWrapper1.0_aadlc/SCOPlayerWrapper.js'
- Data Fields inherited from ilObjSCORMLearningModule
 $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

Detailed Description

Member Function Documentation

static ilObjSCORM2004LearningModule::_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 from ilObjSCORMLearningModule.

Definition at line 760 of file class.ilObjSCORM2004LearningModule.php.

References $ilDB, and $ilUser.

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

{
global $ilDB, $ilUser;
$scos = array();
//get all SCO's of the object
$val_set = $ilDB->queryF('
SELECT cp_node.cp_node_id FROM cp_node,cp_resource,cp_item
WHERE cp_item.cp_node_id = cp_node.cp_node_id
AND cp_item.resourceid = cp_resource.id
AND scormtype = %s
AND nodename = %s
AND cp_node.slm_id = %s',
array('text','text','integer'), array('sco' ,'item',$a_id));
while ($val_rec = $ilDB->fetchAssoc($val_set))
{
array_push($scos,$val_rec['cp_node_id']);
}
$scos_c = $scos;
//copy SCO_array
//check if all SCO's are completed
for ($i=0;$i<count($scos);$i++)
{
$val_set = $ilDB->queryF('
SELECT * FROM cmi_node
WHERE (user_id= %s
AND cp_node_id= %s
AND (completion_status = %s OR success_status = %s))',
array('integer','integer','text','text'),
array($a_user,$scos[$i],'completed','passed'));
if ($ilDB->numRows($val_set) > 0)
{
//delete from array
$key = array_search($scos[$i], $scos_c);
unset ($scos_c[$key]);
}
}
//check for completion
if (count($scos_c) == 0) {
$completion = true;
} else {
$completion = false;
}
return $completion;
}

+ Here is the caller graph for this function:

static ilObjSCORM2004LearningModule::_getMaxScoreForUser (   $a_id,
  $a_user 
)
static

Returns score.max for the learning module, refered to the last sco where score.max is set.

Parameters
integer$a_id
integer$a_user
Returns
float

Definition at line 1833 of file class.ilObjSCORM2004LearningModule.php.

References $ilDB, $res, $result, and $row.

Referenced by ilObjSAHSLearningModule\getMaxPoints().

{
global $ilDB;
$scos = array();
$result = $ilDB->query(
'SELECT cp_node.cp_node_id '
.'FROM cp_node, cp_resource, cp_item '
.'WHERE cp_item.cp_node_id = cp_node.cp_node_id '
.'AND cp_item.resourceId = cp_resource.id '
.'AND scormType = '.$ilDB->quote('sco', 'text').' '
.'AND nodeName = '.$ilDB->quote('item', 'text').' '
.'AND cp_node.slm_id = '.$ilDB->quote($a_id, 'integer').' '
.'GROUP BY cp_node.cp_node_id'
);
while($row = $ilDB->fetchAssoc($result))
{
array_push($scos, $row['cp_node_id']);
}
$set = 0; //numbers of SCO that set cmi.score.scaled
$max = null;
for($i = 0; $i < count($scos); $i++)
{
$res = $ilDB->queryF(
'SELECT c_max FROM cmi_node WHERE (user_id = %s AND cp_node_id = %s)',
array('integer', 'integer'),
array($a_user, $scos[$i])
);
if($ilDB->numRows($res) > 0)
{
$row = $ilDB->fetchAssoc($res);
if($row['c_max'] != null)
{
$set++;
$max = $row['c_max'];
}
}
}
$retVal = ($set == 1) ? $max : null;
return $retVal;
}

+ Here is the caller graph for this function:

static ilObjSCORM2004LearningModule::_getMeasure (   $a_obj_id,
  $a_user_id 
)
static

Definition at line 944 of file class.ilObjSCORM2004LearningModule.php.

References $ilDB.

{
global $ilDB;
$status_set = $ilDB->queryF('
SELECT * FROM cmi_gobjective
WHERE scope_id = %s
AND objective_id = %s
AND user_id = %s',
array('integer','text','integer'),
array($a_obj_id,'course_overall_status',$a_user_id)
);
if ($status_rec = $ilDB->fetchAssoc($status_set))
{
return $status_rec["measure"];
}
return false;
}
static ilObjSCORM2004LearningModule::_getSatisfied (   $a_obj_id,
  $a_user_id 
)
static

Definition at line 922 of file class.ilObjSCORM2004LearningModule.php.

References $ilDB.

{
global $ilDB;
$status_set = $ilDB->queryF('
SELECT * FROM cmi_gobjective
WHERE scope_id = %s
AND objective_id = %s
AND user_id = %s',
array('integer','text','integer'),
array($a_obj_id,'course_overall_status',$a_user_id)
);
if ($status_rec = $ilDB->fetchAssoc($status_set))
{
return $status_rec["satisfied"];
}
return false;
}
static ilObjSCORM2004LearningModule::_getScores2004ForUser (   $a_cp_node_id,
  $a_user 
)
static

Definition at line 1880 of file class.ilObjSCORM2004LearningModule.php.

References $ilDB.

Referenced by ilLPCollectionOfSCOs\getScoresForUserAndCP_Node_Id().

{
global $ilDB;
$retAr = array("raw" => null, "max" => null, "scaled" => null);
$val_set = $ilDB->queryF("SELECT c_raw, c_max, scaled FROM cmi_node WHERE (user_id = %s AND cp_node_id = %s)",
array('integer', 'integer'),
array($a_user, $a_cp_node_id)
);
if ($val_set->numRows()>0)
{
$val_rec = $ilDB->fetchAssoc($val_set);
$retAr["raw"] = $val_rec['c_raw'];
$retAr["max"] = $val_rec['c_max'];
$retAr["scaled"] = $val_rec['scaled'];
if ($val_rec['scaled']==null && $val_rec['c_raw']!=null && $val_rec['c_max']!=null) {
$retAr["scaled"] = ($val_rec['c_raw'] / $val_rec['c_max']);
}
}
return $retAr;
}

+ Here is the caller graph for this function:

static ilObjSCORM2004LearningModule::_getStatus (   $a_obj_id,
  $a_user_id 
)
static

Definition at line 901 of file class.ilObjSCORM2004LearningModule.php.

References $ilDB.

{
global $ilDB;
$status_set = $ilDB->queryF('
SELECT * FROM cmi_gobjective
WHERE scope_id = %s
AND objective_id = %s
AND user_id = %s',
array('integer','text','integer'),
array($a_obj_id,'course_overall_status',$a_user_id)
);
if ($status_rec = $ilDB->fetchAssoc($status_set))
{
return $status_rec["status"];
}
return false;
}
ilObjSCORM2004LearningModule::_getTrackingItems (   $a_obj_id)

get all tracking items of scorm object

currently a for learning progress only

static

Reimplemented from ilObjSCORMLearningModule.

Definition at line 860 of file class.ilObjSCORM2004LearningModule.php.

References $ilDB, and $res.

Referenced by ilLPCollectionOfSCOs\getPossibleItems().

{
global $ilDB;
$item_set = $ilDB->queryF('
SELECT cp_item.* FROM cp_node, cp_item WHERE slm_id = %s
AND cp_node.cp_node_id = cp_item.cp_node_id
ORDER BY cp_node.cp_node_id ',
array('integer'),
array($a_obj_id)
);
$items = array();
while ($item_rec = $ilDB->fetchAssoc($item_set))
{
$s2 = $ilDB->queryF('
SELECT cp_resource.* FROM cp_node, cp_resource
WHERE slm_id = %s
AND cp_node.cp_node_id = cp_resource.cp_node_id
AND cp_resource.id = %s ',
array('integer','text'),
array($a_obj_id,$item_rec["resourceid"])
);
if ($res = $ilDB->fetchAssoc($s2))
{
if ($res["scormtype"] == "sco")
{
$items[] = array("id" => $item_rec["cp_node_id"],
"title" => $item_rec["title"]);
}
}
}
return $items;
}

+ Here is the caller graph for this function:

static ilObjSCORM2004LearningModule::_getUniqueScaledScoreForUser (   $a_id,
  $a_user 
)
static

Get the Unique Scaled Score of a course Conditions: Only one SCO may set cmi.score.scaled.

Parameters
int$a_idObject id
int$a_userUser id
Returns
float scaled score, -1 if not unique

Definition at line 817 of file class.ilObjSCORM2004LearningModule.php.

References $ilDB, and $ilUser.

Referenced by ilObjSAHSLearningModule\getPointsInPercent().

{
global $ilDB, $ilUser;
$scos = array();
$val_set = $ilDB->queryF("SELECT cp_node.cp_node_id FROM cp_node,cp_resource,cp_item WHERE".
" cp_item.cp_node_id=cp_node.cp_node_id AND cp_item.resourceId = cp_resource.id AND scormType='sco' AND nodeName='item' AND cp_node.slm_id = %s GROUP BY cp_node.cp_node_id",
array('integer'),
array($a_id)
);
while ($val_rec = $ilDB->fetchAssoc($val_set))
{
array_push($scos,$val_rec['cp_node_id']);
}
$set = 0; //numbers of SCO that set cmi.score.scaled
$scaled = null;
for ($i=0;$i<count($scos);$i++)
{
$val_set = $ilDB->queryF("SELECT scaled FROM cmi_node WHERE (user_id = %s AND cp_node_id = %s)",
array('integer', 'integer'),
array($a_user, $scos[$i])
);
if ($val_set->numRows()>0)
{
$val_rec = $ilDB->fetchAssoc($val_set);
if ($val_rec['scaled']!=NULL) {
$set++;
$scaled = $val_rec['scaled'];
}
}
}
$retVal = ($set == 1) ? $scaled : null ;
return $retVal;
}

+ Here is the caller graph for this function:

ilObjSCORM2004LearningModule::_ISODurationToCentisec (   $str)

convert ISO 8601 Timeperiods to centiseconds ta

static

Definition at line 647 of file class.ilObjSCORM2004LearningModule.php.

Referenced by ilSCORM2004TrackingItems\exportSelectedCore(), ilSCORM2004TrackingItems\exportSelectedInteractions(), ilSCORM2004Tracking\getSumTotalTimeSecondsFromScos(), getTrackingDataAgg(), and ilSCORM2004TrackingItems\tracInteractionUser().

{
$aV = array(0, 0, 0, 0, 0, 0);
$bErr = false;
$bTFound = false;
if (strpos($str,"P") != 0) {
$bErr = true;
}
if (!$bErr) {
$aT = array("Y", "M", "D", "H", "M", "S");
$p = 0;
$i = 0;
$str = substr($str,1);
for ($i = 0; $i < count($aT); $i++) {
if (strpos($str,"T")===0) {
$str = substr($str,1);
$i = max($i, 3);
$bTFound = true;
}
$p = strpos($str,$aT[$i]);
if ($p > -1) {
if ($i == 1 && strpos($str,"T") > -1 && strpos($str,"T") < $p) {
continue;
}
if ($aT[$i] == "S") {
$aV[$i] = substr($str,0, $p);
} else {
$aV[$i] = intval(substr($str,0, $p));
}
if (!is_numeric($aV[$i])) {
$bErr = true;
break;
} else if ($i > 2 && !$bTFound) {
$bErr = true;
break;
}
$str = substr($str,$p + 1);
}
}
if (!$bErr && strlen($str) != 0) {
$bErr = true;
}
}
if ($bErr) {
return;
}
return $aV[0] * 3155760000 + $aV[1] * 262980000 + $aV[2] * 8640000 + $aV[3] * 360000 + $aV[4] * 6000 + round($aV[5] * 100);
}

+ Here is the caller graph for this function:

static ilObjSCORM2004LearningModule::_lookupItemTitle (   $a_node_id)
static

Definition at line 965 of file class.ilObjSCORM2004LearningModule.php.

References $ilDB.

Referenced by ilLPStatusSCORM\_getStatusInfo(), getTrackedItems(), and getTrackingDataAgg().

{
global $ilDB;
$r = $ilDB->queryF('
SELECT * FROM cp_item
WHERE cp_node_id = %s',
array('integer'),
array($a_node_id)
);
if ($i = $ilDB->fetchAssoc($r))
{
return $i["title"];
}
return "";
}

+ Here is the caller graph for this function:

static ilObjSCORM2004LearningModule::_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 from ilObjSCORMLearningModule.

Definition at line 315 of file class.ilObjSCORM2004LearningModule.php.

References $ilDB, $result, and $row.

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

{
global $ilDB;
$result = $ilDB->queryF('
SELECT MAX(c_timestamp) last_access
FROM cmi_node, cp_node
WHERE cmi_node.cp_node_id = cp_node.cp_node_id
AND cp_node.slm_id = %s
AND user_id = %s
GROUP BY c_timestamp',
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:

ilObjSCORM2004LearningModule::convert_1_2_to_2004 (   $manifest)

Definition at line 240 of file class.ilObjSCORM2004LearningModule.php.

References $ilDB, $ilLog, $ret, fixReload(), and ilObjSAHSLearningModule\getDataDirectory().

Referenced by readObject().

{
global $ilDB, $ilLog;
##check manifest-file for version. Check for schemaversion as this is a required element for SCORM 2004
##accept 2004 3rd Edition an CAM 1.3 as valid schemas
//set variables
$this->packageFolder=$this->getDataDirectory();
$this->imsmanifestFile=$manifest;
$doc = new DomDocument();
//fix reload errors before loading
$this->fixReload();
$doc->load($this->imsmanifestFile);
$elements = $doc->getElementsByTagName("schemaversion");
$schema=$elements->item(0)->nodeValue;
if (strtolower(trim($schema))=="cam 1.3" || strtolower(trim($schema))=="2004 3rd edition" || strtolower(trim($schema))=="2004 4th edition") {
//no conversion
$this->converted=false;
return true;
} else {
$this->converted=true;
//convert to SCORM 2004
//check for broken SCORM 1.2 manifest file (missing organization default-common error in a lot of manifest files)
$organizations = $doc->getElementsByTagName("organizations");
//first check if organizations is in manifest
if ($organizations->item(0)==null) die("organizations missing in manifest");
$default=$organizations->item(0)->getAttribute("default");
if ($default=="" || $default==null) {
//lookup identifier
$organization = $doc->getElementsByTagName("organization");
$ident=$organization->item(0)->getAttribute("identifier");
$organizations->item(0)->setAttribute("default",$ident);
}
//validate the fixed mainfest. If it's still not valid, don't transform an throw error
//first copy wrappers
$wrapperdir=$this->packageFolder."/GenericRunTimeWrapper1.0_aadlc";
mkdir($wrapperdir);
copy(self::WRAPPER_HTML,$wrapperdir."/GenericRunTimeWrapper.htm");
copy(self::WRAPPER_JS,$wrapperdir."/SCOPlayerWrapper.js");
//backup manifestfile
$this->backupManifest=$this->packageFolder."/imsmanifest.xml.back";
$ret=copy($this->imsmanifestFile,$this->backupManifest);
//transform manifest file
$this->totransform = $doc;
$ilLog->write("SCORM: about to transform to SCORM 2004");
$xsl = new DOMDocument;
$xsl->async = false;
$xsl->load(self::CONVERT_XSL);
$prc = new XSLTProcessor;
$r = @$prc->importStyleSheet($xsl);
file_put_contents($this->imsmanifestFile, $prc->transformToXML($this->totransform));
$ilLog->write("SCORM: Transformation completed");
return true;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSCORM2004LearningModule::copyAuthoredContent (   $a_new_obj)

Copy authored content (everything done with the editor.

Parameters
@return

Definition at line 1906 of file class.ilObjSCORM2004LearningModule.php.

References ilObject\$ilias, ilObjStyleSheet\_lookupStandard(), ilObjSAHSLearningModule\getStyleSheetId(), getTree(), IL_LAST_NODE, and ilSCORM2004Node\pasteTree().

{
global $ilias;
// set/copy stylesheet
include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
$style_id = $this->getStyleSheetId();
if ($style_id > 0 && !ilObjStyleSheet::_lookupStandard($style_id))
{
$style_obj = $ilias->obj_factory->getInstanceByObjId($style_id);
$new_id = $style_obj->ilClone();
$a_new_obj->setStyleSheetId($new_id);
$a_new_obj->update();
}
$a_new_obj->createScorm2004Tree();
$source_tree = $this->getTree();
$target_tree_root_id = $a_new_obj->getTree()->readRootId();
$childs = $source_tree->getChilds($source_tree->readRootId());
$a_copied_nodes = array();
include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
foreach ($childs as $c)
{
ilSCORM2004Node::pasteTree($a_new_obj, $c["child"], $target_tree_root_id,
IL_LAST_NODE, "", $a_copied_nodes, true, false);
}
}

+ Here is the call graph for this function:

ilObjSCORM2004LearningModule::createScorm2004Tree ( )

Create Scorm 2004 Tree used by Editor.

Definition at line 986 of file class.ilObjSCORM2004LearningModule.php.

References ilObject\getId().

{
include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Tree.php");
$this->slm_tree = new ilSCORM2004Tree($this->getId());
//$this->slm_tree =& new ilTree($this->getId());
//$this->slm_tree->setTreeTablePK("slm_id");
//$this->slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
$this->slm_tree->addTree($this->getId(), 1);
//add seqinfo for rootNode
include_once ("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Sequencing.php");
$seq_info = new ilSCORM2004Sequencing($this->getId(),true);
$seq_info->insert();
}

+ Here is the call graph for this function:

ilObjSCORM2004LearningModule::deleteTrackingDataOfUsers (   $a_users)

get all tracked items of current user

Reimplemented from ilObjSCORMLearningModule.

Definition at line 384 of file class.ilObjSCORM2004LearningModule.php.

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

{
global $ilDB;
include_once("./Modules/Scorm2004/classes/class.ilSCORM2004DeleteData.php");
include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
foreach($a_users as $user)
{
}
}

+ Here is the call graph for this function:

ilObjSCORM2004LearningModule::executeDragDrop (   $source_id,
  $target_id,
  $first_child,
  $as_subitem = false,
  $movecopy = "move" 
)

Execute Drag Drop Action.

Parameters
string$source_idSource element ID
string$target_idTarget element ID
string$first_childInsert as first child of target
string$movecopyPosition ("move" | "copy")

Definition at line 1041 of file class.ilObjSCORM2004LearningModule.php.

References $target_id, ilObject\getId(), ilSCORM2004NodeFactory\getInstance(), and IL_FIRST_NODE.

{
$this->slm_tree = new ilTree($this->getId());
$this->slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
$this->slm_tree->setTreeTablePK("slm_id");
require_once("./Modules/Scorm2004/classes/class.ilSCORM2004NodeFactory.php");
$source_obj = ilSCORM2004NodeFactory::getInstance($this, $source_id, true);
//$source_obj->setLMId($this->getId());
if (!$first_child)
{
$target_obj = ilSCORM2004NodeFactory::getInstance($this, $target_id, true);
//$target_obj->setLMId($this->getId());
$target_parent = $this->slm_tree->getParentId($target_id);
}
//echo "-".$source_obj->getType()."-";
// handle pages
if ($source_obj->getType() == "page")
{
if ($this->slm_tree->isInTree($source_obj->getId()))
{
$node_data = $this->slm_tree->getNodeData($source_obj->getId());
// cut on move
if ($movecopy == "move")
{
$parent_id = $this->slm_tree->getParentId($source_obj->getId());
$this->slm_tree->deleteTree($node_data);
// write history entry
/* require_once("./Services/History/classes/class.ilHistory.php");
ilHistory::_createEntry($source_obj->getId(), "cut",
array(ilLMObject::_lookupTitle($parent_id), $parent_id),
$this->getType().":pg");
ilHistory::_createEntry($parent_id, "cut_page",
array(ilLMObject::_lookupTitle($source_obj->getId()), $source_obj->getId()),
$this->getType().":st");
*/
}
/* else // this is not implemented here
{
// copy page
$new_page =& $source_obj->copy();
$source_id = $new_page->getId();
$source_obj =& $new_page;
}
*/
// paste page
if(!$this->slm_tree->isInTree($source_obj->getId()))
{
if ($first_child) // as first child
{
$target_pos = IL_FIRST_NODE;
$parent = $target_id;
}
else if ($as_subitem) // as last child
{
$parent = $target_id;
$target_pos = IL_FIRST_NODE;
$pg_childs = $this->slm_tree->getChildsByType($parent, "page");
if (count($pg_childs) != 0)
{
$target_pos = $pg_childs[count($pg_childs) - 1]["obj_id"];
}
}
else // at position
{
$target_pos = $target_id;
$parent = $target_parent;
}
// insert page into tree
$this->slm_tree->insertNode($source_obj->getId(),
$parent, $target_pos);
// write history entry
/* if ($movecopy == "move")
{
// write history comments
include_once("./Services/History/classes/class.ilHistory.php");
ilHistory::_createEntry($source_obj->getId(), "paste",
array(ilLMObject::_lookupTitle($parent), $parent),
$this->getType().":pg");
ilHistory::_createEntry($parent, "paste_page",
array(ilLMObject::_lookupTitle($source_obj->getId()), $source_obj->getId()),
$this->getType().":st");
}
*/
}
}
}
// handle scos
if ($source_obj->getType() == "sco" || $source_obj->getType() == "ass")
{
//echo "2";
$source_node = $this->slm_tree->getNodeData($source_id);
$subnodes = $this->slm_tree->getSubtree($source_node);
// check, if target is within subtree
foreach ($subnodes as $subnode)
{
if($subnode["obj_id"] == $target_id)
{
return;
}
}
$target_pos = $target_id;
if ($first_child) // as first sco
{
$target_pos = IL_FIRST_NODE;
$target_parent = $target_id;
$pg_childs = $this->slm_tree->getChildsByType($target_parent, "page");
if (count($pg_childs) != 0)
{
$target_pos = $pg_childs[count($pg_childs) - 1]["obj_id"];
}
}
else if ($as_subitem) // as last sco
{
$target_parent = $target_id;
$target_pos = IL_FIRST_NODE;
$childs = $this->slm_tree->getChilds($target_parent);
if (count($childs) != 0)
{
$target_pos = $childs[count($childs) - 1]["obj_id"];
}
}
// delete source tree
if ($movecopy == "move")
{
$this->slm_tree->deleteTree($source_node);
}
/* else
{
// copy chapter (incl. subcontents)
$new_chapter =& $source_obj->copy($this->slm_tree, $target_parent, $target_pos);
}
*/
if (!$this->slm_tree->isInTree($source_id))
{
$this->slm_tree->insertNode($source_id, $target_parent, $target_pos);
// insert moved tree
if ($movecopy == "move")
{
foreach ($subnodes as $node)
{
if($node["obj_id"] != $source_id)
{
$this->slm_tree->insertNode($node["obj_id"], $node["parent"]);
}
}
}
}
// check the tree
// $this->checkTree();
}
// handle chapters
if ($source_obj->getType() == "chap")
{
//echo "2";
$source_node = $this->slm_tree->getNodeData($source_id);
$subnodes = $this->slm_tree->getSubtree($source_node);
// check, if target is within subtree
foreach ($subnodes as $subnode)
{
if($subnode["obj_id"] == $target_id)
{
return;
}
}
$target_pos = $target_id;
if ($first_child) // as first chapter
{
$target_pos = IL_FIRST_NODE;
$target_parent = $target_id;
//$sco_childs = $this->slm_tree->getChildsByType($target_parent, "sco");
//if (count($sco_childs) != 0)
//{
// $target_pos = $sco_childs[count($sco_childs) - 1]["obj_id"];
//}
}
else if ($as_subitem) // as last chapter
{
$target_parent = $target_id;
$target_pos = IL_FIRST_NODE;
$childs = $this->slm_tree->getChilds($target_parent);
if (count($childs) != 0)
{
$target_pos = $childs[count($childs) - 1]["obj_id"];
}
}
// delete source tree
if ($movecopy == "move")
{
$this->slm_tree->deleteTree($source_node);
}
/* else
{
// copy chapter (incl. subcontents)
$new_chapter =& $source_obj->copy($this->slm_tree, $target_parent, $target_pos);
}
*/
if (!$this->slm_tree->isInTree($source_id))
{
$this->slm_tree->insertNode($source_id, $target_parent, $target_pos);
// insert moved tree
if ($movecopy == "move")
{
foreach ($subnodes as $node)
{
if($node["obj_id"] != $source_id)
{
$this->slm_tree->insertNode($node["obj_id"], $node["parent"]);
}
}
}
}
// check the tree
// $this->checkTree();
}
// $this->checkTree();
}

+ Here is the call graph for this function:

ilObjSCORM2004LearningModule::exportFileItems (   $a_target_dir,
$expLog 
)

export files of file itmes

Definition at line 1802 of file class.ilObjSCORM2004LearningModule.php.

{
include_once("./Modules/File/classes/class.ilObjFile.php");
foreach ($this->file_ids as $file_id)
{
$expLog->write(date("[y-m-d H:i:s] ")."File Item ".$file_id);
$file_obj = new ilObjFile($file_id, false);
$file_obj->export($a_target_dir);
unset($file_obj);
}
}
ilObjSCORM2004LearningModule::exportHTML (   $a_inst,
  $a_target_dir,
$expLog,
  $a_one_file = "" 
)

Export SCORM package to HTML.

Definition at line 1526 of file class.ilObjSCORM2004LearningModule.php.

References exportHTMLScoObjects(), ilObject\getTitle(), xslt_create(), and xslt_free().

Referenced by exportHTMLOne().

{
// $a_xml_writer = new ilXmlWriter;
// set dtd definition
// $a_xml_writer->xmlSetDtdDef("<!DOCTYPE ContentObject SYSTEM \"http://www.ilias.de/download/dtd/ilias_co_3_7.dtd\">");
// set generated comment
// $a_xml_writer->xmlSetGenCmt("Export of ILIAS Content Module ". $this->getId()." of installation ".$a_inst.".");
// set xml header
// $a_xml_writer->xmlHeader();
// global $ilBench;
// $a_xml_writer->xmlStartTag("ContentObject", array("Type"=>"SCORM2004LearningModule"));
// $expLog->write(date("[y-m-d H:i:s] ")."Start Export Sco Objects");
$this->exportHTMLScoObjects($a_inst, $a_target_dir, $expLog, $a_one_file);
// $expLog->write(date("[y-m-d H:i:s] ")."Finished Export Sco Objects");
// $a_xml_writer->xmlEndTag("ContentObject");
/*$toc_tpl = new ilTemplate("tpl.main.html", true, true, false);
$style_name = $ilUser->prefs["style"].".css";
$tpl->setCurrentBlock("css_file");
$tpl->setVariable("CSS_FILE", $style_name);
$tpl->parseCurrentBlock();*/
if ($a_one_file == "")
{
include_once("./Modules/Scorm2004/classes/class.ilContObjectManifestBuilder.php");
$manifestBuilder = new ilContObjectManifestBuilder($this);
$manifestBuilder->buildManifest('12');
include_once("Services/Frameset/classes/class.ilFramesetGUI.php");
$fs_gui = new ilFramesetGUI();
$fs_gui->setFramesetTitle($this->getTitle());
$fs_gui->setMainFrameSource("");
$fs_gui->setSideFrameSource("toc.html");
$fs_gui->setMainFrameName("content");
$fs_gui->setSideFrameName("toc");
$output = $fs_gui->get();
fputs(fopen($a_target_dir.'/index.html','w+'),$output);
$xsl = file_get_contents("./Modules/Scorm2004/templates/xsl/module.xsl");
$xml = simplexml_load_string($manifestBuilder->writer->xmlDumpMem());
$args = array( '/_xml' => $xml->organizations->organization->asXml(), '/_xsl' => $xsl );
$xh = xslt_create();
$output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args,NULL);
xslt_free($xh);
fputs(fopen($a_target_dir.'/toc.html','w+'),$output);
}
// $a_xml_writer->_XmlWriter;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSCORM2004LearningModule::exportHTML4PDF (   $a_inst,
  $a_target_dir,
$expLog 
)

Definition at line 1445 of file class.ilObjSCORM2004LearningModule.php.

References $ilBench, ilObject\getId(), and ilUtil\makeDir().

{
global $ilBench;
$tree = new ilTree($this->getId());
$tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
$tree->setTreeTablePK("slm_id");
foreach($tree->getSubTree($tree->getNodeData($tree->getRootId()),true,'sco') as $sco)
{
include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
$sco_folder = $a_target_dir."/".$sco['obj_id'];
ilUtil::makeDir($sco_folder);
$node = new ilSCORM2004Sco($this,$sco['obj_id']);
$node->exportHTML4PDF($a_inst, $sco_folder, $expLog);
}
}

+ Here is the call graph for this function:

ilObjSCORM2004LearningModule::exportHTMLOne (   $a_inst,
  $a_target_dir,
$expLog 
)

Definition at line 1516 of file class.ilObjSCORM2004LearningModule.php.

References exportHTML().

{
$one_file = fopen($a_target_dir.'/index.html','w+');
$this->exportHTML($a_inst, $a_target_dir, $expLog, $one_file);
fclose($one_file);
}

+ Here is the call graph for this function:

ilObjSCORM2004LearningModule::exportHTMLScoObjects (   $a_inst,
  $a_target_dir,
$expLog,
  $a_one_file = "" 
)

Definition at line 1664 of file class.ilObjSCORM2004LearningModule.php.

References $ilBench, ilObjSAHSLearningModule\getAssignedGlossary(), ilObject\getId(), ilCOPageHTMLExport\getPreparedMainTemplate(), ilUtil\makeDir(), prepareHTMLExporter(), xslt_create(), and xslt_free().

Referenced by exportHTML().

{
global $ilBench;
$tree = new ilTree($this->getId());
$tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
$tree->setTreeTablePK("slm_id");
// copy all necessary files now
if ($a_one_file != "")
{
$this->prepareHTMLExporter($a_target_dir);
// put header into file
$sco_tpl = new ilTemplate("tpl.sco.html", true, true, "Modules/Scorm2004");
include_once("./Services/COPage/classes/class.ilCOPageHTMLExport.php");
$sco_tpl->setCurrentBlock("js_file");
$sco_tpl->setVariable("JS_FILE", "./js/pure.js");
$sco_tpl->parseCurrentBlock();
$sco_tpl->setCurrentBlock("js_file");
$sco_tpl->setVariable("JS_FILE", "./js/question_handling.js");
$sco_tpl->parseCurrentBlock();
$sco_tpl->setCurrentBlock("head");
$sco_tpl->parseCurrentBlock();
fputs($a_one_file, $sco_tpl->get("head"));
// toc
include_once("./Modules/Scorm2004/classes/class.ilContObjectManifestBuilder.php");
$manifestBuilder = new ilContObjectManifestBuilder($this);
$manifestBuilder->buildManifest('12');
$xsl = file_get_contents("./Modules/Scorm2004/templates/xsl/module.xsl");
$xml = simplexml_load_string($manifestBuilder->writer->xmlDumpMem());
$args = array( '/_xml' => $xml->organizations->organization->asXml(), '/_xsl' => $xsl );
$xh = xslt_create();
$params = array("one_page" => "y");
$output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args,$params);
xslt_free($xh);
fputs($a_one_file, $output);
}
foreach($tree->getSubTree($tree->getNodeData($tree->getRootId()),true,'sco') as $sco)
{
include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
$sco_folder = $a_target_dir."/".$sco['obj_id'];
ilUtil::makeDir($sco_folder);
$node = new ilSCORM2004Sco($this,$sco['obj_id']);
if ($a_one_file == "")
{
$node->exportHTML($a_inst, $sco_folder, $expLog, $a_one_file);
}
else
{
$node->exportHTMLPageObjects($a_inst, $a_target_dir, $expLog, 'full',
"sco", $a_one_file, $sco_tpl);
}
if($this->getAssignedGlossary()!=0)
{
include_once("./Modules/Glossary/classes/class.ilObjGlossary.php");
$glos = new ilObjGlossary($this->getAssignedGlossary(),false);
//$glos->exportHTML($sco_folder."/glossary", $expLog);
}
}
// copy all necessary files now
if ($a_one_file != "")
{
// put tail into file
fputs($a_one_file, $sco_tpl->get("tail"));
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSCORM2004LearningModule::exportPDF (   $a_inst,
  $a_target_dir,
$expLog 
)

Definition at line 1461 of file class.ilObjSCORM2004LearningModule.php.

References $ilBench, $results, exportXMLMetaData(), ilObjSAHSLearningModule\getAssignedGlossary(), ilObject\getId(), ilUtil\makeDir(), ilFileUtils\recursive_dirscan(), and ilXmlWriter\xmlStartTag().

{
global $ilBench;
$a_xml_writer = new ilXmlWriter;
$a_xml_writer->xmlStartTag("ContentObject", array("Type"=>"SCORM2004SCO"));
$this->exportXMLMetaData($a_xml_writer);
$tree = new ilTree($this->getId());
$tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
$tree->setTreeTablePK("slm_id");
foreach($tree->getSubTree($tree->getNodeData($tree->getRootId()),true,'sco') as $sco)
{
include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
$sco_folder = $a_target_dir."/".$sco['obj_id'];
ilUtil::makeDir($sco_folder);
$node = new ilSCORM2004Sco($this,$sco['obj_id']);
$node->exportPDFPrepareXmlNFiles($a_inst, $a_target_dir, $expLog, $a_xml_writer);
}
if($this->getAssignedGlossary()!=0)
{
ilUtil::makeDir($a_target_dir."/glossary");
include_once("./Modules/Glossary/classes/class.ilObjGlossary.php");
include_once("./Modules/Glossary/classes/class.ilGlossaryExport.php");
$glos = new ilObjGlossary($this->getAssignedGlossary(), false);
$glos_export = new ilGlossaryExport($glos,"xml");
$glos->exportXML($a_xml_writer,$glos_export->getInstId(), $a_target_dir."/glossary", $expLog);
}
$a_xml_writer->xmlEndTag("ContentObject");
include_once 'Services/Transformation/classes/class.ilXML2FO.php';
$xml2FO = new ilXML2FO();
$xml2FO->setXSLTLocation('./Modules/Scorm2004/templates/xsl/contentobject2fo.xsl');
$xml2FO->setXMLString($a_xml_writer->xmlDumpMem());
$xml2FO->setXSLTParams(array ('target_dir' => $a_target_dir));
$xml2FO->transform();
$fo_string = $xml2FO->getFOString();
$fo_xml = simplexml_load_string($fo_string);
$fo_ext = $fo_xml->xpath("//fo:declarations");
$fo_ext = $fo_ext[0];
$results = array();
include_once "./Services/Utilities/classes/class.ilFileUtils.php";
ilFileUtils::recursive_dirscan($a_target_dir."/objects", $results);
if (is_array($results["file"]))
{
foreach ($results["file"] as $key => $value)
{
$e = $fo_ext->addChild("fox:embedded-file","","http://xml.apache.org/fop/extensions");
$e->addAttribute("src",$results[path][$key].$value);
$e->addAttribute("name",$value);
$e->addAttribute("desc","");
}
}
$fo_string = $fo_xml->asXML();
$a_xml_writer->_XmlWriter;
return $fo_string;
}

+ Here is the call graph for this function:

ilObjSCORM2004LearningModule::exportScorm (   $a_inst,
  $a_target_dir,
  $ver,
$expLog 
)

Export (authoring) scorm package.

Definition at line 1333 of file class.ilObjSCORM2004LearningModule.php.

References $ilBench, ilScormExportUtil\exportContentCSS(), exportXMLMetaData(), exportXMLScoObjects(), exportXMLStructureObjects(), ilObjSAHSLearningModule\getAssignedGlossary(), ilObject\getId(), ilUtil\makeDir(), ilUtil\rCopy(), ilXmlWriter\xmlSetDtdDef(), xslt_create(), and xslt_free().

{
$a_xml_writer = new ilXmlWriter;
// export metadata
$this->exportXMLMetaData($a_xml_writer);
$metadata_xml = $a_xml_writer->xmlDumpMem(false);
$a_xml_writer->_XmlWriter;
$xsl = file_get_contents("./Modules/Scorm2004/templates/xsl/metadata.xsl");
$args = array( '/_xml' => $metadata_xml , '/_xsl' => $xsl );
$xh = xslt_create();
$output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args,NULL);
xslt_free($xh);
file_put_contents($a_target_dir.'/indexMD.xml',$output);
// export glossary
if($this->getAssignedGlossary()!=0)
{
ilUtil::makeDir($a_target_dir."/glossary");
include_once("./Modules/Glossary/classes/class.ilObjGlossary.php");
include_once("./Modules/Glossary/classes/class.ilGlossaryExport.php");
$glo_xml_writer = new ilXmlWriter();
$glo_xml_writer->xmlSetDtdDef("<!DOCTYPE ContentObject SYSTEM \"http://www.ilias.de/download/dtd/ilias_co_3_7.dtd\">");
// set xml header
$glo_xml_writer->xmlHeader();
$glos = new ilObjGlossary($this->getAssignedGlossary(), false);
//$glos->exportHTML($a_target_dir."/glossary", $expLog);
$glos_export = new ilGlossaryExport($glos,"xml");
$glos->exportXML($glo_xml_writer,$glos_export->getInstId(), $a_target_dir."/glossary", $expLog);
$glo_xml_writer->xmlDumpFile($a_target_dir."/glossary/glossary.xml");
$glo_xml_writer->_XmlWriter;
}
$a_xml_writer = new ilXmlWriter;
// set dtd definition
$a_xml_writer->xmlSetDtdDef("<!DOCTYPE ContentObject SYSTEM \"http://www.ilias.de/download/dtd/ilias_co_3_7.dtd\">");
// set generated comment
$a_xml_writer->xmlSetGenCmt("Export of ILIAS Content Module ". $this->getId()." of installation ".$a_inst.".");
// set xml header
$a_xml_writer->xmlHeader();
global $ilBench;
$a_xml_writer->xmlStartTag("ContentObject", array("Type"=>"SCORM2004LearningModule"));
// MetaData
$this->exportXMLMetaData($a_xml_writer);
$this->exportXMLStructureObjects($a_xml_writer, $a_inst, $expLog);
// SCO Objects
$expLog->write(date("[y-m-d H:i:s] ")."Start Export Sco Objects");
$this->exportXMLScoObjects($a_inst, $a_target_dir, $ver, $expLog);
$expLog->write(date("[y-m-d H:i:s] ")."Finished Export Sco Objects");
$a_xml_writer->xmlEndTag("ContentObject");
$a_xml_writer->xmlDumpFile($a_target_dir.'/index.xml', false);
if ($ver == "2004 4th") {
$revision ="4th";
$ver = "2004";
}
if ($ver == "2004 3rd") {
$revision ="3rd";
$ver = "2004";
}
// add content css (note: this is also done per item)
$css_dir = $a_target_dir."/ilias_css_4_2";
ilUtil::makeDir($css_dir);
include_once("./Modules/Scorm2004/classes/class.ilScormExportUtil.php");
// add manifest
include_once("./Modules/Scorm2004/classes/class.ilContObjectManifestBuilder.php");
$manifestBuilder = new ilContObjectManifestBuilder($this);
$manifestBuilder->buildManifest($ver,$revision);
$manifestBuilder->dump($a_target_dir);
$xsl = file_get_contents("./Modules/Scorm2004/templates/xsl/module.xsl");
$args = array( '/_xml' => file_get_contents($a_target_dir."/imsmanifest.xml"), '/_xsl' => $xsl );
$xh = xslt_create();
$output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args,NULL);
xslt_free($xh);
fputs(fopen($a_target_dir.'/index.html','w+'),$output);
// copy xsd files to target
switch ($ver)
{
case "2004":
if ($revision == "3rd") {
ilUtil::rCopy('./Modules/Scorm2004/templates/xsd/adlcp_130_export_2004',$a_target_dir,false);
}
if ($revision == "4th") {
ilUtil::rCopy('./Modules/Scorm2004/templates/xsd/adlcp_130_export_2004_4th',$a_target_dir,false);
}
break;
case "12":
ilUtil::rCopy('./Modules/Scorm2004/templates/xsd/adlcp_120_export_12',$a_target_dir,false);
break;
}
$a_xml_writer->_XmlWriter;
}

+ Here is the call graph for this function:

ilObjSCORM2004LearningModule::exportXMLMetaData ( $a_xml_writer)

export content objects meta data to xml (see ilias_co.dtd)

Parameters
object$a_xml_writerilXmlWriter object that receives the xml data

Definition at line 1589 of file class.ilObjSCORM2004LearningModule.php.

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

Referenced by exportPDF(), and exportScorm().

{
include_once("Services/MetaData/classes/class.ilMD2XML.php");
$md2xml = new ilMD2XML($this->getId(), 0, $this->getType());
$md2xml->setExportMode(true);
$md2xml->startExport();
$a_xml_writer->appendXML($md2xml->getXML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSCORM2004LearningModule::exportXMLScoObjects (   $a_inst,
  $a_target_dir,
  $ver,
$expLog 
)

export page objects to xml (see ilias_co.dtd)

Parameters
object$a_xml_writerilXmlWriter object that receives the xml data

Definition at line 1631 of file class.ilObjSCORM2004LearningModule.php.

References $ilBench, ilObject\getId(), and ilUtil\makeDir().

Referenced by exportScorm().

{
global $ilBench;
$tree = new ilTree($this->getId());
$tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
$tree->setTreeTablePK("slm_id");
foreach($tree->getSubTree($tree->getNodeData($tree->getRootId()),true,array('sco','ass')) as $sco)
{
if ($sco['type'] == "sco")
{
include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
$sco_folder = $a_target_dir."/".$sco['obj_id'];
ilUtil::makeDir($sco_folder);
$node = new ilSCORM2004Sco($this,$sco['obj_id']);
$node->exportScorm($a_inst, $sco_folder, $ver, $expLog);
}
if ($sco['type'] == "ass")
{
include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Asset.php");
$sco_folder = $a_target_dir."/".$sco['obj_id'];
ilUtil::makeDir($sco_folder);
$node = new ilSCORM2004Asset($this,$sco['obj_id']);
$node->exportScorm($a_inst, $sco_folder, $ver, $expLog);
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSCORM2004LearningModule::exportXMLStructureObjects ( $a_xml_writer,
  $a_inst,
$expLog 
)

export structure objects to xml (see ilias_co.dtd)

Parameters
object$a_xml_writerilXmlWriter object that receives the xml data

Definition at line 1604 of file class.ilObjSCORM2004LearningModule.php.

References ilObject\getId().

Referenced by exportScorm().

{
include_once("Services/MetaData/classes/class.ilMD2XML.php");
$tree = new ilTree($this->getId());
$tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
$tree->setTreeTablePK("slm_id");
$a_xml_writer->xmlStartTag("StructureObject");
foreach($tree->getFilteredSubTree($tree->getRootId(),Array('page')) as $obj)
{
if($obj['type']=='') continue;
//$md2xml = new ilMD2XML($obj['obj_id'], 0, $obj['type']);
$md2xml = new ilMD2XML($this->getId(), $obj['obj_id'], $obj['type']);
$md2xml->setExportMode(true);
$md2xml->startExport();
$a_xml_writer->appendXML($md2xml->getXML());
}
$a_xml_writer->xmlEndTag("StructureObject");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSCORM2004LearningModule::fixReload ( )

Definition at line 231 of file class.ilObjSCORM2004LearningModule.php.

References $out.

Referenced by convert_1_2_to_2004().

{
$out = file_get_contents($this->imsmanifestFile);
$check ='/xmlns="http:\/\/www.imsglobal.org\/xsd\/imscp_v1p1"/';
$replace="xmlns=\"http://www.imsproject.org/xsd/imscp_rootv1p1p2\"";
$out=preg_replace($check, $replace, $out);
file_put_contents($this->imsmanifestFile, $out);
}

+ Here is the caller graph for this function:

ilObjSCORM2004LearningModule::getAttemptsForUser (   $a_user_id)

get number of atttempts for a certain user and package

Reimplemented from ilObjSCORMLearningModule.

Definition at line 499 of file class.ilObjSCORM2004LearningModule.php.

References $ilDB, and ilObject\getId().

{
global $ilDB;
$val_set = $ilDB->queryF('SELECT package_attempts FROM sahs_user WHERE user_id = %s AND obj_id = %s',
array('integer','integer'),
array($a_user_id, $this->getId()));
$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:

ilObjSCORM2004LearningModule::getCourseCompletionForUser (   $a_user)

Reimplemented from ilObjSCORMLearningModule.

Definition at line 700 of file class.ilObjSCORM2004LearningModule.php.

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

{
global $ilDB, $ilUser;
$scos = array();
//get all SCO's of this object
$val_set = $ilDB->queryF('
SELECT cp_node.cp_node_id FROM cp_node,cp_resource,cp_item
WHERE cp_item.cp_node_id = cp_node.cp_node_id
AND cp_item.resourceid = cp_resource.id
AND scormtype = %s
AND nodename = %s
AND cp_node.slm_id = %s ',
array('text','text','integer'),
array('sco','item',$this->getId()));
while ($val_rec = $ilDB->fetchAssoc($val_set))
{
array_push($scos,$val_rec['cp_node_id']);
}
$scos_c = $scos;
//copy SCO_array
//check if all SCO's are completed
for ($i=0;$i<count($scos);$i++)
{
$val_set = $ilDB->queryF('
SELECT * FROM cmi_node
WHERE (user_id= %s
AND cp_node_id= %s
AND (completion_status=%s OR success_status=%s))',
array('integer','integer','text', 'text'),
array($a_user,$scos[$i],'completed','passed')
);
if ($ilDB->numRows($val_set) > 0) {
//delete from array
$key = array_search($scos[$i], $scos_c);
unset ($scos_c[$key]);
}
}
//check for completion
if (count($scos_c) == 0) {
$completion = true;
} else {
$completion = false;
}
return $completion;
}

+ Here is the call graph for this function:

ilObjSCORM2004LearningModule::getExportFiles ( )

Definition at line 1286 of file class.ilObjSCORM2004LearningModule.php.

References $file, ilObject\$type, and ilObject\getType().

{
$file = array();
require_once("./Modules/Scorm2004/classes/class.ilSCORM2004Export.php");
$export = new ilSCORM2004Export($this);
foreach ($export->getSupportedExportTypes() as $type)
{
$dir = $export->getExportDirectoryForType($type);
// quit if import dir not available
if (!@is_dir($dir) or !is_writeable($dir))
{
continue;
}
// open directory
$cdir = dir($dir);
// get files and save the in the array
while ($entry = $cdir->read())
{
if ($entry != "." and
$entry != ".." and
(
ereg("^[0-9]{10}_{2}[0-9]+_{2}(".$this->getType()."_)*[0-9]+\.zip\$", $entry) or
ereg("^[0-9]{10}_{2}[0-9]+_{2}(".$this->getType()."_)*[0-9]+\.pdf\$", $entry) or
ereg("^[0-9]{10}_{2}[0-9]+_{2}(".$this->getType()."_)*[0-9]+\.iso\$", $entry)
))
{
$file[$entry.$type] = array("type" => $type, "file" => $entry,
"size" => filesize($dir."/".$entry));
}
}
// close import directory
$cdir->close();
}
// sort files
ksort ($file);
reset ($file);
return $file;
}

+ Here is the call graph for this function:

ilObjSCORM2004LearningModule::getImportSequencing ( )

Get import sequencing.

Returns
boolean import sequencing information

Definition at line 51 of file class.ilObjSCORM2004LearningModule.php.

Referenced by readObject().

{
return $this->import_sequencing;
}

+ Here is the caller graph for this function:

ilObjSCORM2004LearningModule::getModuleVersionForUser (   $a_user_id)

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

Reimplemented from ilObjSCORMLearningModule.

Definition at line 518 of file class.ilObjSCORM2004LearningModule.php.

References $ilDB, and ilObject\getId().

{
global $ilDB;
$val_set = $ilDB->queryF('SELECT module_version FROM sahs_user WHERE user_id = %s AND obj_id = %s',
array('integer','integer'),
array($a_user_id, $this->getId()));
$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:

ilObjSCORM2004LearningModule::getPublicExportFile (   $a_type)

get public export file

Parameters
string$a_typetype ("xml" / "html")
Returns
string $a_file file name

Definition at line 1793 of file class.ilObjSCORM2004LearningModule.php.

{
return $this->public_export_file[$a_type];
}
ilObjSCORM2004LearningModule::getSequencingSettings ( )

Definition at line 1010 of file class.ilObjSCORM2004LearningModule.php.

References ilObject\getId().

{
global $ilTabs;
$ilTabs->setTabActive("sequencing");
include_once ("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Sequencing.php");
$control_settings = new ilSCORM2004Sequencing($this->getId(),true);
return $control_settings;
}

+ Here is the call graph for this function:

ilObjSCORM2004LearningModule::getTrackedItems ( )

get all tracked items of current user

Reimplemented from ilObjSCORMLearningModule.

Definition at line 401 of file class.ilObjSCORM2004LearningModule.php.

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

{
global $ilUser, $ilDB, $ilUser;
$sco_set = $ilDB->queryF('
SELECT DISTINCT cmi_node.cp_node_id id
FROM cp_node, cmi_node
WHERE slm_id = %s
AND cp_node.cp_node_id = cmi_node.cp_node_id
ORDER BY cp_node.cp_node_id ',
array('integer'),
array($this->getId()));
$items = array();
while($sco_rec = $ilDB->fetchAssoc($sco_set))
{
$item['id']=$sco_rec["id"];
$item['title']=self::_lookupItemTitle($sco_rec["id"]);
$items[count($items)] =$item;
}
return $items;
}

+ Here is the call graph for this function:

ilObjSCORM2004LearningModule::getTrackingDataAgg (   $a_user_id,
  $raw = false 
)

Definition at line 427 of file class.ilObjSCORM2004LearningModule.php.

References $ilDB, ilObject\$title, _ISODurationToCentisec(), _lookupItemTitle(), ilFormat\_secondsToString(), ilDatePresentation\formatDate(), ilObject\getId(), and IL_CAL_UNIX.

{
global $ilDB;
$scos = array();
$data = array();
//get all SCO's of this object
$val_set = $ilDB->queryF(
'SELECT cp_node_id FROM cp_node
WHERE nodename = %s
AND cp_node.slm_id = %s',
array('text', 'integer'),
array('item',$this->getId())
);
while($val_rec = $ilDB->fetchAssoc($val_set))
{
array_push($scos,$val_rec['cp_node_id']);
}
foreach ($scos as $sco)
{
$data_set = $ilDB->queryF('
SELECT c_timestamp last_access, total_time, success_status, completion_status,
c_raw, scaled, cp_node_id
FROM cmi_node
WHERE cp_node_id = %s
AND user_id = %s',
array('integer','integer'),
array($sco,$a_user_id)
);
while($data_rec = $ilDB->fetchAssoc($data_set))
{
if ($data_rec["success_status"]!="" && $data_rec["success_status"]!="unknown") {
$status = $data_rec["success_status"];
} else {
if ($data_rec["completion_status"]=="") {
$status="unknown";
} else {
$status = $data_rec["completion_status"];
}
}
if(!$raw)
{
$time = ilFormat::_secondsToString(self::_ISODurationToCentisec($data_rec["total_time"])/100);
$score = "";
if ($data_rec["c_raw"] != null) {
$score = $data_rec["c_raw"];
if ($data_rec["scaled"] != null) $score .= " = ";
}
if ($data_rec["scaled"] != null) $score .= ($data_rec["scaled"]*100)."%";
$title = self::_lookupItemTitle($data_rec["cp_node_id"]);
$last_access=ilDatePresentation::formatDate(new ilDateTime($data_rec['last_access'],IL_CAL_UNIX));
$data[] = array("user_id" => $data_rec["user_id"], "sco_id"=>$data_rec["cp_node_id"],
"score" => $score, "time" => $time, "status" => $status,"last_access"=>$last_access,"title"=>$title);
}
else
{
$data_rec["total_time"] = self::_ISODurationToCentisec($data_rec["total_time"])/100;
$data[$data_rec["cp_node_id"]] = $data_rec;
}
}
}
return $data;
}

+ Here is the call graph for this function:

ilObjSCORM2004LearningModule::getTree ( )

Definition at line 1002 of file class.ilObjSCORM2004LearningModule.php.

References ilObject\getId().

Referenced by copyAuthoredContent().

{
$this->slm_tree = new ilTree($this->getId());
$this->slm_tree->setTreeTablePK("slm_id");
$this->slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
return $this->slm_tree;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSCORM2004LearningModule::ilObjSCORM2004LearningModule (   $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 30 of file class.ilObjSCORM2004LearningModule.php.

References ilObject\ilObject().

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

+ Here is the call graph for this function:

ilObjSCORM2004LearningModule::importSuccess (   $a_file)

Reimplemented from ilObjSCORMLearningModule.

Definition at line 541 of file class.ilObjSCORM2004LearningModule.php.

References $ilDB, $ilUser, $res, ilLPStatusWrapper\_refreshStatus(), ilObjSCORMLearningModule\get_user_id(), ilObject\getId(), ilObjectLP\getInstance(), ilObjSCORMLearningModule\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().

{
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();
$users = array();
$fields = fgetcsv($fhandle, 4096, ';');
while(($csv_rows = fgetcsv($fhandle, 4096, ";")) !== 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)
{
$res = $ilDB->queryF('
SELECT * FROM cmi_node WHERE cp_node_id = %s AND user_id = %s AND (completion_status = %s OR success_status = %s)',
array('integer','integer','text','text'),
array($sco_id,$user_id,'completed','passed'));
if(!$ilDB->numRows($res))
{
$nextId = $ilDB->nextId('cmi_node');
$val_set = $ilDB->manipulateF('INSERT INTO cmi_node
(cp_node_id,user_id,completion_status,c_timestamp,cmi_node_id)
VALUES(%s,%s,%s,%s,%s)',
array('integer','integer','text','timestamp','integer'),
array($sco_id,$user_id,'completed',$last_access,$nextId));
} else {
$ilDB->update('cmi_node',
array(
'completion_status' => array('text', 'completed'),
'success_status' => array('text', ''),
'c_timestamp' => array('timestamp', $last_access)
),
array(
'user_id' => array('integer', $user_id),
'cp_node_id' => array('integer', $sco_id)
)
);
}
}
}
} else {
//echo "Warning! User $csv_rows[0] does not exist in ILIAS. Data for this user was skipped.\n";
}
}
// update learning progress
include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
return 0;
}

+ Here is the call graph for this function:

ilObjSCORM2004LearningModule::prepareHTMLExporter (   $a_target_dir)

Prepare HTML exporter.

Parameters
@return

Definition at line 1748 of file class.ilObjSCORM2004LearningModule.php.

References ilPlayerUtil\copyPlayerFilesToTargetDirectory(), ilObjStyleSheet\getEffectiveContentStyleId(), ilPlayerUtil\getFlashVideoPlayerDirectory(), ilObjSAHSLearningModule\getStyleSheetId(), and ilUtil\makeDir().

Referenced by exportHTMLScoObjects().

{
// system style html exporter
include_once("./Services/Style/classes/class.ilSystemStyleHTMLExport.php");
$this->sys_style_html_export = new ilSystemStyleHTMLExport($a_target_dir);
$this->sys_style_html_export->export();
// init co page html exporter
include_once("./Services/COPage/classes/class.ilCOPageHTMLExport.php");
$this->co_page_html_export = new ilCOPageHTMLExport($a_target_dir);
include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
$this->co_page_html_export->setContentStyleId(
$this->co_page_html_export->createDirectories();
$this->co_page_html_export->exportStyles();
$this->co_page_html_export->exportSupportScripts();
include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
$this->flv_dir = $a_target_dir."/".ilPlayerUtil::getFlashVideoPlayerDirectory();
ilUtil::makeDir($a_target_dir.'/css/yahoo');
ilUtil::makeDir($a_target_dir.'/objects');
ilUtil::makeDir($a_target_dir.'/players');
ilUtil::makeDir($this->flv_dir);
include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
// copy(ilPlayerUtil::getFlashVideoPlayerFilename(true),
// $a_target_dir.'/js/'.ilPlayerUtil::getFlashVideoPlayerFilename());
copy('./Modules/Scorm2004/scripts/scorm_2004.js',$a_target_dir.'/js/scorm.js');
copy('./Modules/Scorm2004/scripts/pager.js',$a_target_dir.'/js/pager.js');
copy('./Modules/Scorm2004/scripts/questions/pure.js',$a_target_dir.'/js/pure.js');
copy('./Modules/Scorm2004/scripts/questions/question_handling.js',
$a_target_dir.'/js/question_handling.js');
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSCORM2004LearningModule::readObject ( )

read manifest file public

Reimplemented from ilObjSCORMLearningModule.

Definition at line 73 of file class.ilObjSCORM2004LearningModule.php.

References $_POST, $ilDB, ilObject\$ilias, ilObject\$lng, $n, convert_1_2_to_2004(), ilObjSAHSLearningModule\getDataDirectory(), ilObjSAHSLearningModule\getEditable(), ilObject\getId(), getImportSequencing(), ilObjSCORMLearningModule\getValidationSummary(), and validate().

{
global $ilias, $lng ,$ilDB;
//check for MYSQL 4.1 and json_encode,json_decode
if (!function_exists('json_encode') || !function_exists('json_decode') || ($ilDB->getDBType() == 'mysql' && !$ilDB->isMysql4_1OrHigher())) {
$ilias->raiseError($lng->txt('scplayer_phpmysqlcheck'),$ilias->error_obj->WARNING);
}
$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()))
{
$this->ilias->raiseError("<b>Validation Error(s):</b><br>".$this->getValidationSummary(),
$this->ilias->error_obj->WARNING);
}
}
//check for SCORM 1.2
$this->convert_1_2_to_2004($manifest_file);
// start SCORM 2004 package parser/importer
include_once ("./Modules/Scorm2004/classes/ilSCORM13Package.php");
$newPack = new ilSCORM13Package();
if ($this->getEditable())
{
return $newPack->il_importLM($this,$this->getDataDirectory(),
}
else
{
return $newPack->il_import($this->getDataDirectory(),$this->getId(),$this->ilias,$_POST["validate"]);
}
}

+ Here is the call graph for this function:

ilObjSCORM2004LearningModule::setImportSequencing (   $a_val)

Set import sequencing.

Parameters
boolean$a_valimport sequencing information

Definition at line 41 of file class.ilObjSCORM2004LearningModule.php.

{
$this->import_sequencing = $a_val;
}
ilObjSCORM2004LearningModule::setPublicExportFile (   $a_type,
  $a_file 
)

Definition at line 1818 of file class.ilObjSCORM2004LearningModule.php.

{
$this->public_export_file[$a_type] = $a_file;
}
ilObjSCORM2004LearningModule::updateSequencingSettings ( )

Definition at line 1021 of file class.ilObjSCORM2004LearningModule.php.

References $_POST, ilObject\getId(), and ilUtil\yn2tf().

{
include_once ("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Sequencing.php");
$control_settings = new ilSCORM2004Sequencing($this->getId(),true);
$control_settings->setChoice(ilUtil::yn2tf($_POST["choice"]));
$control_settings->setFlow(ilUtil::yn2tf($_POST["flow"]));
$control_settings->setForwardOnly(ilUtil::yn2tf($_POST["forwardonly"]));
$control_settings->insert();
return true;
}

+ Here is the call graph for this function:

ilObjSCORM2004LearningModule::validate (   $directory)

Validate all XML-Files in a SCOM-Directory.

public

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

Reimplemented from ilObjSCORMLearningModule.

Definition at line 62 of file class.ilObjSCORM2004LearningModule.php.

Referenced by readObject().

{
//$this->validator =& new ilObjSCORMValidator($directory);
//$returnValue = $this->validator->validate();
return true;
}

+ Here is the caller graph for this function:

Field Documentation

ilObjSCORM2004LearningModule::$validator

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

const ilObjSCORM2004LearningModule::CONVERT_XSL = './Modules/Scorm2004/templates/xsl/op/scorm12To2004.xsl'

Definition at line 20 of file class.ilObjSCORM2004LearningModule.php.

const ilObjSCORM2004LearningModule::WRAPPER_HTML = './Modules/Scorm2004/scripts/converter/GenericRunTimeWrapper1.0_aadlc/GenericRunTimeWrapper.htm'

Definition at line 21 of file class.ilObjSCORM2004LearningModule.php.

const ilObjSCORM2004LearningModule::WRAPPER_JS = './Modules/Scorm2004/scripts/converter/GenericRunTimeWrapper1.0_aadlc/SCOPlayerWrapper.js'

Definition at line 22 of file class.ilObjSCORM2004LearningModule.php.


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