ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 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 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 public. More...
 
 validate ($directory)
 Validate all XML-Files in a SCOM-Directory. More...
 
 getValidationSummary ()
 
 getTrackingItems ()
 
 readObject ()
 read manifest file 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 ilDB $ilDB. More...
 
 getAttemptsForUser ($a_user_id)
 get number of attempts for a certain user and package More...
 
 getModuleVersionForUsers ()
 Get module version for users. More...
 
 getModuleVersionForUser ($a_user_id)
 get module version that tracking data for a user was recorded on More...
 
 getTrackingDataPerUser ($a_sco_id, $a_user_id)
 Get tracking data per user ilDB $ilDB. More...
 
 getTrackingDataAgg ($a_user_id)
 
 getTrackingDataAggSco ($a_sco_id)
 
 exportSelected ($a_all, $a_users=array())
 Export selected user tracking data ilDB $ilDB 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 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 public. More...
 
 create ($upload=false)
 create file based lm More...
 
 read ()
 read object More...
 
 setEditable ($a_editable)
 Set Editable. More...
 
 getEditable ()
 Get Editable. More...
 
 setTries ($a_tries)
 Set default tries for questions. More...
 
 getTries ()
 Get Tries. More...
 
 setLocalization ($a_val)
 Set localization. More...
 
 getLocalization ()
 Get localization. More...
 
 getDiskUsage ()
 Gets the disk usage of the object in bytes. More...
 
 createDataDirectory ()
 creates data directory for package files ("./data/lm_data/lm_<id>") More...
 
 getDataDirectory ($mode="filesystem")
 get data directory of lm More...
 
 getAPIAdapterName ()
 get api adapter name More...
 
 setAPIAdapterName ($a_api)
 set api adapter name More...
 
 getAPIFunctionsPrefix ()
 get api functions prefix More...
 
 setAPIFunctionsPrefix ($a_prefix)
 set api functions prefix More...
 
 getCreditMode ()
 get credit mode More...
 
 setCreditMode ($a_credit_mode)
 set credit mode More...
 
 setDefaultLessonMode ($a_lesson_mode)
 set default lesson mode More...
 
 getDefaultLessonMode ()
 get default lesson mode More...
 
 getStyleSheetId ()
 get ID of assigned style sheet object More...
 
 setStyleSheetId ($a_style_id)
 set ID of assigned style sheet object More...
 
 setAutoReview ($a_auto_review)
 set auto review as true/false for SCORM 1.2 More...
 
 getAutoReview ()
 get auto review as true/false for SCORM 1.2 More...
 
 setAutoReviewChar ($a_auto_review)
 set auto review as Char for SCORM 2004 More...
 
 getAutoReviewChar ()
 get auto review as Char for SCORM 2004 More...
 
 getMaxAttempt ()
 get max attempt More...
 
 setMaxAttempt ($a_max_attempt)
 set max attempt More...
 
 getModuleVersion ()
 get module version More...
 
 getAssignedGlossary ()
 get assigned glossary More...
 
 setAssignedGlossary ($a_assigned_glossary)
 set assigned glossary More...
 
 setModuleVersion ($a_module_version)
 set max attempt More...
 
 getSession ()
 get session setting More...
 
 setSession ($a_session)
 set session setting More...
 
 getNoMenu ()
 disable menu More...
 
 setNoMenu ($a_no_menu)
 disable menu More...
 
 getHideNavig ()
 hide navigation tree More...
 
 setHideNavig ($a_hide_navig)
 disable menu More...
 
 getCacheDeactivated ()
 BrowserCacheDisabled for SCORM 2004 / ENABLE_JS_DEBUG. More...
 
 getSessionDeactivated ()
 sessionDisabled for SCORM 2004 More...
 
 getDebugActivated ()
 debugActivated More...
 
 getIe_force_render ()
 force Internet Explorer to render again after some Milliseconds - useful for learning Modules with a lot of iframesor frames and IE >=10 More...
 
 setIe_force_render ($a_ie_force_render)
 
 getFourth_Edition ()
 SCORM 2004 4th edition features. More...
 
 setFourth_edition ($a_fourth_edition)
 
 getSequencing ()
 sequencing More...
 
 setSequencing ($a_sequencing)
 
 getInteractions ()
 interactions More...
 
 setInteractions ($a_interactions)
 
 getObjectives ()
 objectives More...
 
 setObjectives ($a_objectives)
 
 getComments ()
 comments More...
 
 setComments ($a_comments)
 
 getTime_from_lms ()
 time_from_lms More...
 
 setTime_from_lms ($a_time_from_lms)
 
 getCheck_values ()
 check_values More...
 
 setCheck_values ($a_check_values)
 
 getOfflineMode ()
 offlineMode More...
 
 setOfflineMode ($a_offline_mode)
 
 getDebug ()
 debug More...
 
 setDebug ($a_debug)
 debug More...
 
 getDebugPw ()
 debug pw More...
 
 setDebugPw ($a_debug_pw)
 debug pw More...
 
 setAutoContinue ($a_auto_continue)
 get auto continue More...
 
 getAutoContinue ()
 set auto continue More...
 
 getAuto_last_visited ()
 auto_last_visited More...
 
 setAuto_last_visited ($a_auto_last_visited)
 
 setSequencingExpertMode ($a_val)
 Set sequencing expert mode. More...
 
 getSequencingExpertMode ()
 Get sequencing expert mode. More...
 
 setAutoSuspend ($a_auto_suspend)
 get auto continue More...
 
 getAutoSuspend ()
 set auto continue More...
 
 getOpenMode ()
 open_mode 0: in Tab/new Window like in previous versions 1: in iFrame with width=100% and heigth=100% 2: in iFrame with specified width and height 3: 4: 5: in new Window without specified width and height 6: in new Window with specified width and height More...
 
 setOpenMode ($a_open_mode)
 
 getWidth ()
 width More...
 
 setWidth ($a_width)
 
 getHeight ()
 height More...
 
 setHeight ($a_height)
 
 getMasteryScore ()
 get mastery_score More...
 
 setMasteryScore ($a_mastery_score)
 set mastery_score More...
 
 checkMasteryScoreValues ()
 check mastery_score / min_normalized_measure of SCOs (SCORM 1.2) / objectives (SCORM 2004) More...
 
 getMasteryScoreValues ()
 get mastery_score_values More...
 
 getIdSetting ()
 update values for mastery_score / min_normalized_measure in database - not requested More...
 
 setIdSetting ($a_id_setting)
 set id_setting More...
 
 getNameSetting ()
 get name_setting More...
 
 setNameSetting ($a_name_setting)
 set name_setting More...
 
 update ()
 update object data More...
 
 setSubType ($a_sub_type)
 get sub type More...
 
 getSubType ()
 set sub type More...
 
 delete ()
 delete SCORM learning module and all related data More...
 
 getPointsInPercent ()
 Returns the points in percent for the learning module This is called by the certificate generator if [SCORM_POINTS] is inserted. More...
 
 getMaxPoints ()
 Returns score.max for the learning module, refered to the last sco where score.max is set. More...
 
 populateByDirectoy ($a_dir, $a_filename="")
 Populate by directory. More...
 
 zipLmForOfflineMode ()
 
 getApiStudentId ()
 Get cmi.core.student_id / cmi.learner_id for API. More...
 
 getApiStudentName ()
 Get cmi.core.student_name / cmi.learner_name for API note: 'lastname, firstname' is required for SCORM 1.2; 9 = no name to hide student_name for external content. More...
 
 getViewButton ()
 get button for view More...
 
- Public Member Functions inherited from ilObject
 __construct ($a_id=0, $a_reference=true)
 Constructor 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 public More...
 
 setId ($a_id)
 set object id public More...
 
 setRefId ($a_id)
 set reference id public More...
 
 getRefId ()
 get reference id public More...
 
 getType ()
 get object type public More...
 
 setType ($a_type)
 set object type public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title public More...
 
 getUntranslatedTitle ()
 get untranslated object title public More...
 
 setTitle ($a_title)
 set object title More...
 
 getDescription ()
 get object description More...
 
 setDescription ($a_desc)
 set object description More...
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 get import id More...
 
 setImportId ($a_import_id)
 set import id More...
 
 setOfflineStatus ($a_status)
 Set offline status. More...
 
 getOfflineStatus ()
 Get offline status. More...
 
 supportsOfflineHandling ()
 Check whether object supports offline handling. More...
 
 getOwner ()
 get object owner More...
 
 getOwnerName ()
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date public More...
 
 getLastUpdateDate ()
 get last update date 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) public More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. More...
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies. More...
 
 cloneMetaData ($target_obj)
 Copy meta data. More...
 
 getPossibleSubObjects ($a_filter=true)
 get all possible subobjects of this type the object can decide which types of subobjects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static _lookupLastAccess ($a_obj_id, $a_usr_id)
 Return the last access timestamp for a given user. More...
 
static _ISODurationToCentisec ($str)
 convert ISO 8601 Timeperiods to centiseconds ta More...
 
static getQuantityOfSCOs (int $a_slm_id)
 
static _getCourseCompletionForUser ($a_id, $a_user)
 Get the completion of a SCORM module for a given user. More...
 
static _getUniqueScaledScoreForUser ($a_id, $a_user)
 Get the Unique Scaled Score of a course Conditions: Only one SCO may set cmi.score.scaled. More...
 
static _getTrackingItems ($a_obj_id)
 get all tracking items of scorm object More...
 
static _getStatus ($a_obj_id, $a_user_id)
 
static _getSatisfied ($a_obj_id, $a_user_id)
 
static _getMeasure ($a_obj_id, $a_user_id)
 
static _lookupItemTitle ($a_node_id)
 
static _getMaxScoreForUser ($a_id, $a_user)
 Returns score.max for the learning module, refered to the last sco where score.max is set. More...
 
static _getScores2004ForUser ($a_cp_node_id, $a_user)
 
- Static Public Member Functions inherited from ilObjSCORMLearningModule
static _getTrackingItems ($a_obj_id)
 get all tracking items of scorm object static More...
 
static _lookupLastAccess ($a_obj_id, $a_usr_id)
 Return the last access timestamp for a given user. More...
 
static _getAllScoIds ($a_id)
 Get an array of id's for all Sco's in the module. More...
 
static _getStatusForUser ($a_id, $a_user, $a_allScoIds, $a_numerical=false)
 Get the status of a SCORM module for a given user. More...
 
static _getCourseCompletionForUser ($a_id, $a_user)
 Get the completion of a SCORM module for a given user. More...
 
static _removeTrackingDataForUser ($user_id)
 
static _getScoresForUser ($a_item_id, $a_user_id)
 
- Static Public Member Functions inherited from ilObjSAHSLearningModule
static getAffectiveLocalization ($a_id)
 Get affective localization. More...
 
static _lookupSubType ($a_obj_id)
 lookup subtype id (scorm, ) More...
 
static _getTries ($a_id)
 
static getScormModulesForGlossary ($a_glo_id)
 Get SCORM modules that assign a certain glossary. More...
 
static lookupAssignedGlossary ($a_slm_id)
 Get SCORM modules that assign a certain glossary. More...
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId ($a_import_id)
 
static _lookupImportId ($a_obj_id)
 
static _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
static _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
static _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static lookupOfflineStatus ($a_obj_id)
 Lookup offline status using objectDataCache. More...
 
static _lookupOwner ($a_id)
 lookup object owner More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
static _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
static _lookupObjId ($a_id)
 
static _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree More...
 
static setDeletedDates ($a_ref_ids)
 Set deleted date. More...
 
static _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
static _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
static _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
static _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id More...
 
static _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type More...
 
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data 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 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 public.

Parameters
integerreference_id or object_id
booleantreat the id as reference_id (true) or object_id (false)

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

References $DIC, and user().

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  }
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
+ 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

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

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

Referenced by ilCertificateMigrationJob\getScormCertificates().

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

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

Referenced by ilObjSAHSLearningModule\getMaxPoints().

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

◆ _getMeasure()

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

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

References $DIC, and $ilDB.

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

◆ _getSatisfied()

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

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

References $DIC, and $ilDB.

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

◆ _getScores2004ForUser()

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

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

References $DIC, and $ilDB.

Referenced by ilLPCollectionOfSCOs\getScoresForUserAndCP_Node_Id().

1905  {
1906  global $DIC;
1907 
1908  $ilDB = $DIC->database();
1909  $retAr = array("raw" => null, "max" => null, "scaled" => null);
1910  $val_set = $ilDB->queryF(
1911  "SELECT c_raw, c_max, scaled FROM cmi_node WHERE (user_id = %s AND cp_node_id = %s)",
1912  array('integer', 'integer'),
1913  array($a_user, $a_cp_node_id)
1914  );
1915  if ($val_set->numRows() > 0) {
1916  $val_rec = $ilDB->fetchAssoc($val_set);
1917  $retAr["raw"] = $val_rec['c_raw'];
1918  $retAr["max"] = $val_rec['c_max'];
1919  $retAr["scaled"] = $val_rec['scaled'];
1920  if ($val_rec['scaled'] == null && $val_rec['c_raw'] != null && $val_rec['c_max'] != null) {
1921  $retAr["scaled"] = ($val_rec['c_raw'] / $val_rec['c_max']);
1922  }
1923  }
1924  return $retAr;
1925  }
global $DIC
Definition: saml.php:7
global $ilDB
+ Here is the caller graph for this function:

◆ _getStatus()

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

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

References $DIC, and $ilDB.

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

◆ _getTrackingItems()

static ilObjSCORM2004LearningModule::_getTrackingItems (   $a_obj_id)
static

get all tracking items of scorm object

currently a for learning progress only

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

References $DIC, $ilDB, and $res.

Referenced by ilLPCollectionOfSCOs\getPossibleItems().

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

◆ _getUniqueScaledScoreForUser()

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

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

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

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

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

Referenced by ilObjSAHSLearningModule\getPointsInPercent().

896  {
897  global $DIC;
898 
899  $ilDB = $DIC->database();
900  $ilUser = $DIC->user();
901  $scos = array();
902 
903  $val_set = $ilDB->queryF(
904  "SELECT cp_node.cp_node_id FROM cp_node,cp_resource,cp_item WHERE" .
905  " cp_item.cp_node_id=cp_node.cp_node_id AND cp_item.resourceId = cp_resource.id AND scormType='sco' AND nodeName='item' AND cp_node.slm_id = %s GROUP BY cp_node.cp_node_id",
906  array('integer'),
907  array($a_id)
908  );
909  while ($val_rec = $ilDB->fetchAssoc($val_set)) {
910  array_push($scos, $val_rec['cp_node_id']);
911  }
912  $set = 0; //numbers of SCO that set cmi.score.scaled
913  $scaled = null;
914  for ($i = 0;$i < count($scos);$i++) {
915  $val_set = $ilDB->queryF(
916  "SELECT scaled FROM cmi_node WHERE (user_id = %s AND cp_node_id = %s)",
917  array('integer', 'integer'),
918  array($a_user, $scos[$i])
919  );
920  if ($val_set->numRows() > 0) {
921  $val_rec = $ilDB->fetchAssoc($val_set);
922  if ($val_rec['scaled'] != null) {
923  $set++;
924  $scaled = $val_rec['scaled'];
925  }
926  }
927  }
928  $retVal = ($set == 1) ? $scaled : null ;
929  return $retVal;
930  }
global $DIC
Definition: saml.php:7
$ilUser
Definition: imgupload.php:18
global $ilDB
$i
Definition: disco.tpl.php:19
+ Here is the caller graph for this function:

◆ _ISODurationToCentisec()

static ilObjSCORM2004LearningModule::_ISODurationToCentisec (   $str)
static

convert ISO 8601 Timeperiods to centiseconds ta

static

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

References $i.

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

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

◆ _lookupItemTitle()

static ilObjSCORM2004LearningModule::_lookupItemTitle (   $a_node_id)
static

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

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

Referenced by ilLPStatusSCORM\_getStatusInfo().

1048  {
1049  global $DIC;
1050 
1051  $ilDB = $DIC->database();
1052 
1053  $r = $ilDB->queryF(
1054  '
1055  SELECT * FROM cp_item
1056  WHERE cp_node_id = %s',
1057  array('integer'),
1058  array($a_node_id)
1059  );
1060 
1061  if ($i = $ilDB->fetchAssoc($r)) {
1062  return $i["title"];
1063  }
1064  return "";
1065  }
global $DIC
Definition: saml.php:7
$r
Definition: example_031.php:79
global $ilDB
$i
Definition: disco.tpl.php:19
+ 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

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

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

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

◆ convert_1_2_to_2004()

ilObjSCORM2004LearningModule::convert_1_2_to_2004 (   $manifest)

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

References ilObject\$db, $default, $ilDB, $ilLog, ilObject\$log, $organizations, $r, $ret, fixReload(), and ilObjSAHSLearningModule\getDataDirectory().

Referenced by readObject().

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

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

References $c, ilObjStyleSheet\_lookupStandard(), ilObjectFactory\getInstanceByObjId(), ilObjSAHSLearningModule\getStyleSheetId(), getTree(), IL_LAST_NODE, and ilSCORM2004Node\pasteTree().

1934  {
1935  // set/copy stylesheet
1936  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1937  $style_id = $this->getStyleSheetId();
1938  if ($style_id > 0 && !ilObjStyleSheet::_lookupStandard($style_id)) {
1939  $style_obj = ilObjectFactory::getInstanceByObjId($style_id);
1940  $new_id = $style_obj->ilClone();
1941  $a_new_obj->setStyleSheetId($new_id);
1942  $a_new_obj->update();
1943  }
1944 
1945  $a_new_obj->createScorm2004Tree();
1946  $source_tree = $this->getTree();
1947  $target_tree_root_id = $a_new_obj->getTree()->readRootId();
1948  $childs = $source_tree->getChilds($source_tree->readRootId());
1949  $a_copied_nodes = array();
1950  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
1951  foreach ($childs as $c) {
1953  $a_new_obj,
1954  $c["child"],
1955  $target_tree_root_id,
1956  IL_LAST_NODE,
1957  "",
1958  $a_copied_nodes,
1959  true,
1960  false
1961  );
1962  }
1963  }
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
const IL_LAST_NODE
Definition: class.ilTree.php:4
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...
+ Here is the call graph for this function:

◆ createScorm2004Tree()

ilObjSCORM2004LearningModule::createScorm2004Tree ( )

Create Scorm 2004 Tree used by Editor.

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

References ilObject\getId().

1071  {
1072  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Tree.php");
1073  $this->slm_tree = new ilSCORM2004Tree($this->getId());
1074 
1075  //$this->slm_tree = new ilTree($this->getId());
1076  //$this->slm_tree->setTreeTablePK("slm_id");
1077  //$this->slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1078  $this->slm_tree->addTree($this->getId(), 1);
1079 
1080  //add seqinfo for rootNode
1081  include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Sequencing.php");
1082  $seq_info = new ilSCORM2004Sequencing($this->getId(), true);
1083  $seq_info->insert();
1084  }
SCORM 2004 Editing tree.
getId()
get object id public
Class ilSCORM2004Sequencing.
+ Here is the call graph for this function:

◆ deleteTrackingDataOfUsers()

ilObjSCORM2004LearningModule::deleteTrackingDataOfUsers (   $a_users)

get all tracked items of current user

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

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

Referenced by importSuccess().

394  {
395  $ilDB = $this->db;
396  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004DeleteData.php");
397  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
398  include_once("./Services/Tracking/classes/class.ilChangeEvent.php");
400 
401  foreach ($a_users as $user) {
403  ilLPStatusWrapper::_updateStatus($this->getId(), $user);
404  }
405  }
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)
getId()
get object id public
static _deleteReadEventsForUsers($a_obj_id, array $a_user_ids)
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeDragDrop()

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

Execute Drag Drop Action.

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

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

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

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

◆ exportFileItems()

ilObjSCORM2004LearningModule::exportFileItems (   $a_target_dir,
$expLog 
)

export files of file itmes

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

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

◆ exportHTML()

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

Export SCORM package to HTML.

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

References Sabre\VObject\$output, $xml, exportHTMLScoObjects(), ilObject\getTitle(), xslt_create(), and xslt_free().

Referenced by exportHTMLOne().

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

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

1488  {
1489  $tree = new ilTree($this->getId());
1490  $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1491  $tree->setTreeTablePK("slm_id");
1492  foreach ($tree->getSubTree($tree->getNodeData($tree->getRootId()), true, 'sco') as $sco) {
1493  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
1494  $sco_folder = $a_target_dir . "/" . $sco['obj_id'];
1495  ilUtil::makeDir($sco_folder);
1496  $node = new ilSCORM2004Sco($this, $sco['obj_id']);
1497  $node->exportHTML4PDF($a_inst, $sco_folder, $expLog);
1498  }
1499  }
Class ilSCORM2004Sco.
getId()
get object id public
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
+ Here is the call graph for this function:

◆ exportHTMLOne()

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

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

References exportHTML().

1552  {
1553  $one_file = fopen($a_target_dir . '/index.html', 'w+');
1554  $this->exportHTML($a_inst, $a_target_dir, $expLog, $one_file);
1555  fclose($one_file);
1556  }
exportHTML($a_inst, $a_target_dir, &$expLog, $a_one_file="")
Export SCORM package to HTML.
+ Here is the call graph for this function:

◆ exportHTMLScoObjects()

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

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

References Sabre\VObject\$output, PHPMailer\PHPMailer\$params, ilObject\$tree, $xml, ilObjSAHSLearningModule\getAssignedGlossary(), ilObject\getId(), ilUtil\makeDir(), prepareHTMLExporter(), xslt_create(), and xslt_free().

Referenced by exportHTML().

1693  {
1694  $tree = new ilTree($this->getId());
1695  $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1696  $tree->setTreeTablePK("slm_id");
1697 
1698  // copy all necessary files now
1699  if ($a_one_file != "") {
1700  $this->prepareHTMLExporter($a_target_dir);
1701 
1702  // put header into file
1703  $sco_tpl = new ilTemplate("tpl.sco.html", true, true, "Modules/Scorm2004");
1704  include_once("./Services/COPage/classes/class.ilCOPageHTMLExport.php");
1705  $page_html_export = new ilCOPageHTMLExport($a_target_dir);
1706  $sco_tpl = $page_html_export->getPreparedMainTemplate($sco_tpl);
1707 
1708  $sco_tpl->setCurrentBlock("js_file");
1709  $sco_tpl->setVariable("JS_FILE", "./js/pure.js");
1710  $sco_tpl->parseCurrentBlock();
1711  $sco_tpl->setCurrentBlock("js_file");
1712  $sco_tpl->setVariable("JS_FILE", "./js/question_handling.js");
1713  $sco_tpl->parseCurrentBlock();
1714 
1715 
1716  $sco_tpl->setCurrentBlock("head");
1717  $sco_tpl->parseCurrentBlock();
1718  fputs($a_one_file, $sco_tpl->get("head"));
1719 
1720  // toc
1721  include_once("./Modules/Scorm2004/classes/class.ilContObjectManifestBuilder.php");
1722  $manifestBuilder = new ilContObjectManifestBuilder($this);
1723  $manifestBuilder->buildManifest('12');
1724  $xsl = file_get_contents("./Modules/Scorm2004/templates/xsl/module.xsl");
1725  $xml = simplexml_load_string($manifestBuilder->writer->xmlDumpMem());
1726  $args = array( '/_xml' => $xml->organizations->organization->asXml(), '/_xsl' => $xsl );
1727  $xh = xslt_create();
1728  $params = array("one_page" => "y");
1729  $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, $params);
1730  xslt_free($xh);
1731  fputs($a_one_file, $output);
1732  }
1733 
1734  foreach ($tree->getSubTree($tree->getNodeData($tree->getRootId()), true, 'sco') as $sco) {
1735  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
1736  $sco_folder = $a_target_dir . "/" . $sco['obj_id'];
1737  ilUtil::makeDir($sco_folder);
1738  $node = new ilSCORM2004Sco($this, $sco['obj_id']);
1739 
1740  if ($a_one_file == "") {
1741  $node->exportHTML($a_inst, $sco_folder, $expLog, $a_one_file);
1742  } else {
1743  $node->exportHTMLPageObjects(
1744  $a_inst,
1745  $a_target_dir,
1746  $expLog,
1747  'full',
1748  "sco",
1749  $a_one_file,
1750  $sco_tpl
1751  );
1752  }
1753  if ($this->getAssignedGlossary() != 0) {
1754  include_once("./Modules/Glossary/classes/class.ilObjGlossary.php");
1755  $glos = new ilObjGlossary($this->getAssignedGlossary(), false);
1756  //$glos->exportHTML($sco_folder."/glossary", $expLog);
1757  }
1758  }
1759 
1760  // copy all necessary files now
1761  if ($a_one_file != "") {
1762  // put tail into file
1763  fputs($a_one_file, $sco_tpl->get("tail"));
1764  }
1765  }
xslt_create()
Class ilSCORM2004Sco.
HTML export class for pages.
Class ilObjGlossary.
xslt_free(&$proc)
getAssignedGlossary()
get assigned glossary
prepareHTMLExporter($a_target_dir)
Prepare HTML exporter.
getId()
get object id public
special template class to simplify handling of ITX/PEAR
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
Scorm 2004 Content Object Manifest export class.
+ 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 1501 of file class.ilObjSCORM2004LearningModule.php.

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

1502  {
1503  $a_xml_writer = new ilXmlWriter;
1504  $a_xml_writer->xmlStartTag("ContentObject", array("Type" => "SCORM2004SCO"));
1505  $this->exportXMLMetaData($a_xml_writer);
1506  $tree = new ilTree($this->getId());
1507  $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1508  $tree->setTreeTablePK("slm_id");
1509  foreach ($tree->getSubTree($tree->getNodeData($tree->getRootId()), true, 'sco') as $sco) {
1510  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
1511  $sco_folder = $a_target_dir . "/" . $sco['obj_id'];
1512  ilUtil::makeDir($sco_folder);
1513  $node = new ilSCORM2004Sco($this, $sco['obj_id']);
1514  $node->exportPDFPrepareXmlNFiles($a_inst, $a_target_dir, $expLog, $a_xml_writer);
1515  }
1516  if ($this->getAssignedGlossary() != 0) {
1517  ilUtil::makeDir($a_target_dir . "/glossary");
1518  include_once("./Modules/Glossary/classes/class.ilObjGlossary.php");
1519  include_once("./Modules/Glossary/classes/class.ilGlossaryExport.php");
1520  $glos = new ilObjGlossary($this->getAssignedGlossary(), false);
1521  $glos_export = new ilGlossaryExport($glos, "xml");
1522  $glos->exportXML($a_xml_writer, $glos_export->getInstId(), $a_target_dir . "/glossary", $expLog);
1523  }
1524  $a_xml_writer->xmlEndTag("ContentObject");
1525  include_once 'Services/Transformation/classes/class.ilXML2FO.php';
1526  $xml2FO = new ilXML2FO();
1527  $xml2FO->setXSLTLocation('./Modules/Scorm2004/templates/xsl/contentobject2fo.xsl');
1528  $xml2FO->setXMLString($a_xml_writer->xmlDumpMem());
1529  $xml2FO->setXSLTParams(array('target_dir' => $a_target_dir));
1530  $xml2FO->transform();
1531  $fo_string = $xml2FO->getFOString();
1532  $fo_xml = simplexml_load_string($fo_string);
1533  $fo_ext = $fo_xml->xpath("//fo:declarations");
1534  $fo_ext = $fo_ext[0];
1535  $results = array();
1536  include_once "./Services/Utilities/classes/class.ilFileUtils.php";
1537  ilFileUtils::recursive_dirscan($a_target_dir . "/objects", $results);
1538  if (is_array($results["file"])) {
1539  foreach ($results["file"] as $key => $value) {
1540  $e = $fo_ext->addChild("fox:embedded-file", "", "http://xml.apache.org/fop/extensions");
1541  $e->addAttribute("src", $results[path][$key] . $value);
1542  $e->addAttribute("name", $value);
1543  $e->addAttribute("desc", "");
1544  }
1545  }
1546  $fo_string = $fo_xml->asXML();
1547  $a_xml_writer->_XmlWriter;
1548  return $fo_string;
1549  }
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
Class ilSCORM2004Sco.
Class ilObjGlossary.
XML writer class.
getAssignedGlossary()
get assigned glossary
getId()
get object id public
exportXMLMetaData(&$a_xml_writer)
export content objects meta data to xml (see ilias_co.dtd)
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
$results
Definition: svg-scanner.php:47
static recursive_dirscan($dir, &$arr)
Recursively scans a given directory and writes path and filename into referenced array.
Export class for content objects.
$key
Definition: croninfo.php:18
+ Here is the call graph for this function:

◆ exportScorm()

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

Export (authoring) scorm package.

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

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

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

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

Referenced by exportPDF(), and exportScorm().

1622  {
1623  include_once("Services/MetaData/classes/class.ilMD2XML.php");
1624  $md2xml = new ilMD2XML($this->getId(), 0, $this->getType());
1625  $md2xml->setExportMode(true);
1626  $md2xml->startExport();
1627  $a_xml_writer->appendXML($md2xml->getXML());
1628  }
getId()
get object id public
getType()
get object type public
+ 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 1664 of file class.ilObjSCORM2004LearningModule.php.

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

Referenced by exportScorm().

1665  {
1666  $tree = new ilTree($this->getId());
1667  $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1668  $tree->setTreeTablePK("slm_id");
1669  foreach ($tree->getSubTree($tree->getNodeData($tree->getRootId()), true, array('sco','ass')) as $sco) {
1670  if ($sco['type'] == "sco") {
1671  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
1672  $sco_folder = $a_target_dir . "/" . $sco['obj_id'];
1673  ilUtil::makeDir($sco_folder);
1674  $node = new ilSCORM2004Sco($this, $sco['obj_id']);
1675  $node->exportScorm($a_inst, $sco_folder, $ver, $expLog);
1676  }
1677  if ($sco['type'] == "ass") {
1678  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Asset.php");
1679  $sco_folder = $a_target_dir . "/" . $sco['obj_id'];
1680  ilUtil::makeDir($sco_folder);
1681  $node = new ilSCORM2004Asset($this, $sco['obj_id']);
1682  $node->exportScorm($a_inst, $sco_folder, $ver, $expLog);
1683  }
1684  }
1685  }
Class ilSCORM2004Sco.
getId()
get object id public
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
Class ilSCORM2004Asset.
+ 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 1636 of file class.ilObjSCORM2004LearningModule.php.

References ilObject\$tree, and ilObject\getId().

Referenced by exportScorm().

1637  {
1638  include_once("Services/MetaData/classes/class.ilMD2XML.php");
1639  $tree = new ilTree($this->getId());
1640  $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1641  $tree->setTreeTablePK("slm_id");
1642  $a_xml_writer->xmlStartTag("StructureObject");
1643  foreach ($tree->getFilteredSubTree($tree->getRootId(), array('page')) as $obj) {
1644  if ($obj['type'] == '') {
1645  continue;
1646  }
1647 
1648  //$md2xml = new ilMD2XML($obj['obj_id'], 0, $obj['type']);
1649  $md2xml = new ilMD2XML($this->getId(), $obj['obj_id'], $obj['type']);
1650  $md2xml->setExportMode(true);
1651  $md2xml->startExport();
1652  $a_xml_writer->appendXML($md2xml->getXML());
1653  }
1654  $a_xml_writer->xmlEndTag("StructureObject");
1655  }
getId()
get object id public
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fixReload()

ilObjSCORM2004LearningModule::fixReload ( )

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

References $out.

Referenced by convert_1_2_to_2004().

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

◆ getAttemptsForUser()

ilObjSCORM2004LearningModule::getAttemptsForUser (   $a_user_id)

get number of atttempts for a certain user and package

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

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

511  {
512  $ilDB = $this->db;
513  $val_set = $ilDB->queryF(
514  'SELECT package_attempts FROM sahs_user WHERE user_id = %s AND obj_id = %s',
515  array('integer','integer'),
516  array($a_user_id, $this->getId())
517  );
518 
519  $val_rec = $ilDB->fetchAssoc($val_set);
520 
521  if ($val_rec["package_attempts"] == null) {
522  $val_rec["package_attempts"] = "";
523  }
524 
525  return $val_rec["package_attempts"];
526  }
getId()
get object id public
global $ilDB
+ Here is the call graph for this function:

◆ getCourseCompletionForUser()

ilObjSCORM2004LearningModule::getCourseCompletionForUser (   $a_user)

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

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

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

◆ getExportFiles()

ilObjSCORM2004LearningModule::getExportFiles ( )

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

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

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

Referenced by readObject().

70  {
71  return $this->import_sequencing;
72  }
+ 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

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

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

533  {
534  $ilDB = $this->db;
535  $val_set = $ilDB->queryF(
536  'SELECT module_version FROM sahs_user WHERE user_id = %s AND obj_id = %s',
537  array('integer','integer'),
538  array($a_user_id, $this->getId())
539  );
540 
541  $val_rec = $ilDB->fetchAssoc($val_set);
542 
543  if ($val_rec["module_version"] == null) {
544  $val_rec["module_version"] = "";
545  }
546  return $val_rec["module_version"];
547  }
getId()
get object id public
global $ilDB
+ 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 1820 of file class.ilObjSCORM2004LearningModule.php.

References $a_type.

1821  {
1822  return $this->public_export_file[$a_type];
1823  }
$a_type
Definition: workflow.php:92

◆ getQuantityOfSCOs()

static ilObjSCORM2004LearningModule::getQuantityOfSCOs ( int  $a_slm_id)
static

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

References $DIC.

Referenced by ilSCORM2004StoreData\persistCMIData().

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

◆ getSequencingSettings()

ilObjSCORM2004LearningModule::getSequencingSettings ( )

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

References $tabs, and ilObject\getId().

1095  {
1096  $ilTabs = $this->tabs;
1097  $ilTabs->setTabActive("sequencing");
1098 
1099  include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Sequencing.php");
1100  $control_settings = new ilSCORM2004Sequencing($this->getId(), true);
1101 
1102  return $control_settings;
1103  }
getId()
get object id public
Class ilSCORM2004Sequencing.
+ Here is the call graph for this function:

◆ getTrackedItems()

ilObjSCORM2004LearningModule::getTrackedItems ( )

get all tracked items of current user

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

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

412  {
414  $ilDB = $this->db;
416 
417  $sco_set = $ilDB->queryF(
418  '
419  SELECT DISTINCT cmi_node.cp_node_id id
420  FROM cp_node, cmi_node
421  WHERE slm_id = %s
422  AND cp_node.cp_node_id = cmi_node.cp_node_id
423  ORDER BY cmi_node.cp_node_id ',
424  array('integer'),
425  array($this->getId())
426  );
427 
428  $items = array();
429 
430  while ($sco_rec = $ilDB->fetchAssoc($sco_set)) {
431  $item['id'] = $sco_rec["id"];
432  $item['title'] = self::_lookupItemTitle($sco_rec["id"]);
433  $items[count($items)] = $item;
434  }
435  return $items;
436  }
getId()
get object id public
$ilUser
Definition: imgupload.php:18
global $ilDB
+ Here is the call graph for this function:

◆ getTrackingDataAgg()

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

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

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

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

◆ getTree()

ilObjSCORM2004LearningModule::getTree ( )

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

References ilObject\getId().

Referenced by copyAuthoredContent().

1087  {
1088  $this->slm_tree = new ilTree($this->getId());
1089  $this->slm_tree->setTreeTablePK("slm_id");
1090  $this->slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1091  return $this->slm_tree;
1092  }
getId()
get object id public
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ importSuccess()

ilObjSCORM2004LearningModule::importSuccess (   $a_file)

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

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().

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

◆ prepareHTMLExporter()

ilObjSCORM2004LearningModule::prepareHTMLExporter (   $a_target_dir)

Prepare HTML exporter.

Parameters

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

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

Referenced by exportHTMLScoObjects().

1774  {
1775  // system style html exporter
1776  include_once("./Services/Style/System/classes/class.ilSystemStyleHTMLExport.php");
1777  $this->sys_style_html_export = new ilSystemStyleHTMLExport($a_target_dir);
1778  $this->sys_style_html_export->export();
1779 
1780  // init co page html exporter
1781  include_once("./Services/COPage/classes/class.ilCOPageHTMLExport.php");
1782  $this->co_page_html_export = new ilCOPageHTMLExport($a_target_dir);
1783  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1784  $this->co_page_html_export->setContentStyleId(
1786  );
1787  $this->co_page_html_export->createDirectories();
1788  $this->co_page_html_export->exportStyles();
1789  $this->co_page_html_export->exportSupportScripts();
1790 
1791  include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
1792  $this->flv_dir = $a_target_dir . "/" . ilPlayerUtil::getFlashVideoPlayerDirectory();
1793 
1794  ilUtil::makeDir($a_target_dir . '/css/yahoo');
1795  ilUtil::makeDir($a_target_dir . '/objects');
1796  ilUtil::makeDir($a_target_dir . '/players');
1797  ilUtil::makeDir($this->flv_dir);
1798 
1799  include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
1800  // copy(ilPlayerUtil::getFlashVideoPlayerFilename(true),
1801  // $a_target_dir.'/js/'.ilPlayerUtil::getFlashVideoPlayerFilename());
1803 
1804  copy('./Modules/Scorm2004/scripts/scorm_2004.js', $a_target_dir . '/js/scorm.js');
1805  copy('./Modules/Scorm2004/scripts/pager.js', $a_target_dir . '/js/pager.js');
1806  copy('./Modules/Scorm2004/scripts/questions/pure.js', $a_target_dir . '/js/pure.js');
1807  copy(
1808  './Modules/Scorm2004/scripts/questions/question_handling.js',
1809  $a_target_dir . '/js/question_handling.js'
1810  );
1811  }
getStyleSheetId()
get ID of assigned style sheet object
HTML export class for pages.
HTML export class for system styles.
static getEffectiveContentStyleId($a_style_id, $a_type="")
Get effective Style Id.
static getFlashVideoPlayerDirectory()
Get flash video player directory.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static copyPlayerFilesToTargetDirectory($a_target_dir)
Copy css files to target dir.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readObject()

ilObjSCORM2004LearningModule::readObject ( )

read manifest file public

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

References $_POST, $DIC, ilObject\$error, $ilErr, ilObject\$lng, $n, $start, convert_1_2_to_2004(), ilObjSAHSLearningModule\getDataDirectory(), ilObjSAHSLearningModule\getEditable(), ilObject\getId(), getImportSequencing(), ilObjSCORMLearningModule\getValidationSummary(), and validate().

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

References $a_type.

1845  {
1846  $this->public_export_file[$a_type] = $a_file;
1847  }
$a_type
Definition: workflow.php:92

◆ updateSequencingSettings()

ilObjSCORM2004LearningModule::updateSequencingSettings ( )

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

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

1106  {
1107  include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Sequencing.php");
1108 
1109  $control_settings = new ilSCORM2004Sequencing($this->getId(), true);
1110  $control_settings->setChoice(ilUtil::yn2tf($_POST["choice"]));
1111  $control_settings->setFlow(ilUtil::yn2tf($_POST["flow"]));
1112  $control_settings->setForwardOnly(ilUtil::yn2tf($_POST["forwardonly"]));
1113  $control_settings->insert();
1114 
1115  return true;
1116  }
getId()
get object id public
Class ilSCORM2004Sequencing.
static yn2tf($a_yn)
convert "y"/"n" to true/false
$_POST["username"]
+ Here is the call graph for this function:

◆ validate()

ilObjSCORM2004LearningModule::validate (   $directory)

Validate all XML-Files in a SCOM-Directory.

public

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

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

Referenced by readObject().

81  {
82  //$this->validator = new ilObjSCORMValidator($directory);
83  //$returnValue = $this->validator->validate();
84  return true;
85  }
+ 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: