ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 atttempts for a certain user and package More...
 
 getModuleVersionForUsers ()
 Get module version for users. More...
 
 getModuleVersionForUser ($a_user_id)
 get module version that tracking data for a user was recorded on More...
 
 getTrackingDataPerUser ($a_sco_id, $a_user_id)
 Get tracking data per user @global ilDB $ilDB. More...
 
 getTrackingDataAgg ($a_user_id)
 
 getTrackingDataAggSco ($a_sco_id)
 
 exportSelected ($a_all, $a_users=array())
 Export selected user tracking data @global ilDB $ilDB @global ilObjUser $ilUser. More...
 
 importTrackingData ($a_file)
 
 importSuccess ($a_file)
 
 importSuccessForSahsUser ($user_id, $last_access, $status, $attempts=null, $percentage_completed=null, $sco_total_time_sec=null)
 
 decreaseAttemptsForUser ($a_user_id)
 Decrease attempts for user @global ilDB $ilDB. More...
 
 get_user_id ($a_login)
 
 getUserIdEmail ($a_mail)
 assumes that only one account exists for a mailadress More...
 
 sendExportFile ($a_header, $a_content)
 send export file to browser More...
 
 getAllScoIds ()
 
 getStatusForUser ($a_user, $a_allScoIds, $a_numerical=false)
 
 getCourseCompletionForUser ($a_user)
 
 getLastVisited ($user_id)
 
 deleteTrackingDataOfUsers ($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...
 
 setOnline ($a_online)
 get online More...
 
 getOnline ()
 set online More...
 
 setSubType ($a_sub_type)
 get sub type More...
 
 getSubType ()
 set sub type More...
 
 delete ()
 delete SCORM learning module and all related data More...
 
 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...
 
 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...
 
 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 _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 _lookupOnline ($a_id)
 check wether scorm module is online More...
 
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 _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)
 only called in ilTree::saveSubTree More...
 
static setDeletedDates ($a_ref_ids)
 Set deleted date @global type $ilDB. 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: saml.php:7

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

815 {
816 global $DIC;
817
818 $ilDB = $DIC->database();
819 $ilUser = $DIC->user();
820 $scos = array();
821 //get all SCO's of the object
822
823 $val_set = $ilDB->queryF(
824 '
825 SELECT cp_node.cp_node_id FROM cp_node,cp_resource,cp_item
826 WHERE cp_item.cp_node_id = cp_node.cp_node_id
827 AND cp_item.resourceid = cp_resource.id
828 AND scormtype = %s
829 AND nodename = %s
830 AND cp_node.slm_id = %s',
831 array('text','text','integer'),
832 array('sco' ,'item',$a_id)
833 );
834 while ($val_rec = $ilDB->fetchAssoc($val_set)) {
835 array_push($scos, $val_rec['cp_node_id']);
836 }
837
838 $scos_c = $scos;
839 //copy SCO_array
840 //check if all SCO's are completed
841 for ($i=0;$i<count($scos);$i++) {
842 $val_set = $ilDB->queryF(
843 '
844 SELECT * FROM cmi_node
845 WHERE (user_id= %s
846 AND cp_node_id= %s
847 AND (completion_status = %s OR success_status = %s))',
848 array('integer','integer','text','text'),
849 array($a_user,$scos[$i],'completed','passed')
850 );
851
852 if ($ilDB->numRows($val_set) > 0) {
853 //delete from array
854 $key = array_search($scos[$i], $scos_c);
855 unset($scos_c[$key]);
856 }
857 }
858 //check for completion
859 if (count($scos_c) == 0) {
860 $completion = true;
861 } else {
862 $completion = false;
863 }
864 return $completion;
865 }
$key
Definition: croninfo.php:18
$i
Definition: disco.tpl.php:19
global $ilDB
$ilUser
Definition: imgupload.php:18

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

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

+ Here is the caller graph for this function:

◆ _getMaxScoreForUser()

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

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

Parameters
integer$a_id
integer$a_user
Returns
float

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

1839 {
1840 global $DIC;
1841
1842 $ilDB = $DIC->database();
1843
1844 $scos = array();
1845
1846 $result = $ilDB->query(
1847 'SELECT cp_node.cp_node_id '
1848 . 'FROM cp_node, cp_resource, cp_item '
1849 . 'WHERE cp_item.cp_node_id = cp_node.cp_node_id '
1850 . 'AND cp_item.resourceId = cp_resource.id '
1851 . 'AND scormType = ' . $ilDB->quote('sco', 'text') . ' '
1852 . 'AND nodeName = ' . $ilDB->quote('item', 'text') . ' '
1853 . 'AND cp_node.slm_id = ' . $ilDB->quote($a_id, 'integer') . ' '
1854 . 'GROUP BY cp_node.cp_node_id'
1855 );
1856
1857 while ($row = $ilDB->fetchAssoc($result)) {
1858 array_push($scos, $row['cp_node_id']);
1859 }
1860
1861 $set = 0; //numbers of SCO that set cmi.score.scaled
1862 $max = null;
1863 for ($i = 0; $i < count($scos); $i++) {
1864 $res = $ilDB->queryF(
1865 'SELECT c_max FROM cmi_node WHERE (user_id = %s AND cp_node_id = %s)',
1866 array('integer', 'integer'),
1867 array($a_user, $scos[$i])
1868 );
1869
1870 if ($ilDB->numRows($res) > 0) {
1871 $row = $ilDB->fetchAssoc($res);
1872 if ($row['c_max'] != null) {
1873 $set++;
1874 $max = $row['c_max'];
1875 }
1876 }
1877 }
1878 $retVal = ($set == 1) ? $max : null;
1879
1880 return $retVal;
1881 }
$result
foreach($_POST as $key=> $value) $res

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

Referenced by ilObjSAHSLearningModule\getMaxPoints().

+ Here is the caller graph for this function:

◆ _getMeasure()

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

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

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

References $DIC, and $ilDB.

◆ _getSatisfied()

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

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

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

References $DIC, and $ilDB.

◆ _getScores2004ForUser()

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

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

1884 {
1885 global $DIC;
1886
1887 $ilDB = $DIC->database();
1888 $retAr = array("raw" => null, "max" => null, "scaled" => null);
1889 $val_set = $ilDB->queryF(
1890 "SELECT c_raw, c_max, scaled FROM cmi_node WHERE (user_id = %s AND cp_node_id = %s)",
1891 array('integer', 'integer'),
1892 array($a_user, $a_cp_node_id)
1893 );
1894 if ($val_set->numRows()>0) {
1895 $val_rec = $ilDB->fetchAssoc($val_set);
1896 $retAr["raw"] = $val_rec['c_raw'];
1897 $retAr["max"] = $val_rec['c_max'];
1898 $retAr["scaled"] = $val_rec['scaled'];
1899 if ($val_rec['scaled']==null && $val_rec['c_raw']!=null && $val_rec['c_max']!=null) {
1900 $retAr["scaled"] = ($val_rec['c_raw'] / $val_rec['c_max']);
1901 }
1902 }
1903 return $retAr;
1904 }

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

957 {
958 global $DIC;
959
960 $ilDB = $DIC->database();
961
962 $status_set = $ilDB->queryF(
963 '
964 SELECT * FROM cmi_gobjective
965 WHERE scope_id = %s
966 AND objective_id = %s
967 AND user_id = %s',
968 array('integer','text','integer'),
969 array($a_obj_id,'-course_overall_status-',$a_user_id)
970 );
971
972 if ($status_rec = $ilDB->fetchAssoc($status_set)) {
973 return $status_rec["status"];
974 }
975
976 return false;
977 }

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

917 {
918 global $DIC;
919
920 $ilDB = $DIC->database();
921
922
923 $item_set = $ilDB->queryF(
924 '
925 SELECT cp_item.* FROM cp_node, cp_item WHERE slm_id = %s
926 AND cp_node.cp_node_id = cp_item.cp_node_id
927 ORDER BY cp_node.cp_node_id ',
928 array('integer'),
929 array($a_obj_id)
930 );
931
932 $items = array();
933 while ($item_rec = $ilDB->fetchAssoc($item_set)) {
934 $s2 = $ilDB->queryF(
935 '
936 SELECT cp_resource.* FROM cp_node, cp_resource
937 WHERE slm_id = %s
938 AND cp_node.cp_node_id = cp_resource.cp_node_id
939 AND cp_resource.id = %s ',
940 array('integer','text'),
941 array($a_obj_id,$item_rec["resourceid"])
942 );
943
944
945 if ($res = $ilDB->fetchAssoc($s2)) {
946 if ($res["scormtype"] == "sco") {
947 $items[] = array("id" => $item_rec["cp_node_id"],
948 "title" => $item_rec["title"]);
949 }
950 }
951 }
952
953 return $items;
954 }

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

875 {
876 global $DIC;
877
878 $ilDB = $DIC->database();
879 $ilUser = $DIC->user();
880 $scos = array();
881
882 $val_set = $ilDB->queryF(
883 "SELECT cp_node.cp_node_id FROM cp_node,cp_resource,cp_item WHERE" .
884 " 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",
885 array('integer'),
886 array($a_id)
887 );
888 while ($val_rec = $ilDB->fetchAssoc($val_set)) {
889 array_push($scos, $val_rec['cp_node_id']);
890 }
891 $set = 0; //numbers of SCO that set cmi.score.scaled
892 $scaled = null;
893 for ($i=0;$i<count($scos);$i++) {
894 $val_set = $ilDB->queryF(
895 "SELECT scaled FROM cmi_node WHERE (user_id = %s AND cp_node_id = %s)",
896 array('integer', 'integer'),
897 array($a_user, $scos[$i])
898 );
899 if ($val_set->numRows()>0) {
900 $val_rec = $ilDB->fetchAssoc($val_set);
901 if ($val_rec['scaled']!=null) {
902 $set++;
903 $scaled = $val_rec['scaled'];
904 }
905 }
906 }
907 $retVal = ($set == 1) ? $scaled : null ;
908 return $retVal;
909 }

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

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

References $i.

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

+ Here is the caller graph for this function:

◆ _lookupItemTitle()

static ilObjSCORM2004LearningModule::_lookupItemTitle (   $a_node_id)
static

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

1027 {
1028 global $DIC;
1029
1030 $ilDB = $DIC->database();
1031
1032 $r = $ilDB->queryF(
1033 '
1034 SELECT * FROM cp_item
1035 WHERE cp_node_id = %s',
1036 array('integer'),
1037 array($a_node_id)
1038 );
1039
1040 if ($i = $ilDB->fetchAssoc($r)) {
1041 return $i["title"];
1042 }
1043 return "";
1044 }
$r
Definition: example_031.php:79

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

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

+ Here is the caller graph for this function:

◆ _lookupLastAccess()

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

Return the last access timestamp for a given user.

Parameters
int$a_obj_idobject id
int$user_iduser id
Returns
timestamp

Reimplemented from ilObjSCORMLearningModule.

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

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

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

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

+ Here is the caller graph for this function:

◆ convert_1_2_to_2004()

ilObjSCORM2004LearningModule::convert_1_2_to_2004 (   $manifest)

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

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

References ilObject\$db, $ilDB, $ilLog, ilObject\$log, $organizations, $r, $ret, $schema, 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 1912 of file class.ilObjSCORM2004LearningModule.php.

1913 {
1914 // set/copy stylesheet
1915 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1916 $style_id = $this->getStyleSheetId();
1917 if ($style_id > 0 && !ilObjStyleSheet::_lookupStandard($style_id)) {
1918 $style_obj = ilObjectFactory::getInstanceByObjId($style_id);
1919 $new_id = $style_obj->ilClone();
1920 $a_new_obj->setStyleSheetId($new_id);
1921 $a_new_obj->update();
1922 }
1923
1924 $a_new_obj->createScorm2004Tree();
1925 $source_tree = $this->getTree();
1926 $target_tree_root_id = $a_new_obj->getTree()->readRootId();
1927 $childs = $source_tree->getChilds($source_tree->readRootId());
1928 $a_copied_nodes = array();
1929 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
1930 foreach ($childs as $c) {
1932 $a_new_obj,
1933 $c["child"],
1934 $target_tree_root_id,
1936 "",
1937 $a_copied_nodes,
1938 true,
1939 false
1940 );
1941 }
1942 }
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.

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

1050 {
1051 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Tree.php");
1052 $this->slm_tree = new ilSCORM2004Tree($this->getId());
1053
1054 //$this->slm_tree = new ilTree($this->getId());
1055 //$this->slm_tree->setTreeTablePK("slm_id");
1056 //$this->slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1057 $this->slm_tree->addTree($this->getId(), 1);
1058
1059 //add seqinfo for rootNode
1060 include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Sequencing.php");
1061 $seq_info = new ilSCORM2004Sequencing($this->getId(), true);
1062 $seq_info->insert();
1063 }
getId()
get object id @access public
Class ilSCORM2004Sequencing.
SCORM 2004 Editing tree.

References ilObject\getId().

+ Here is the call graph for this function:

◆ deleteTrackingDataOfUsers()

ilObjSCORM2004LearningModule::deleteTrackingDataOfUsers (   $a_users)

get all tracked items of current user

Reimplemented from ilObjSCORMLearningModule.

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

390 {
392 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004DeleteData.php");
393 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
394 include_once("./Services/Tracking/classes/class.ilChangeEvent.php");
396
397 foreach ($a_users as $user) {
400 }
401 }
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 1105 of file class.ilObjSCORM2004LearningModule.php.

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

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

1809 {
1810 include_once("./Modules/File/classes/class.ilObjFile.php");
1811
1812 foreach ($this->file_ids as $file_id) {
1813 $expLog->write(date("[y-m-d H:i:s] ") . "File Item " . $file_id);
1814 $file_obj = new ilObjFile($file_id, false);
1815 $file_obj->export($a_target_dir);
1816 unset($file_obj);
1817 }
1818 }
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
Class ilObjFile.

References date.

◆ exportHTML()

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

Export SCORM package to HTML.

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

1541 {
1542 // $a_xml_writer = new ilXmlWriter;
1543 // set dtd definition
1544 // $a_xml_writer->xmlSetDtdDef("<!DOCTYPE ContentObject SYSTEM \"http://www.ilias.de/download/dtd/ilias_co_3_7.dtd\">");
1545
1546 // set generated comment
1547 // $a_xml_writer->xmlSetGenCmt("Export of ILIAS Content Module ". $this->getId()." of installation ".$a_inst.".");
1548
1549 // set xml header
1550 // $a_xml_writer->xmlHeader();
1551
1552
1553 // $a_xml_writer->xmlStartTag("ContentObject", array("Type"=>"SCORM2004LearningModule"));
1554
1555 // $expLog->write(date("[y-m-d H:i:s] ")."Start Export Sco Objects");
1556 $this->exportHTMLScoObjects($a_inst, $a_target_dir, $expLog, $a_one_file);
1557 // $expLog->write(date("[y-m-d H:i:s] ")."Finished Export Sco Objects");
1558
1559 // $a_xml_writer->xmlEndTag("ContentObject");
1560
1561
1562 /*$toc_tpl = new ilTemplate("tpl.main.html", true, true, false);
1563 $style_name = $ilUser->prefs["style"].".css";
1564 $tpl->setCurrentBlock("css_file");
1565 $tpl->setVariable("CSS_FILE", $style_name);
1566 $tpl->parseCurrentBlock();*/
1567
1568 if ($a_one_file == "") {
1569 include_once("./Modules/Scorm2004/classes/class.ilContObjectManifestBuilder.php");
1570 $manifestBuilder = new ilContObjectManifestBuilder($this);
1571 $manifestBuilder->buildManifest('12');
1572
1573 include_once("Services/Frameset/classes/class.ilFramesetGUI.php");
1574 $fs_gui = new ilFramesetGUI();
1575 $fs_gui->setFramesetTitle($this->getTitle());
1576 $fs_gui->setMainFrameSource("");
1577 $fs_gui->setSideFrameSource("toc.html");
1578 $fs_gui->setMainFrameName("content");
1579 $fs_gui->setSideFrameName("toc");
1580 $output = $fs_gui->get();
1581 fputs(fopen($a_target_dir . '/index.html', 'w+'), $output);
1582
1583 $xsl = file_get_contents("./Modules/Scorm2004/templates/xsl/module.xsl");
1584 $xml = simplexml_load_string($manifestBuilder->writer->xmlDumpMem());
1585 $args = array( '/_xml' => $xml->organizations->organization->asXml(), '/_xsl' => $xsl );
1586 $xh = xslt_create();
1587 $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, null);
1588 xslt_free($xh);
1589 fputs(fopen($a_target_dir . '/toc.html', 'w+'), $output);
1590 }
1591 // $a_xml_writer->_XmlWriter;
1592 }
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
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\s+" &#(? foreach( $entity_files as $file) $output
xslt_free(&$proc)
xslt_create()
$xml
Definition: metadata.php:240

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

1467 {
1468 $tree = new ilTree($this->getId());
1469 $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1470 $tree->setTreeTablePK("slm_id");
1471 foreach ($tree->getSubTree($tree->getNodeData($tree->getRootId()), true, 'sco') as $sco) {
1472 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
1473 $sco_folder = $a_target_dir . "/" . $sco['obj_id'];
1474 ilUtil::makeDir($sco_folder);
1475 $node = new ilSCORM2004Sco($this, $sco['obj_id']);
1476 $node->exportHTML4PDF($a_inst, $sco_folder, $expLog);
1477 }
1478 }
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 1530 of file class.ilObjSCORM2004LearningModule.php.

1531 {
1532 $one_file = fopen($a_target_dir . '/index.html', 'w+');
1533 $this->exportHTML($a_inst, $a_target_dir, $expLog, $one_file);
1534 fclose($one_file);
1535 }
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 1671 of file class.ilObjSCORM2004LearningModule.php.

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

References $output, $params, 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 1480 of file class.ilObjSCORM2004LearningModule.php.

1481 {
1482 $a_xml_writer = new ilXmlWriter;
1483 $a_xml_writer->xmlStartTag("ContentObject", array("Type"=>"SCORM2004SCO"));
1484 $this->exportXMLMetaData($a_xml_writer);
1485 $tree = new ilTree($this->getId());
1486 $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1487 $tree->setTreeTablePK("slm_id");
1488 foreach ($tree->getSubTree($tree->getNodeData($tree->getRootId()), true, 'sco') as $sco) {
1489 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
1490 $sco_folder = $a_target_dir . "/" . $sco['obj_id'];
1491 ilUtil::makeDir($sco_folder);
1492 $node = new ilSCORM2004Sco($this, $sco['obj_id']);
1493 $node->exportPDFPrepareXmlNFiles($a_inst, $a_target_dir, $expLog, $a_xml_writer);
1494 }
1495 if ($this->getAssignedGlossary()!=0) {
1496 ilUtil::makeDir($a_target_dir . "/glossary");
1497 include_once("./Modules/Glossary/classes/class.ilObjGlossary.php");
1498 include_once("./Modules/Glossary/classes/class.ilGlossaryExport.php");
1499 $glos = new ilObjGlossary($this->getAssignedGlossary(), false);
1500 $glos_export = new ilGlossaryExport($glos, "xml");
1501 $glos->exportXML($a_xml_writer, $glos_export->getInstId(), $a_target_dir . "/glossary", $expLog);
1502 }
1503 $a_xml_writer->xmlEndTag("ContentObject");
1504 include_once 'Services/Transformation/classes/class.ilXML2FO.php';
1505 $xml2FO = new ilXML2FO();
1506 $xml2FO->setXSLTLocation('./Modules/Scorm2004/templates/xsl/contentobject2fo.xsl');
1507 $xml2FO->setXMLString($a_xml_writer->xmlDumpMem());
1508 $xml2FO->setXSLTParams(array('target_dir' => $a_target_dir));
1509 $xml2FO->transform();
1510 $fo_string = $xml2FO->getFOString();
1511 $fo_xml = simplexml_load_string($fo_string);
1512 $fo_ext = $fo_xml->xpath("//fo:declarations");
1513 $fo_ext = $fo_ext[0];
1514 $results = array();
1515 include_once "./Services/Utilities/classes/class.ilFileUtils.php";
1516 ilFileUtils::recursive_dirscan($a_target_dir . "/objects", $results);
1517 if (is_array($results["file"])) {
1518 foreach ($results["file"] as $key => $value) {
1519 $e = $fo_ext->addChild("fox:embedded-file", "", "http://xml.apache.org/fop/extensions");
1520 $e->addAttribute("src", $results[path][$key] . $value);
1521 $e->addAttribute("name", $value);
1522 $e->addAttribute("desc", "");
1523 }
1524 }
1525 $fo_string = $fo_xml->asXML();
1526 $a_xml_writer->_XmlWriter;
1527 return $fo_string;
1528 }
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
Definition: svg-scanner.php:47

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

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

1601 {
1602 include_once("Services/MetaData/classes/class.ilMD2XML.php");
1603 $md2xml = new ilMD2XML($this->getId(), 0, $this->getType());
1604 $md2xml->setExportMode(true);
1605 $md2xml->startExport();
1606 $a_xml_writer->appendXML($md2xml->getXML());
1607 }
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 1643 of file class.ilObjSCORM2004LearningModule.php.

1644 {
1645 $tree = new ilTree($this->getId());
1646 $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1647 $tree->setTreeTablePK("slm_id");
1648 foreach ($tree->getSubTree($tree->getNodeData($tree->getRootId()), true, array('sco','ass')) as $sco) {
1649 if ($sco['type'] == "sco") {
1650 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
1651 $sco_folder = $a_target_dir . "/" . $sco['obj_id'];
1652 ilUtil::makeDir($sco_folder);
1653 $node = new ilSCORM2004Sco($this, $sco['obj_id']);
1654 $node->exportScorm($a_inst, $sco_folder, $ver, $expLog);
1655 }
1656 if ($sco['type'] == "ass") {
1657 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Asset.php");
1658 $sco_folder = $a_target_dir . "/" . $sco['obj_id'];
1659 ilUtil::makeDir($sco_folder);
1660 $node = new ilSCORM2004Asset($this, $sco['obj_id']);
1661 $node->exportScorm($a_inst, $sco_folder, $ver, $expLog);
1662 }
1663 }
1664 }
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 1615 of file class.ilObjSCORM2004LearningModule.php.

1616 {
1617 include_once("Services/MetaData/classes/class.ilMD2XML.php");
1618 $tree = new ilTree($this->getId());
1619 $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1620 $tree->setTreeTablePK("slm_id");
1621 $a_xml_writer->xmlStartTag("StructureObject");
1622 foreach ($tree->getFilteredSubTree($tree->getRootId(), array('page')) as $obj) {
1623 if ($obj['type']=='') {
1624 continue;
1625 }
1626
1627 //$md2xml = new ilMD2XML($obj['obj_id'], 0, $obj['type']);
1628 $md2xml = new ilMD2XML($this->getId(), $obj['obj_id'], $obj['type']);
1629 $md2xml->setExportMode(true);
1630 $md2xml->startExport();
1631 $a_xml_writer->appendXML($md2xml->getXML());
1632 }
1633 $a_xml_writer->xmlEndTag("StructureObject");
1634 }

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

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

References $out.

Referenced by convert_1_2_to_2004().

+ Here is the caller graph for this function:

◆ getAttemptsForUser()

ilObjSCORM2004LearningModule::getAttemptsForUser (   $a_user_id)

get number of atttempts for a certain user and package

Reimplemented from ilObjSCORMLearningModule.

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

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

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

755 {
758
759 $scos = array();
760 //get all SCO's of this object
761
762 $val_set = $ilDB->queryF(
763 '
764 SELECT cp_node.cp_node_id FROM cp_node,cp_resource,cp_item
765 WHERE cp_item.cp_node_id = cp_node.cp_node_id
766 AND cp_item.resourceid = cp_resource.id
767 AND scormtype = %s
768 AND nodename = %s
769 AND cp_node.slm_id = %s ',
770 array('text','text','integer'),
771 array('sco','item',$this->getId())
772 );
773
774 while ($val_rec = $ilDB->fetchAssoc($val_set)) {
775 array_push($scos, $val_rec['cp_node_id']);
776 }
777
778
779 $scos_c = $scos;
780 //copy SCO_array
781 //check if all SCO's are completed
782 for ($i=0;$i<count($scos);$i++) {
783 $val_set = $ilDB->queryF(
784 '
785 SELECT * FROM cmi_node
786 WHERE (user_id= %s
787 AND cp_node_id= %s
788 AND (completion_status=%s OR success_status=%s))',
789 array('integer','integer','text', 'text'),
790 array($a_user,$scos[$i],'completed','passed')
791 );
792
793 if ($ilDB->numRows($val_set) > 0) {
794 //delete from array
795 $key = array_search($scos[$i], $scos_c);
796 unset($scos_c[$key]);
797 }
798 }
799 //check for completion
800 if (count($scos_c) == 0) {
801 $completion = true;
802 } else {
803 $completion = false;
804 }
805 return $completion;
806 }

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

+ Here is the call graph for this function:

◆ getExportFiles()

ilObjSCORM2004LearningModule::getExportFiles ( )

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

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

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

+ Here is the call graph for this function:

◆ getImportSequencing()

ilObjSCORM2004LearningModule::getImportSequencing ( )

Get import sequencing.

Returns
boolean import sequencing information

Definition at line 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 528 of file class.ilObjSCORM2004LearningModule.php.

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

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

1800 {
1801 return $this->public_export_file[$a_type];
1802 }
$a_type
Definition: workflow.php:92

References $a_type.

◆ getSequencingSettings()

ilObjSCORM2004LearningModule::getSequencingSettings ( )

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

1074 {
1075 $ilTabs = $this->tabs;
1076 $ilTabs->setTabActive("sequencing");
1077
1078 include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Sequencing.php");
1079 $control_settings = new ilSCORM2004Sequencing($this->getId(), true);
1080
1081 return $control_settings;
1082 }

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

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

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

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

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

1066 {
1067 $this->slm_tree = new ilTree($this->getId());
1068 $this->slm_tree->setTreeTablePK("slm_id");
1069 $this->slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1070 return $this->slm_tree;
1071 }

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

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

1753 {
1754 // system style html exporter
1755 include_once("./Services/Style/System/classes/class.ilSystemStyleHTMLExport.php");
1756 $this->sys_style_html_export = new ilSystemStyleHTMLExport($a_target_dir);
1757 $this->sys_style_html_export->export();
1758
1759 // init co page html exporter
1760 include_once("./Services/COPage/classes/class.ilCOPageHTMLExport.php");
1761 $this->co_page_html_export = new ilCOPageHTMLExport($a_target_dir);
1762 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1763 $this->co_page_html_export->setContentStyleId(
1765 );
1766 $this->co_page_html_export->createDirectories();
1767 $this->co_page_html_export->exportStyles();
1768 $this->co_page_html_export->exportSupportScripts();
1769
1770 include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
1771 $this->flv_dir = $a_target_dir . "/" . ilPlayerUtil::getFlashVideoPlayerDirectory();
1772
1773 ilUtil::makeDir($a_target_dir . '/css/yahoo');
1774 ilUtil::makeDir($a_target_dir . '/objects');
1775 ilUtil::makeDir($a_target_dir . '/players');
1776 ilUtil::makeDir($this->flv_dir);
1777
1778 include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
1779 // copy(ilPlayerUtil::getFlashVideoPlayerFilename(true),
1780 // $a_target_dir.'/js/'.ilPlayerUtil::getFlashVideoPlayerFilename());
1782
1783 copy('./Modules/Scorm2004/scripts/scorm_2004.js', $a_target_dir . '/js/scorm.js');
1784 copy('./Modules/Scorm2004/scripts/pager.js', $a_target_dir . '/js/pager.js');
1785 copy('./Modules/Scorm2004/scripts/questions/pure.js', $a_target_dir . '/js/pure.js');
1786 copy(
1787 './Modules/Scorm2004/scripts/questions/question_handling.js',
1788 $a_target_dir . '/js/question_handling.js'
1789 );
1790 }
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 {
95
96 //check for json_encode,json_decode
97 if (!function_exists('json_encode') || !function_exists('json_decode')) {
98 $ilErr->raiseError($lng->txt('scplayer_phpmysqlcheck'), $ilErr->WARNING);
99 }
100
101 $needs_convert = false;
102
103 // convert imsmanifest.xml file in iso to utf8 if needed
104
105 $manifest_file = $this->getDataDirectory() . "/imsmanifest.xml";
106
107 // check if manifestfile exists and space left on device...
108 $check_for_manifest_file = is_file($manifest_file);
109
110
111
112 // if no manifestfile
113 if (!$check_for_manifest_file) {
114 $ilErr->raiseError($this->lng->txt("Manifestfile $manifest_file not found!"), $ilErr->MESSAGE);
115 return;
116 }
117
118
119 if ($check_for_manifest_file) {
120 $manifest_file_array = file($manifest_file);
121
122 foreach ($manifest_file_array as $mfa) {
123 // if (seems_not_utf8($mfa))
124 if (@iconv('UTF-8', 'UTF-8', $mfa) != $mfa) {
125 $needs_convert = true;
126 break;
127 }
128 }
129
130
131
132 // to copy the file we need some extraspace, counted in bytes *2 ... we need 2 copies....
133 $estimated_manifest_filesize = filesize($manifest_file) * 2;
134
135 // i deactivated this, because it seems to fail on some windows systems (see bug #1795)
136 //$check_disc_free = disk_free_space($this->getDataDirectory()) - $estimated_manifest_filesize;
137 $check_disc_free = 2;
138 }
139
140
141 // if $manifest_file needs to be converted to UTF8
142 if ($needs_convert) {
143 // if file exists and enough space left on device
144 if ($check_for_manifest_file && ($check_disc_free > 1)) {
145
146 // create backup from original
147 if (!copy($manifest_file, $manifest_file . ".old")) {
148 echo "Failed to copy $manifest_file...<br>\n";
149 }
150
151 // read backupfile, convert each line to utf8, write line to new file
152 // php < 4.3 style
153 $f_write_handler = fopen($manifest_file . ".new", "w");
154 $f_read_handler = fopen($manifest_file . ".old", "r");
155 while (!feof($f_read_handler)) {
156 $zeile = fgets($f_read_handler);
157 //echo mb_detect_encoding($zeile);
158 fputs($f_write_handler, utf8_encode($zeile));
159 }
160 fclose($f_read_handler);
161 fclose($f_write_handler);
162
163 // copy new utf8-file to imsmanifest.xml
164 if (!copy($manifest_file . ".new", $manifest_file)) {
165 echo "Failed to copy $manifest_file...<br>\n";
166 }
167
168 if (!@is_file($manifest_file)) {
169 $ilErr->raiseError($this->lng->txt("cont_no_manifest"), $ilErr->WARNING);
170 }
171 } else {
172 // gives out the specific error
173
174 if (!($check_disc_free > 1)) {
175 $ilErr->raiseError($this->lng->txt("Not enough space left on device!"), $ilErr->MESSAGE);
176 }
177 return;
178 }
179 } else {
180 // check whether file starts with BOM (that confuses some sax parsers, see bug #1795)
181 $hmani = fopen($manifest_file, "r");
182 $start = fread($hmani, 3);
183 if (strtolower(bin2hex($start)) == "efbbbf") {
184 $f_write_handler = fopen($manifest_file . ".new", "w");
185 while (!feof($hmani)) {
186 $n = fread($hmani, 900);
187 fputs($f_write_handler, $n);
188 }
189 fclose($f_write_handler);
190 fclose($hmani);
191
192 // copy new utf8-file to imsmanifest.xml
193 if (!copy($manifest_file . ".new", $manifest_file)) {
194 echo "Failed to copy $manifest_file...<br>\n";
195 }
196 } else {
197 fclose($hmani);
198 }
199 }
200
201 //validate the XML-Files in the SCORM-Package
202 if ($_POST["validate"] == "y") {
203 if (!$this->validate($this->getDataDirectory())) {
204 $ilErr->raiseError(
205 "<b>Validation Error(s):</b><br>" . $this->getValidationSummary(),
206 $ilErr->WARNING
207 );
208 }
209 }
210
211
212 //check for SCORM 1.2
213 $this->convert_1_2_to_2004($manifest_file);
214
215 // start SCORM 2004 package parser/importer
216 include_once("./Modules/Scorm2004/classes/ilSCORM13Package.php");
217 $newPack = new ilSCORM13Package();
218 if ($this->getEditable()) {
219 return $newPack->il_importLM(
220 $this,
221 $this->getDataDirectory(),
222 $this->getImportSequencing()
223 );
224 } else {
225 return $newPack->il_import($this->getDataDirectory(), $this->getId(), $DIC["ilias"], $_POST["validate"]);
226 }
227 }
$n
Definition: RandomTest.php:85
$_POST["username"]
validate($directory)
Validate all XML-Files in a SCOM-Directory.
global $ilErr
Definition: raiseError.php:16

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

1824 {
1825 $this->public_export_file[$a_type] = $a_file;
1826 }

References $a_type.

◆ updateSequencingSettings()

ilObjSCORM2004LearningModule::updateSequencingSettings ( )

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

1085 {
1086 include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Sequencing.php");
1087
1088 $control_settings = new ilSCORM2004Sequencing($this->getId(), true);
1089 $control_settings->setChoice(ilUtil::yn2tf($_POST["choice"]));
1090 $control_settings->setFlow(ilUtil::yn2tf($_POST["flow"]));
1091 $control_settings->setForwardOnly(ilUtil::yn2tf($_POST["forwardonly"]));
1092 $control_settings->insert();
1093
1094 return true;
1095 }
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: