diff --git a/mod/scorm/aicc.php b/mod/scorm/aicc.php index f0985f8853b..9e3ed52a8f0 100755 --- a/mod/scorm/aicc.php +++ b/mod/scorm/aicc.php @@ -55,6 +55,14 @@ } else { print_error('cannotcallscript'); } + scorm_write_log("aicc", "scoid: $scoid", $scoid); + scorm_write_log("aicc", "mode: $mode", $scoid); + scorm_write_log("aicc", "status: $status", $scoid); + scorm_write_log("aicc", "attempt: $attempt", $scoid); + scorm_write_log("aicc", "command: $command", $scoid); + scorm_write_log("aicc", "sessionid: $sessionid", $scoid); + scorm_write_log("aicc", "aiccdata:\r\n$aiccdata", $scoid); + ob_start(); if ($scorm = $DB->get_record('scorm','id',$sco->scorm)) { switch ($command) { @@ -377,3 +385,6 @@ echo "error=3\r\nerror_text=Invalid Session ID\r\n"; } } + $aiccresponse = ob_get_contents(); + scorm_write_log("aicc", "response:\r\n$aiccresponse", $scoid); + ob_end_flush(); \ No newline at end of file diff --git a/mod/scorm/lib.php b/mod/scorm/lib.php index f5e7c7d5dbe..5061d022fcf 100755 --- a/mod/scorm/lib.php +++ b/mod/scorm/lib.php @@ -965,3 +965,24 @@ function scorm_extend_navigation($navigation, $course, $module, $cm) { */ $navigation->nodetype = navigation_node::NODETYPE_LEAF; } +/** + * writes log output to a temp log file + * + * @param string $type - type of log(aicc,scorm12,scorm13) used as prefix for filename + * @param string $text - text to be written to file. + * @param integer $scoid - scoid of object this log entry is for. + */ +function scorm_write_log($type, $text, $scoid) { + global $CFG, $USER; + + $debugenablelog = debugging('', DEBUG_DEVELOPER); + if (!$debugenablelog || empty($text)) { + return ; + } + if (make_upload_directory('temp/scormlogs/')) { + $logpath = $CFG->dataroot.'/temp/scormlogs'; + + $logfile = $logpath.'/'.$type.'debug_'.$USER->id.'_'.$scoid.'.log'; + @file_put_contents($logfile, date('Y/m/d H:i:s O')." DEBUG $text\r\n", FILE_APPEND); + } +}