ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 @access public. More...
 
 setImportSequencing ($a_val)
 Set import sequencing. More...
 
 getImportSequencing ()
 Get import sequencing. More...
 
 validate ($directory)
 Validate all XML-Files in a SCOM-Directory. More...
 
 readObject ()
 read manifest file @access public More...
 
 fixReload ()
 
 convert_1_2_to_2004 ($manifest)
 
 deleteTrackingDataOfUsers ($a_users)
 get all tracked items of current user More...
 
 getTrackedItems ()
 get all tracked items of current user More...
 
 getTrackingDataAgg ($a_user_id, $raw=false)
 
 getAttemptsForUser ($a_user_id)
 get number of atttempts for a certain user and package More...
 
 getModuleVersionForUser ($a_user_id)
 get module version that tracking data for a user was recorded on More...
 
 importSuccess ($a_file)
 
 _ISODurationToCentisec ($str)
 convert ISO 8601 Timeperiods to centiseconds ta More...
 
 getCourseCompletionForUser ($a_user)
 
 _getTrackingItems ($a_obj_id)
 get all tracking items of scorm object More...
 
 createScorm2004Tree ()
 Create Scorm 2004 Tree used by Editor. More...
 
 getTree ()
 
 getSequencingSettings ()
 
 updateSequencingSettings ()
 
 executeDragDrop ($source_id, $target_id, $first_child, $as_subitem=false, $movecopy="move")
 Execute Drag Drop Action. More...
 
 getExportFiles ()
 
 exportScorm ($a_inst, $a_target_dir, $ver, &$expLog)
 Export (authoring) scorm package. More...
 
 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. More...
 
 exportXMLMetaData (&$a_xml_writer)
 export content objects meta data to xml (see ilias_co.dtd) More...
 
 exportXMLStructureObjects (&$a_xml_writer, $a_inst, &$expLog)
 export structure objects to xml (see ilias_co.dtd) More...
 
 exportXMLScoObjects ($a_inst, $a_target_dir, $ver, &$expLog)
 export page objects to xml (see ilias_co.dtd) More...
 
 exportHTMLScoObjects ($a_inst, $a_target_dir, &$expLog, $a_one_file="")
 
 prepareHTMLExporter ($a_target_dir)
 Prepare HTML exporter. More...
 
 getPublicExportFile ($a_type)
 get public export file More...
 
 exportFileItems ($a_target_dir, &$expLog)
 export files of file itmes More...
 
 setPublicExportFile ($a_type, $a_file)
 
 copyAuthoredContent ($a_new_obj)
 Copy authored content (everything done with the editor. More...
 
- Public Member Functions inherited from ilObjSCORMLearningModule
 ilObjSCORMLearningModule ($a_id=0, $a_call_by_reference=true)
 Constructor @access public. More...
 
 validate ($directory)
 Validate all XML-Files in a SCOM-Directory. More...
 
 getValidationSummary ()
 
 getTrackingItems ()
 
 _getTrackingItems ($a_obj_id)
 get all tracking items of scorm object @access static More...
 
 readObject ()
 read manifest file @access public More...
 
 setLearningProgressSettingsAtUpload ()
 set settings for learning progress determination per default at upload More...
 
 getTrackedItems ()
 get all tracked items of current user More...
 
 getTrackedUsers ($a_search)
 
 getAttemptsForUsers ()
 Get attempts for all users @global ilDB $ilDB. More...
 
 getAttemptsForUser ($a_user_id)
 get number of atttempts for a certain user and package More...
 
 getModuleVersionForUsers ()
 Get module version for users. More...
 
 getModuleVersionForUser ($a_user_id)
 get module version that tracking data for a user was recorded on More...
 
 getTrackingDataPerUser ($a_sco_id, $a_user_id)
 Get tracking data per user @global ilDB $ilDB. More...
 
 getTrackingDataAgg ($a_user_id)
 
 getTrackingDataAggSco ($a_sco_id)
 
 exportSelected ($a_all, $a_users=array())
 Export selected user tracking data @global ilDB $ilDB @global ilObjUser $ilUser. More...
 
 importTrackingData ($a_file)
 
 importSuccess ($a_file)
 
 importSuccessForSahsUser ($user_id, $last_access, $status, $attempts=null, $percentage_completed=null, $sco_total_time_sec=null)
 
 decreaseAttemptsForUser ($a_user_id)
 Decrease attempts for user @global ilDB $ilDB. More...
 
 get_user_id ($a_login)
 
 getUserIdEmail ($a_mail)
 assumes that only one account exists for a mailadress More...
 
 sendExportFile ($a_header, $a_content)
 send export file to browser More...
 
 getAllScoIds ()
 
 getStatusForUser ($a_user, $a_allScoIds, $a_numerical=false)
 
 getCourseCompletionForUser ($a_user)
 
 _getScoresForUser ($a_item_id, $a_user_id)
 
 getLastVisited ($user_id)
 
 deleteTrackingDataOfUsers ($a_users)
 
- Public Member Functions inherited from ilObjSAHSLearningModule
 ilObjSAHSLearningModule ($a_id=0, $a_call_by_reference=true)
 Constructor @access public. More...
 
 create ($upload=false)
 create file based lm More...
 
 read ()
 read object More...
 
 _lookupOnline ($a_id)
 check wether scorm module is online More...
 
 getAffectiveLocalization ($a_id)
 Get affective localization. More...
 
 _lookupSubType ($a_obj_id)
 lookup subtype id (scorm, aicc, hacp) More...
 
 setEditable ($a_editable)
 Set Editable. More...
 
 getEditable ()
 Get Editable. More...
 
 setTries ($a_tries)
 Set default tries for questions. More...
 
 getTries ()
 Get Tries. More...
 
 setLocalization ($a_val)
 Set localization. More...
 
 getLocalization ()
 Get localization. More...
 
 getDiskUsage ()
 Gets the disk usage of the object in bytes. More...
 
 createDataDirectory ()
 creates data directory for package files ("./data/lm_data/lm_<id>") More...
 
 getDataDirectory ($mode="filesystem")
 get data directory of lm More...
 
 getAPIAdapterName ()
 get api adapter name More...
 
 setAPIAdapterName ($a_api)
 set api adapter name More...
 
 getAPIFunctionsPrefix ()
 get api functions prefix More...
 
 setAPIFunctionsPrefix ($a_prefix)
 set api functions prefix More...
 
 getCreditMode ()
 get credit mode More...
 
 setCreditMode ($a_credit_mode)
 set credit mode More...
 
 setDefaultLessonMode ($a_lesson_mode)
 set default lesson mode More...
 
 getDefaultLessonMode ()
 get default lesson mode More...
 
 getStyleSheetId ()
 get ID of assigned style sheet object More...
 
 setStyleSheetId ($a_style_id)
 set ID of assigned style sheet object More...
 
 setAutoReview ($a_auto_review)
 set auto review as true/false for SCORM 1.2, HACP, SAHS, AICC More...
 
 getAutoReview ()
 get auto review as true/false for SCORM 1.2, HACP, SAHS, AICC More...
 
 setAutoReviewChar ($a_auto_review)
 set auto review as Char for SCORM 2004 More...
 
 getAutoReviewChar ()
 get auto review as Char for SCORM 2004 More...
 
 getMaxAttempt ()
 get max attempt More...
 
 setMaxAttempt ($a_max_attempt)
 set max attempt More...
 
 getModuleVersion ()
 get module version More...
 
 getAssignedGlossary ()
 get assigned glossary More...
 
 setAssignedGlossary ($a_assigned_glossary)
 set assigned glossary More...
 
 setModuleVersion ($a_module_version)
 set max attempt More...
 
 getSession ()
 get session setting More...
 
 setSession ($a_session)
 set session setting More...
 
 getNoMenu ()
 disable menu More...
 
 setNoMenu ($a_no_menu)
 disable menu More...
 
 getHideNavig ()
 hide navigation tree More...
 
 setHideNavig ($a_hide_navig)
 disable menu More...
 
 getCacheDeactivated ()
 BrowserCacheDisabled for SCORM 2004 / ENABLE_JS_DEBUG. More...
 
 getSessionDeactivated ()
 sessionDisabled for SCORM 2004 More...
 
 getDebugActivated ()
 debugActivated More...
 
 getIe_compatibility ()
 set compatibility mode for Internet Exlorer manually More...
 
 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 More...
 
 setIe_force_render ($a_ie_force_render)
 
 getFourth_Edition ()
 SCORM 2004 4th edition features. More...
 
 setFourth_edition ($a_fourth_edition)
 
 getSequencing ()
 sequencing More...
 
 setSequencing ($a_sequencing)
 
 getInteractions ()
 interactions More...
 
 setInteractions ($a_interactions)
 
 getObjectives ()
 objectives More...
 
 setObjectives ($a_objectives)
 
 getComments ()
 comments More...
 
 setComments ($a_comments)
 
 getTime_from_lms ()
 time_from_lms More...
 
 setTime_from_lms ($a_time_from_lms)
 
 getCheck_values ()
 check_values More...
 
 setCheck_values ($a_check_values)
 
 getOfflineMode ()
 offlineMode More...
 
 setOfflineMode ($a_offline_mode)
 
 getDebug ()
 debug More...
 
 setDebug ($a_debug)
 debug More...
 
 getDebugPw ()
 debug pw More...
 
 setDebugPw ($a_debug_pw)
 debug pw More...
 
 setAutoContinue ($a_auto_continue)
 get auto continue More...
 
 getAutoContinue ()
 set auto continue More...
 
 getAuto_last_visited ()
 auto_last_visited More...
 
 setAuto_last_visited ($a_auto_last_visited)
 
 setSequencingExpertMode ($a_val)
 Set sequencing expert mode. More...
 
 getSequencingExpertMode ()
 Get sequencing expert mode. More...
 
 setAutoSuspend ($a_auto_suspend)
 get auto continue More...
 
 getAutoSuspend ()
 set auto continue More...
 
 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 More...
 
 setOpenMode ($a_open_mode)
 
 getWidth ()
 width More...
 
 setWidth ($a_width)
 
 getHeight ()
 height More...
 
 setHeight ($a_height)
 
 getMasteryScore ()
 get mastery_score More...
 
 setMasteryScore ($a_mastery_score)
 set mastery_score More...
 
 checkMasteryScoreValues ()
 check mastery_score / min_normalized_measure of SCOs (SCORM 1.2) / objectives (SCORM 2004) More...
 
 getMasteryScoreValues ()
 get mastery_score_values More...
 
 update ()
 update values for mastery_score / min_normalized_measure in database - not requested More...
 
 setOnline ($a_online)
 get online More...
 
 getOnline ()
 set online More...
 
 setSubType ($a_sub_type)
 get sub type More...
 
 getSubType ()
 set sub type More...
 
 delete ()
 delete SCORM learning module and all related data More...
 
 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. More...
 
 getPointsInPercent ()
 Returns the points in percent for the learning module This is called by the certificate generator if [SCORM_POINTS] is inserted. More...
 
 getMaxPoints ()
 Returns score.max for the learning module, refered to the last sco where score.max is set. More...
 
 populateByDirectoy ($a_dir, $a_filename="")
 Populate by directory. More...
 
 cloneObject ($a_target_id, $a_copy_id=0)
 Clone scorm object. More...
 
 zipLmForOfflineMode ()
 
- Public Member Functions inherited from ilObject
 ilObject ($a_id=0, $a_reference=true)
 Constructor @access public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ($a_force_db=false)
 read object data from db into object More...
 
 getId ()
 get object id @access public More...
 
 setId ($a_id)
 set object id @access public More...
 
 setRefId ($a_id)
 set reference id @access public More...
 
 getRefId ()
 get reference id @access public More...
 
 getType ()
 get object type @access public More...
 
 setType ($a_type)
 set object type @access public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title @access public More...
 
 getUntranslatedTitle ()
 get untranslated object title @access public More...
 
 setTitle ($a_title)
 set object title More...
 
 getDescription ()
 get object description More...
 
 setDescription ($a_desc)
 set object description More...
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 get import id More...
 
 setImportId ($a_import_id)
 set import id More...
 
 getOwner ()
 get object owner More...
 
 getOwnerName ()
 
 _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date @access public More...
 
 getLastUpdateDate ()
 get last update date @access public More...
 
 getDiskUsage ()
 
 setObjDataRecord ($a_record)
 set object_data record (note: this method should only be called from the ilObjectFactory class) More...
 
 create ()
 create More...
 
 update ()
 update object in db More...
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 updateOwner ()
 update owner of object in db More...
 
 _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
 _lookupOwner ($a_id)
 lookup object owner More...
 
 _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
 _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
 _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree More...
 
 _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
 _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
 _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
 _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
 _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
 _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
 _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
 _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type More...
 
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!? More...
 
 setPermissions ($a_parent_ref)
 set permissions of object More...
 
 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. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 count references of object More...
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! More...
 
 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) @access public More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. More...
 
 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 passed, each object may decide how it reacts. More...
 
 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 ... More...
 
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies. More...
 
 cloneMetaData ($target_obj)
 Copy meta data. More...
 
 _lookupCreationDate ($a_id)
 Lookup creation date. More...
 
 getPossibleSubObjects ($a_filter=true)
 get all possible subobjects of this type the object can decide which types of subobjects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static _lookupLastAccess ($a_obj_id, $a_usr_id)
 Return the last access timestamp for a given user. More...
 
static _getCourseCompletionForUser ($a_id, $a_user)
 Get the completion of a SCORM module for a given user. More...
 
static _getUniqueScaledScoreForUser ($a_id, $a_user)
 Get the Unique Scaled Score of a course Conditions: Only one SCO may set cmi.score.scaled. More...
 
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. More...
 
static _getScores2004ForUser ($a_cp_node_id, $a_user)
 
- Static Public Member Functions inherited from ilObjSCORMLearningModule
static _lookupLastAccess ($a_obj_id, $a_usr_id)
 Return the last access timestamp for a given user. More...
 
static _getAllScoIds ($a_id)
 Get an array of id's for all Sco's in the module. More...
 
static _getStatusForUser ($a_id, $a_user, $a_allScoIds, $a_numerical=false)
 Get the status of a SCORM module for a given user. More...
 
static _getCourseCompletionForUser ($a_id, $a_user)
 Get the completion of a SCORM module for a given user. More...
 
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. More...
 
static lookupAssignedGlossary ($a_slm_id)
 Get SCORM modules that assign a certain glossary. More...
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId ($a_import_id)
 
static _lookupImportId ($a_obj_id)
 
static _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupObjId ($a_id)
 
static setDeletedDates ($a_ref_ids)
 Set deleted date @global type $ilDB. More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id More...
 
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data@access public More...
 
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type. More...
 
static _prepareCloneSelection ($a_ref_ids, $new_type, $show_path=true)
 Prepare copy wizard object selection. More...
 
static _getIcon ($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies ($a_obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $a_obj_ids)
 Get long description data. More...
 
static getAllOwnedRepositoryObjects ($a_user_id)
 Get all ids of objects user owns. More...
 
static fixMissingTitles ($a_type, array &$a_obj_title_map)
 Try to fix missing object titles. More...
 
static hasAutoRating ($a_type, $a_ref_id)
 Check if auto rating is active for parent group/course. More...
 

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 More...
 
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 More...
 

Detailed Description

Member Function Documentation

◆ _getCourseCompletionForUser()

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 783 of file class.ilObjSCORM2004LearningModule.php.

784 {
785 global $ilDB, $ilUser;
786 $scos = array();
787 //get all SCO's of the object
788
789 $val_set = $ilDB->queryF('
790 SELECT cp_node.cp_node_id FROM cp_node,cp_resource,cp_item
791 WHERE cp_item.cp_node_id = cp_node.cp_node_id
792 AND cp_item.resourceid = cp_resource.id
793 AND scormtype = %s
794 AND nodename = %s
795 AND cp_node.slm_id = %s',
796 array('text','text','integer'), array('sco' ,'item',$a_id));
797 while ($val_rec = $ilDB->fetchAssoc($val_set))
798 {
799 array_push($scos,$val_rec['cp_node_id']);
800 }
801
802 $scos_c = $scos;
803 //copy SCO_array
804 //check if all SCO's are completed
805 for ($i=0;$i<count($scos);$i++)
806 {
807
808 $val_set = $ilDB->queryF('
809 SELECT * FROM cmi_node
810 WHERE (user_id= %s
811 AND cp_node_id= %s
812 AND (completion_status = %s OR success_status = %s))',
813 array('integer','integer','text','text'),
814 array($a_user,$scos[$i],'completed','passed'));
815
816 if ($ilDB->numRows($val_set) > 0)
817 {
818 //delete from array
819 $key = array_search($scos[$i], $scos_c);
820 unset ($scos_c[$key]);
821 }
822
823 }
824 //check for completion
825 if (count($scos_c) == 0) {
826 $completion = true;
827 } else {
828 $completion = false;
829 }
830 return $completion;
831 }
global $ilDB
global $ilUser
Definition: imgupload.php:15

References $ilDB, and $ilUser.

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

+ Here is the caller graph for this function:

◆ _getMaxScoreForUser()

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 1856 of file class.ilObjSCORM2004LearningModule.php.

1857 {
1858 global $ilDB;
1859
1860 $scos = array();
1861
1862 $result = $ilDB->query(
1863 'SELECT cp_node.cp_node_id '
1864 .'FROM cp_node, cp_resource, cp_item '
1865 .'WHERE cp_item.cp_node_id = cp_node.cp_node_id '
1866 .'AND cp_item.resourceId = cp_resource.id '
1867 .'AND scormType = '.$ilDB->quote('sco', 'text').' '
1868 .'AND nodeName = '.$ilDB->quote('item', 'text').' '
1869 .'AND cp_node.slm_id = '.$ilDB->quote($a_id, 'integer').' '
1870 .'GROUP BY cp_node.cp_node_id'
1871 );
1872
1873 while($row = $ilDB->fetchAssoc($result))
1874 {
1875 array_push($scos, $row['cp_node_id']);
1876 }
1877
1878 $set = 0; //numbers of SCO that set cmi.score.scaled
1879 $max = null;
1880 for($i = 0; $i < count($scos); $i++)
1881 {
1882 $res = $ilDB->queryF(
1883 'SELECT c_max FROM cmi_node WHERE (user_id = %s AND cp_node_id = %s)',
1884 array('integer', 'integer'),
1885 array($a_user, $scos[$i])
1886 );
1887
1888 if($ilDB->numRows($res) > 0)
1889 {
1890 $row = $ilDB->fetchAssoc($res);
1891 if($row['c_max'] != null)
1892 {
1893 $set++;
1894 $max = $row['c_max'];
1895 }
1896 }
1897 }
1898 $retVal = ($set == 1) ? $max : null;
1899
1900 return $retVal;
1901 }
$result

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

Referenced by ilObjSAHSLearningModule\getMaxPoints().

+ Here is the caller graph for this function:

◆ _getMeasure()

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

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

968 {
969 global $ilDB;
970
971 $status_set = $ilDB->queryF('
972 SELECT * FROM cmi_gobjective
973 WHERE scope_id = %s
974 AND objective_id = %s
975 AND user_id = %s',
976 array('integer','text','integer'),
977 array($a_obj_id,'course_overall_status',$a_user_id)
978 );
979
980 if ($status_rec = $ilDB->fetchAssoc($status_set))
981 {
982 return $status_rec["measure"];
983 }
984
985 return false;
986 }

References $ilDB.

◆ _getSatisfied()

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

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

946 {
947 global $ilDB;
948
949
950 $status_set = $ilDB->queryF('
951 SELECT * FROM cmi_gobjective
952 WHERE scope_id = %s
953 AND objective_id = %s
954 AND user_id = %s',
955 array('integer','text','integer'),
956 array($a_obj_id,'course_overall_status',$a_user_id)
957 );
958
959 if ($status_rec = $ilDB->fetchAssoc($status_set))
960 {
961 return $status_rec["satisfied"];
962 }
963
964 return false;
965 }

References $ilDB.

◆ _getScores2004ForUser()

static ilObjSCORM2004LearningModule::_getScores2004ForUser (   $a_cp_node_id,
  $a_user 
)
static

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

1903 {
1904 global $ilDB;
1905 $retAr = array("raw" => null, "max" => null, "scaled" => null);
1906 $val_set = $ilDB->queryF("SELECT c_raw, c_max, scaled FROM cmi_node WHERE (user_id = %s AND cp_node_id = %s)",
1907 array('integer', 'integer'),
1908 array($a_user, $a_cp_node_id)
1909 );
1910 if ($val_set->numRows()>0)
1911 {
1912 $val_rec = $ilDB->fetchAssoc($val_set);
1913 $retAr["raw"] = $val_rec['c_raw'];
1914 $retAr["max"] = $val_rec['c_max'];
1915 $retAr["scaled"] = $val_rec['scaled'];
1916 if ($val_rec['scaled']==null && $val_rec['c_raw']!=null && $val_rec['c_max']!=null) {
1917 $retAr["scaled"] = ($val_rec['c_raw'] / $val_rec['c_max']);
1918 }
1919 }
1920 return $retAr;
1921 }

References $ilDB.

Referenced by ilLPCollectionOfSCOs\getScoresForUserAndCP_Node_Id().

+ Here is the caller graph for this function:

◆ _getStatus()

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

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

925 {
926 global $ilDB;
927
928 $status_set = $ilDB->queryF('
929 SELECT * FROM cmi_gobjective
930 WHERE scope_id = %s
931 AND objective_id = %s
932 AND user_id = %s',
933 array('integer','text','integer'),
934 array($a_obj_id,'course_overall_status',$a_user_id)
935 );
936
937 if ($status_rec = $ilDB->fetchAssoc($status_set))
938 {
939 return $status_rec["status"];
940 }
941
942 return false;
943 }

References $ilDB.

◆ _getTrackingItems()

ilObjSCORM2004LearningModule::_getTrackingItems (   $a_obj_id)

get all tracking items of scorm object

currently a for learning progress only

@access static

Reimplemented from ilObjSCORMLearningModule.

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

884 {
885 global $ilDB;
886
887
888 $item_set = $ilDB->queryF('
889 SELECT cp_item.* FROM cp_node, cp_item WHERE slm_id = %s
890 AND cp_node.cp_node_id = cp_item.cp_node_id
891 ORDER BY cp_node.cp_node_id ',
892 array('integer'),
893 array($a_obj_id)
894 );
895
896 $items = array();
897 while ($item_rec = $ilDB->fetchAssoc($item_set))
898 {
899
900 $s2 = $ilDB->queryF('
901 SELECT cp_resource.* FROM cp_node, cp_resource
902 WHERE slm_id = %s
903 AND cp_node.cp_node_id = cp_resource.cp_node_id
904 AND cp_resource.id = %s ',
905 array('integer','text'),
906 array($a_obj_id,$item_rec["resourceid"])
907 );
908
909
910 if ($res = $ilDB->fetchAssoc($s2))
911
912 {
913 if ($res["scormtype"] == "sco")
914 {
915 $items[] = array("id" => $item_rec["cp_node_id"],
916 "title" => $item_rec["title"]);
917 }
918 }
919 }
920
921 return $items;
922 }

References $ilDB, and $res.

Referenced by ilLPCollectionOfSCOs\getPossibleItems().

+ Here is the caller graph for this function:

◆ _getUniqueScaledScoreForUser()

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 840 of file class.ilObjSCORM2004LearningModule.php.

841 {
842 global $ilDB, $ilUser;
843 $scos = array();
844
845 $val_set = $ilDB->queryF("SELECT cp_node.cp_node_id FROM cp_node,cp_resource,cp_item WHERE".
846 " 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",
847 array('integer'),
848 array($a_id)
849 );
850 while ($val_rec = $ilDB->fetchAssoc($val_set))
851 {
852 array_push($scos,$val_rec['cp_node_id']);
853 }
854 $set = 0; //numbers of SCO that set cmi.score.scaled
855 $scaled = null;
856 for ($i=0;$i<count($scos);$i++)
857 {
858 $val_set = $ilDB->queryF("SELECT scaled FROM cmi_node WHERE (user_id = %s AND cp_node_id = %s)",
859 array('integer', 'integer'),
860 array($a_user, $scos[$i])
861 );
862 if ($val_set->numRows()>0)
863 {
864 $val_rec = $ilDB->fetchAssoc($val_set);
865 if ($val_rec['scaled']!=NULL) {
866 $set++;
867 $scaled = $val_rec['scaled'];
868 }
869 }
870 }
871 $retVal = ($set == 1) ? $scaled : null ;
872 return $retVal;
873 }

References $ilDB, and $ilUser.

Referenced by ilObjSAHSLearningModule\getPointsInPercent().

+ Here is the caller graph for this function:

◆ _ISODurationToCentisec()

ilObjSCORM2004LearningModule::_ISODurationToCentisec (   $str)

convert ISO 8601 Timeperiods to centiseconds ta

@access static

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

670 {
671 $aV = array(0, 0, 0, 0, 0, 0);
672 $bErr = false;
673 $bTFound = false;
674 if (strpos($str,"P") != 0) {
675 $bErr = true;
676 }
677 if (!$bErr) {
678 $aT = array("Y", "M", "D", "H", "M", "S");
679 $p = 0;
680 $i = 0;
681 $str = substr($str,1);
682 for ($i = 0; $i < count($aT); $i++) {
683 if (strpos($str,"T")===0) {
684 $str = substr($str,1);
685 $i = max($i, 3);
686 $bTFound = true;
687 }
688 $p = strpos($str,$aT[$i]);
689
690 if ($p > -1) {
691 if ($i == 1 && strpos($str,"T") > -1 && strpos($str,"T") < $p) {
692 continue;
693 }
694 if ($aT[$i] == "S") {
695 $aV[$i] = substr($str,0, $p);
696
697 } else {
698 $aV[$i] = intval(substr($str,0, $p));
699 }
700 if (!is_numeric($aV[$i])) {
701 $bErr = true;
702 break;
703 } else if ($i > 2 && !$bTFound) {
704 $bErr = true;
705 break;
706 }
707 $str = substr($str,$p + 1);
708
709 }
710 }
711 if (!$bErr && strlen($str) != 0) {
712 $bErr = true;
713
714 }
715 }
716
717 if ($bErr) {
718 return;
719 }
720 return $aV[0] * 3155760000 + $aV[1] * 262980000 + $aV[2] * 8640000 + $aV[3] * 360000 + $aV[4] * 6000 + round($aV[5] * 100);
721 }

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

+ Here is the caller graph for this function:

◆ _lookupItemTitle()

static ilObjSCORM2004LearningModule::_lookupItemTitle (   $a_node_id)
static

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

989 {
990 global $ilDB;
991
992 $r = $ilDB->queryF('
993 SELECT * FROM cp_item
994 WHERE cp_node_id = %s',
995 array('integer'),
996 array($a_node_id)
997 );
998
999 if ($i = $ilDB->fetchAssoc($r))
1000 {
1001 return $i["title"];
1002 }
1003 return "";
1004 }
$r
Definition: example_031.php:79

References $ilDB, and $r.

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

+ Here is the caller graph for this function:

◆ _lookupLastAccess()

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.

316 {
317 global $ilDB;
318
319 $result = $ilDB->queryF('
320 SELECT MAX(c_timestamp) last_access
321 FROM cmi_node, cp_node
322 WHERE cmi_node.cp_node_id = cp_node.cp_node_id
323 AND cp_node.slm_id = %s
324 AND user_id = %s
325 GROUP BY c_timestamp',
326 array('integer', 'integer'),
327 array($a_obj_id, $a_usr_id));
328 if ($ilDB->numRows($result))
329 {
330 $row = $ilDB->fetchAssoc($result);
331 return $row["last_access"];
332 }
333
334 return "";
335 }

References $ilDB, $result, and $row.

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

+ Here is the caller graph for this function:

◆ convert_1_2_to_2004()

ilObjSCORM2004LearningModule::convert_1_2_to_2004 (   $manifest)

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

240 {
241 global $ilDB, $ilLog;
242
243 ##check manifest-file for version. Check for schemaversion as this is a required element for SCORM 2004
244 ##accept 2004 3rd Edition an CAM 1.3 as valid schemas
245
246 //set variables
247 $this->packageFolder=$this->getDataDirectory();
248 $this->imsmanifestFile=$manifest;
249 $doc = new DomDocument();
250
251 //fix reload errors before loading
252 $this->fixReload();
253 $doc->load($this->imsmanifestFile);
254 $elements = $doc->getElementsByTagName("schemaversion");
255 $schema=$elements->item(0)->nodeValue;
256 if (strtolower(trim($schema))=="cam 1.3" || strtolower(trim($schema))=="2004 3rd edition" || strtolower(trim($schema))=="2004 4th edition") {
257 //no conversion
258 $this->converted=false;
259 return true;
260
261 } else {
262 $this->converted=true;
263 //convert to SCORM 2004
264
265 //check for broken SCORM 1.2 manifest file (missing organization default-common error in a lot of manifest files)
266 $organizations = $doc->getElementsByTagName("organizations");
267 //first check if organizations is in manifest
268 if ($organizations->item(0)==null) die("organizations missing in manifest");
269 $default=$organizations->item(0)->getAttribute("default");
270 if ($default=="" || $default==null) {
271 //lookup identifier
272 $organization = $doc->getElementsByTagName("organization");
273 $ident=$organization->item(0)->getAttribute("identifier");
274 $organizations->item(0)->setAttribute("default",$ident);
275 }
276
277 //validate the fixed mainfest. If it's still not valid, don't transform an throw error
278
279
280 //first copy wrappers
281 $wrapperdir=$this->packageFolder."/GenericRunTimeWrapper1.0_aadlc";
282 mkdir($wrapperdir);
283 copy(self::WRAPPER_HTML,$wrapperdir."/GenericRunTimeWrapper.htm");
284 copy(self::WRAPPER_JS,$wrapperdir."/SCOPlayerWrapper.js");
285
286 //backup manifestfile
287 $this->backupManifest=$this->packageFolder."/imsmanifest.xml.back";
288 $ret=copy($this->imsmanifestFile,$this->backupManifest);
289
290 //transform manifest file
291 $this->totransform = $doc;
292 $ilLog->write("SCORM: about to transform to SCORM 2004");
293
294 $xsl = new DOMDocument;
295 $xsl->async = false;
296 $xsl->load(self::CONVERT_XSL);
297 $prc = new XSLTProcessor;
298 $r = @$prc->importStyleSheet($xsl);
299
300 file_put_contents($this->imsmanifestFile, $prc->transformToXML($this->totransform));
301
302 $ilLog->write("SCORM: Transformation completed");
303 return true;
304 }
305
306 }
getDataDirectory($mode="filesystem")
get data directory of lm

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

Referenced by readObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyAuthoredContent()

ilObjSCORM2004LearningModule::copyAuthoredContent (   $a_new_obj)

Copy authored content (everything done with the editor.

Parameters

return

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

1930 {
1931 global $ilias;
1932
1933 // set/copy stylesheet
1934 include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
1935 $style_id = $this->getStyleSheetId();
1936 if ($style_id > 0 && !ilObjStyleSheet::_lookupStandard($style_id))
1937 {
1938 $style_obj = $ilias->obj_factory->getInstanceByObjId($style_id);
1939 $new_id = $style_obj->ilClone();
1940 $a_new_obj->setStyleSheetId($new_id);
1941 $a_new_obj->update();
1942 }
1943
1944 $a_new_obj->createScorm2004Tree();
1945 $source_tree = $this->getTree();
1946 $target_tree_root_id = $a_new_obj->getTree()->readRootId();
1947 $childs = $source_tree->getChilds($source_tree->readRootId());
1948 $a_copied_nodes = array();
1949 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
1950 foreach ($childs as $c)
1951 {
1952 ilSCORM2004Node::pasteTree($a_new_obj, $c["child"], $target_tree_root_id,
1953 IL_LAST_NODE, "", $a_copied_nodes, true, false);
1954 }
1955 }
const IL_LAST_NODE
Definition: class.ilTree.php:4
getStyleSheetId()
get ID of assigned style sheet object
_lookupStandard($a_id)
Lookup standard flag.
static pasteTree($a_target_slm, $a_item_id, $a_parent_id, $a_target, $a_insert_time, &$a_copied_nodes, $a_as_copy=false, $a_from_clipboard=true, $a_source_parent_type="")
Paste item (tree) from clipboard or other learning module to target scorm learning module.

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

+ Here is the call graph for this function:

◆ createScorm2004Tree()

ilObjSCORM2004LearningModule::createScorm2004Tree ( )

Create Scorm 2004 Tree used by Editor.

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

1010 {
1011 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Tree.php");
1012 $this->slm_tree = new ilSCORM2004Tree($this->getId());
1013
1014 //$this->slm_tree =& new ilTree($this->getId());
1015 //$this->slm_tree->setTreeTablePK("slm_id");
1016 //$this->slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1017 $this->slm_tree->addTree($this->getId(), 1);
1018
1019 //add seqinfo for rootNode
1020 include_once ("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Sequencing.php");
1021 $seq_info = new ilSCORM2004Sequencing($this->getId(),true);
1022 $seq_info->insert();
1023 }
getId()
get object id @access public
Class ilSCORM2004Sequencing.
SCORM 2004 Editing tree.

References ilObject\getId().

+ Here is the call graph for this function:

◆ deleteTrackingDataOfUsers()

ilObjSCORM2004LearningModule::deleteTrackingDataOfUsers (   $a_users)

get all tracked items of current user

Reimplemented from ilObjSCORMLearningModule.

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

385 {
386 global $ilDB;
387 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004DeleteData.php");
388 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
389 include_once("./Services/Tracking/classes/class.ilChangeEvent.php");
391
392 foreach($a_users as $user)
393 {
396 }
397 }
static _deleteReadEventsForUsers($a_obj_id, array $a_user_ids)
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
removeCMIDataForUserAndPackage($user_id, $packageId)

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

Referenced by importSuccess().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeDragDrop()

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 1064 of file class.ilObjSCORM2004LearningModule.php.

1065 {
1066 $this->slm_tree = new ilTree($this->getId());
1067 $this->slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1068 $this->slm_tree->setTreeTablePK("slm_id");
1069
1070 require_once("./Modules/Scorm2004/classes/class.ilSCORM2004NodeFactory.php");
1071
1072 $source_obj = ilSCORM2004NodeFactory::getInstance($this, $source_id, true);
1073 //$source_obj->setLMId($this->getId());
1074
1075 if (!$first_child)
1076 {
1077 $target_obj = ilSCORM2004NodeFactory::getInstance($this, $target_id, true);
1078 //$target_obj->setLMId($this->getId());
1079 $target_parent = $this->slm_tree->getParentId($target_id);
1080 }
1081//echo "-".$source_obj->getType()."-";
1082 // handle pages
1083 if ($source_obj->getType() == "page")
1084 {
1085 if ($this->slm_tree->isInTree($source_obj->getId()))
1086 {
1087 $node_data = $this->slm_tree->getNodeData($source_obj->getId());
1088
1089 // cut on move
1090 if ($movecopy == "move")
1091 {
1092 $parent_id = $this->slm_tree->getParentId($source_obj->getId());
1093 $this->slm_tree->deleteTree($node_data);
1094
1095 // write history entry
1096/* require_once("./Services/History/classes/class.ilHistory.php");
1097 ilHistory::_createEntry($source_obj->getId(), "cut",
1098 array(ilLMObject::_lookupTitle($parent_id), $parent_id),
1099 $this->getType().":pg");
1100 ilHistory::_createEntry($parent_id, "cut_page",
1101 array(ilLMObject::_lookupTitle($source_obj->getId()), $source_obj->getId()),
1102 $this->getType().":st");
1103*/
1104 }
1105/* else // this is not implemented here
1106 {
1107 // copy page
1108 $new_page =& $source_obj->copy();
1109 $source_id = $new_page->getId();
1110 $source_obj =& $new_page;
1111 }
1112*/
1113
1114 // paste page
1115 if(!$this->slm_tree->isInTree($source_obj->getId()))
1116 {
1117 if ($first_child) // as first child
1118 {
1119 $target_pos = IL_FIRST_NODE;
1120 $parent = $target_id;
1121 }
1122 else if ($as_subitem) // as last child
1123 {
1124 $parent = $target_id;
1125 $target_pos = IL_FIRST_NODE;
1126 $pg_childs = $this->slm_tree->getChildsByType($parent, "page");
1127 if (count($pg_childs) != 0)
1128 {
1129 $target_pos = $pg_childs[count($pg_childs) - 1]["obj_id"];
1130 }
1131 }
1132 else // at position
1133 {
1134 $target_pos = $target_id;
1135 $parent = $target_parent;
1136 }
1137
1138 // insert page into tree
1139 $this->slm_tree->insertNode($source_obj->getId(),
1140 $parent, $target_pos);
1141
1142 // write history entry
1143/* if ($movecopy == "move")
1144 {
1145 // write history comments
1146 include_once("./Services/History/classes/class.ilHistory.php");
1147 ilHistory::_createEntry($source_obj->getId(), "paste",
1148 array(ilLMObject::_lookupTitle($parent), $parent),
1149 $this->getType().":pg");
1150 ilHistory::_createEntry($parent, "paste_page",
1151 array(ilLMObject::_lookupTitle($source_obj->getId()), $source_obj->getId()),
1152 $this->getType().":st");
1153 }
1154*/
1155
1156 }
1157 }
1158 }
1159
1160 // handle scos
1161 if ($source_obj->getType() == "sco" || $source_obj->getType() == "ass")
1162 {
1163//echo "2";
1164 $source_node = $this->slm_tree->getNodeData($source_id);
1165 $subnodes = $this->slm_tree->getSubtree($source_node);
1166
1167 // check, if target is within subtree
1168 foreach ($subnodes as $subnode)
1169 {
1170 if($subnode["obj_id"] == $target_id)
1171 {
1172 return;
1173 }
1174 }
1175
1176 $target_pos = $target_id;
1177
1178 if ($first_child) // as first sco
1179 {
1180 $target_pos = IL_FIRST_NODE;
1181 $target_parent = $target_id;
1182
1183 $pg_childs = $this->slm_tree->getChildsByType($target_parent, "page");
1184 if (count($pg_childs) != 0)
1185 {
1186 $target_pos = $pg_childs[count($pg_childs) - 1]["obj_id"];
1187 }
1188 }
1189 else if ($as_subitem) // as last sco
1190 {
1191 $target_parent = $target_id;
1192 $target_pos = IL_FIRST_NODE;
1193 $childs = $this->slm_tree->getChilds($target_parent);
1194 if (count($childs) != 0)
1195 {
1196 $target_pos = $childs[count($childs) - 1]["obj_id"];
1197 }
1198 }
1199
1200 // delete source tree
1201 if ($movecopy == "move")
1202 {
1203 $this->slm_tree->deleteTree($source_node);
1204 }
1205/* else
1206 {
1207 // copy chapter (incl. subcontents)
1208 $new_chapter =& $source_obj->copy($this->slm_tree, $target_parent, $target_pos);
1209 }
1210*/
1211
1212 if (!$this->slm_tree->isInTree($source_id))
1213 {
1214 $this->slm_tree->insertNode($source_id, $target_parent, $target_pos);
1215
1216 // insert moved tree
1217 if ($movecopy == "move")
1218 {
1219 foreach ($subnodes as $node)
1220 {
1221 if($node["obj_id"] != $source_id)
1222 {
1223 $this->slm_tree->insertNode($node["obj_id"], $node["parent"]);
1224 }
1225 }
1226 }
1227 }
1228
1229 // check the tree
1230// $this->checkTree();
1231 }
1232
1233 // handle chapters
1234 if ($source_obj->getType() == "chap")
1235 {
1236//echo "2";
1237 $source_node = $this->slm_tree->getNodeData($source_id);
1238 $subnodes = $this->slm_tree->getSubtree($source_node);
1239
1240 // check, if target is within subtree
1241 foreach ($subnodes as $subnode)
1242 {
1243 if($subnode["obj_id"] == $target_id)
1244 {
1245 return;
1246 }
1247 }
1248
1249 $target_pos = $target_id;
1250
1251 if ($first_child) // as first chapter
1252 {
1253 $target_pos = IL_FIRST_NODE;
1254 $target_parent = $target_id;
1255
1256 //$sco_childs = $this->slm_tree->getChildsByType($target_parent, "sco");
1257 //if (count($sco_childs) != 0)
1258 //{
1259 // $target_pos = $sco_childs[count($sco_childs) - 1]["obj_id"];
1260 //}
1261 }
1262 else if ($as_subitem) // as last chapter
1263 {
1264 $target_parent = $target_id;
1265 $target_pos = IL_FIRST_NODE;
1266 $childs = $this->slm_tree->getChilds($target_parent);
1267 if (count($childs) != 0)
1268 {
1269 $target_pos = $childs[count($childs) - 1]["obj_id"];
1270 }
1271 }
1272
1273 // delete source tree
1274 if ($movecopy == "move")
1275 {
1276 $this->slm_tree->deleteTree($source_node);
1277 }
1278/* else
1279 {
1280 // copy chapter (incl. subcontents)
1281 $new_chapter =& $source_obj->copy($this->slm_tree, $target_parent, $target_pos);
1282 }
1283*/
1284
1285 if (!$this->slm_tree->isInTree($source_id))
1286 {
1287 $this->slm_tree->insertNode($source_id, $target_parent, $target_pos);
1288
1289 // insert moved tree
1290 if ($movecopy == "move")
1291 {
1292 foreach ($subnodes as $node)
1293 {
1294 if($node["obj_id"] != $source_id)
1295 {
1296 $this->slm_tree->insertNode($node["obj_id"], $node["parent"]);
1297 }
1298 }
1299 }
1300 }
1301
1302 // check the tree
1303// $this->checkTree();
1304 }
1305
1306// $this->checkTree();
1307 }
const IL_FIRST_NODE
Definition: class.ilTree.php:5
static getInstance($a_slm_object, $a_id=0, $a_halt=true)
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
$target_id
Definition: goto.php:88

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

+ Here is the call graph for this function:

◆ exportFileItems()

ilObjSCORM2004LearningModule::exportFileItems (   $a_target_dir,
$expLog 
)

export files of file itmes

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

1826 {
1827 include_once("./Modules/File/classes/class.ilObjFile.php");
1828
1829 foreach ($this->file_ids as $file_id)
1830 {
1831 $expLog->write(date("[y-m-d H:i:s] ")."File Item ".$file_id);
1832 $file_obj = new ilObjFile($file_id, false);
1833 $file_obj->export($a_target_dir);
1834 unset($file_obj);
1835 }
1836 }
Class ilObjFile.

◆ exportHTML()

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

Export SCORM package to HTML.

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

1550 {
1551
1552// $a_xml_writer = new ilXmlWriter;
1553 // set dtd definition
1554// $a_xml_writer->xmlSetDtdDef("<!DOCTYPE ContentObject SYSTEM \"http://www.ilias.de/download/dtd/ilias_co_3_7.dtd\">");
1555
1556 // set generated comment
1557// $a_xml_writer->xmlSetGenCmt("Export of ILIAS Content Module ". $this->getId()." of installation ".$a_inst.".");
1558
1559 // set xml header
1560// $a_xml_writer->xmlHeader();
1561
1562// global $ilBench;
1563
1564// $a_xml_writer->xmlStartTag("ContentObject", array("Type"=>"SCORM2004LearningModule"));
1565
1566// $expLog->write(date("[y-m-d H:i:s] ")."Start Export Sco Objects");
1567 $this->exportHTMLScoObjects($a_inst, $a_target_dir, $expLog, $a_one_file);
1568// $expLog->write(date("[y-m-d H:i:s] ")."Finished Export Sco Objects");
1569
1570// $a_xml_writer->xmlEndTag("ContentObject");
1571
1572
1573 /*$toc_tpl = new ilTemplate("tpl.main.html", true, true, false);
1574 $style_name = $ilUser->prefs["style"].".css";
1575 $tpl->setCurrentBlock("css_file");
1576 $tpl->setVariable("CSS_FILE", $style_name);
1577 $tpl->parseCurrentBlock();*/
1578
1579 if ($a_one_file == "")
1580 {
1581 include_once("./Modules/Scorm2004/classes/class.ilContObjectManifestBuilder.php");
1582 $manifestBuilder = new ilContObjectManifestBuilder($this);
1583 $manifestBuilder->buildManifest('12');
1584
1585 include_once("Services/Frameset/classes/class.ilFramesetGUI.php");
1586 $fs_gui = new ilFramesetGUI();
1587 $fs_gui->setFramesetTitle($this->getTitle());
1588 $fs_gui->setMainFrameSource("");
1589 $fs_gui->setSideFrameSource("toc.html");
1590 $fs_gui->setMainFrameName("content");
1591 $fs_gui->setSideFrameName("toc");
1592 $output = $fs_gui->get();
1593 fputs(fopen($a_target_dir.'/index.html','w+'),$output);
1594
1595 $xsl = file_get_contents("./Modules/Scorm2004/templates/xsl/module.xsl");
1596 $xml = simplexml_load_string($manifestBuilder->writer->xmlDumpMem());
1597 $args = array( '/_xml' => $xml->organizations->organization->asXml(), '/_xsl' => $xsl );
1598 $xh = xslt_create();
1599 $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args,NULL);
1600 xslt_free($xh);
1601 fputs(fopen($a_target_dir.'/toc.html','w+'),$output);
1602 }
1603// $a_xml_writer->_XmlWriter;
1604 }
Content Object (ILIAS native learning module / digilib book) Manifest export class.
Class ilFramesetGUI.
exportHTMLScoObjects($a_inst, $a_target_dir, &$expLog, $a_one_file="")
getTitle()
get object title @access public
xslt_free(&$proc)
xslt_create()

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

Referenced by exportHTMLOne().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportHTML4PDF()

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

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

1469 {
1470 global $ilBench;
1471 $tree = new ilTree($this->getId());
1472 $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1473 $tree->setTreeTablePK("slm_id");
1474 foreach($tree->getSubTree($tree->getNodeData($tree->getRootId()),true,'sco') as $sco)
1475 {
1476 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
1477 $sco_folder = $a_target_dir."/".$sco['obj_id'];
1478 ilUtil::makeDir($sco_folder);
1479 $node = new ilSCORM2004Sco($this,$sco['obj_id']);
1480 $node->exportHTML4PDF($a_inst, $sco_folder, $expLog);
1481 }
1482 }
Class ilSCORM2004Sco.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
global $ilBench
Definition: ilias.php:18

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

+ Here is the call graph for this function:

◆ exportHTMLOne()

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

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

1540 {
1541 $one_file = fopen($a_target_dir.'/index.html','w+');
1542 $this->exportHTML($a_inst, $a_target_dir, $expLog, $one_file);
1543 fclose($one_file);
1544 }
exportHTML($a_inst, $a_target_dir, &$expLog, $a_one_file="")
Export SCORM package to HTML.

References exportHTML().

+ Here is the call graph for this function:

◆ exportHTMLScoObjects()

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

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

1688 {
1689 global $ilBench;
1690
1691 $tree = new ilTree($this->getId());
1692 $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1693 $tree->setTreeTablePK("slm_id");
1694
1695 // copy all necessary files now
1696 if ($a_one_file != "")
1697 {
1698 $this->prepareHTMLExporter($a_target_dir);
1699
1700 // put header into file
1701 $sco_tpl = new ilTemplate("tpl.sco.html", true, true, "Modules/Scorm2004");
1702 include_once("./Services/COPage/classes/class.ilCOPageHTMLExport.php");
1704
1705 $sco_tpl->setCurrentBlock("js_file");
1706 $sco_tpl->setVariable("JS_FILE", "./js/pure.js");
1707 $sco_tpl->parseCurrentBlock();
1708 $sco_tpl->setCurrentBlock("js_file");
1709 $sco_tpl->setVariable("JS_FILE", "./js/question_handling.js");
1710 $sco_tpl->parseCurrentBlock();
1711
1712
1713 $sco_tpl->setCurrentBlock("head");
1714 $sco_tpl->parseCurrentBlock();
1715 fputs($a_one_file, $sco_tpl->get("head"));
1716
1717 // toc
1718 include_once("./Modules/Scorm2004/classes/class.ilContObjectManifestBuilder.php");
1719 $manifestBuilder = new ilContObjectManifestBuilder($this);
1720 $manifestBuilder->buildManifest('12');
1721 $xsl = file_get_contents("./Modules/Scorm2004/templates/xsl/module.xsl");
1722 $xml = simplexml_load_string($manifestBuilder->writer->xmlDumpMem());
1723 $args = array( '/_xml' => $xml->organizations->organization->asXml(), '/_xsl' => $xsl );
1724 $xh = xslt_create();
1725 $params = array("one_page" => "y");
1726 $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args,$params);
1727 xslt_free($xh);
1728 fputs($a_one_file, $output);
1729
1730 }
1731
1732 foreach($tree->getSubTree($tree->getNodeData($tree->getRootId()),true,'sco') as $sco)
1733 {
1734 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
1735 $sco_folder = $a_target_dir."/".$sco['obj_id'];
1736 ilUtil::makeDir($sco_folder);
1737 $node = new ilSCORM2004Sco($this,$sco['obj_id']);
1738
1739 if ($a_one_file == "")
1740 {
1741 $node->exportHTML($a_inst, $sco_folder, $expLog, $a_one_file);
1742 }
1743 else
1744 {
1745 $node->exportHTMLPageObjects($a_inst, $a_target_dir, $expLog, 'full',
1746 "sco", $a_one_file, $sco_tpl);
1747 }
1748 if($this->getAssignedGlossary()!=0)
1749 {
1750 include_once("./Modules/Glossary/classes/class.ilObjGlossary.php");
1751 $glos = new ilObjGlossary($this->getAssignedGlossary(),false);
1752 //$glos->exportHTML($sco_folder."/glossary", $expLog);
1753 }
1754 }
1755
1756 // copy all necessary files now
1757 if ($a_one_file != "")
1758 {
1759 // put tail into file
1760 fputs($a_one_file, $sco_tpl->get("tail"));
1761 }
1762
1763 }
getPreparedMainTemplate($a_tpl="")
Get prepared main template.
Class ilObjGlossary.
getAssignedGlossary()
get assigned glossary
prepareHTMLExporter($a_target_dir)
Prepare HTML exporter.
special template class to simplify handling of ITX/PEAR
$params
Definition: example_049.php:96

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

Referenced by exportHTML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportPDF()

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

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

1485 {
1486 global $ilBench;
1487 $a_xml_writer = new ilXmlWriter;
1488 $a_xml_writer->xmlStartTag("ContentObject", array("Type"=>"SCORM2004SCO"));
1489 $this->exportXMLMetaData($a_xml_writer);
1490 $tree = new ilTree($this->getId());
1491 $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1492 $tree->setTreeTablePK("slm_id");
1493 foreach($tree->getSubTree($tree->getNodeData($tree->getRootId()),true,'sco') as $sco)
1494 {
1495 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
1496 $sco_folder = $a_target_dir."/".$sco['obj_id'];
1497 ilUtil::makeDir($sco_folder);
1498 $node = new ilSCORM2004Sco($this,$sco['obj_id']);
1499 $node->exportPDFPrepareXmlNFiles($a_inst, $a_target_dir, $expLog, $a_xml_writer);
1500 }
1501 if($this->getAssignedGlossary()!=0)
1502 {
1503 ilUtil::makeDir($a_target_dir."/glossary");
1504 include_once("./Modules/Glossary/classes/class.ilObjGlossary.php");
1505 include_once("./Modules/Glossary/classes/class.ilGlossaryExport.php");
1506 $glos = new ilObjGlossary($this->getAssignedGlossary(), false);
1507 $glos_export = new ilGlossaryExport($glos,"xml");
1508 $glos->exportXML($a_xml_writer,$glos_export->getInstId(), $a_target_dir."/glossary", $expLog);
1509 }
1510 $a_xml_writer->xmlEndTag("ContentObject");
1511 include_once 'Services/Transformation/classes/class.ilXML2FO.php';
1512 $xml2FO = new ilXML2FO();
1513 $xml2FO->setXSLTLocation('./Modules/Scorm2004/templates/xsl/contentobject2fo.xsl');
1514 $xml2FO->setXMLString($a_xml_writer->xmlDumpMem());
1515 $xml2FO->setXSLTParams(array ('target_dir' => $a_target_dir));
1516 $xml2FO->transform();
1517 $fo_string = $xml2FO->getFOString();
1518 $fo_xml = simplexml_load_string($fo_string);
1519 $fo_ext = $fo_xml->xpath("//fo:declarations");
1520 $fo_ext = $fo_ext[0];
1521 $results = array();
1522 include_once "./Services/Utilities/classes/class.ilFileUtils.php";
1523 ilFileUtils::recursive_dirscan($a_target_dir."/objects", $results);
1524 if (is_array($results["file"]))
1525 {
1526 foreach ($results["file"] as $key => $value)
1527 {
1528 $e = $fo_ext->addChild("fox:embedded-file","","http://xml.apache.org/fop/extensions");
1529 $e->addAttribute("src",$results[path][$key].$value);
1530 $e->addAttribute("name",$value);
1531 $e->addAttribute("desc","");
1532 }
1533 }
1534 $fo_string = $fo_xml->asXML();
1535 $a_xml_writer->_XmlWriter;
1536 return $fo_string;
1537 }
recursive_dirscan($dir, &$arr)
Recursively scans a given directory and writes path and filename into referenced array.
Export class for content objects.
exportXMLMetaData(&$a_xml_writer)
export content objects meta data to xml (see ilias_co.dtd)
XML writer class.
xmlStartTag($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
Writes a starttag.
$results

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

+ Here is the call graph for this function:

◆ exportScorm()

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

Export (authoring) scorm package.

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

1357 {
1358
1359 $a_xml_writer = new ilXmlWriter;
1360
1361 // export metadata
1362 $this->exportXMLMetaData($a_xml_writer);
1363 $metadata_xml = $a_xml_writer->xmlDumpMem(false);
1364 $a_xml_writer->_XmlWriter;
1365
1366 $xsl = file_get_contents("./Modules/Scorm2004/templates/xsl/metadata.xsl");
1367 $args = array( '/_xml' => $metadata_xml , '/_xsl' => $xsl );
1368 $xh = xslt_create();
1369 $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args,NULL);
1370 xslt_free($xh);
1371 file_put_contents($a_target_dir.'/indexMD.xml',$output);
1372
1373 // export glossary
1374 if($this->getAssignedGlossary()!=0)
1375 {
1376 ilUtil::makeDir($a_target_dir."/glossary");
1377 include_once("./Modules/Glossary/classes/class.ilObjGlossary.php");
1378 include_once("./Modules/Glossary/classes/class.ilGlossaryExport.php");
1379 $glo_xml_writer = new ilXmlWriter();
1380
1381 $glo_xml_writer->xmlSetDtdDef("<!DOCTYPE ContentObject SYSTEM \"http://www.ilias.de/download/dtd/ilias_co_3_7.dtd\">");
1382 // set xml header
1383 $glo_xml_writer->xmlHeader();
1384 $glos = new ilObjGlossary($this->getAssignedGlossary(), false);
1385 //$glos->exportHTML($a_target_dir."/glossary", $expLog);
1386 $glos_export = new ilGlossaryExport($glos,"xml");
1387 $glos->exportXML($glo_xml_writer,$glos_export->getInstId(), $a_target_dir."/glossary", $expLog);
1388 $glo_xml_writer->xmlDumpFile($a_target_dir."/glossary/glossary.xml");
1389 $glo_xml_writer->_XmlWriter;
1390 }
1391
1392 $a_xml_writer = new ilXmlWriter;
1393 // set dtd definition
1394 $a_xml_writer->xmlSetDtdDef("<!DOCTYPE ContentObject SYSTEM \"http://www.ilias.de/download/dtd/ilias_co_3_7.dtd\">");
1395
1396 // set generated comment
1397 $a_xml_writer->xmlSetGenCmt("Export of ILIAS Content Module ". $this->getId()." of installation ".$a_inst.".");
1398
1399 // set xml header
1400 $a_xml_writer->xmlHeader();
1401
1402 global $ilBench;
1403
1404 $a_xml_writer->xmlStartTag("ContentObject", array("Type"=>"SCORM2004LearningModule"));
1405
1406 // MetaData
1407 $this->exportXMLMetaData($a_xml_writer);
1408
1409 $this->exportXMLStructureObjects($a_xml_writer, $a_inst, $expLog);
1410
1411 // SCO Objects
1412 $expLog->write(date("[y-m-d H:i:s] ")."Start Export Sco Objects");
1413 $this->exportXMLScoObjects($a_inst, $a_target_dir, $ver, $expLog);
1414 $expLog->write(date("[y-m-d H:i:s] ")."Finished Export Sco Objects");
1415
1416 $a_xml_writer->xmlEndTag("ContentObject");
1417 $a_xml_writer->xmlDumpFile($a_target_dir.'/index.xml', false);
1418
1419 if ($ver == "2004 4th") {
1420 $revision ="4th";
1421 $ver = "2004";
1422 }
1423
1424 if ($ver == "2004 3rd") {
1425 $revision ="3rd";
1426 $ver = "2004";
1427 }
1428
1429 // add content css (note: this is also done per item)
1430 $css_dir = $a_target_dir."/ilias_css_4_2";
1431 ilUtil::makeDir($css_dir);
1432 include_once("./Modules/Scorm2004/classes/class.ilScormExportUtil.php");
1433 ilScormExportUtil::exportContentCSS($this, $css_dir);
1434
1435 // add manifest
1436 include_once("./Modules/Scorm2004/classes/class.ilContObjectManifestBuilder.php");
1437 $manifestBuilder = new ilContObjectManifestBuilder($this);
1438 $manifestBuilder->buildManifest($ver,$revision);
1439 $manifestBuilder->dump($a_target_dir);
1440
1441 $xsl = file_get_contents("./Modules/Scorm2004/templates/xsl/module.xsl");
1442 $args = array( '/_xml' => file_get_contents($a_target_dir."/imsmanifest.xml"), '/_xsl' => $xsl );
1443 $xh = xslt_create();
1444 $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args,NULL);
1445 xslt_free($xh);
1446 fputs(fopen($a_target_dir.'/index.html','w+'),$output);
1447 // copy xsd files to target
1448 switch ($ver)
1449 {
1450 case "2004":
1451 if ($revision == "3rd") {
1452 ilUtil::rCopy('./Modules/Scorm2004/templates/xsd/adlcp_130_export_2004',$a_target_dir,false);
1453 }
1454
1455 if ($revision == "4th") {
1456 ilUtil::rCopy('./Modules/Scorm2004/templates/xsd/adlcp_130_export_2004_4th',$a_target_dir,false);
1457 }
1458 break;
1459 case "12":
1460 ilUtil::rCopy('./Modules/Scorm2004/templates/xsd/adlcp_120_export_12',$a_target_dir,false);
1461 break;
1462 }
1463
1464 $a_xml_writer->_XmlWriter;
1465 }
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)
static exportContentCSS($a_slm_object, $a_target_dir)
Export lm content css to a directory.
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
xmlSetDtdDef($dtdDef)
Sets dtd definition.

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

+ Here is the call graph for this function:

◆ exportXMLMetaData()

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 1612 of file class.ilObjSCORM2004LearningModule.php.

1613 {
1614 include_once("Services/MetaData/classes/class.ilMD2XML.php");
1615 $md2xml = new ilMD2XML($this->getId(), 0, $this->getType());
1616 $md2xml->setExportMode(true);
1617 $md2xml->startExport();
1618 $a_xml_writer->appendXML($md2xml->getXML());
1619 }
getType()
get object type @access public

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

Referenced by exportPDF(), and exportScorm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportXMLScoObjects()

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 1654 of file class.ilObjSCORM2004LearningModule.php.

1655 {
1656 global $ilBench;
1657 $tree = new ilTree($this->getId());
1658 $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1659 $tree->setTreeTablePK("slm_id");
1660 foreach($tree->getSubTree($tree->getNodeData($tree->getRootId()),true,array('sco','ass')) as $sco)
1661 {
1662 if ($sco['type'] == "sco")
1663 {
1664 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
1665 $sco_folder = $a_target_dir."/".$sco['obj_id'];
1666 ilUtil::makeDir($sco_folder);
1667 $node = new ilSCORM2004Sco($this,$sco['obj_id']);
1668 $node->exportScorm($a_inst, $sco_folder, $ver, $expLog);
1669 }
1670 if ($sco['type'] == "ass")
1671 {
1672 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Asset.php");
1673 $sco_folder = $a_target_dir."/".$sco['obj_id'];
1674 ilUtil::makeDir($sco_folder);
1675 $node = new ilSCORM2004Asset($this,$sco['obj_id']);
1676 $node->exportScorm($a_inst, $sco_folder, $ver, $expLog);
1677 }
1678
1679 }
1680 }
Class ilSCORM2004Asset.

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

Referenced by exportScorm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportXMLStructureObjects()

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 1627 of file class.ilObjSCORM2004LearningModule.php.

1628 {
1629 include_once("Services/MetaData/classes/class.ilMD2XML.php");
1630 $tree = new ilTree($this->getId());
1631 $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1632 $tree->setTreeTablePK("slm_id");
1633 $a_xml_writer->xmlStartTag("StructureObject");
1634 foreach($tree->getFilteredSubTree($tree->getRootId(),Array('page')) as $obj)
1635 {
1636 if($obj['type']=='') continue;
1637
1638 //$md2xml = new ilMD2XML($obj['obj_id'], 0, $obj['type']);
1639 $md2xml = new ilMD2XML($this->getId(), $obj['obj_id'], $obj['type']);
1640 $md2xml->setExportMode(true);
1641 $md2xml->startExport();
1642 $a_xml_writer->appendXML($md2xml->getXML());
1643 }
1644 $a_xml_writer->xmlEndTag("StructureObject");
1645 }

References ilObject\getId().

Referenced by exportScorm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fixReload()

ilObjSCORM2004LearningModule::fixReload ( )

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

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

References $out.

Referenced by convert_1_2_to_2004().

+ Here is the caller graph for this function:

◆ getAttemptsForUser()

ilObjSCORM2004LearningModule::getAttemptsForUser (   $a_user_id)

get number of atttempts for a certain user and package

Reimplemented from ilObjSCORMLearningModule.

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

501 {
502 global $ilDB;
503 $val_set = $ilDB->queryF('SELECT package_attempts FROM sahs_user WHERE user_id = %s AND obj_id = %s',
504 array('integer','integer'),
505 array($a_user_id, $this->getId()));
506
507 $val_rec = $ilDB->fetchAssoc($val_set);
508
509 if ($val_rec["package_attempts"] == null) {
510 $val_rec["package_attempts"]="";
511 }
512
513 return $val_rec["package_attempts"];
514 }

References $ilDB, and ilObject\getId().

+ Here is the call graph for this function:

◆ getCourseCompletionForUser()

ilObjSCORM2004LearningModule::getCourseCompletionForUser (   $a_user)

Reimplemented from ilObjSCORMLearningModule.

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

724 {
725 global $ilDB, $ilUser;
726
727 $scos = array();
728 //get all SCO's of this object
729
730 $val_set = $ilDB->queryF('
731 SELECT cp_node.cp_node_id FROM cp_node,cp_resource,cp_item
732 WHERE cp_item.cp_node_id = cp_node.cp_node_id
733 AND cp_item.resourceid = cp_resource.id
734 AND scormtype = %s
735 AND nodename = %s
736 AND cp_node.slm_id = %s ',
737 array('text','text','integer'),
738 array('sco','item',$this->getId()));
739
740 while ($val_rec = $ilDB->fetchAssoc($val_set))
741 {
742 array_push($scos,$val_rec['cp_node_id']);
743 }
744
745
746 $scos_c = $scos;
747 //copy SCO_array
748 //check if all SCO's are completed
749 for ($i=0;$i<count($scos);$i++)
750 {
751
752 $val_set = $ilDB->queryF('
753 SELECT * FROM cmi_node
754 WHERE (user_id= %s
755 AND cp_node_id= %s
756 AND (completion_status=%s OR success_status=%s))',
757 array('integer','integer','text', 'text'),
758 array($a_user,$scos[$i],'completed','passed')
759 );
760
761 if ($ilDB->numRows($val_set) > 0) {
762 //delete from array
763 $key = array_search($scos[$i], $scos_c);
764 unset ($scos_c[$key]);
765 }
766
767 }
768 //check for completion
769 if (count($scos_c) == 0) {
770 $completion = true;
771 } else {
772 $completion = false;
773 }
774 return $completion;
775 }

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

+ Here is the call graph for this function:

◆ getExportFiles()

ilObjSCORM2004LearningModule::getExportFiles ( )

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

1310 {
1311 $file = array();
1312
1313 require_once("./Modules/Scorm2004/classes/class.ilSCORM2004Export.php");
1314
1315 $export = new ilSCORM2004Export($this);
1316 foreach ($export->getSupportedExportTypes() as $type)
1317 {
1318 $dir = $export->getExportDirectoryForType($type);
1319 // quit if import dir not available
1320 if (!@is_dir($dir) or !is_writeable($dir))
1321 {
1322 continue;
1323 }
1324 // open directory
1325 $cdir = dir($dir);
1326
1327 // get files and save the in the array
1328 while ($entry = $cdir->read())
1329 {
1330 if ($entry != "." and
1331 $entry != ".." and
1332 (
1333 ereg("^[0-9]{10}_{2}[0-9]+_{2}(".$this->getType()."_)*[0-9]+\.zip\$", $entry) or
1334 ereg("^[0-9]{10}_{2}[0-9]+_{2}(".$this->getType()."_)*[0-9]+\.pdf\$", $entry) or
1335 ereg("^[0-9]{10}_{2}[0-9]+_{2}(".$this->getType()."_)*[0-9]+\.iso\$", $entry)
1336 ))
1337 {
1338 $file[$entry.$type] = array("type" => $type, "file" => $entry,
1339 "size" => filesize($dir."/".$entry));
1340 }
1341 }
1342
1343 // close import directory
1344 $cdir->close();
1345 }
1346
1347 // sort files
1348 ksort ($file);
1349 reset ($file);
1350 return $file;
1351 }
print $file

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

+ Here is the call graph for this function:

◆ getImportSequencing()

ilObjSCORM2004LearningModule::getImportSequencing ( )

Get import sequencing.

Returns
boolean import sequencing information

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

52 {
53 return $this->import_sequencing;
54 }

Referenced by readObject().

+ Here is the caller graph for this function:

◆ getModuleVersionForUser()

ilObjSCORM2004LearningModule::getModuleVersionForUser (   $a_user_id)

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

Reimplemented from ilObjSCORMLearningModule.

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

520 {
521 global $ilDB;
522 $val_set = $ilDB->queryF('SELECT module_version FROM sahs_user WHERE user_id = %s AND obj_id = %s',
523 array('integer','integer'),
524 array($a_user_id, $this->getId()));
525
526 $val_rec = $ilDB->fetchAssoc($val_set);
527
528 if ($val_rec["module_version"] == null) {
529 $val_rec["module_version"]="";
530 }
531 return $val_rec["module_version"];
532 }

References $ilDB, and ilObject\getId().

+ Here is the call graph for this function:

◆ getPublicExportFile()

ilObjSCORM2004LearningModule::getPublicExportFile (   $a_type)

get public export file

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

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

1817 {
1818 return $this->public_export_file[$a_type];
1819 }

◆ getSequencingSettings()

ilObjSCORM2004LearningModule::getSequencingSettings ( )

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

1033 {
1034
1035 global $ilTabs;
1036 $ilTabs->setTabActive("sequencing");
1037
1038 include_once ("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Sequencing.php");
1039 $control_settings = new ilSCORM2004Sequencing($this->getId(),true);
1040
1041 return $control_settings;
1042 }

References ilObject\getId().

+ Here is the call graph for this function:

◆ getTrackedItems()

ilObjSCORM2004LearningModule::getTrackedItems ( )

get all tracked items of current user

Reimplemented from ilObjSCORMLearningModule.

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

404 {
405 global $ilUser, $ilDB, $ilUser;
406
407 $sco_set = $ilDB->queryF('
408 SELECT DISTINCT cmi_node.cp_node_id id
409 FROM cp_node, cmi_node
410 WHERE slm_id = %s
411 AND cp_node.cp_node_id = cmi_node.cp_node_id
412 ORDER BY cp_node.cp_node_id ',
413 array('integer'),
414 array($this->getId()));
415
416 $items = array();
417
418 while($sco_rec = $ilDB->fetchAssoc($sco_set))
419 {
420 $item['id']=$sco_rec["id"];
421 $item['title']=self::_lookupItemTitle($sco_rec["id"]);
422 $items[count($items)] =$item;
423
424 }
425 return $items;
426 }

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

+ Here is the call graph for this function:

◆ getTrackingDataAgg()

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

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

430 {
431 global $ilDB;
432
433 $scos = array();
434 $data = array();
435 //get all SCO's of this object
436
437 $val_set = $ilDB->queryF(
438 'SELECT cp_node_id FROM cp_node
439 WHERE nodename = %s
440 AND cp_node.slm_id = %s',
441 array('text', 'integer'),
442 array('item',$this->getId())
443 );
444 while($val_rec = $ilDB->fetchAssoc($val_set))
445 {
446 array_push($scos,$val_rec['cp_node_id']);
447 }
448
449 foreach ($scos as $sco)
450 {
451 $data_set = $ilDB->queryF('
452 SELECT c_timestamp last_access, total_time, success_status, completion_status,
453 c_raw, scaled, cp_node_id
454 FROM cmi_node
455 WHERE cp_node_id = %s
456 AND user_id = %s',
457 array('integer','integer'),
458 array($sco,$a_user_id)
459 );
460
461 while($data_rec = $ilDB->fetchAssoc($data_set))
462 {
463 if ($data_rec["success_status"]!="" && $data_rec["success_status"]!="unknown") {
464 $status = $data_rec["success_status"];
465 } else {
466 if ($data_rec["completion_status"]=="") {
467 $status="unknown";
468 } else {
469 $status = $data_rec["completion_status"];
470 }
471 }
472 if(!$raw)
473 {
474 $time = ilFormat::_secondsToString(self::_ISODurationToCentisec($data_rec["total_time"])/100);
475 $score = "";
476 if ($data_rec["c_raw"] != null) {
477 $score = $data_rec["c_raw"];
478 if ($data_rec["scaled"] != null) $score .= " = ";
479 }
480 if ($data_rec["scaled"] != null) $score .= ($data_rec["scaled"]*100)."%";
481 $title = self::_lookupItemTitle($data_rec["cp_node_id"]);
482 $last_access=ilDatePresentation::formatDate(new ilDateTime($data_rec['last_access'],IL_CAL_UNIX));
483 $data[] = array("user_id" => $data_rec["user_id"], "sco_id"=>$data_rec["cp_node_id"],
484 "score" => $score, "time" => $time, "status" => $status,"last_access"=>$last_access,"title"=>$title);
485 }
486 else
487 {
488 $data_rec["total_time"] = self::_ISODurationToCentisec($data_rec["total_time"])/100;
489 $data[$data_rec["cp_node_id"]] = $data_rec;
490 }
491 }
492 }
493
494
495 return $data;
496 }
const IL_CAL_UNIX
static formatDate(ilDateTime $date)
Format a date @access public.
@classDescription Date and time handling
_secondsToString($seconds, $force_with_seconds=false, $a_lng=null)
converts seconds to string: Long: 7 days 4 hour(s) ...
_ISODurationToCentisec($str)
convert ISO 8601 Timeperiods to centiseconds ta
$data

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

+ Here is the call graph for this function:

◆ getTree()

ilObjSCORM2004LearningModule::getTree ( )

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

1026 {
1027 $this->slm_tree = new ilTree($this->getId());
1028 $this->slm_tree->setTreeTablePK("slm_id");
1029 $this->slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1030 return $this->slm_tree;
1031 }

References ilObject\getId().

Referenced by copyAuthoredContent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ilObjSCORM2004LearningModule()

ilObjSCORM2004LearningModule::ilObjSCORM2004LearningModule (   $a_id = 0,
  $a_call_by_reference = true 
)

Constructor @access 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.

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

◆ importSuccess()

ilObjSCORM2004LearningModule::importSuccess (   $a_file)

Reimplemented from ilObjSCORMLearningModule.

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

543 {
544 global $ilDB, $ilUser;
545 include_once("./Services/Tracking/classes/class.ilLPStatus.php");
546 $scos = array();
547 //get all SCO's of this object ONLY RELEVANT!
548 include_once './Services/Object/classes/class.ilObjectLP.php';
549 $olp = ilObjectLP::getInstance($this->getId());
550 $collection = $olp->getCollectionInstance();
551 if($collection)
552 {
553 $scos = $collection->getItems();
554 }
555
556 $fhandle = fopen($a_file, "r");
557
558 $obj_id = $this->getID();
559 $users = array();
560 $usersToDelete = array();
561 $fields = fgetcsv($fhandle, 4096, ';');
562 while(($csv_rows = fgetcsv($fhandle, 4096, ";")) !== FALSE) {
563 $data = array_combine($fields, $csv_rows);
564 //no check the format - sufficient to import users
565 if ($data["Login"]) $user_id = $this->get_user_id($data["Login"]);
566 if ($data["login"]) $user_id = $this->get_user_id($data["login"]);
567 //add mail in future
568 if ($data["user"] && is_numeric($data["user"])) $user_id = $data["user"];
569 if ($user_id>0) {
570 $last_access = ilUtil::now();
571 if ($data['Date']) {
572 $date_ex = explode('.', $data['Date']);
573 $last_access = implode('-', array($date_ex[2], $date_ex[1], $date_ex[0]));
574 }
575 if ($data['LastAccess']) {
576 $last_access = $data['LastAccess'];
577 }
578
580
581 if ($data["Status"]) {
582 if (is_numeric($data["Status"])) $status = $data["Status"];
586 }
587 $attempts = null;
588 if($data["Attempts"]) $attempts = $data["Attempts"];
589
590 $percentage_completed = 0;
591 if ($status == ilLPStatus::LP_STATUS_COMPLETED_NUM) $percentage_completed = 100;
592 else if ($data['percentageCompletedSCOs']) $percentage_completed = $data['percentageCompletedSCOs'];
593
594 $sco_total_time_sec = null;
595 if ($data['SumTotal_timeSeconds']) $sco_total_time_sec = $data['SumTotal_timeSeconds'];
596
598 $usersToDelete[] = $user_id;
599 } else {
600 $this->importSuccessForSahsUser($user_id, $last_access, $status, $attempts, $percentage_completed, $sco_total_time_sec);
601 $users[] = $user_id;
602 }
603
605 foreach ($scos as $sco_id)
606 {
607 $res = $ilDB->queryF('
608 SELECT completion_status, success_status, user_id FROM cmi_node WHERE cp_node_id = %s AND user_id = %s',
609 array('integer','integer'),
610 array($sco_id,$user_id)
611 );
612
613 if(!$ilDB->numRows($res))
614 {
615 $nextId = $ilDB->nextId('cmi_node');
616 $val_set = $ilDB->manipulateF('INSERT INTO cmi_node
617 (cp_node_id,user_id,completion_status,c_timestamp,cmi_node_id)
618 VALUES(%s,%s,%s,%s,%s)',
619 array('integer','integer','text','timestamp','integer'),
620 array($sco_id,$user_id,'completed',$last_access,$nextId));
621 } else {
622 $doUpdate = false;
623 while ($row = $ilDB->fetchAssoc($res)) {
624 if ( ($row["completion_status"] == "completed" && $row["success_status"] != "failed") || $row["success_status"] == "passed") {
625 if ($doUpdate != true) $doUpdate = false; //note for issue if there are 2 entries for same sco_id
626 } else {
627 $doUpdate = true;
628 }
629 }
630 if ($doUpdate == true) {
631 $ilDB->update('cmi_node',
632 array(
633 'completion_status' => array('text', 'completed'),
634 'success_status' => array('text', ''),
635 'suspend_data' => array('text', ''),
636 'c_timestamp' => array('timestamp', $last_access)
637 ),
638 array(
639 'user_id' => array('integer', $user_id),
640 'cp_node_id' => array('integer', $sco_id)
641 )
642 );
643 }
644 }
645 }
646
647 }
648 } else {
649 //echo "Warning! User $csv_rows[0] does not exist in ILIAS. Data for this user was skipped.\n";
650 }
651 }
652
653 if (count($usersToDelete)>0) {
654 // include_once("./Services/Tracking/classes/class.ilLPMarks.php");
655 // ilLPMarks::_deleteForUsers($this->getId(), $usersToDelete);
656 $this->deleteTrackingDataOfUsers($usersToDelete);
657 }
658 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
660
661 return 0;
662 }
_refreshStatus($a_obj_id, $a_users=null)
Set dirty.
const LP_STATUS_COMPLETED_NUM
const LP_STATUS_FAILED
const LP_STATUS_IN_PROGRESS_NUM
const LP_STATUS_NOT_ATTEMPTED_NUM
const LP_STATUS_FAILED_NUM
const LP_STATUS_NOT_ATTEMPTED
const LP_STATUS_IN_PROGRESS
deleteTrackingDataOfUsers($a_users)
get all tracked items of current user
importSuccessForSahsUser($user_id, $last_access, $status, $attempts=null, $percentage_completed=null, $sco_total_time_sec=null)
static getInstance($a_obj_id)
static now()
Return current timestamp in Y-m-d H:i:s format.

References $data, $ilDB, $ilUser, $res, $row, ilLPStatusWrapper\_refreshStatus(), deleteTrackingDataOfUsers(), 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().

+ Here is the call graph for this function:

◆ prepareHTMLExporter()

ilObjSCORM2004LearningModule::prepareHTMLExporter (   $a_target_dir)

Prepare HTML exporter.

Parameters

return

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

1772 {
1773 // system style html exporter
1774 include_once("./Services/Style/classes/class.ilSystemStyleHTMLExport.php");
1775 $this->sys_style_html_export = new ilSystemStyleHTMLExport($a_target_dir);
1776 $this->sys_style_html_export->export();
1777
1778 // init co page html exporter
1779 include_once("./Services/COPage/classes/class.ilCOPageHTMLExport.php");
1780 $this->co_page_html_export = new ilCOPageHTMLExport($a_target_dir);
1781 include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
1782 $this->co_page_html_export->setContentStyleId(
1784 $this->co_page_html_export->createDirectories();
1785 $this->co_page_html_export->exportStyles();
1786 $this->co_page_html_export->exportSupportScripts();
1787
1788 include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
1789 $this->flv_dir = $a_target_dir."/".ilPlayerUtil::getFlashVideoPlayerDirectory();
1790
1791 ilUtil::makeDir($a_target_dir.'/css/yahoo');
1792 ilUtil::makeDir($a_target_dir.'/objects');
1793 ilUtil::makeDir($a_target_dir.'/players');
1794 ilUtil::makeDir($this->flv_dir);
1795
1796 include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
1797// copy(ilPlayerUtil::getFlashVideoPlayerFilename(true),
1798// $a_target_dir.'/js/'.ilPlayerUtil::getFlashVideoPlayerFilename());
1800
1801 copy('./Modules/Scorm2004/scripts/scorm_2004.js',$a_target_dir.'/js/scorm.js');
1802 copy('./Modules/Scorm2004/scripts/pager.js',$a_target_dir.'/js/pager.js');
1803 copy('./Modules/Scorm2004/scripts/questions/pure.js',$a_target_dir.'/js/pure.js');
1804 copy('./Modules/Scorm2004/scripts/questions/question_handling.js',
1805 $a_target_dir.'/js/question_handling.js');
1806
1807 }
HTML export class for pages.
static getEffectiveContentStyleId($a_style_id, $a_type="")
Get effective Style Id.
static getFlashVideoPlayerDirectory()
Get flash video player directory.
copyPlayerFilesToTargetDirectory($a_target_dir)
Copy css files to target dir.
HTML export class for system styles.

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

Referenced by exportHTMLScoObjects().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readObject()

ilObjSCORM2004LearningModule::readObject ( )

read manifest file @access public

Reimplemented from ilObjSCORMLearningModule.

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

74 {
75 global $ilias, $lng ,$ilDB;
76
77 //check for MYSQL 4.1 and json_encode,json_decode
78 if (!function_exists('json_encode') || !function_exists('json_decode') || ($ilDB->getDBType() == 'mysql' && !$ilDB->isMysql4_1OrHigher())) {
79 $ilias->raiseError($lng->txt('scplayer_phpmysqlcheck'),$ilias->error_obj->WARNING);
80 }
81
82 $needs_convert = false;
83
84 // convert imsmanifest.xml file in iso to utf8 if needed
85
86 $manifest_file = $this->getDataDirectory()."/imsmanifest.xml";
87
88 // check if manifestfile exists and space left on device...
89 $check_for_manifest_file = is_file($manifest_file);
90
91
92
93 // if no manifestfile
94 if (!$check_for_manifest_file)
95 {
96 $this->ilias->raiseError($this->lng->txt("Manifestfile $manifest_file not found!"), $this->ilias->error_obj->MESSAGE);
97 return;
98 }
99
100
101 if ($check_for_manifest_file)
102 {
103 $manifest_file_array = file($manifest_file);
104
105 foreach($manifest_file_array as $mfa)
106 {
107 // if (seems_not_utf8($mfa))
108 if (@iconv('UTF-8', 'UTF-8', $mfa) != $mfa)
109 {
110 $needs_convert = true;
111 break;
112 }
113 }
114
115
116
117 // to copy the file we need some extraspace, counted in bytes *2 ... we need 2 copies....
118 $estimated_manifest_filesize = filesize($manifest_file) * 2;
119
120 // i deactivated this, because it seems to fail on some windows systems (see bug #1795)
121 //$check_disc_free = disk_free_space($this->getDataDirectory()) - $estimated_manifest_filesize;
122 $check_disc_free = 2;
123 }
124
125
126 // if $manifest_file needs to be converted to UTF8
127 if ($needs_convert)
128 {
129 // if file exists and enough space left on device
130 if ($check_for_manifest_file && ($check_disc_free > 1))
131 {
132
133 // create backup from original
134 if (!copy($manifest_file, $manifest_file.".old"))
135 {
136 echo "Failed to copy $manifest_file...<br>\n";
137 }
138
139 // read backupfile, convert each line to utf8, write line to new file
140 // php < 4.3 style
141 $f_write_handler = fopen($manifest_file.".new", "w");
142 $f_read_handler = fopen($manifest_file.".old", "r");
143 while (!feof($f_read_handler))
144 {
145 $zeile = fgets($f_read_handler);
146 //echo mb_detect_encoding($zeile);
147 fputs($f_write_handler, utf8_encode($zeile));
148 }
149 fclose($f_read_handler);
150 fclose($f_write_handler);
151
152 // copy new utf8-file to imsmanifest.xml
153 if (!copy($manifest_file.".new", $manifest_file))
154 {
155 echo "Failed to copy $manifest_file...<br>\n";
156 }
157
158 if (!@is_file($manifest_file))
159 {
160 $this->ilias->raiseError($this->lng->txt("cont_no_manifest"),
161 $this->ilias->error_obj->WARNING);
162 }
163 }
164 else
165 {
166 // gives out the specific error
167
168 if (!($check_disc_free > 1))
169 $this->ilias->raiseError($this->lng->txt("Not enough space left on device!"),$this->ilias->error_obj->MESSAGE);
170 return;
171 }
172
173 }
174 else
175 {
176 // check whether file starts with BOM (that confuses some sax parsers, see bug #1795)
177 $hmani = fopen($manifest_file, "r");
178 $start = fread($hmani, 3);
179 if (strtolower(bin2hex($start)) == "efbbbf")
180 {
181 $f_write_handler = fopen($manifest_file.".new", "w");
182 while (!feof($hmani))
183 {
184 $n = fread($hmani, 900);
185 fputs($f_write_handler, $n);
186 }
187 fclose($f_write_handler);
188 fclose($hmani);
189
190 // copy new utf8-file to imsmanifest.xml
191 if (!copy($manifest_file.".new", $manifest_file))
192 {
193 echo "Failed to copy $manifest_file...<br>\n";
194 }
195 }
196 else
197 {
198 fclose($hmani);
199 }
200 }
201
202 //validate the XML-Files in the SCORM-Package
203 if ($_POST["validate"] == "y")
204 {
205 if (!$this->validate($this->getDataDirectory()))
206 {
207 $this->ilias->raiseError("<b>Validation Error(s):</b><br>".$this->getValidationSummary(),
208 $this->ilias->error_obj->WARNING);
209 }
210 }
211
212
213 //check for SCORM 1.2
214 $this->convert_1_2_to_2004($manifest_file);
215
216 // start SCORM 2004 package parser/importer
217 include_once ("./Modules/Scorm2004/classes/ilSCORM13Package.php");
218 $newPack = new ilSCORM13Package();
219 if ($this->getEditable())
220 {
221 return $newPack->il_importLM($this,$this->getDataDirectory(),
222 $this->getImportSequencing());
223 }
224 else
225 {
226 return $newPack->il_import($this->getDataDirectory(),$this->getId(),$this->ilias,$_POST["validate"]);
227 }
228 }
$n
Definition: RandomTest.php:80
validate($directory)
Validate all XML-Files in a SCOM-Directory.
$_POST['username']
Definition: cron.php:12
redirection script todo: (a better solution should control the processing via a xml file)

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

+ Here is the call graph for this function:

◆ setImportSequencing()

ilObjSCORM2004LearningModule::setImportSequencing (   $a_val)

Set import sequencing.

Parameters
boolean$a_valimport sequencing information

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

42 {
43 $this->import_sequencing = $a_val;
44 }

◆ setPublicExportFile()

ilObjSCORM2004LearningModule::setPublicExportFile (   $a_type,
  $a_file 
)

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

1842 {
1843 $this->public_export_file[$a_type] = $a_file;
1844 }

◆ updateSequencingSettings()

ilObjSCORM2004LearningModule::updateSequencingSettings ( )

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

1044 {
1045 include_once ("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Sequencing.php");
1046
1047 $control_settings = new ilSCORM2004Sequencing($this->getId(),true);
1048 $control_settings->setChoice(ilUtil::yn2tf($_POST["choice"]));
1049 $control_settings->setFlow(ilUtil::yn2tf($_POST["flow"]));
1050 $control_settings->setForwardOnly(ilUtil::yn2tf($_POST["forwardonly"]));
1051 $control_settings->insert();
1052
1053 return true;
1054 }
static yn2tf($a_yn)
convert "y"/"n" to true/false

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

+ Here is the call graph for this function:

◆ validate()

ilObjSCORM2004LearningModule::validate (   $directory)

Validate all XML-Files in a SCOM-Directory.

@access public

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

Reimplemented from ilObjSCORMLearningModule.

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

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

Referenced by readObject().

+ Here is the caller graph for this function:

Field Documentation

◆ $validator

ilObjSCORM2004LearningModule::$validator

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

◆ CONVERT_XSL

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

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

◆ WRAPPER_HTML

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

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

◆ WRAPPER_JS

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: