5require_once(
"./Services/YUI/classes/class.ilYuiUtil.php");
 
    6require_once(
"./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
 
   25            'user_id' => array(
'pattern' => 
null, 
'permission' => self::NONE, 
'default' => 
null, 
'dbfield' => 
'user_id'),
 
   26            'learner_name' => array(
'pattern' => 
null, 
'permission' => self::NONE, 
'default' => 
null, 
'dbfield' => 
'learner_name'),
 
   27            'slm_id' => array(
'pattern' => 
null, 
'permission' => self::NONE, 
'default' => 
null, 
'dbfield' => 
'slm_id'),
 
   28            'mode' => array(
'pattern' => 
null, 
'permission' => self::NONE, 
'default' => 
null, 
'dbfield' => 
'c_mode'),
 
   29            'credit' => array(
'pattern' => 
null, 
'permission' => self::NONE, 
'default' => 
null, 
'dbfield' => 
'credit'),
 
   32            'accesscount' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'accesscount'),
 
   33            'accessduration' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'accessduration'),
 
   34            'accessed' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'accessed'),
 
   35            'activityAbsoluteDuration' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'activityabsduration'),
 
   36            'activityAttemptCount' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'activityattemptcount'),
 
   37            'activityExperiencedDuration' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'activityexpduration'),
 
   38            'activityProgressStatus' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'activityprogstatus'),
 
   39            'attemptAbsoluteDuration' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'attemptabsduration'),
 
   40            'attemptCompletionAmount' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'attemptcomplamount'),
 
   41            'attemptCompletionStatus' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'attemptcomplstatus'),
 
   42            'attemptExperiencedDuration' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'attemptexpduration'),
 
   43            'attemptProgressStatus' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'attemptprogstatus'),
 
   44            'audio_captioning' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'audio_captioning'),
 
   45            'audio_level' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'audio_level'),
 
   46            'availableChildren' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'availablechildren'),
 
   47            'cmi_node_id' => array(
'pattern' => 
null, 
'permission' => self::NONE, 
'default' => 
null, 
'dbfield' => 
'cmi_node_id'),
 
   48            'completion' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'completion'),
 
   49            'completion_status' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'completion_status'),
 
   50            'completion_threshold' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'completion_threshold'),
 
   51            'cp_node_id' => array(
'pattern' => 
null, 
'permission' => self::NONE, 
'default' => 
null, 
'dbfield' => 
'cp_node_id'),
 
   52            'created' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'created'),
 
   53            'credit' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'credit'),
 
   54            'delivery_speed' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'delivery_speed'),
 
   55            'entry' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'c_entry'),
 
   56            'exit' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'c_exit'),
 
   57            'language' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'c_language'),
 
   58            'launch_data' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'launch_data'),
 
   59            'learner_name' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'learner_name'),
 
   60            'location' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'location'),
 
   61            'max' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'c_max'),
 
   62            'min' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'c_min'),
 
   63            'mode' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'c_mode'),
 
   64            'modified' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'modified'),
 
   65            'progress_measure' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'progress_measure'),
 
   66            'raw' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'c_raw'),
 
   67            'scaled' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'scaled'),
 
   68            'scaled_passing_score' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'scaled_passing_score'),
 
   69            'session_time' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'session_time'),
 
   70            'success_status' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'success_status'),
 
   71            'suspend_data' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'suspend_data'),
 
   72            'total_time' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'total_time'),
 
   73            'user_id' => array(
'pattern' => 
null, 
'permission' => self::NONE, 
'default' => 
null, 
'dbfield' => 
'user_id'),
 
   76            'cmi_comment_id' => array(
'pattern' => 
null, 
'permission' => self::NONE, 
'default' => 
null, 
'dbfield' => 
'cmi_comment_id'),
 
   77            'cmi_node_id' => array(
'pattern' => 
null, 
'permission' => self::NONE, 
'default' => 
null, 
'dbfield' => 
'cmi_node_id'),
 
   78            'comment' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'c_comment'),
 
   79            'timestamp' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'c_timestamp'),
 
   80            'location' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'location'),
 
   81            'sourceIsLMS' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'sourceislms'),
 
   83        'correct_response' => array(
 
   84            'cmi_correct_response_id' => array(
'pattern' => 
null, 
'permission' => self::NONE, 
'default' => 
null, 
'dbfield' => 
'cmi_correct_resp_id'),
 
   85            'cmi_interaction_id' => array(
'pattern' => 
null, 
'permission' => self::NONE, 
'default' => 
null, 
'dbfield' => 
'cmi_interaction_id'),
 
   86            'pattern' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'pattern'),
 
   88        'interaction' => array(
 
   89            'cmi_interaction_id' => array(
'pattern' => 
null, 
'permission' => self::NONE, 
'default' => 
null, 
'dbfield' => 
'cmi_interaction_id'),
 
   90            'cmi_node_id' => array(
'pattern' => 
null, 
'permission' => self::NONE, 
'default' => 
null, 
'dbfield' => 
'cmi_node_id'),
 
   91            'description' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'description'),
 
   92            'id' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'id'),
 
   93            'latency' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'latency'),
 
   94            'learner_response' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'learner_response'),
 
   95            'result' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'result'),
 
   96            'timestamp' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'c_timestamp'),
 
   97            'type' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'c_type'),
 
   98            'weighting' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'weighting'),
 
  100        'objective' => array(
 
  101            'cmi_interaction_id' => array(
'pattern' => 
null, 
'permission' => self::NONE, 
'default' => 
null, 
'dbfield' => 
'cmi_interaction_id'),
 
  102            'cmi_node_id' => array(
'pattern' => 
null, 
'permission' => self::NONE, 
'default' => 
null, 
'dbfield' => 
'cmi_node_id'),
 
  103            'cmi_objective_id' => array(
'pattern' => 
null, 
'permission' => self::NONE, 
'default' => 
null, 
'dbfield' => 
'cmi_objective_id'),
 
  104            'completion_status' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'completion_status'),
 
  105            'description' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'description'),
 
  106            'id' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'id'),
 
  107            'max' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'c_max'),
 
  108            'min' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'c_min'),
 
  109            'raw' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'c_raw'),
 
  110            'scaled' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'scaled'),
 
  111            'progress_measure' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'progress_measure'),
 
  112            'success_status' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'success_status'),
 
  113            'scope' => array(
'pattern' => 
null, 
'permission' => self::READWRITE, 
'default' => 
null, 
'dbfield' => 
'scope'),
 
  128        $ilCtrl = 
$DIC[
'ilCtrl'];
 
  138        $this->packageId = (int) $_REQUEST[
'packageId'];
 
  139        $this->jsMode = strpos(
$_SERVER[
'HTTP_ACCEPT'], 
'text/javascript') !== 
false;
 
  141        $this->page = $_REQUEST[
'page'];
 
  147        $this->ctrl = $ilCtrl;
 
  150        $this->ref_id = 
$_GET[
'ref_id'];
 
  151        $this->userId = 
$ilUser->getID();
 
  153        if (
$_GET[
'envEditor'] != 
null) {
 
  154            $this->envEditor = 
$_GET[
'envEditor'];
 
  156            $this->envEditor = 0;
 
  166        $ilAccess = 
$DIC[
'ilAccess'];
 
  170        $next_class = $this->ctrl->getNextClass($this);
 
  171        $cmd = $this->ctrl->getCmd();
 
  173        if (!$ilAccess->checkAccess(
"read", 
"", 
$_GET[
"ref_id"])) {
 
  205            case 'getGobjective':
 
  209            case 'getSharedData':
 
  213            case 'setSharedData':
 
  219                if (
$_SERVER[
'REQUEST_METHOD'] == 
'POST') {
 
  220                    include_once 
'./Modules/Scorm2004/classes/class.ilSCORM2004StoreData.php';
 
  224                        $this->slm->getDefaultLessonMode(),
 
  225                        $this->slm->getComments(),
 
  226                        $this->slm->getInteractions(),
 
  227                        $this->slm->getObjectives(),
 
  228                        $this->slm->getTime_from_lms()
 
  246            case 'liveLogContent':
 
  259            case 'scormPlayerUnload':
 
  260                include_once 
'./Modules/Scorm2004/classes/class.ilSCORM2004StoreData.php';
 
  275        $js_data = file_get_contents(
"./Modules/Scorm2004/scripts/buildrte/rte.js");
 
  276        if (self::ENABLE_GZIP == 1) {
 
  277            ob_start(
"ob_gzhandler");
 
  278            header(
'Content-Type: text/javascript; charset=UTF-8');
 
  280            header(
'Content-Type: text/javascript; charset=UTF-8');
 
  288        $webdir = str_replace(
"/ilias.php", 
"", 
$_SERVER[
"SCRIPT_NAME"]);
 
  300        $initSuspendData = 
null;
 
  303            'learner_id' => (
string) 
$ilUser->getID(),
 
  304            'cmi_learner_id' => (
string) $this->slm->getApiStudentId(),
 
  305            'course_id' => (
string) $this->packageId,
 
  306            'learner_name' => (
string) $this->slm->getApiStudentName(),
 
  307            'mode' => $this->slm->getDefaultLessonMode(),
 
  308            'credit' => $this->slm->getCreditMode(),
 
  309            'auto_review' => $this->slm->getAutoReviewChar(),
 
  310            'hide_navig' => $this->slm->getHideNavig(),
 
  311            'hide_menu' => $this->slm->getNoMenu(),
 
  312            'ie_force_render' => $this->slm->getIe_force_render(),
 
  313            'fourth_edition' => $this->slm->getFourth_edition(),
 
  314            'sequencing_enabled' => $this->slm->getSequencing(),
 
  315            'interactions_storable' => $this->slm->getInteractions(),
 
  316            'objectives_storable' => $this->slm->getObjectives(),
 
  317            'comments_storable' => $this->slm->getComments(),
 
  318            'time_from_lms' => $this->slm->getTime_from_lms(),
 
  319            'auto_last_visited' => $this->slm->getAuto_last_visited(),
 
  320            'lesson_mastery_score' => $this->slm->getMasteryScore(),
 
  321            'checkSetValues' => $this->slm->getCheck_values(),
 
  322            'auto_suspend' => $this->slm->getAutoSuspend(),
 
  323            'suspend_data' => $initSuspendData,
 
  326            'adlact_data' => 
null,
 
  327            'globalobj_data' => 
null 
  329        include_once 
'./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMInitData.php';
 
  348        require_once(
'./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
 
  353        $initSuspendData = 
null;
 
  354        $initAdlactData = 
null;
 
  355        if ($this->slm->getSequencing() == 
true) {
 
  364        if ($this->slm->getSession()) {
 
  367            if ($session_timeout > $max_idle) {
 
  368                $session_timeout = $max_idle;
 
  371            if ($session_timeout > $min_idle) {
 
  372                $session_timeout = $min_idle;
 
  374            $session_timeout -= 10; 
 
  376            $session_timeout = 0;
 
  378        $config[
'session_ping'] = $session_timeout;
 
  381        $store_url = 
'ilias.php?baseClass=ilSAHSPresentationGUI' . 
'&cmd=cmi&ref_id=' . 
$_GET[
"ref_id"];
 
  382        $unload_url = 
'ilias.php?baseClass=ilSAHSPresentationGUI' . 
'&cmd=scormPlayerUnload&ref_id=' . 
$_GET[
"ref_id"];
 
  383        if ($this->slm->getSessionDeactivated()) {
 
  384            $store_url = 
'storeScorm2004.php?package_id=' . $this->packageId . 
'&ref_id=' . 
$_GET[
"ref_id"] . 
'&client_id=' . 
CLIENT_ID . 
'&do=store';
 
  385            $unload_url = 
'storeScorm2004.php?package_id=' . $this->packageId . 
'&ref_id=' . 
$_GET[
"ref_id"] . 
'&client_id=' . 
CLIENT_ID . 
'&do=unload';
 
  387        $config[
'cp_url'] = 
'ilias.php?baseClass=ilSAHSPresentationGUI' . 
'&cmd=cp&ref_id=' . 
$_GET[
"ref_id"];
 
  388        $config[
'cmi_url'] = 
'ilias.php?baseClass=ilSAHSPresentationGUI' . 
'&cmd=cmi&ref_id=' . 
$_GET[
"ref_id"];
 
  389        $config[
'store_url'] = $store_url;
 
  390        $config[
'get_adldata_url'] = 
'ilias.php?baseClass=ilSAHSPresentationGUI' . 
'&cmd=getSharedData&ref_id=' . 
$_GET[
"ref_id"];
 
  391        $config[
'set_adldata_url'] = 
'ilias.php?baseClass=ilSAHSPresentationGUI' . 
'&cmd=setSharedData&ref_id=' . 
$_GET[
"ref_id"];
 
  392        $config[
'adlact_url'] = 
'ilias.php?baseClass=ilSAHSPresentationGUI' . 
'&cmd=adlact&ref_id=' . 
$_GET[
"ref_id"];
 
  393        $config[
'specialpage_url'] = 
'ilias.php?baseClass=ilSAHSPresentationGUI' . 
'&cmd=specialPage&ref_id=' . 
$_GET[
"ref_id"];
 
  394        $config[
'suspend_url'] = 
'ilias.php?baseClass=ilSAHSPresentationGUI' . 
'&cmd=suspend&ref_id=' . 
$_GET[
"ref_id"];
 
  395        $config[
'get_suspend_url'] = 
'ilias.php?baseClass=ilSAHSPresentationGUI' . 
'&cmd=getSuspend&ref_id=' . 
$_GET[
"ref_id"];
 
  397        $config[
'gobjective_url'] = 
'ilias.php?baseClass=ilSAHSPresentationGUI' . 
'&cmd=gobjective&ref_id=' . 
$_GET[
"ref_id"];
 
  398        $config[
'get_gobjective_url'] = 
'ilias.php?baseClass=ilSAHSPresentationGUI' . 
'&cmd=getGobjective&ref_id=' . 
$_GET[
"ref_id"];
 
  399        $config[
'ping_url'] = 
'ilias.php?baseClass=ilSAHSPresentationGUI' . 
'&cmd=pingSession&ref_id=' . 
$_GET[
"ref_id"];
 
  400        $config[
'scorm_player_unload_url'] = $unload_url;
 
  401        $config[
'post_log_url'] = 
'ilias.php?baseClass=ilSAHSPresentationGUI' . 
'&cmd=postLogEntry&ref_id=' . 
$_GET[
"ref_id"];
 
  402        $config[
'livelog_url'] = 
'ilias.php?baseClass=ilSAHSPresentationGUI' . 
'&cmd=liveLogContent&ref_id=' . 
$_GET[
"ref_id"];
 
  406        $config[
'envEditor'] = $this->envEditor;
 
  409        $config[
'debug'] = $this->slm->getDebug();
 
  415        $langstrings[
'btnStart'] = 
$lng->txt(
'scplayer_start');
 
  416        $langstrings[
'btnExit'] = 
$lng->txt(
'scplayer_exit');
 
  417        $langstrings[
'btnExitAll'] = 
$lng->txt(
'scplayer_exitall');
 
  418        $langstrings[
'btnSuspendAll'] = 
$lng->txt(
'scplayer_suspendall');
 
  419        $langstrings[
'btnPrevious'] = 
$lng->txt(
'scplayer_previous');
 
  420        $langstrings[
'btnContinue'] = 
$lng->txt(
'scplayer_continue');
 
  421        $langstrings[
'btnhidetree'] = 
$lng->txt(
'scplayer_hidetree');
 
  422        $langstrings[
'btnshowtree'] = 
$lng->txt(
'scplayer_showtree');
 
  423        $langstrings[
'linkexpandTree'] = 
$lng->txt(
'scplayer_expandtree');
 
  424        $langstrings[
'linkcollapseTree'] = 
$lng->txt(
'scplayer_collapsetree');
 
  425        $langstrings[
'contCreditOff'] = 
$lng->txt(
'cont_credit_off');
 
  426        if ($this->slm->getAutoReviewChar() == 
"s") {
 
  427            $langstrings[
'contCreditOff'] = 
$lng->txt(
'cont_sc_score_was_higher_message');
 
  429        $config[
'langstrings'] = $langstrings;
 
  433        $this->tpl = 
new ilGlobalTemplate(
"tpl.scorm2004.player.html", 
true, 
true, 
"Modules/Scorm2004");
 
  435        include_once(
"./Services/jQuery/classes/class.iljQueryUtil.php");
 
  439        $rte_css = $this->slm->getDataDirectory() . 
"/ilias_css_4_2/css/style.css";
 
  440        if (is_file($rte_css)) {
 
  441            $this->tpl->setCurrentBlock(
"rte_css");
 
  442            $this->tpl->setVariable(
"RTE_CSS", $rte_css);
 
  443            $this->tpl->parseCurrentBlock();
 
  447        $this->tpl->setVariable(
'JSON_LANGSTRINGS', json_encode($langstrings));
 
  451        $this->tpl->setVariable(
'TREE_JS', 
"./Modules/Scorm2004/scripts/ilNestedList.js");
 
  452        $this->tpl->setVariable($langstrings);
 
  453        $this->tpl->setVariable(
'DOC_TITLE', 
'ILIAS: ' . $this->slm->getTitle());
 
  455        $this->tpl->setVariable(
'INIT_CP_DATA', json_encode(json_decode($this->
getCPDataInit())));
 
  456        $this->tpl->setVariable(
'INIT_CMI_DATA', json_encode($this->
getCMIData($this->userId, $this->packageId)));
 
  457        $this->tpl->setVariable(
'INIT_ADLACT_DATA', json_encode($initAdlactData));
 
  458        $this->tpl->setVariable(
'INIT_GLOBALOBJ_DATA', json_encode($initGlobalobjData));
 
  459        $this->tpl->setVariable(
'JS_DATA', json_encode(
$config));
 
  460        list($tsfrac, $tsint) = explode(
' ', microtime());
 
  461        $this->tpl->setVariable(
'TIMESTAMP', sprintf(
'%d%03d', $tsint, 1000 * (
float) $tsfrac));
 
  462        $this->tpl->setVariable(
'BASE_DIR', 
'./Modules/Scorm2004/');
 
  463        $this->tpl->setVariable(
'TXT_COLLAPSE', 
$lng->txt(
'scplayer_collapsetree'));
 
  464        if ($this->slm->getDebug()) {
 
  465            $this->tpl->setVariable(
'TXT_DEBUGGER', 
$lng->txt(
'scplayer_debugger'));
 
  466            $this->tpl->setVariable(
'DEBUG_URL', 
"PopupCenter('ilias.php?baseClass=ilSAHSPresentationGUI&cmd=debugGUI&ref_id=" . 
$_GET[
"ref_id"] . 
"','Debug',800,600);");
 
  468            $this->tpl->setVariable(
'TXT_DEBUGGER', 
'');
 
  469            $this->tpl->setVariable(
'DEBUG_URL', 
'');
 
  473        $this->tpl->setVariable(
'INLINE_CSS', ilSCORM13PlayerGUI::getInlineCss());
 
  476        if ($this->slm->getCacheDeactivated()) {
 
  477            $this->tpl->setVariable(
'JS_SCRIPTS', 
'ilias.php?baseClass=ilSAHSPresentationGUI' . 
'&cmd=getRTEjs&ref_id=' . 
$_GET[
"ref_id"]);
 
  479            $this->tpl->setVariable(
'JS_SCRIPTS', 
'./Modules/Scorm2004/scripts/buildrte/rte-min.js');
 
  483        if ($this->slm->getNoMenu() == 
"y") {
 
  484            $this->tpl->setVariable(
"VAL_DISPLAY", 
"style=\"display:none;\"");
 
  486            $this->tpl->setVariable(
"VAL_DISPLAY", 
"");
 
  493                header(
'Content-Type: text/html; charset=utf-8');
 
  494                echo(
$lng->txt(
"cont_sc_max_attempt_exceed"));
 
  503        $this->tpl->printToStdout(
"DEFAULT", 
false);
 
  511        $is_tpl = 
new ilTemplate(
"tpl.scorm2004.inlinecss.html", 
true, 
true, 
"Modules/Scorm2004");
 
  514        $is_tpl->setVariable(
'IC_NOTATTEMPTED', 
ilUtil::getImagePath(
"scorm/not_attempted.svg", 
false));
 
  520        return $is_tpl->get();
 
  527            header(
'Content-Type: text/javascript; charset=UTF-8');
 
  530            header(
'Content-Type: text/plain; charset=UTF-8');
 
  531            $jsdata = json_decode($jsdata);
 
  541            'SELECT jsdata FROM cp_package WHERE obj_id = %s',
 
  543            array($this->packageId)
 
  547        $jsdata = $packageData[
'jsdata'];
 
  562            'SELECT activitytree FROM cp_package WHERE obj_id = %s',
 
  564            array($this->packageId)
 
  568        $activitytree = 
$data[
'activitytree'];
 
  570        if (!$activitytree) {
 
  571            $activitytree = 
'null';
 
  573        return $activitytree;
 
  580            header(
'Content-Type: text/javascript; charset=UTF-8');
 
  581            print($activitytree);
 
  583            header(
'Content-Type: text/plain; charset=UTF-8');
 
  584            $activitytree = json_decode($activitytree);
 
  585            print_r($activitytree);
 
  592        require_once(
'./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
 
  595        header(
'Content-Type: text/plain; charset=UTF-8');
 
  606            'SELECT global_to_system FROM cp_package WHERE obj_id = %s',
 
  608            array($this->packageId)
 
  612        $gystem = 
$data[
'global_to_system'];
 
  629            'SELECT data FROM cp_suspend WHERE obj_id = %s AND user_id = %s',
 
  630            array(
'integer', 
'integer'),
 
  631            array($this->packageId, 
$ilUser->getId())
 
  637            'DELETE FROM cp_suspend WHERE obj_id = %s AND user_id = %s',
 
  638            array(
'integer', 
'integer'),
 
  639            array($this->packageId, 
$ilUser->getId())
 
  641        return $data[
'data'];
 
  648            header(
'Content-Type: text/javascript; charset=UTF-8');
 
  649            print($suspend_data);
 
  651            header(
'Content-Type: text/plain; charset=UTF-8');
 
  652            $suspend_data = json_decode($suspend_data);
 
  653            print_r($suspend_data);
 
  664            'SELECT * FROM cp_suspend WHERE obj_id = %s AND user_id = %s',
 
  665            array(
'integer', 
'integer'),
 
  666            array($this->packageId, 
$ilUser->getId())
 
  670            $ilDB->insert(
'cp_suspend', array(
 
  671                'data' => array(
'clob', file_get_contents(
'php://input')),
 
  672                'obj_id' => array(
'integer', $this->packageId),
 
  673                'user_id' => array(
'integer', 
$ilUser->getId())
 
  679                    'data' => array(
'clob', file_get_contents(
'php://input'))
 
  682                    'obj_id' => array(
'integer', $this->packageId),
 
  683                    'user_id' => array(
'integer', 
$ilUser->getId())
 
  698        $global_to_system = 1;
 
  701            'SELECT global_to_system FROM cp_package WHERE obj_id = %s',
 
  703            array($this->packageId)
 
  706            $global_to_system = 
$data[
'global_to_system'];
 
  709        $query = 
'SELECT objective_id, scope_id, satisfied, measure, user_id,  
  710                                                 score_min, score_max, score_raw, completion_status,  
  712               . 
'FROM cmi_gobjective, cp_node, cp_mapinfo ' 
  713               . 
'WHERE (cmi_gobjective.objective_id <> %s AND cmi_gobjective.status IS NULL ' 
  714               . 
'AND cp_node.slm_id = %s AND cp_node.nodename = %s ' 
  715               . 
'AND cp_node.cp_node_id = cp_mapinfo.cp_node_id ' 
  716               . 
'AND cmi_gobjective.objective_id = cp_mapinfo.targetobjectiveid) ' 
  717               . 
'GROUP BY objective_id, scope_id, satisfied, measure, user_id, 
  718                                       score_min, score_max, score_raw, completion_status,  
  722            array(
'text', 
'integer', 
'text'),
 
  723            array(
'-course_overall_status-', $this->packageId, 
'mapInfo')
 
  726            if (($global_to_system == 1 && $row[
'scope_id'] == 0) || ($global_to_system == 0 && $row[
'scope_id'] == $this->packageId)) {
 
  727                $learner = $row[
'user_id'];
 
  728                $objective_id = $row[
'objective_id'];
 
  729                if ($row[
'scope_id'] == 0) {
 
  732                    $scope = $row[
'scope_id'];
 
  735                if ($row[
'satisfied'] != 
null) {
 
  736                    $toset = $row[
'satisfied'];
 
  737                    $g_data[
"satisfied"][$objective_id][$learner][$scope] = $toset;
 
  740                if ($row[
'measure'] != 
null) {
 
  741                    $toset = $row[
'measure'];
 
  742                    $g_data[
"measure"][$objective_id][$learner][$scope] = $toset;
 
  745                if ($row[
'score_raw'] != 
null) {
 
  746                    $toset = $row[
'score_raw'];
 
  747                    $g_data[
"score_raw"][$objective_id][$learner][$scope] = $toset;
 
  750                if ($row[
'score_min'] != 
null) {
 
  751                    $toset = $row[
'score_min'];
 
  752                    $g_data[
"score_min"][$objective_id][$learner][$scope] = $toset;
 
  755                if ($row[
'score_max'] != 
null) {
 
  756                    $toset = $row[
'score_max'];
 
  757                    $g_data[
"score_max"][$objective_id][$learner][$scope] = $toset;
 
  760                if ($row[
'progress_measure'] != 
null) {
 
  761                    $toset = $row[
'progress_measure'];
 
  762                    $g_data[
"progress_measure"][$objective_id][$learner][$scope] = $toset;
 
  765                if ($row[
'completion_status'] != 
null) {
 
  766                    $toset = $row[
'completion_status'];
 
  767                    $g_data[
"completion_status"][$objective_id][$learner][$scope] = $toset;
 
  778            header(
'Content-Type: text/javascript; charset=UTF-8');
 
  779            print($gobjective_data);
 
  781            header(
'Content-Type: text/plain; charset=UTF-8');
 
  782            $gobjective_data = json_decode($gobjective_data);
 
  783            print_r($gobjective_data);
 
  794        $dataStores = array( 
"data" => array(),
 
  795                             "permissions" => array());
 
  796        $readPermissions = array();
 
  798        $query = 
'SELECT target_id, read_shared_data, write_shared_data ' 
  800               . 
'WHERE slm_id = %s ' 
  801               . 
'AND sco_node_id = %s ' 
  802               . 
'GROUP BY target_id, read_shared_data, write_shared_data';
 
  807            array(
'integer', 
'integer'),
 
  808            array($this->packageId, $sco_node_id)
 
  814            $storeVal = ($row[
'read_shared_data'] == 0 && $row[
'write_shared_data'] == 1)
 
  818            $dataStores[
"data"][$row[
'target_id']] = array( 
"store" => $storeVal,
 
  819                                    "readSharedData" => $row[
'read_shared_data'],
 
  820                                    "writeSharedData" => $row[
'write_shared_data']);
 
  821            $dataStores[
"readPermissions"][$row[
'target_id']] = $row[
'read_shared_data'];
 
  824        if (count($dataStores) < 1) {
 
  828        } elseif ($dataStores[
"readPermissions"] != 
null && array_sum($dataStores[
"readPermissions"]) != 0) {
 
  834            $params = array(
"types" => array(
"integer", 
"integer"),
 
  835                            "values" => array($this->userId, $this->packageId));
 
  841            foreach ($dataStores[
"data"] as $key => $val) {
 
  842                if ($dataStores[
"readPermissions"][$key] == 1
 
  843                    && $dataStores[
"data"][$key][
"store"] != 
'notWritten') {
 
  844                    $params[
"types"][] = 
"text";
 
  845                    $params[
"values"][] = $key;
 
  846                    $paramTemplate .= 
'%s, ';
 
  851            $paramTemplate = substr($paramTemplate, 0, strlen($paramTemplate) - 2);
 
  854            $query = 
'SELECT target_id, store ' 
  855                   . 
'FROM adl_shared_data ' 
  856                   . 
'WHERE user_id = %s ' 
  858                   . 
'AND target_id IN (' . $paramTemplate . 
')';
 
  868                $dataStores[
"data"][$row[
'target_id']][
"store"] = $row[
'store'];
 
  872        header(
'Content-Type: text/javascript; charset=UTF-8');
 
  874        echo json_encode($dataStores[
"data"]);
 
  882        $g_data = json_decode(file_get_contents(
'php://input'));
 
  885        $query = 
'SELECT dm.target_id, sd.store ' 
  886               . 
'FROM cp_datamap dm ' 
  887               . 
'LEFT JOIN adl_shared_data sd ' 
  888               . 
'ON(dm.slm_id = sd.slm_id AND dm.target_id = sd.target_id) ' 
  889               . 
'WHERE sco_node_id = %s ' 
  890               . 
'AND dm.slm_id = %s ' 
  891               . 
'AND write_shared_data = 1 ' 
  892               . 
'AND user_id = %s';
 
  896            array(
'integer', 
'integer', 
'integer'),
 
  897            array($sco_node_id, $this->packageId, $this->userId)
 
  900        $dataStores = array();
 
  901        $originalVals = array();
 
  903            $id = $row[
'target_id'];
 
  904            $dataStores[$id] = $g_data->{$id};
 
  905            $originalVals[$id] = $row[
'store'];
 
  910        foreach ($g_data as $key => $obj) {
 
  913            if (array_key_exists($key, $dataStores)) {
 
  914                if ($obj == 
'notWritten') {
 
  918                $query = 
'UPDATE adl_shared_data ' 
  920                       . 
'WHERE user_id = %s ' 
  921                       . 
'AND target_id = %s ' 
  922                       . 
'AND slm_id = %s ';
 
  926                    array(
'text', 
'integer', 
'text', 
'integer'),
 
  927                    array($dataStores[$key], $this->userId, $key, $this->packageId)
 
  932                    'SELECT write_shared_data, cp_node_id ' 
  934                      . 
'WHERE target_id = %s ' 
  936                      . 
'AND sco_node_id = %s',
 
  937                    array(
'text', 
'integer', 
'integer'),
 
  938                    array($key, $this->packageId, $sco_node_id)
 
  942                if ($row[
"write_shared_data"] != 1) {
 
  948                    'INSERT INTO adl_shared_data (slm_id, user_id, target_id, store, cp_node_id) VALUES (%s, %s, %s, %s, %s)',
 
  949                    array(
'integer', 
'integer', 
'text', 
'text', 
'integer'),
 
  950                    array($this->packageId, $this->userId, $key, $obj, $row[
"cp_node_id"])
 
  963        $specialpages = array(
 
  964            "_COURSECOMPLETE_" => 
"seq_coursecomplete",
 
  965            "_ENDSESSION_" => 
"seq_endsession",
 
  966            "_SEQBLOCKED_" => 
"seq_blocked",
 
  967            "_NOTHING_" => 
"seq_nothing",
 
  968            "_ERROR_" => 
"seq_error",
 
  969            "_DEADLOCK_" => 
"seq_deadlock",
 
  970            "_INVALIDNAVREQ_" => 
"seq_invalidnavreq",
 
  971            "_SEQABANDON_" => 
"seq_abandon",
 
  972            "_SEQABANDONALL_" => 
"seq_abandonall",
 
  976        $this->tpl = 
new ilGlobalTemplate(
"tpl.scorm2004.specialpages.html", 
false, 
false, 
"Modules/Scorm2004");
 
  978        $this->tpl->setVariable(
'TXT_SPECIALPAGE', 
$lng->txt($specialpages[$this->page]));
 
  979        if ($this->page != 
"_TOC_" && $this->page != 
"_SEQABANDON_" && $this->page != 
"_SEQABANDONALL_") {
 
  980            $this->tpl->setVariable(
'CLOSE_WINDOW', 
$lng->txt(
'seq_close'));
 
  982            $this->tpl->setVariable(
'CLOSE_WINDOW', 
"");
 
  984        $this->tpl->printToStdout(
"DEFAULT", 
false);
 
  990        $data = $this->getCMIData($this->userId, $this->packageId);
 
  992            header(
'Content-Type: text/javascript; charset=UTF-8');
 
  995            header(
'Content-Type: text/plain; charset=UTF-8');
 
 1008        foreach (self::$schema[$table] as $k => $v) {
 
 1010            if (isset($value) && is_string($v) && !preg_match($v, $value)) {
 
 1023            'schema' => array(),
 
 1027        foreach (self::$schema as $k => &$v) {
 
 1028            $result[
'schema'][$k] = array_keys($v);
 
 1032                    $q = 
'SELECT cmi_node.*  
 1034                                                INNER JOIN cp_node ON cmi_node.cp_node_id = cp_node.cp_node_id 
 1035                                                WHERE cmi_node.user_id = %s 
 1036                                                AND cp_node.slm_id = %s';
 
 1043                        if ($this->slm->getComments()) {
 
 1045                                                        cmi_comment.cmi_comment_id,  
 1046                                                        cmi_comment.cmi_node_id,  
 1047                                                        cmi_comment.c_comment,  
 1048                                                        cmi_comment.c_timestamp,  
 1049                                                        cmi_comment.location,  
 1050                                                        cmi_comment.sourceislms  
 1052                                                        INNER JOIN cmi_node ON cmi_node.cmi_node_id = cmi_comment.cmi_node_id  
 1053                                                        INNER JOIN cp_node ON cp_node.cp_node_id = cmi_node.cp_node_id 
 1054                                                        WHERE cmi_node.user_id = %s 
 1055                                                        AND cp_node.slm_id = %s  
 1056                                                        ORDER BY cmi_comment.cmi_comment_id';
 
 1062                case "correct_response":
 
 1065                        if ($this->slm->getInteractions()) {
 
 1066                            $q = 
'SELECT cmi_correct_response.*  
 1067                                                        FROM cmi_correct_response  
 1068                                                        INNER JOIN cmi_interaction  
 1069                                                        ON cmi_interaction.cmi_interaction_id = cmi_correct_response.cmi_interaction_id  
 1070                                                        INNER JOIN cmi_node ON cmi_node.cmi_node_id = cmi_interaction.cmi_node_id  
 1071                                                        INNER JOIN cp_node ON cp_node.cp_node_id = cmi_node.cp_node_id 
 1072                                                        WHERE cmi_node.user_id = %s 
 1073                                                        AND cp_node.slm_id = %s  
 1074                                                        ORDER BY cmi_correct_response.cmi_correct_resp_id';
 
 1082                        if ($this->slm->getInteractions()) {
 
 1084                                                        cmi_interaction.cmi_interaction_id,  
 1085                                                        cmi_interaction.cmi_node_id,  
 1086                                                        cmi_interaction.description,  
 1088                                                        cmi_interaction.latency,  
 1089                                                        cmi_interaction.learner_response,  
 1090                                                        cmi_interaction.result,  
 1091                                                        cmi_interaction.c_timestamp,  
 1092                                                        cmi_interaction.c_type,  
 1093                                                        cmi_interaction.weighting 
 1094                                                        FROM cmi_interaction  
 1095                                                        INNER JOIN cmi_node ON cmi_node.cmi_node_id = cmi_interaction.cmi_node_id  
 1096                                                        INNER JOIN cp_node ON cp_node.cp_node_id = cmi_node.cp_node_id 
 1097                                                        WHERE cmi_node.user_id = %s 
 1098                                                        AND cp_node.slm_id = %s  
 1099                                                        ORDER BY cmi_interaction.cmi_interaction_id';
 
 1106                        if ($this->slm->getObjectives()) {
 
 1108                                                        cmi_objective.cmi_interaction_id,  
 1109                                                        cmi_objective.cmi_node_id,  
 1110                                                        cmi_objective.cmi_objective_id,  
 1111                                                        cmi_objective.completion_status,  
 1112                                                        cmi_objective.description,  
 1114                                                        cmi_objective.c_max,  
 1115                                                        cmi_objective.c_min,  
 1116                                                        cmi_objective.c_raw,  
 1117                                                        cmi_objective.scaled,  
 1118                                                        cmi_objective.progress_measure,  
 1119                                                        cmi_objective.success_status,  
 1122                                                        INNER JOIN cmi_node ON cmi_node.cmi_node_id = cmi_objective.cmi_node_id  
 1123                                                        INNER JOIN cp_node ON cp_node.cp_node_id = cmi_node.cp_node_id 
 1124                                                        WHERE cmi_node.user_id = %s 
 1125                                                        AND cp_node.slm_id = %s  
 1126                                                        ORDER BY cmi_objective.cmi_objective_id';
 
 1132                    $q = 
'SELECT usr_data.usr_id user_id,  
 1133                                                CONCAT(CONCAT(COALESCE(usr_data.firstname, \'\'), \' \'), COALESCE(usr_data.lastname, \'\')) learner_name,  
 1134                                                sahs_lm.id slm_id , sahs_lm.default_lesson_mode "mode", sahs_lm.credit 
 1135                                                FROM usr_data, cp_package 
 1136                                                INNER JOIN sahs_lm ON cp_package.obj_id = sahs_lm.id  
 1137                                                WHERE usr_data.usr_id = %s 
 1138                                                AND sahs_lm.id = %s';
 
 1144            $result[
'data'][$k] = array();
 
 1146                $types = array(
'integer', 
'integer');
 
 1148                $res = 
$ilDB->queryF($q, $types, $values);
 
 1150                while ($row = 
$ilDB->fetchAssoc(
$res)) {
 
 1151                    $tmp_result = array();
 
 1152                    foreach ($row as $key => $value) {
 
 1153                        if ($k == 
"comment" && $key == 
"c_timestamp" && strpos($value, 
' ') == 10) {
 
 1154                            $value = str_replace(
' ', 
'T', $value);
 
 1156                        $tmp_result[] = $value;
 
 1157                        if ($k == 
"node" && $key == 
"additional_tables" && $i_check < $value) {
 
 1162                    $result[
'data'][$k][] = $tmp_result;
 
 1175        if (!is_array($a_array) or !count($a_array)) {
 
 1179        foreach ($a_array as $k => $item) {
 
 1180            if ($item != 
null) {
 
 1181                $a_array[$k] = 
$ilDB->quote($item);
 
 1183                $a_array[$k] = 
"NULL";
 
 1199        include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
 1209        include_once 
"./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMInitData.php";
 
 1219            'SELECT module_version FROM sahs_lm WHERE id = %s',
 
 1221            array($this->packageId)
 
 1225        return $row[
'module_version'];
 
 1236        $val_set = 
$ilDB->queryF(
 
 1237            'SELECT package_attempts FROM sahs_user WHERE obj_id = %s AND user_id = %s',
 
 1238            array(
'integer',
'integer'),
 
 1239            array($this->packageId,$this->userId)
 
 1241        $val_rec = 
$ilDB->fetchAssoc($val_set);
 
 1242        $attempts = $val_rec[
"package_attempts"];
 
 1243        if ($attempts == 
null) {
 
 1258            'SELECT package_attempts,count(*) cnt FROM sahs_user WHERE obj_id = %s AND user_id = %s GROUP BY package_attempts',
 
 1259            array(
'integer',
'integer'),
 
 1260            array($this->slm->getId(),
$ilUser->getId())
 
 1263        if ($val_rec[
"cnt"] == 0) { 
 
 1266                'INSERT INTO sahs_user (obj_id,user_id,package_attempts,module_version,last_access) VALUES(%s,%s,%s,%s,%s)',
 
 1267                array(
'integer', 
'integer', 
'integer', 
'integer', 
'timestamp'),
 
 1268                array($this->slm->getId(), 
$ilUser->getId(), $attempts, $this->slm->getModuleVersion(), date(
'Y-m-d H:i:s'))
 
 1271            $attempts = $val_rec[
"package_attempts"];
 
 1272            if ($attempts == 
null) {
 
 1277                'UPDATE sahs_user SET package_attempts = %s, module_version = %s, last_access=%s WHERE obj_id = %s AND user_id = %s ',
 
 1278                array(
'integer', 
'integer', 
'timestamp', 
'integer', 
'integer'),
 
 1279                array($attempts, $this->slm->getModuleVersion(), date(
'Y-m-d H:i:s'), $this->slm->getId(), 
$ilUser->getId())
 
 1291                                          SELECT shared_data_global_to_system    
 1295            array($this->packageId)
 
 1298        $shared_global_to_sys = 
$ilDB->fetchObject(
$res)->shared_data_global_to_system;
 
 1306            array(
'integer', 
'integer'),
 
 1307            array($this->packageId, $this->userId)
 
 1313        if ($dat != 
null && $dat != 
'') {
 
 1317        if ($shared_global_to_sys == 0 && !$suspended) {
 
 1320                                DELETE FROM adl_shared_data  
 1323                array(
'integer', 
'integer'),
 
 1324                array($this->packageId, $this->userId)
 
 1335        $ilLog = 
$DIC[
'ilLog'];
 
 1337        $fieldList = 
"cmi_node.cp_node_id, cmi_node.completion_threshold, cmi_node.c_exit, cmi_node.completion_status, cmi_node.progress_measure, cmi_node.success_status, cmi_node.scaled, cmi_node.session_time," .
 
 1338                     "cmi_node.c_min, cmi_node.c_max, cmi_node.c_raw, cmi_node.location, cmi_node.suspend_data, cmi_node.scaled_passing_score, cmi_node.total_time";
 
 1343                                          SELECT ' . $fieldList . 
' 
 1344                                          FROM cmi_node,cp_node,cp_item 
 1345                                          WHERE cp_node.slm_id = %s 
 1346                                          AND cp_node.cp_node_id = cp_item.cp_node_id 
 1348                                          AND cmi_node.cp_node_id = cp_item.cp_node_id 
 1349                                          AND cmi_node.user_id = %s',
 
 1350            array(
'integer',
'text',
'integer'),
 
 1351            array($this->packageId, $sco_id, $this->userId)
 
 1354        $ilLog->write(
"DEBUG SQL" . $row);
 
 1360        $filename = $this->logDirectory() . 
"/" . $this->packageId . 
".tmp";
 
 1363            $fHandle = fopen(
$filename, 
'a') or die(
"can't open file");
 
 1364            fwrite($fHandle, 
"");
 
 1372        $filename = $this->logDirectory() . 
"/" . $this->packageId . 
"_summary_" . $this->get_actual_attempts();
 
 1376        while (file_exists(
$filename . 
"_" . $adder . $suffix)) {
 
 1378            $adder = (string) 
$i;
 
 1380        $retname = 
$filename . 
"_" . $adder . $suffix;
 
 1382        if (!file_exists($retname)) {
 
 1384            $fHandle = fopen($retname, 
'a') or die(
"can't open file");
 
 1385            fwrite($fHandle, 
"");
 
 1395        $lng->loadLanguageModule(
"scormdebug");
 
 1397        $filename = $this->logDirectory() . 
"/" . $this->packageId . 
"_" . $this->get_actual_attempts();
 
 1400        if (!file_exists($path_csv)) {
 
 1402            $fHandle = fopen($path_csv, 
'a') or die(
"can't open file");
 
 1403            $string = 
'"CourseId";"ScoId";"ScoTitle";"Timestamp";"Action";"Key";"Value";"Return Value";"Errorcode";"Timespan";"ErrorDescription"' . 
"\n";
 
 1404            fwrite($fHandle, $string);
 
 1407        if (!file_exists($path_txt)) {
 
 1408            if (file_exists($this->logTmpName())) {
 
 1409                unlink($this->logTmpName());
 
 1412            $fHandle2 = fopen($path_txt, 
'a') or die(
"can't open file");
 
 1413            $logtpl = $this->getLogTemplate();
 
 1414            $logtpl->setCurrentBlock(
'NewLog');
 
 1415            $logtpl->setVariable(
"COURSETITLE", $this->slm->getTitle());
 
 1416            $logtpl->setVariable(
"COURSEID", $this->packageId);
 
 1417            $logtpl->setVariable(
"TIMESTAMP", date(
"d.m.Y H:i", time()));
 
 1418            $logtpl->setVariable(
"SESSION", $this->get_actual_attempts());
 
 1419            $logtpl->setVariable(
"error0", 
$lng->txt(
"error0"));
 
 1420            $logtpl->setVariable(
"error101", 
$lng->txt(
"error101"));
 
 1421            $logtpl->setVariable(
"error102", 
$lng->txt(
"error102"));
 
 1422            $logtpl->setVariable(
"error103", 
$lng->txt(
"error103"));
 
 1423            $logtpl->setVariable(
"error104", 
$lng->txt(
"error104"));
 
 1424            $logtpl->setVariable(
"error111", 
$lng->txt(
"error111"));
 
 1425            $logtpl->setVariable(
"error112", 
$lng->txt(
"error112"));
 
 1426            $logtpl->setVariable(
"error113", 
$lng->txt(
"error113"));
 
 1427            $logtpl->setVariable(
"error122", 
$lng->txt(
"error122"));
 
 1428            $logtpl->setVariable(
"error123", 
$lng->txt(
"error123"));
 
 1429            $logtpl->setVariable(
"error132", 
$lng->txt(
"error132"));
 
 1430            $logtpl->setVariable(
"error133", 
$lng->txt(
"error133"));
 
 1431            $logtpl->setVariable(
"error142", 
$lng->txt(
"error142"));
 
 1432            $logtpl->setVariable(
"error143", 
$lng->txt(
"error143"));
 
 1433            $logtpl->setVariable(
"error201", 
$lng->txt(
"error201"));
 
 1434            $logtpl->setVariable(
"error301", 
$lng->txt(
"error301"));
 
 1435            $logtpl->setVariable(
"error351", 
$lng->txt(
"error351"));
 
 1436            $logtpl->setVariable(
"error391", 
$lng->txt(
"error391"));
 
 1437            $logtpl->setVariable(
"error401", 
$lng->txt(
"error401"));
 
 1438            $logtpl->setVariable(
"error402", 
$lng->txt(
"error402"));
 
 1439            $logtpl->setVariable(
"error403", 
$lng->txt(
"error403"));
 
 1440            $logtpl->setVariable(
"error404", 
$lng->txt(
"error404"));
 
 1441            $logtpl->setVariable(
"error405", 
$lng->txt(
"error405"));
 
 1442            $logtpl->setVariable(
"error406", 
$lng->txt(
"error406"));
 
 1443            $logtpl->setVariable(
"error407", 
$lng->txt(
"error407"));
 
 1444            $logtpl->setVariable(
"error408", 
$lng->txt(
"error408"));
 
 1445            $logtpl->setVariable(
"SetValue", 
$lng->txt(
"SetValue"));
 
 1446            $logtpl->setVariable(
"GetValue", 
$lng->txt(
"GetValue"));
 
 1447            $logtpl->setVariable(
"Commit", 
$lng->txt(
"Commit"));
 
 1448            $logtpl->setVariable(
"Initialize", 
$lng->txt(
"Initialize"));
 
 1449            $logtpl->setVariable(
"Terminate", 
$lng->txt(
"Terminate"));
 
 1450            $logtpl->setVariable(
"GetErrorString", 
$lng->txt(
"GetErrorString"));
 
 1451            $logtpl->setVariable(
"GetLastError", 
$lng->txt(
"GetLastError"));
 
 1452            $logtpl->setVariable(
"GetDiagnostic", 
$lng->txt(
"GetDiagnostic"));
 
 1453            $logtpl->setVariable(
"cmi._version", 
$lng->txt(
"cmi._version"));
 
 1454            $logtpl->setVariable(
"cmi.comments_from_learner._children", 
$lng->txt(
"cmi.comments_from_learner._children"));
 
 1455            $logtpl->setVariable(
"cmi.comments_from_learner._count", 
$lng->txt(
"cmi.comments_from_learner._count"));
 
 1456            $logtpl->setVariable(
"cmi.comments_from_learner.n.comment", 
$lng->txt(
"cmi.comments_from_learner.n.comment"));
 
 1457            $logtpl->setVariable(
"cmi.comments_from_learner.n.location", 
$lng->txt(
"cmi.comments_from_learner.n.location"));
 
 1458            $logtpl->setVariable(
"cmi.comments_from_learner.n.timestamp", 
$lng->txt(
"cmi.comments_from_learner.n.timestamp"));
 
 1459            $logtpl->setVariable(
"cmi.comments_from_lms._children", 
$lng->txt(
"cmi.comments_from_lms._children"));
 
 1460            $logtpl->setVariable(
"cmi.comments_from_lms._count", 
$lng->txt(
"cmi.comments_from_lms._count"));
 
 1461            $logtpl->setVariable(
"cmi.comments_from_lms.n.comment", 
$lng->txt(
"cmi.comments_from_lms.n.comment"));
 
 1462            $logtpl->setVariable(
"cmi.comments_from_lms.n.location", 
$lng->txt(
"cmi.comments_from_lms.n.location"));
 
 1463            $logtpl->setVariable(
"cmi.comments_from_lms.n.timestamp", 
$lng->txt(
"cmi.comments_from_lms.n.timestamp"));
 
 1464            $logtpl->setVariable(
"cmi.completion_status", 
$lng->txt(
"cmi.completion_status"));
 
 1465            $logtpl->setVariable(
"cmi.completion_threshold", 
$lng->txt(
"cmi.completion_threshold"));
 
 1466            $logtpl->setVariable(
"cmi.credit", 
$lng->txt(
"cmi.credit"));
 
 1467            $logtpl->setVariable(
"cmi.entry", 
$lng->txt(
"cmi.entry"));
 
 1468            $logtpl->setVariable(
"cmi.exit", 
$lng->txt(
"cmi.exit"));
 
 1469            $logtpl->setVariable(
"cmi.interactions._children", 
$lng->txt(
"cmi.interactions._children"));
 
 1470            $logtpl->setVariable(
"cmi.interactions._count", 
$lng->txt(
"cmi.interactions._count"));
 
 1471            $logtpl->setVariable(
"cmi.interactions.n.id", 
$lng->txt(
"cmi.interactions.n.id"));
 
 1472            $logtpl->setVariable(
"cmi.interactions.n.type", 
$lng->txt(
"cmi.interactions.n.type"));
 
 1473            $logtpl->setVariable(
"cmi.interactions.n.objectives._count", 
$lng->txt(
"cmi.interactions.n.objectives._count"));
 
 1474            $logtpl->setVariable(
"cmi.interactions.n.objectives.n.id", 
$lng->txt(
"cmi.interactions.n.objectives.n.id"));
 
 1475            $logtpl->setVariable(
"cmi.interactions.n.timestamp", 
$lng->txt(
"cmi.interactions.n.timestamp"));
 
 1476            $logtpl->setVariable(
"cmi.interactions.n.correct_responses._count", 
$lng->txt(
"cmi.interactions.n.correct_responses._count"));
 
 1477            $logtpl->setVariable(
"cmi.interactions.n.correct_responses.n.pattern", 
$lng->txt(
"cmi.interactions.n.correct_responses.n.pattern"));
 
 1478            $logtpl->setVariable(
"cmi.interactions.n.weighting", 
$lng->txt(
"cmi.interactions.n.weighting"));
 
 1479            $logtpl->setVariable(
"cmi.interactions.n.learner_response", 
$lng->txt(
"cmi.interactions.n.learner_response"));
 
 1480            $logtpl->setVariable(
"cmi.interactions.n.result", 
$lng->txt(
"cmi.interactions.n.result"));
 
 1481            $logtpl->setVariable(
"cmi.interactions.n.latency", 
$lng->txt(
"cmi.interactions.n.latency"));
 
 1482            $logtpl->setVariable(
"cmi.interactions.n.description", 
$lng->txt(
"cmi.interactions.n.description"));
 
 1483            $logtpl->setVariable(
"cmi.launch_data", 
$lng->txt(
"cmi.launch_data"));
 
 1484            $logtpl->setVariable(
"cmi.learner_id", 
$lng->txt(
"cmi.learner_id"));
 
 1485            $logtpl->setVariable(
"cmi.learner_name", 
$lng->txt(
"cmi.learner_name"));
 
 1486            $logtpl->setVariable(
"cmi.learner_preference._children", 
$lng->txt(
"cmi.learner_preference._children"));
 
 1487            $logtpl->setVariable(
"cmi.learner_preference.audio_level", 
$lng->txt(
"cmi.learner_preference.audio_level"));
 
 1488            $logtpl->setVariable(
"cmi.learner_preference.language", 
$lng->txt(
"cmi.learner_preference.language"));
 
 1489            $logtpl->setVariable(
"cmi.learner_preference.delivery_speed", 
$lng->txt(
"cmi.learner_preference.delivery_speed"));
 
 1490            $logtpl->setVariable(
"cmi.learner_preference.audio_captioning", 
$lng->txt(
"cmi.learner_preference.audio_captioning"));
 
 1491            $logtpl->setVariable(
"cmi.location", 
$lng->txt(
"cmi.location"));
 
 1492            $logtpl->setVariable(
"cmi.max_time_allowed", 
$lng->txt(
"cmi.max_time_allowed"));
 
 1493            $logtpl->setVariable(
"cmi.mode", 
$lng->txt(
"cmi.mode"));
 
 1494            $logtpl->setVariable(
"cmi.objectives._children", 
$lng->txt(
"cmi.objectives._children"));
 
 1495            $logtpl->setVariable(
"cmi.objectives._count", 
$lng->txt(
"cmi.objectives._count"));
 
 1496            $logtpl->setVariable(
"cmi.objectives.n.id", 
$lng->txt(
"cmi.objectives.n.id"));
 
 1497            $logtpl->setVariable(
"cmi.objectives.n.score._children", 
$lng->txt(
"cmi.objectives.n.score._children"));
 
 1498            $logtpl->setVariable(
"cmi.objectives.n.score.scaled", 
$lng->txt(
"cmi.objectives.n.score.scaled"));
 
 1499            $logtpl->setVariable(
"cmi.objectives.n.score.raw", 
$lng->txt(
"cmi.objectives.n.score.raw"));
 
 1500            $logtpl->setVariable(
"cmi.objectives.n.score.min", 
$lng->txt(
"cmi.objectives.n.score.min"));
 
 1501            $logtpl->setVariable(
"cmi.objectives.n.score.max", 
$lng->txt(
"cmi.objectives.n.score.max"));
 
 1502            $logtpl->setVariable(
"cmi.objectives.n.success_status", 
$lng->txt(
"cmi.objectives.n.success_status"));
 
 1503            $logtpl->setVariable(
"cmi.objectives.n.completion_status", 
$lng->txt(
"cmi.objectives.n.completion_status"));
 
 1504            $logtpl->setVariable(
"cmi.objectives.n.progress_measure", 
$lng->txt(
"cmi.objectives.n.progress_measure"));
 
 1505            $logtpl->setVariable(
"cmi.objectives.n.description", 
$lng->txt(
"cmi.objectives.n.description"));
 
 1506            $logtpl->setVariable(
"cmi.progress_measure", 
$lng->txt(
"cmi.progress_measure"));
 
 1507            $logtpl->setVariable(
"cmi.scaled_passing_score", 
$lng->txt(
"cmi.scaled_passing_score"));
 
 1508            $logtpl->setVariable(
"cmi.score._children", 
$lng->txt(
"cmi.score._children"));
 
 1509            $logtpl->setVariable(
"cmi.score.scaled", 
$lng->txt(
"cmi.score.scaled"));
 
 1510            $logtpl->setVariable(
"cmi.score.raw", 
$lng->txt(
"cmi.score.raw"));
 
 1511            $logtpl->setVariable(
"cmi.score.min", 
$lng->txt(
"cmi.score.min"));
 
 1512            $logtpl->setVariable(
"cmi.score.max", 
$lng->txt(
"cmi.score.max"));
 
 1513            $logtpl->setVariable(
"cmi.session_time", 
$lng->txt(
"cmi.session_time"));
 
 1514            $logtpl->setVariable(
"cmi.success_status", 
$lng->txt(
"cmi.success_status"));
 
 1515            $logtpl->setVariable(
"cmi.suspend_data", 
$lng->txt(
"cmi.suspend_data"));
 
 1516            $logtpl->setVariable(
"cmi.time_limit_action", 
$lng->txt(
"cmi.time_limit_action"));
 
 1517            $logtpl->setVariable(
"cmi.total_time", 
$lng->txt(
"cmi.total_time"));
 
 1518            $logtpl->setVariable(
"adl.nav.request", 
$lng->txt(
"adl.nav.request"));
 
 1519            $logtpl->setVariable(
"adl.nav.request_valid.continue", 
$lng->txt(
"adl.nav.request_valid.continue"));
 
 1520            $logtpl->setVariable(
"adl.nav.request_valid.previous", 
$lng->txt(
"adl.nav.request_valid.previous"));
 
 1521            $logtpl->setVariable(
"adl.nav.request_valid.choice", 
$lng->txt(
"adl.nav.request_valid.choice"));
 
 1522            $logtpl->setVariable(
"i_green", 
$lng->txt(
"i_green"));
 
 1523            $logtpl->setVariable(
"i_red", 
$lng->txt(
"i_red"));
 
 1524            $logtpl->setVariable(
"i_orange", 
$lng->txt(
"i_orange"));
 
 1525            $logtpl->setVariable(
"i_fuchsia", 
$lng->txt(
"i_fuchsia"));
 
 1526            $logtpl->setVariable(
"i_gray", 
$lng->txt(
"i_gray"));
 
 1527            $logtpl->setVariable(
"error", 
$lng->txt(
"error"));
 
 1528            $logtpl->setVariable(
"strange_error", 
$lng->txt(
"strange_error"));
 
 1529            $logtpl->setVariable(
"strange_API-Call", 
$lng->txt(
"strange_API-Call"));
 
 1530            $logtpl->setVariable(
"unknown", 
$lng->txt(
"unknown"));
 
 1531            $logtpl->setVariable(
"undefined_color", 
$lng->txt(
"undefined_color"));
 
 1532            $logtpl->setVariable(
"description_for", 
$lng->txt(
"description_for"));
 
 1533            $logtpl->setVariable(
"hide", 
$lng->txt(
"hide"));
 
 1534            $logtpl->setVariable(
"all_API-calls_shown", 
$lng->txt(
"all_API-calls_shown"));
 
 1535            $logtpl->setVariable(
"show_only_important_API-calls", 
$lng->txt(
"show_only_important_API-calls"));
 
 1536            $logtpl->setVariable(
"only_important_API-Calls_shown", 
$lng->txt(
"only_important_API-Calls_shown"));
 
 1537            $logtpl->setVariable(
"show_all_API-calls", 
$lng->txt(
"show_all_API-calls"));
 
 1538            $logtpl->setVariable(
"log_for", 
$lng->txt(
"log_for"));
 
 1539            $logtpl->setVariable(
"started", 
$lng->txt(
"started"));
 
 1540            $logtpl->setVariable(
"nr_session", 
$lng->txt(
"nr_session"));
 
 1541            $logtpl->setVariable(
"id_learning_module", 
$lng->txt(
"id_learning_module"));
 
 1542            if ($this->slm->getCheck_values() == 
false) {
 
 1543                $logtpl->setVariable(
"CHECK_VALUES", 
$lng->txt(
"sent_values_not_checked"));
 
 1545            $logtpl->parseCurrentBlock();
 
 1546            fwrite($fHandle2, $logtpl->get());
 
 1554        $webdir = str_replace(
"/ilias.php", 
"", 
$_SERVER[
"SCRIPT_NAME"]);
 
 1564        $logDir = $this->slm->getDataDirectory() . 
"/logs";
 
 1565        if (!file_exists($logDir)) {
 
 1576        header(
'Content-Type: text/html; charset=UTF-8');
 
 1577        echo file_get_contents($this->logDirectory() . 
"/" . 
$filename);
 
 1586        header(
"Expires: 0");
 
 1587        header(
"Cache-Control: private");
 
 1588        header(
"Cache-Control: must-revalidate, post-check=0, pre-check=0");
 
 1589        header(
"Pragma: cache");
 
 1590        header(
"Content-Description: File Transfer");
 
 1591        header(
"Content-Type: application/octet-stream");
 
 1592        header(
"Content-disposition: attachment; filename=$filename");
 
 1593        echo file_get_contents($this->logDirectory() . 
"/" . 
$filename);
 
 1600        foreach (
new DirectoryIterator($this->logDirectory()) as $fileInfo) {
 
 1601            if ($fileInfo->isDot()) {
 
 1604            $item[
'filename'] = $fileInfo->getFilename();
 
 1605            $parts = pathinfo($item[
'filename']);
 
 1606            $fnameparts = preg_split(
'/_/', $parts[
'filename'], -1, PREG_SPLIT_NO_EMPTY);
 
 1607            $deleteUrl = 
' <a href=#' . 
" onclick=\"javascript:deleteFile('" . $item[
'filename'] . 
"');\">" . $s_delete . 
"</a>";
 
 1609            if ($this->get_actual_attempts() == $fnameparts[1]) {
 
 1613            $urlDownload = 
'ilias.php?baseClass=ilSAHSPresentationGUI' . 
'&cmd=downloadLog&ref_id=' . 
$_GET[
"ref_id"] . 
'&logFile=' . $fileInfo->getFilename();
 
 1614            $urlOpen = 
'ilias.php?baseClass=ilSAHSPresentationGUI' . 
'&cmd=openLog&ref_id=' . 
$_GET[
"ref_id"] . 
'&logFile=' . $fileInfo->getFilename();
 
 1615            $item[
'date'] = date(
'Y/m/d H:i:s', $fileInfo->getCTime());
 
 1616            if ($parts[
'extension'] == 
"html") {
 
 1617                $item[
'action'] = $deleteUrl . 
" <a href=" . $urlDownload . 
">" . $s_download . 
"</a> <a target=_new href=" . $urlOpen . 
">" . $s_open . 
"</a>";
 
 1619                $item[
'action'] = $deleteUrl . 
" <a href=" . $urlDownload . 
">" . $s_download . 
"</a>";
 
 1621            if ($parts[
'extension'] == 
"html" || $parts[
'extension'] == 
"csv") {
 
 1622                array_push(
$data, $item);
 
 1625        usort(
$data, 
"datecmp");
 
 1631        header(
'Content-Type: text/html; charset=UTF-8');
 
 1632        print file_get_contents($this->logFileName() . 
".html");
 
 1639        $lng->loadLanguageModule(
"scormdebug");
 
 1651        $this->tpl = 
new ilGlobalTemplate(
"tpl.scorm2004.debug.html", 
false, 
false, 
"./Modules/Scorm2004");
 
 1652        $this->tpl->setVariable(
'CONSOLE', 
$lng->txt(
"debugwindow_console"));
 
 1653        $this->tpl->setVariable(
'LOGS', 
$lng->txt(
"debugwindow_logs"));
 
 1654        $this->tpl->setVariable(
'COMMENT', 
$lng->txt(
"debugwindow_comment"));
 
 1655        $this->tpl->setVariable(
'COMMENT_ENTER', 
$lng->txt(
"debugwindow_comment_enter"));
 
 1656        $this->tpl->setVariable(
'START_RECORDING', 
$lng->txt(
"debugwindow_start_recording"));
 
 1657        $this->tpl->setVariable(
'STOP_RECORDING', 
$lng->txt(
"debugwindow_stop_recording"));
 
 1658        $this->tpl->setVariable(
'DELETE_LOGFILE', 
$lng->txt(
"debugwindow_delete_logfile"));
 
 1659        $this->tpl->setVariable(
'SUBMISSION_FAILED', 
$lng->txt(
"debugwindow_submission_failed"));
 
 1660        $this->tpl->setVariable(
'SUBMIT', 
$lng->txt(
"debugwindow_submit"));
 
 1661        $this->tpl->setVariable(
'CANCEL', 
$lng->txt(
"debugwindow_cancel"));
 
 1662        $this->tpl->setVariable(
'FILENAME', 
$lng->txt(
"debugwindow_filename"));
 
 1663        $this->tpl->setVariable(
'DATE', 
$lng->txt(
"debugwindow_date"));
 
 1664        $this->tpl->setVariable(
'ACTION', 
$lng->txt(
"debugwindow_action"));
 
 1665        $this->tpl->setVariable(
'RECORD_IMG', 
ilUtil::getImagePath(
"record.png", 
"./Modules/Scorm2004"));
 
 1667        $this->tpl->setVariable(
'COMMENT_IMG', 
ilUtil::getImagePath(
"comment.png", 
"./Modules/Scorm2004"));
 
 1668        $logfile = $this->logFileName() . 
".html";
 
 1669        $this->tpl->setVariable(
'LOGFILE', $this->logFileName() . 
".html");
 
 1670        $this->tpl->setVariable(
'FILES_DATA', json_encode($this->getLogFileList(
$lng->txt(
"debugwindow_delete"), 
$lng->txt(
"debugwindow_download"), 
$lng->txt(
"debugwindow_open"))));
 
 1673        include_once 
"Services/YUI/classes/class.ilYuiUtil.php";
 
 1676        echo $this->tpl->get(
"DEFAULT", 
true);
 
 1681        return new ilTemplate(
"tpl.scorm2004.debugtxt.txt", 
true, 
true, 
"Modules/Scorm2004");
 
 1688        $ilLog = 
$DIC[
'ilLog'];
 
 1702        $debug_fields = parse_ini_file(
"./Modules/Scorm2004/scripts/rtemain/debug_default.ini", 
true);
 
 1705            $ini_array = $debug_fields[
'test_sco'];
 
 1707            $ini_array = $debug_fields[
'normal_sco'];
 
 1709        foreach ($ini_array as $key => $value) {
 
 1711                array_push($dvalues, $key);
 
 1720        $ilLog = 
$DIC[
'ilLog'];
 
 1722        $lng->loadLanguageModule(
"scormdebug");
 
 1724        $logdata = json_decode(file_get_contents(
'php://input'));
 
 1726        $tmp_name = $this->logTmpName();
 
 1728        $fh_txt = fopen(
$filename . 
".html", 
'a') or die(
"can't open txt file");
 
 1729        $fh_csv = fopen(
$filename . 
".csv", 
'a') or die(
"can't open csv file");
 
 1730        $fh_tmp = fopen($tmp_name, 
'r') or die(
"can't open tmp file");
 
 1733        if (filesize($tmp_name) > 0) {
 
 1734            $tmp_content = unserialize(fread($fh_tmp, filesize($tmp_name)));
 
 1736            $tmp_content = 
null;
 
 1742        $fh_tmp2 = fopen($tmp_name, 
'w') or die(
"can't open tmp file");
 
 1746        $tmp_content[$logdata->scoid][$logdata->key][
'value'] = $logdata->value;
 
 1747        $tmp_content[$logdata->scoid][$logdata->key][
'status'] = $logdata->result;
 
 1748        $tmp_content[$logdata->scoid][$logdata->key][
'action'] = $logdata->action;
 
 1750        fwrite($fh_tmp2, serialize($tmp_content));
 
 1756        $errorcode = $logdata->errorcode;
 
 1757        $fixedFailure = 
false;
 
 1758        $toleratedFailure = 
false;
 
 1759        $extraErrorDescription = 
"";
 
 1760        if ($errorcode == 200000) {
 
 1762            $toleratedFailure = 
true;
 
 1763            $extraErrorDescription = 
"tolerated failure";
 
 1765        if ($errorcode > 99999) {
 
 1766            $errorcode -= 100000;
 
 1767            $fixedFailure = 
true;
 
 1768            $extraErrorDescription = 
" failure corrected by ILIAS";
 
 1770        if (strpos($logdata->action, 
"ANALYZE") === 
false) {
 
 1771            $errorDescriptions = array(
"0" => 
"",
 
 1772                "101" => 
"General Exeption",
 
 1773                "102" => 
"General Initialization Failure",
 
 1774                "103" => 
"Already Initialized",
 
 1775                "104" => 
"Content Instance Terminated",
 
 1776                "111" => 
"General Termination Failure",
 
 1777                "112" => 
"Termination Before Initialization",
 
 1778                "113" => 
"Termination After Termination",
 
 1779                "122" => 
"Retrieve Data Before Initialization",
 
 1780                "123" => 
"Retrieve Data After Termination",
 
 1781                "132" => 
"Store Data Before Initialization",
 
 1782                "133" => 
"Store Data After Termination",
 
 1783                "142" => 
"Commit Before Initialization",
 
 1784                "143" => 
"Commit After Termination",
 
 1785                "201" => 
"General Argument Error",
 
 1786                "301" => 
"General Get Failure",
 
 1787                "351" => 
"General Set Failure",
 
 1788                "391" => 
"General Commit Failure",
 
 1789                "401" => 
"Undefined Data Model Element",
 
 1790                "402" => 
"Unimplemented Data Model Element",
 
 1791                "403" => 
"Data Model Element Value Not Initialized",
 
 1792                "404" => 
"Data Model Element Is Read Only",
 
 1793                "405" => 
"Data Model Element Is Write Only",
 
 1794                "406" => 
"Data Model Element Type Mismatch",
 
 1795                "407" => 
"Data Model Element Value Out Of Range",
 
 1796                "408" => 
"Data Model Dependency Not Established");
 
 1797            $csv_string = $this->packageId . 
';"' 
 1798                . $logdata->scoid . 
'";"' 
 1799                . $logdata->scotitle . 
'";' 
 1800                . date(
"d.m.Y H:i", time()) . 
';"' 
 1801                . $logdata->action . 
'";"' 
 1802                . $logdata->key . 
'";"' 
 1803                . str_replace(
"\"", 
"\"\"", $logdata->value) . 
'";"' 
 1804                . str_replace(
"\"", 
"\"\"", $logdata->result) . 
'";' 
 1806                . $logdata->timespan . 
';"' 
 1807                . $errorDescriptions[$errorcode] . $extraErrorDescription . 
'"' . 
"\n";
 
 1808            fwrite($fh_csv, $csv_string);
 
 1812        if ($logdata->action == 
"Commit" || $logdata->action == 
"Terminate") {
 
 1814            $sql_data = $this->getNodeData($logdata->scoid, $fh_csv);
 
 1815            if (count($sql_data) != 0) {
 
 1816                foreach ($sql_data as $key => $value) {
 
 1817                    $sql_string = $this->packageId . 
';"' 
 1818                        . $logdata->scoid . 
'";"' 
 1819                        . $logdata->scotitle . 
'";' 
 1822                        . str_replace(
"\"", 
"\"\"", $value) . 
'";;;;' . 
"\n";
 
 1823                    fwrite($fh_csv, $sql_string);
 
 1829        if ($logdata->action == 
"DELETE") {
 
 1832            $path = $this->logDirectory() . 
"/" . 
$filename;
 
 1838        $logtpl = $this->getLogTemplate();
 
 1841        $ArGetValues = array(
'comments_from_lms',
'completion_threshold',
'credit',
'entry',
'launch_data',
'learner_id',
'learner_name',
'max_time_allowed',
'mode',
'scaled_passing_score',
'time_limit_action',
'total_time');
 
 1843        switch ($logdata->action) {
 
 1845                if ($logdata->result == 
"true" && $errorcode == 0) {
 
 1848                if ($color == 
"green" && $logdata->key == 
"cmi.exit" && $logdata->value != 
"suspend") {
 
 1851                if ($fixedFailure == 
false && $errorcode != 406) {
 
 1852                    $logdata->value = 
'"' . $logdata->value . 
'"';
 
 1854                if ($toleratedFailure == 
true) {
 
 1857                if ($fixedFailure == 
true) {
 
 1862                if ($errorcode == 0) {
 
 1867                if ($errorcode == 0) {
 
 1869                    $logtpl->setCurrentBlock(
"InitializeStart");
 
 1870                    $logtpl->setVariable(
"SCO-title", 
$lng->txt(
"SCO-title"));
 
 1871                    $logtpl->setVariable(
"SCO_TITLE", $logdata->scotitle);
 
 1872                    $logtpl->setVariable(
"SCO-name", 
$lng->txt(
"SCO-name"));
 
 1873                    $logtpl->setVariable(
"SCO_NAME", $logdata->scoid);
 
 1874                    $logtpl->setVariable(
"started", 
$lng->txt(
"started"));
 
 1875                    $logtpl->setVariable(
"TIMESTAMP", 
$timestamp);
 
 1876                    $logtpl->setVariable(
"milliseconds", 
$lng->txt(
"milliseconds"));
 
 1877                    $logtpl->setVariable(
"API-call", 
$lng->txt(
"API-call"));
 
 1878                    $logtpl->setVariable(
"return_value", 
$lng->txt(
"return_value"));
 
 1879                    $logtpl->setVariable(
"error", 
$lng->txt(
"error"));
 
 1880                    $logtpl->parseCurrentBlock();
 
 1884                if ($errorcode == 0) {
 
 1887                if ($fixedFailure == 
true) {
 
 1892                if ($errorcode == 0) {
 
 1896            case 'GetErrorString':
 
 1898                if ($errorcode == 0) {
 
 1902            case 'GetLastError':
 
 1903                $logtpl->setCurrentBlock(
"GetLastError");
 
 1904                $logtpl->setVariable(
"TIMESPAN", $logdata->timespan);
 
 1905                $logtpl->setVariable(
"RESULT", $logdata->result);
 
 1906                $logtpl->parseCurrentBlock();
 
 1908            case 'GetDiagnostic':
 
 1909                $logtpl->setCurrentBlock(
"GetDiagnostic");
 
 1910                $logtpl->setVariable(
"TIMESPAN", $logdata->timespan);
 
 1911                $logtpl->setVariable(
"KEY", $logdata->key);
 
 1912                $logtpl->setVariable(
"RESULT", $logdata->result);
 
 1913                $logtpl->parseCurrentBlock();
 
 1916                $logtpl->setCurrentBlock(
"INFO");
 
 1917                $logtpl->setVariable(
"hint", 
$lng->txt(
"hint"));
 
 1918                $logtpl->setVariable(
"KEY", 
$lng->txt($logdata->key));
 
 1919                $logtpl->setVariable(
"VALUE", $logdata->value);
 
 1920                $logtpl->parseCurrentBlock();
 
 1923                $logtpl->setCurrentBlock(
"COMMENT");
 
 1924                $logtpl->setVariable(
"comment", 
$lng->txt(
"comment"));
 
 1925                $logtpl->setVariable(
"generated", 
$lng->txt(
"generated"));
 
 1926                $logtpl->setVariable(
"TIMESTAMP", 
$timestamp);
 
 1927                $logtpl->setVariable(
"VALUE", $logdata->value);
 
 1928                $logtpl->parseCurrentBlock();
 
 1931                $logtpl->setCurrentBlock(
"ANALYZE");
 
 1932                if (count($logdata->value) == 0) {
 
 1934                    $logtpl->setVariable(
"ANALYZE_SUMMARY", 
$lng->txt(
"no_missing_API-calls"));
 
 1935                    $logtpl->setVariable(
"VALUE", 
"");
 
 1937                    $tmpvalue = 
"SetValue(\"" . implode(
"\", ... ),<br/>SetValue(\"", $logdata->value) . 
"\", ... )";
 
 1938                    for (
$i = 0; 
$i < count($ArGetValues); 
$i++) {
 
 1939                        $tmpvalue = str_replace(
"SetValue(\"cmi." . $ArGetValues[
$i] . 
"\", ... )", 
"GetValue(\"cmi." . $ArGetValues[
$i] . 
"\")", $tmpvalue);
 
 1941                    $logtpl->setVariable(
"ANALYZE_SUMMARY", 
$lng->txt(
"missing_API-calls"));
 
 1942                    $logtpl->setVariable(
"VALUE", $tmpvalue);
 
 1944                $logtpl->setVariable(
"summary_for_SCO_without_test", 
$lng->txt(
"summary_for_SCO_without_test"));
 
 1945                $logtpl->setVariable(
"generated", 
$lng->txt(
"generated"));
 
 1946                $logtpl->setVariable(
"TIMESTAMP", 
$timestamp);
 
 1947                $logtpl->setVariable(
"COLOR", $color);
 
 1948                $logtpl->parseCurrentBlock();
 
 1951                $logtpl->setCurrentBlock(
"ANALYZETEST");
 
 1952                if (count($logdata->value) == 0) {
 
 1954                    $logtpl->setVariable(
"ANALYZE_SUMMARY", 
$lng->txt(
"no_missing_API-calls"));
 
 1955                    $logtpl->setVariable(
"VALUE", 
"");
 
 1957                    $tmpvalue = 
"SetValue(\"" . implode(
"\", ... ),<br/>SetValue(\"", $logdata->value) . 
"\", ... )";
 
 1958                    for (
$i = 0; 
$i < count($ArGetValues); 
$i++) {
 
 1959                        $tmpvalue = str_replace(
"SetValue(\"cmi." . $ArGetValues[
$i] . 
"\", ... )", 
"GetValue(\"cmi." . $ArGetValues[
$i] . 
"\")", $tmpvalue);
 
 1961                    $logtpl->setVariable(
"ANALYZE_SUMMARY", 
$lng->txt(
"missing_API-calls"));
 
 1962                    $logtpl->setVariable(
"VALUE", $tmpvalue);
 
 1964                $logtpl->setVariable(
"summary_for_SCO_with_test", 
$lng->txt(
"summary_for_SCO_with_test"));
 
 1965                $logtpl->setVariable(
"generated", 
$lng->txt(
"generated"));
 
 1966                $logtpl->setVariable(
"TIMESTAMP", 
$timestamp);
 
 1967                $logtpl->setVariable(
"COLOR", $color);
 
 1968                $logtpl->parseCurrentBlock();
 
 1971                $logtpl->setCurrentBlock(
"SUMMARY");
 
 1972                $logtpl->setVariable(
"summary_csv", 
$lng->txt(
"summary_csv"));
 
 1973                $logtpl->setVariable(
"TIMESTAMP", 
$timestamp);
 
 1974                $logtpl->setVariable(
"summary_download", 
$lng->txt(
"summary_download"));
 
 1975                $logtpl->parseCurrentBlock();
 
 1982        if ($logdata->action == 
'SetValue' || $logdata->action == 
'GetValue') {
 
 1983            $logtpl->setCurrentBlock($logdata->action);
 
 1984            $logtpl->setVariable(
"ACTION", $logdata->action);
 
 1985            $logtpl->setVariable(
"TIMESPAN", $logdata->timespan);
 
 1986            $logtpl->setVariable(
"KEY", $logdata->key);
 
 1987            $logtpl->setVariable(
"VALUE", $logdata->value);
 
 1988            $logtpl->setVariable(
"RESULT", $logdata->result);
 
 1989            $logtpl->setVariable(
"ERRORCODE", $errorcode);
 
 1990            $debugfields = $this->getDebugValues(
true);
 
 1992            for (
$i = 0; 
$i < count($debugfields) ; 
$i++) {
 
 1993                if ($logdata->key == $debugfields[
$i]) {
 
 1997            $logtpl->setVariable(
"IMPORTANTKEY", 
"" . $importantkey);
 
 1998            $logtpl->setVariable(
"COLOR", $color);
 
 1999            $logtpl->parseCurrentBlock();
 
 2000        } elseif ($logdata->action != 
'INFO' && $logdata->action != 
'ANALYZE' && $logdata->action != 
'ANALYZETEST' && $logdata->action != 
'SUMMARY' && $logdata->action != 
'COMMENT' && $logdata->action != 
'GetDiagnostic' && $logdata->action != 
'GetLastError') {
 
 2001            $logtpl->setCurrentBlock(
"defaultCall");
 
 2002            $logtpl->setVariable(
"ACTION", $logdata->action);
 
 2003            $logtpl->setVariable(
"TIMESPAN", $logdata->timespan);
 
 2004            $logtpl->setVariable(
"KEY", $logdata->key);
 
 2005            $logtpl->setVariable(
"VALUE", $logdata->value);
 
 2006            $logtpl->setVariable(
"RESULT", $logdata->result);
 
 2007            $logtpl->setVariable(
"ERRORCODE", $errorcode);
 
 2008            $logtpl->setVariable(
"IMPORTANTKEY", 
"" . $importantkey);
 
 2009            $logtpl->setVariable(
"COLOR", $color);
 
 2010            $logtpl->parseCurrentBlock();
 
 2023        if ($logdata->action == 
"SUMMARY") {
 
 2024            $this->createSummary($tmp_content);
 
 2027        fwrite($fh_txt, $logtpl->get());
 
 2036            $element[
'title'] = 
$data[
$i][
'title'];
 
 2037            $element[
'id'] = 
$data[
$i][
'id'];
 
 2039                $element[
'sco'] = 
"sco";
 
 2041                $element[
'sco'] = 
"assset";
 
 2043            if (
$data[
$i][
'href'] != 
null) {
 
 2044                array_push($this->flat_structure, $element);
 
 2046            if (
$data[
$i][
'item'] != 
null) {
 
 2047                $this->getStructureFlat(
$data[
$i][
'item']);
 
 2059        $columns_fixed = array(
'id',
'title',
'type',
'attempted');
 
 2061        $ini_data = parse_ini_file(
"./Modules/Scorm2004/scripts/rtemain/debug_default.ini", 
true);
 
 2062        $ini_array = $ini_data[
'summary'];
 
 2063        $colums_variable = array();
 
 2064        $api_keys = array();
 
 2066        foreach ($ini_array as $key => $value) {
 
 2068                array_push($colums_variable, $key);
 
 2069                array_push($api_keys, $key);
 
 2070                array_push($colums_variable, 
"Status");
 
 2074        $header_array = array_merge($columns_fixed, $colums_variable);
 
 2076        $csv_header = implode(
";", $header_array);
 
 2080            'SELECT jsdata FROM cp_package WHERE obj_id = %s',
 
 2082            array($this->packageId)
 
 2087        $structure = json_decode($packageData[
'jsdata'], 
true);
 
 2090        $this->flat_structure = array();  
 
 2091        $this->getStructureFlat($structure[
'item'][
'item']);
 
 2093        foreach ($this->flat_structure as $tree_element) {
 
 2094            $csv_data = $csv_data . $tree_element[
'id'] . 
";" . $tree_element[
'title'] . 
";" . $tree_element[
'sco'] . 
";";
 
 2095            if ($api_data[$tree_element[
'id']] != 
null) {
 
 2096                $csv_data = $csv_data . 
"X" . 
";";
 
 2098                $csv_data = $csv_data . 
";";
 
 2102            $id = $tree_element[
'id'];
 
 2103            foreach ($api_keys as $api_element) {
 
 2104                if ($api_data[$id] != 
null) {
 
 2105                    if ($api_data[$id][$api_element] != 
null) {
 
 2106                        $csv_data = $csv_data . $api_data[$id][$api_element][
'value'] . 
";" . $api_data[$id][$api_element][
'status'] . 
";";
 
 2108                        $csv_data = $csv_data . 
";;";
 
 2112            $csv_data = $csv_data . 
"\n";
 
 2115        $fh = fopen($this->summaryFileName(), 
"w");
 
 2116        fwrite($fh, $csv_header . 
"\n" . $csv_data);
 
 2118        unlink($this->logTmpName());
 
 2139    if (strtotime(
$a[
'date']) == strtotime(
$b[
'date'])) {
 
 2142    return (strtotime(
$a[
'date']) < strtotime(
$b[
'date'])) ? 1 :-1;
 
foreach($mandatory_scripts as $file) $timestamp
An exception for terminatinating execution or to throw for unit testing.
special template class to simplify handling of ITX/PEAR
Class ilObjSCORM2004LearningModule.
static get_max_attempts($a_packageId)
Get max.
static getStatus($a_packageId, $a_user_id, $auto_last_visited, $scormType="1.2")
static _lookupObjectId($a_ref_id)
lookup object id
writeSharedData($sco_node_id)
getMimetype($filename)
estimate content type for a filename by extension first do it for common static web files from extern...
getCMIData($userId, $packageId)
normalizeFields($table, &$node)
maps API data structure type to internal datatype on a node and accepts only valid values,...
readSharedData($sco_node_id)
getNodeData($sco_id, $fh)
getDebugValues($test_sco=false)
get_max_attempts()
Get max.
get_actual_attempts()
Get number of actual attempts for the user.
getLogFileList($s_delete, $s_download, $s_open)
& executeCommand()
execute command
increase_attemptAndsave_module_version()
Increases attempts by one and saves module_version for this package.
static getInlineCSS()
Get inline css.
static persistCMIData($userId=null, $packageId, $defaultLessonMode, $comments, $interactions, $objectives, $time_from_lms, $data=null)
static scormPlayerUnload($userId=null, $packageId, $time_from_lms)
static getIdleValue($fixedMode=false)
Returns the idle time in seconds.
special template class to simplify handling of ITX/PEAR
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static getCookieMaxLifetimeInSeconds()
static signFolderOfStartFile($start_file_path)
static getLocalPath($a_name="")
Get local path of a YUI js file.
static getLocaljQueryPath()
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
foreach($_POST as $key=> $value) $res