mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
SCORM MDL-21354 Add log to file option for AICC objects as we can't use the normal SCORM debugger. - thanks to Matteo Scaramuccia for help with the patch
This commit is contained in:
parent
88b8f04eb9
commit
169a204c08
2 changed files with 32 additions and 0 deletions
|
@ -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();
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue