ILIAS  release_7 Revision v7.30-3-g800a261c036
ilObjSCORM2004LearningModule Class Reference

Class ilObjSCORM2004LearningModule. More...

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

Public Member Functions

 __construct ($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)
 
 getCourseCompletionForUser ($a_user)
 
 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
 __construct ($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 ()
 
 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 attempts 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)
 
 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)
 
 getLastVisited ($user_id)
 
 deleteTrackingDataOfUsers (array $a_users)
 
- Public Member Functions inherited from ilObjSAHSLearningModule
 __construct ($a_id=0, $a_call_by_reference=true)
 Constructor @access public. More...
 
 create ($upload=false)
 create file based lm More...
 
 read ()
 read object 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 More...
 
 getAutoReview ()
 get auto review as true/false for SCORM 1.2 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_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...
 
 getIdSetting ()
 update values for mastery_score / min_normalized_measure in database - not requested More...
 
 setIdSetting ($a_id_setting)
 set id_setting More...
 
 getNameSetting ()
 get name_setting More...
 
 setNameSetting ($a_name_setting)
 set name_setting More...
 
 update ()
 update object data More...
 
 setSubType ($a_sub_type)
 get sub type More...
 
 getSubType ()
 set sub type More...
 
 delete ()
 delete SCORM learning module and all related data 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...
 
 zipLmForOfflineMode ()
 
 getApiStudentId ()
 Get cmi.core.student_id / cmi.learner_id for API. More...
 
 getApiStudentName ()
 Get cmi.core.student_name / cmi.learner_name for API note: 'lastname, firstname' is required for SCORM 1.2; 9 = no name to hide student_name for external content. More...
 
 getViewButton ()
 get button for view More...
 
- Public Member Functions inherited from ilObject
 __construct ($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 ()
 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...
 
 setOfflineStatus ($a_status)
 Set offline status. More...
 
 getOfflineStatus ()
 Get offline status. More...
 
 supportsOfflineHandling ()
 Check whether object supports offline handling. More...
 
 getOwner ()
 get object owner More...
 
 getOwnerName ()
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date @access public More...
 
 getLastUpdateDate ()
 get last update date @access public More...
 
 getDiskUsage ()
 Gets the disk usage of the object in bytes. 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...
 
 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...
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 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...
 
 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 _ISODurationToCentisec ($str)
 convert ISO 8601 Timeperiods to centiseconds ta More...
 
static getQuantityOfSCOs (int $a_slm_id)
 
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 _getTrackingItems ($a_obj_id)
 get all tracking items of scorm object 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 _getTrackingItems ($a_obj_id)
 get all tracking items of scorm object @access static More...
 
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 _getScoresForUser ($a_item_id, $a_user_id)
 
- Static Public Member Functions inherited from ilObjSAHSLearningModule
static getAffectiveLocalization ($a_id)
 Get affective localization. More...
 
static _lookupSubType ($a_obj_id)
 lookup subtype id (scorm, ) More...
 
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 _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
static _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
static _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static lookupOfflineStatus ($a_obj_id)
 Lookup offline status using objectDataCache. More...
 
static _lookupOwner ($a_id)
 lookup object owner More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
static _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
static _lookupObjId ($a_id)
 
static _setDeletedDate ($a_ref_id, $a_deleted_by)
 
static setDeletedDates ($a_ref_ids, $a_user_id)
 Set deleted date. More...
 
static _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
static _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
static _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
static _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id More...
 
static _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type 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 _lookupCreationDate ($a_id)
 Lookup creation date. 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
 
 $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
 

Protected Attributes

 $user
 
 $tabs
 
- Protected Attributes inherited from ilObject
 $objDefinition
 
 $db
 
 $log
 
 $error
 
 $tree
 
 $app_event_handler
 
 $rbacadmin
 
 $rbacreview
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjSCORM2004LearningModule::__construct (   $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)

Reimplemented from ilObjSCORMLearningModule.

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

41 {
42 global $DIC;
43
44 $this->lng = $DIC->language();
45 $this->error = $DIC["ilErr"];
46 $this->db = $DIC->database();
47 $this->log = $DIC["ilLog"];
48 $this->user = $DIC->user();
49 $this->tabs = $DIC->tabs();
50 $this->type = "sahs";
51 parent::__construct($a_id, $a_call_by_reference);
52 }
user()
Definition: user.php:4
error($a_errmsg)
set error message @access public
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), error(), and user().

+ Here is the call graph for this function:

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

836 {
837 global $DIC;
838
839 $ilDB = $DIC->database();
840 $ilUser = $DIC->user();
841 $scos = array();
842 //get all SCO's of the object
843
844 $val_set = $ilDB->queryF(
845 '
846 SELECT cp_node.cp_node_id FROM cp_node,cp_resource,cp_item
847 WHERE cp_item.cp_node_id = cp_node.cp_node_id
848 AND cp_item.resourceid = cp_resource.id
849 AND scormtype = %s
850 AND nodename = %s
851 AND cp_node.slm_id = %s',
852 array('text','text','integer'),
853 array('sco' ,'item',$a_id)
854 );
855 while ($val_rec = $ilDB->fetchAssoc($val_set)) {
856 array_push($scos, $val_rec['cp_node_id']);
857 }
858
859 $scos_c = $scos;
860 //copy SCO_array
861 //check if all SCO's are completed
862 for ($i = 0;$i < count($scos);$i++) {
863 $val_set = $ilDB->queryF(
864 '
865 SELECT * FROM cmi_node
866 WHERE (user_id= %s
867 AND cp_node_id= %s
868 AND (completion_status = %s OR success_status = %s))',
869 array('integer','integer','text','text'),
870 array($a_user,$scos[$i],'completed','passed')
871 );
872
873 if ($ilDB->numRows($val_set) > 0) {
874 //delete from array
875 $key = array_search($scos[$i], $scos_c);
876 unset($scos_c[$key]);
877 }
878 }
879 //check for completion
880 if (count($scos_c) == 0) {
881 $completion = true;
882 } else {
883 $completion = false;
884 }
885 return $completion;
886 }
$ilUser
Definition: imgupload.php:18
$i
Definition: metadata.php:24
global $ilDB

References $DIC, $i, $ilDB, and $ilUser.

◆ _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 1853 of file class.ilObjSCORM2004LearningModule.php.

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

References $DIC, $i, $ilDB, $res, and $result.

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

1025 {
1026 global $DIC;
1027
1028 $ilDB = $DIC->database();
1029
1030 $status_set = $ilDB->queryF(
1031 '
1032 SELECT * FROM cmi_gobjective
1033 WHERE scope_id = %s
1034 AND objective_id = %s
1035 AND user_id = %s',
1036 array('integer','text','integer'),
1037 array($a_obj_id,'-course_overall_status-',$a_user_id)
1038 );
1039
1040 if ($status_rec = $ilDB->fetchAssoc($status_set)) {
1041 return $status_rec["measure"];
1042 }
1043
1044 return false;
1045 }

References $DIC, and $ilDB.

◆ _getSatisfied()

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

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

1001 {
1002 global $DIC;
1003
1004 $ilDB = $DIC->database();
1005
1006
1007 $status_set = $ilDB->queryF(
1008 '
1009 SELECT * FROM cmi_gobjective
1010 WHERE scope_id = %s
1011 AND objective_id = %s
1012 AND user_id = %s',
1013 array('integer','text','integer'),
1014 array($a_obj_id,'-course_overall_status-',$a_user_id)
1015 );
1016
1017 if ($status_rec = $ilDB->fetchAssoc($status_set)) {
1018 return $status_rec["satisfied"];
1019 }
1020
1021 return false;
1022 }

References $DIC, and $ilDB.

◆ _getScores2004ForUser()

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

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

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

References $DIC, and $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 977 of file class.ilObjSCORM2004LearningModule.php.

978 {
979 global $DIC;
980
981 $ilDB = $DIC->database();
982
983 $status_set = $ilDB->queryF(
984 '
985 SELECT * FROM cmi_gobjective
986 WHERE scope_id = %s
987 AND objective_id = %s
988 AND user_id = %s',
989 array('integer','text','integer'),
990 array($a_obj_id,'-course_overall_status-',$a_user_id)
991 );
992
993 if ($status_rec = $ilDB->fetchAssoc($status_set)) {
994 return $status_rec["status"];
995 }
996
997 return false;
998 }

References $DIC, and $ilDB.

◆ _getTrackingItems()

static ilObjSCORM2004LearningModule::_getTrackingItems (   $a_obj_id)
static

get all tracking items of scorm object

currently a for learning progress only

Reimplemented from ilObjSCORMLearningModule.

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

938 {
939 global $DIC;
940
941 $ilDB = $DIC->database();
942
943
944 $item_set = $ilDB->queryF(
945 '
946 SELECT cp_item.* FROM cp_node, cp_item WHERE slm_id = %s
947 AND cp_node.cp_node_id = cp_item.cp_node_id
948 ORDER BY cp_node.cp_node_id ',
949 array('integer'),
950 array($a_obj_id)
951 );
952
953 $items = array();
954 while ($item_rec = $ilDB->fetchAssoc($item_set)) {
955 $s2 = $ilDB->queryF(
956 '
957 SELECT cp_resource.* FROM cp_node, cp_resource
958 WHERE slm_id = %s
959 AND cp_node.cp_node_id = cp_resource.cp_node_id
960 AND cp_resource.id = %s ',
961 array('integer','text'),
962 array($a_obj_id,$item_rec["resourceid"])
963 );
964
965
966 if ($res = $ilDB->fetchAssoc($s2)) {
967 if ($res["scormtype"] == "sco") {
968 $items[] = array("id" => $item_rec["cp_node_id"],
969 "title" => $item_rec["title"]);
970 }
971 }
972 }
973
974 return $items;
975 }

References $DIC, $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 895 of file class.ilObjSCORM2004LearningModule.php.

896 {
897 global $DIC;
898
899 $ilDB = $DIC->database();
900 $ilUser = $DIC->user();
901 $scos = array();
902
903 $val_set = $ilDB->queryF(
904 "SELECT cp_node.cp_node_id FROM cp_node,cp_resource,cp_item WHERE" .
905 " 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",
906 array('integer'),
907 array($a_id)
908 );
909 while ($val_rec = $ilDB->fetchAssoc($val_set)) {
910 array_push($scos, $val_rec['cp_node_id']);
911 }
912 $set = 0; //numbers of SCO that set cmi.score.scaled
913 $scaled = null;
914 for ($i = 0;$i < count($scos);$i++) {
915 $val_set = $ilDB->queryF(
916 "SELECT scaled FROM cmi_node WHERE (user_id = %s AND cp_node_id = %s)",
917 array('integer', 'integer'),
918 array($a_user, $scos[$i])
919 );
920 if ($val_set->numRows() > 0) {
921 $val_rec = $ilDB->fetchAssoc($val_set);
922 if ($val_rec['scaled'] != null) {
923 $set++;
924 $scaled = $val_rec['scaled'];
925 }
926 }
927 }
928 $retVal = ($set == 1) ? $scaled : null ;
929 return $retVal;
930 }

References $DIC, $i, $ilDB, and $ilUser.

Referenced by ilObjSAHSLearningModule\getPointsInPercent().

+ Here is the caller graph for this function:

◆ _ISODurationToCentisec()

static ilObjSCORM2004LearningModule::_ISODurationToCentisec (   $str)
static

convert ISO 8601 Timeperiods to centiseconds ta

@access static

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

708 {
709 $aV = array(0, 0, 0, 0, 0, 0);
710 $bErr = false;
711 $bTFound = false;
712 if (strpos($str, "P") != 0) {
713 $bErr = true;
714 }
715 if (!$bErr) {
716 $aT = array("Y", "M", "D", "H", "M", "S");
717 $p = 0;
718 $i = 0;
719 $str = substr($str, 1);
720 for ($i = 0; $i < count($aT); $i++) {
721 if (strpos($str, "T") === 0) {
722 $str = substr($str, 1);
723 $i = max($i, 3);
724 $bTFound = true;
725 }
726 $p = strpos($str, $aT[$i]);
727
728 if ($p > -1) {
729 if ($i == 1 && strpos($str, "T") > -1 && strpos($str, "T") < $p) {
730 continue;
731 }
732 if ($aT[$i] == "S") {
733 $aV[$i] = substr($str, 0, $p);
734 } else {
735 $aV[$i] = intval(substr($str, 0, $p));
736 }
737 if (!is_numeric($aV[$i])) {
738 $bErr = true;
739 break;
740 } elseif ($i > 2 && !$bTFound) {
741 $bErr = true;
742 break;
743 }
744 $str = substr($str, $p + 1);
745 }
746 }
747 if (!$bErr && strlen($str) != 0) {
748 $bErr = true;
749 }
750 }
751
752 if ($bErr) {
753 return;
754 }
755 return $aV[0] * 3155760000 + $aV[1] * 262980000 + $aV[2] * 8640000 + $aV[3] * 360000 + $aV[4] * 6000 + round($aV[5] * 100);
756 }

References $i.

Referenced by ilSCORM2004TrackingItems\exportSelectedCore(), ilSCORM2004TrackingItems\exportSelectedInteractions(), ilCmiXapiHighscoreReport\fetchTotalDuration(), 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 1047 of file class.ilObjSCORM2004LearningModule.php.

1048 {
1049 global $DIC;
1050
1051 $ilDB = $DIC->database();
1052
1053 $r = $ilDB->queryF(
1054 '
1055 SELECT * FROM cp_item
1056 WHERE cp_node_id = %s',
1057 array('integer'),
1058 array($a_node_id)
1059 );
1060
1061 if ($i = $ilDB->fetchAssoc($r)) {
1062 return $i["title"];
1063 }
1064 return "";
1065 }

References $DIC, $i, and $ilDB.

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

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

References $DIC, $ilDB, and $result.

◆ convert_1_2_to_2004()

ilObjSCORM2004LearningModule::convert_1_2_to_2004 (   $manifest)

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

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

References ilObject\$db, $ilDB, ilObject\$log, $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 1927 of file class.ilObjSCORM2004LearningModule.php.

1928 {
1929 // set/copy stylesheet
1930 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1931 $style_id = $this->getStyleSheetId();
1932 if ($style_id > 0 && !ilObjStyleSheet::_lookupStandard($style_id)) {
1933 $style_obj = ilObjectFactory::getInstanceByObjId($style_id);
1934 $new_id = $style_obj->ilClone();
1935 $a_new_obj->setStyleSheetId($new_id);
1936 $a_new_obj->update();
1937 }
1938
1939 $a_new_obj->createScorm2004Tree();
1940 $source_tree = $this->getTree();
1941 $target_tree_root_id = $a_new_obj->getTree()->readRootId();
1942 $childs = $source_tree->getChilds($source_tree->readRootId());
1943 $a_copied_nodes = array();
1944 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
1945 foreach ($childs as $c) {
1947 $a_new_obj,
1948 $c["child"],
1949 $target_tree_root_id,
1951 "",
1952 $a_copied_nodes,
1953 true,
1954 false
1955 );
1956 }
1957 }
const IL_LAST_NODE
Definition: class.ilTree.php:4
getStyleSheetId()
get ID of assigned style sheet object
static _lookupStandard($a_id)
Lookup standard flag.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
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.
$c
Definition: cli.php:37

References $c, ilObjStyleSheet\_lookupStandard(), ilObjectFactory\getInstanceByObjId(), 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 1070 of file class.ilObjSCORM2004LearningModule.php.

1071 {
1072 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Tree.php");
1073 $this->slm_tree = new ilSCORM2004Tree($this->getId());
1074
1075 //$this->slm_tree = new ilTree($this->getId());
1076 //$this->slm_tree->setTreeTablePK("slm_id");
1077 //$this->slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1078 $this->slm_tree->addTree($this->getId(), 1);
1079
1080 //add seqinfo for rootNode
1081 include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Sequencing.php");
1082 $seq_info = new ilSCORM2004Sequencing($this->getId(), true);
1083 $seq_info->insert();
1084 }
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

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

394 {
396 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004DeleteData.php");
397 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
398 include_once("./Services/Tracking/classes/class.ilChangeEvent.php");
400
401 foreach ($a_users as $user) {
404 }
405 }
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.
static removeCMIDataForUserAndPackage($user_id, $packageId)

References ilObject\$db, $ilDB, $user, 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 1126 of file class.ilObjSCORM2004LearningModule.php.

1127 {
1128 $this->slm_tree = new ilTree($this->getId());
1129 $this->slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1130 $this->slm_tree->setTreeTablePK("slm_id");
1131
1132 require_once("./Modules/Scorm2004/classes/class.ilSCORM2004NodeFactory.php");
1133
1134 $source_obj = ilSCORM2004NodeFactory::getInstance($this, $source_id, true);
1135 //$source_obj->setLMId($this->getId());
1136
1137 if (!$first_child) {
1138 $target_obj = ilSCORM2004NodeFactory::getInstance($this, $target_id, true);
1139 //$target_obj->setLMId($this->getId());
1140 $target_parent = $this->slm_tree->getParentId($target_id);
1141 }
1142 //echo "-".$source_obj->getType()."-";
1143 // handle pages
1144 if ($source_obj->getType() == "page") {
1145 if ($this->slm_tree->isInTree($source_obj->getId())) {
1146 $node_data = $this->slm_tree->getNodeData($source_obj->getId());
1147
1148 // cut on move
1149 if ($movecopy == "move") {
1150 $parent_id = $this->slm_tree->getParentId($source_obj->getId());
1151 $this->slm_tree->deleteTree($node_data);
1152
1153 // write history entry
1154/* require_once("./Services/History/classes/class.ilHistory.php");
1155 ilHistory::_createEntry($source_obj->getId(), "cut",
1156 array(ilLMObject::_lookupTitle($parent_id), $parent_id),
1157 $this->getType().":pg");
1158 ilHistory::_createEntry($parent_id, "cut_page",
1159 array(ilLMObject::_lookupTitle($source_obj->getId()), $source_obj->getId()),
1160 $this->getType().":st");
1161*/
1162 }
1163 /* else // this is not implemented here
1164 {
1165 // copy page
1166 $new_page =& $source_obj->copy();
1167 $source_id = $new_page->getId();
1168 $source_obj =& $new_page;
1169 }
1170 */
1171
1172 // paste page
1173 if (!$this->slm_tree->isInTree($source_obj->getId())) {
1174 if ($first_child) { // as first child
1175 $target_pos = IL_FIRST_NODE;
1176 $parent = $target_id;
1177 } elseif ($as_subitem) { // as last child
1178 $parent = $target_id;
1179 $target_pos = IL_FIRST_NODE;
1180 $pg_childs = $this->slm_tree->getChildsByType($parent, "page");
1181 if (count($pg_childs) != 0) {
1182 $target_pos = $pg_childs[count($pg_childs) - 1]["obj_id"];
1183 }
1184 } else { // at position
1185 $target_pos = $target_id;
1186 $parent = $target_parent;
1187 }
1188
1189 // insert page into tree
1190 $this->slm_tree->insertNode(
1191 $source_obj->getId(),
1192 $parent,
1193 $target_pos
1194 );
1195
1196 // write history entry
1197/* if ($movecopy == "move")
1198 {
1199 // write history comments
1200 include_once("./Services/History/classes/class.ilHistory.php");
1201 ilHistory::_createEntry($source_obj->getId(), "paste",
1202 array(ilLMObject::_lookupTitle($parent), $parent),
1203 $this->getType().":pg");
1204 ilHistory::_createEntry($parent, "paste_page",
1205 array(ilLMObject::_lookupTitle($source_obj->getId()), $source_obj->getId()),
1206 $this->getType().":st");
1207 }
1208*/
1209 }
1210 }
1211 }
1212
1213 // handle scos
1214 if ($source_obj->getType() == "sco" || $source_obj->getType() == "ass") {
1215 //echo "2";
1216 $source_node = $this->slm_tree->getNodeData($source_id);
1217 $subnodes = $this->slm_tree->getSubtree($source_node);
1218
1219 // check, if target is within subtree
1220 foreach ($subnodes as $subnode) {
1221 if ($subnode["obj_id"] == $target_id) {
1222 return;
1223 }
1224 }
1225
1226 $target_pos = $target_id;
1227
1228 if ($first_child) { // as first sco
1229 $target_pos = IL_FIRST_NODE;
1230 $target_parent = $target_id;
1231
1232 $pg_childs = $this->slm_tree->getChildsByType($target_parent, "page");
1233 if (count($pg_childs) != 0) {
1234 $target_pos = $pg_childs[count($pg_childs) - 1]["obj_id"];
1235 }
1236 } elseif ($as_subitem) { // as last sco
1237 $target_parent = $target_id;
1238 $target_pos = IL_FIRST_NODE;
1239 $childs = $this->slm_tree->getChilds($target_parent);
1240 if (count($childs) != 0) {
1241 $target_pos = $childs[count($childs) - 1]["obj_id"];
1242 }
1243 }
1244
1245 // delete source tree
1246 if ($movecopy == "move") {
1247 $this->slm_tree->deleteTree($source_node);
1248 }
1249 /* else
1250 {
1251 // copy chapter (incl. subcontents)
1252 $new_chapter =& $source_obj->copy($this->slm_tree, $target_parent, $target_pos);
1253 }
1254 */
1255
1256 if (!$this->slm_tree->isInTree($source_id)) {
1257 $this->slm_tree->insertNode($source_id, $target_parent, $target_pos);
1258
1259 // insert moved tree
1260 if ($movecopy == "move") {
1261 foreach ($subnodes as $node) {
1262 if ($node["obj_id"] != $source_id) {
1263 $this->slm_tree->insertNode($node["obj_id"], $node["parent"]);
1264 }
1265 }
1266 }
1267 }
1268
1269 // check the tree
1270// $this->checkTree();
1271 }
1272
1273 // handle chapters
1274 if ($source_obj->getType() == "chap") {
1275 //echo "2";
1276 $source_node = $this->slm_tree->getNodeData($source_id);
1277 $subnodes = $this->slm_tree->getSubtree($source_node);
1278
1279 // check, if target is within subtree
1280 foreach ($subnodes as $subnode) {
1281 if ($subnode["obj_id"] == $target_id) {
1282 return;
1283 }
1284 }
1285
1286 $target_pos = $target_id;
1287
1288 if ($first_child) { // as first chapter
1289 $target_pos = IL_FIRST_NODE;
1290 $target_parent = $target_id;
1291
1292 //$sco_childs = $this->slm_tree->getChildsByType($target_parent, "sco");
1293 //if (count($sco_childs) != 0)
1294 //{
1295 // $target_pos = $sco_childs[count($sco_childs) - 1]["obj_id"];
1296 //}
1297 } elseif ($as_subitem) { // as last chapter
1298 $target_parent = $target_id;
1299 $target_pos = IL_FIRST_NODE;
1300 $childs = $this->slm_tree->getChilds($target_parent);
1301 if (count($childs) != 0) {
1302 $target_pos = $childs[count($childs) - 1]["obj_id"];
1303 }
1304 }
1305
1306 // delete source tree
1307 if ($movecopy == "move") {
1308 $this->slm_tree->deleteTree($source_node);
1309 }
1310 /* else
1311 {
1312 // copy chapter (incl. subcontents)
1313 $new_chapter =& $source_obj->copy($this->slm_tree, $target_parent, $target_pos);
1314 }
1315 */
1316
1317 if (!$this->slm_tree->isInTree($source_id)) {
1318 $this->slm_tree->insertNode($source_id, $target_parent, $target_pos);
1319
1320 // insert moved tree
1321 if ($movecopy == "move") {
1322 foreach ($subnodes as $node) {
1323 if ($node["obj_id"] != $source_id) {
1324 $this->slm_tree->insertNode($node["obj_id"], $node["parent"]);
1325 }
1326 }
1327 }
1328 }
1329
1330 // check the tree
1331// $this->checkTree();
1332 }
1333
1334 // $this->checkTree();
1335 }
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:51

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

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

◆ exportHTML()

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

Export SCORM package to HTML.

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

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

References $xml, 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 1485 of file class.ilObjSCORM2004LearningModule.php.

1486 {
1487 $tree = new ilTree($this->getId());
1488 $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1489 $tree->setTreeTablePK("slm_id");
1490 foreach ($tree->getSubTree($tree->getNodeData($tree->getRootId()), true, 'sco') as $sco) {
1491 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
1492 $sco_folder = $a_target_dir . "/" . $sco['obj_id'];
1493 ilUtil::makeDir($sco_folder);
1494 $node = new ilSCORM2004Sco($this, $sco['obj_id']);
1495 $node->exportHTML4PDF($a_inst, $sco_folder, $expLog);
1496 }
1497 }
Class ilSCORM2004Sco.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...

References ilObject\$tree, 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 1547 of file class.ilObjSCORM2004LearningModule.php.

1548 {
1549 $one_file = fopen($a_target_dir . '/index.html', 'w+');
1550 $this->exportHTML($a_inst, $a_target_dir, $expLog, $one_file);
1551 fclose($one_file);
1552 }
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 1688 of file class.ilObjSCORM2004LearningModule.php.

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

References ilObject\$tree, $xml, ilObjSAHSLearningModule\getAssignedGlossary(), ilObject\getId(), 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 1499 of file class.ilObjSCORM2004LearningModule.php.

1500 {
1501 $a_xml_writer = new ilXmlWriter;
1502 $a_xml_writer->xmlStartTag("ContentObject", array("Type" => "SCORM2004SCO"));
1503 $this->exportXMLMetaData($a_xml_writer);
1504 $tree = new ilTree($this->getId());
1505 $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1506 $tree->setTreeTablePK("slm_id");
1507 foreach ($tree->getSubTree($tree->getNodeData($tree->getRootId()), true, 'sco') as $sco) {
1508 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
1509 $sco_folder = $a_target_dir . "/" . $sco['obj_id'];
1510 ilUtil::makeDir($sco_folder);
1511 $node = new ilSCORM2004Sco($this, $sco['obj_id']);
1512 $node->exportPDFPrepareXmlNFiles($a_inst, $a_target_dir, $expLog, $a_xml_writer);
1513 }
1514 if ($this->getAssignedGlossary() != 0) {
1515 ilUtil::makeDir($a_target_dir . "/glossary");
1516 $glos = new ilObjGlossary($this->getAssignedGlossary(), false);
1517 $glos_export = new ilGlossaryExport($glos, "xml");
1518 $glos->exportXML($a_xml_writer, $glos_export->getInstId(), $a_target_dir . "/glossary", $expLog);
1519 }
1520 $a_xml_writer->xmlEndTag("ContentObject");
1521 include_once 'Services/Transformation/classes/class.ilXML2FO.php';
1522 $xml2FO = new ilXML2FO();
1523 $xml2FO->setXSLTLocation('./Modules/Scorm2004/templates/xsl/contentobject2fo.xsl');
1524 $xml2FO->setXMLString($a_xml_writer->xmlDumpMem());
1525 $xml2FO->setXSLTParams(array('target_dir' => $a_target_dir));
1526 $xml2FO->transform();
1527 $fo_string = $xml2FO->getFOString();
1528 $fo_xml = simplexml_load_string($fo_string);
1529 $fo_ext = $fo_xml->xpath("//fo:declarations");
1530 $fo_ext = $fo_ext[0];
1531 $results = array();
1532 include_once "./Services/Utilities/classes/class.ilFileUtils.php";
1533 ilFileUtils::recursive_dirscan($a_target_dir . "/objects", $results);
1534 if (is_array($results["file"])) {
1535 foreach ($results["file"] as $key => $value) {
1536 $e = $fo_ext->addChild("fox:embedded-file", "", "http://xml.apache.org/fop/extensions");
1537 $e->addAttribute("src", $results[path][$key] . $value);
1538 $e->addAttribute("name", $value);
1539 $e->addAttribute("desc", "");
1540 }
1541 }
1542 $fo_string = $fo_xml->asXML();
1543 $a_xml_writer->_XmlWriter;
1544 return $fo_string;
1545 }
static 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 Vendor\Package\$e, $results, ilObject\$tree, 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 1380 of file class.ilObjSCORM2004LearningModule.php.

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

1618 {
1619 include_once("Services/MetaData/classes/class.ilMD2XML.php");
1620 $md2xml = new ilMD2XML($this->getId(), 0, $this->getType());
1621 $md2xml->setExportMode(true);
1622 $md2xml->startExport();
1623 $a_xml_writer->appendXML($md2xml->getXML());
1624 }
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 1660 of file class.ilObjSCORM2004LearningModule.php.

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

References ilObject\$tree, 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 1632 of file class.ilObjSCORM2004LearningModule.php.

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

References ilObject\$tree, and 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.

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

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

511 {
513 $val_set = $ilDB->queryF(
514 'SELECT package_attempts FROM sahs_user WHERE user_id = %s AND obj_id = %s',
515 array('integer','integer'),
516 array($a_user_id, $this->getId())
517 );
518
519 $val_rec = $ilDB->fetchAssoc($val_set);
520
521 if ($val_rec["package_attempts"] == null) {
522 $val_rec["package_attempts"] = "";
523 }
524
525 return $val_rec["package_attempts"];
526 }

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

+ Here is the call graph for this function:

◆ getCourseCompletionForUser()

ilObjSCORM2004LearningModule::getCourseCompletionForUser (   $a_user)

Reimplemented from ilObjSCORMLearningModule.

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

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

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

+ Here is the call graph for this function:

◆ getExportFiles()

ilObjSCORM2004LearningModule::getExportFiles ( )

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

1338 {
1339 $file = array();
1340
1341 require_once("./Modules/Scorm2004/classes/class.ilSCORM2004Export.php");
1342
1343 $export = new ilSCORM2004Export($this);
1344 foreach ($export->getSupportedExportTypes() as $type) {
1345 $dir = $export->getExportDirectoryForType($type);
1346 // quit if import dir not available
1347 if (!@is_dir($dir) or !is_writeable($dir)) {
1348 continue;
1349 }
1350 // open directory
1351 $cdir = dir($dir);
1352
1353 // get files and save the in the array
1354 while ($entry = $cdir->read()) {
1355 if ($entry != "." and
1356 $entry != ".." and
1357 (
1358 preg_match("~^[0-9]{10}_{2}[0-9]+_{2}(" . $this->getType() . "_)*[0-9]+\.zip\$~", $entry) or
1359 preg_match("~^[0-9]{10}_{2}[0-9]+_{2}(" . $this->getType() . "_)*[0-9]+\.pdf\$~", $entry) or
1360 preg_match("~^[0-9]{10}_{2}[0-9]+_{2}(" . $this->getType() . "_)*[0-9]+\.iso\$~", $entry)
1361 )) {
1362 $file[$entry . $type] = array("type" => $type, "file" => $entry,
1363 "size" => filesize($dir . "/" . $entry));
1364 }
1365 }
1366
1367 // close import directory
1368 $cdir->close();
1369 }
1370
1371 // sort files
1372 ksort($file);
1373 reset($file);
1374 return $file;
1375 }

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

70 {
71 return $this->import_sequencing;
72 }

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

533 {
535 $val_set = $ilDB->queryF(
536 'SELECT module_version FROM sahs_user WHERE user_id = %s AND obj_id = %s',
537 array('integer','integer'),
538 array($a_user_id, $this->getId())
539 );
540
541 $val_rec = $ilDB->fetchAssoc($val_set);
542
543 if ($val_rec["module_version"] == null) {
544 $val_rec["module_version"] = "";
545 }
546 return $val_rec["module_version"];
547 }

References ilObject\$db, $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 1814 of file class.ilObjSCORM2004LearningModule.php.

1815 {
1816 return $this->public_export_file[$a_type];
1817 }

◆ getQuantityOfSCOs()

static ilObjSCORM2004LearningModule::getQuantityOfSCOs ( int  $a_slm_id)
static

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

759 {
760 global $DIC;
761 $val_set = $DIC->database()->queryF(
762 '
763 SELECT distinct(cp_node.cp_node_id) FROM cp_node,cp_resource,cp_item
764 WHERE cp_item.cp_node_id = cp_node.cp_node_id
765 AND cp_item.resourceid = cp_resource.id
766 AND scormtype = %s
767 AND nodename = %s
768 AND cp_node.slm_id = %s ',
769 array('text','text','integer'),
770 array('sco','item',$a_slm_id)
771 );
772 return $DIC->database()->numRows($val_set);
773 }

References $DIC.

Referenced by ilSCORM2004StoreData\persistCMIData().

+ Here is the caller graph for this function:

◆ getSequencingSettings()

ilObjSCORM2004LearningModule::getSequencingSettings ( )

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

1095 {
1096 $ilTabs = $this->tabs;
1097 $ilTabs->setTabActive("sequencing");
1098
1099 include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Sequencing.php");
1100 $control_settings = new ilSCORM2004Sequencing($this->getId(), true);
1101
1102 return $control_settings;
1103 }

References $tabs, and 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 411 of file class.ilObjSCORM2004LearningModule.php.

412 {
416
417 $sco_set = $ilDB->queryF(
418 '
419 SELECT DISTINCT cmi_node.cp_node_id id
420 FROM cp_node, cmi_node
421 WHERE slm_id = %s
422 AND cp_node.cp_node_id = cmi_node.cp_node_id
423 ORDER BY cmi_node.cp_node_id ',
424 array('integer'),
425 array($this->getId())
426 );
427
428 $items = array();
429
430 while ($sco_rec = $ilDB->fetchAssoc($sco_set)) {
431 $item['id'] = $sco_rec["id"];
432 $item['title'] = self::_lookupItemTitle($sco_rec["id"]);
433 $items[count($items)] = $item;
434 }
435 return $items;
436 }

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

+ Here is the call graph for this function:

◆ getTrackingDataAgg()

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

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

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

References $data, ilObject\$db, $ilDB, ilObject\$title, _ISODurationToCentisec(), _lookupItemTitle(), ilDatePresentation\formatDate(), ilObject\getId(), IL_CAL_DATETIME, and ilDatePresentation\secondsToString().

+ Here is the call graph for this function:

◆ getTree()

ilObjSCORM2004LearningModule::getTree ( )

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

1087 {
1088 $this->slm_tree = new ilTree($this->getId());
1089 $this->slm_tree->setTreeTablePK("slm_id");
1090 $this->slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1091 return $this->slm_tree;
1092 }

References ilObject\getId().

Referenced by copyAuthoredContent().

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

◆ importSuccess()

ilObjSCORM2004LearningModule::importSuccess (   $a_file)

Reimplemented from ilObjSCORMLearningModule.

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

559 {
562 include_once("./Services/Tracking/classes/class.ilLPStatus.php");
563 $scos = array();
564 //get all SCO's of this object ONLY RELEVANT!
565 include_once './Services/Object/classes/class.ilObjectLP.php';
566 $olp = ilObjectLP::getInstance($this->getId());
567 $collection = $olp->getCollectionInstance();
568 if ($collection) {
569 $scos = $collection->getItems();
570 }
571
572 $fhandle = fopen($a_file, "r");
573
574 $obj_id = $this->getID();
575 $users = array();
576 $usersToDelete = array();
577 $fields = fgetcsv($fhandle, 4096, ';');
578 while (($csv_rows = fgetcsv($fhandle, 4096, ";")) !== false) {
579 $data = array_combine($fields, $csv_rows);
580 //no check the format - sufficient to import users
581 if ($data["Login"]) {
582 $user_id = $this->get_user_id($data["Login"]);
583 }
584 if ($data["login"]) {
585 $user_id = $this->get_user_id($data["login"]);
586 }
587 //add mail in future
588 if ($data["user"] && is_numeric($data["user"])) {
589 $user_id = $data["user"];
590 }
591 if ($user_id > 0) {
592 $last_access = ilUtil::now();
593 if ($data['Date']) {
594 $date_ex = explode('.', $data['Date']);
595 $last_access = implode('-', array($date_ex[2], $date_ex[1], $date_ex[0]));
596 }
597 if ($data['LastAccess']) {
598 $last_access = $data['LastAccess'];
599 }
600
602
603 if ($data["Status"]) {
604 if (is_numeric($data["Status"])) {
605 $status = $data["Status"];
606 } elseif ($data["Status"] == ilLPStatus::LP_STATUS_NOT_ATTEMPTED) {
608 } elseif ($data["Status"] == ilLPStatus::LP_STATUS_IN_PROGRESS) {
610 } elseif ($data["Status"] == ilLPStatus::LP_STATUS_FAILED) {
612 }
613 }
614 $attempts = null;
615 if ($data["Attempts"]) {
616 $attempts = $data["Attempts"];
617 }
618
619 $percentage_completed = 0;
621 $percentage_completed = 100;
622 } elseif ($data['percentageCompletedSCOs']) {
623 $percentage_completed = $data['percentageCompletedSCOs'];
624 }
625
626 $sco_total_time_sec = null;
627 if ($data['SumTotal_timeSeconds']) {
628 $sco_total_time_sec = $data['SumTotal_timeSeconds'];
629 }
630
632 $usersToDelete[] = $user_id;
633 } else {
634 $this->importSuccessForSahsUser($user_id, $last_access, $status, $attempts, $percentage_completed, $sco_total_time_sec);
635 $users[] = $user_id;
636 }
637
639 foreach ($scos as $sco_id) {
640 $res = $ilDB->queryF(
641 '
642 SELECT completion_status, success_status, user_id FROM cmi_node WHERE cp_node_id = %s AND user_id = %s',
643 array('integer','integer'),
644 array($sco_id,$user_id)
645 );
646
647 if (!$ilDB->numRows($res)) {
648 $nextId = $ilDB->nextId('cmi_node');
649 $val_set = $ilDB->manipulateF(
650 'INSERT INTO cmi_node
651 (cp_node_id,user_id,completion_status,c_timestamp,cmi_node_id)
652 VALUES(%s,%s,%s,%s,%s)',
653 array('integer','integer','text','timestamp','integer'),
654 array($sco_id,$user_id,'completed',$last_access,$nextId)
655 );
656 } else {
657 $doUpdate = false;
658 while ($row = $ilDB->fetchAssoc($res)) {
659 if (($row["completion_status"] == "completed" && $row["success_status"] != "failed") || $row["success_status"] == "passed") {
660 if ($doUpdate != true) {
661 $doUpdate = false;
662 } //note for issue if there are 2 entries for same sco_id
663 } else {
664 $doUpdate = true;
665 }
666 }
667 if ($doUpdate == true) {
668 $ilDB->update(
669 'cmi_node',
670 array(
671 'completion_status' => array('text', 'completed'),
672 'success_status' => array('text', ''),
673 'suspend_data' => array('text', ''),
674 'c_timestamp' => array('timestamp', $last_access)
675 ),
676 array(
677 'user_id' => array('integer', $user_id),
678 'cp_node_id' => array('integer', $sco_id)
679 )
680 );
681 }
682 }
683 }
684 }
685 } else {
686 //echo "Warning! User $csv_rows[0] does not exist in ILIAS. Data for this user was skipped.\n";
687 }
688 }
689
690 if (count($usersToDelete) > 0) {
691 // include_once("./Services/Tracking/classes/class.ilLPMarks.php");
692 // ilLPMarks::_deleteForUsers($this->getId(), $usersToDelete);
693 $this->deleteTrackingDataOfUsers($usersToDelete);
694 }
695 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
697
698 return 0;
699 }
static _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, ilObject\$db, $ilDB, $ilUser, $res, $user, 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 1767 of file class.ilObjSCORM2004LearningModule.php.

1768 {
1769 // system style html exporter
1770 include_once("./Services/Style/System/classes/class.ilSystemStyleHTMLExport.php");
1771 $this->sys_style_html_export = new ilSystemStyleHTMLExport($a_target_dir);
1772 $this->sys_style_html_export->export();
1773
1774 // init co page html exporter
1775 include_once("./Services/COPage/classes/class.ilCOPageHTMLExport.php");
1776 $this->co_page_html_export = new ilCOPageHTMLExport($a_target_dir);
1777 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1778 $this->co_page_html_export->setContentStyleId(
1780 );
1781 $this->co_page_html_export->createDirectories();
1782 $this->co_page_html_export->exportStyles();
1783 $this->co_page_html_export->exportSupportScripts();
1784
1785 include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
1786 $this->flv_dir = $a_target_dir . "/" . ilPlayerUtil::getFlashVideoPlayerDirectory();
1787
1788 ilUtil::makeDir($a_target_dir . '/css/yahoo');
1789 ilUtil::makeDir($a_target_dir . '/objects');
1790 ilUtil::makeDir($a_target_dir . '/players');
1791 ilUtil::makeDir($this->flv_dir);
1792
1793 include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
1794 // copy(ilPlayerUtil::getFlashVideoPlayerFilename(true),
1795 // $a_target_dir.'/js/'.ilPlayerUtil::getFlashVideoPlayerFilename());
1797
1798 copy('./Modules/Scorm2004/scripts/scorm_2004.js', $a_target_dir . '/js/scorm.js');
1799 copy('./Modules/Scorm2004/scripts/pager.js', $a_target_dir . '/js/pager.js');
1800 copy('./Modules/Scorm2004/scripts/questions/pure.js', $a_target_dir . '/js/pure.js');
1801 copy(
1802 './Modules/Scorm2004/scripts/questions/question_handling.js',
1803 $a_target_dir . '/js/question_handling.js'
1804 );
1805 }
static getEffectiveContentStyleId($a_style_id, $a_type="")
Get effective Style Id.
static getFlashVideoPlayerDirectory()
Get flash video player directory.
static 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 91 of file class.ilObjSCORM2004LearningModule.php.

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

References $_POST, $DIC, ilObject\$error, $ilErr, 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 59 of file class.ilObjSCORM2004LearningModule.php.

60 {
61 $this->import_sequencing = $a_val;
62 }

◆ setPublicExportFile()

ilObjSCORM2004LearningModule::setPublicExportFile (   $a_type,
  $a_file 
)

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

1839 {
1840 $this->public_export_file[$a_type] = $a_file;
1841 }

◆ updateSequencingSettings()

ilObjSCORM2004LearningModule::updateSequencingSettings ( )

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

1106 {
1107 include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Sequencing.php");
1108
1109 $control_settings = new ilSCORM2004Sequencing($this->getId(), true);
1110 $control_settings->setChoice(ilUtil::yn2tf($_POST["choice"]));
1111 $control_settings->setFlow(ilUtil::yn2tf($_POST["flow"]));
1112 $control_settings->setForwardOnly(ilUtil::yn2tf($_POST["forwardonly"]));
1113 $control_settings->insert();
1114
1115 return true;
1116 }
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 80 of file class.ilObjSCORM2004LearningModule.php.

81 {
82 //$this->validator = new ilObjSCORMValidator($directory);
83 //$returnValue = $this->validator->validate();
84 return true;
85 }

Referenced by readObject().

+ Here is the caller graph for this function:

Field Documentation

◆ $tabs

ilObjSCORM2004LearningModule::$tabs
protected

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

Referenced by getSequencingSettings().

◆ $user

ilObjSCORM2004LearningModule::$user
protected

◆ $validator

ilObjSCORM2004LearningModule::$validator

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

◆ CONVERT_XSL

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

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

◆ WRAPPER_HTML

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

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

◆ WRAPPER_JS

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

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


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