course)) {
error("Course is misconfigured");
}
if (! $scorm = get_record("scorm", "id", $cm->instance)) {
error("Course module is incorrect");
}
} else {
if (!empty($b)) {
if (! $sco = get_record("scorm_scoes", "id", $b)) {
error("Scorm activity is incorrect");
}
$a = $sco->scorm;
}
if (!empty($a)) {
if (! $scorm = get_record("scorm", "id", $a)) {
error("Course module is incorrect");
}
if (! $course = get_record("course", "id", $scorm->course)) {
error("Course is misconfigured");
}
if (! $cm = get_coursemodule_from_instance("scorm", $scorm->id, $course->id)) {
error("Course Module ID was incorrect");
}
}
}
require_login($course->id, false, $cm);
if (!isteacher($course->id)) {
error("You are not allowed to use this script");
}
add_to_log($course->id, "scorm", "report", "report.php?id=$cm->id", "$scorm->id");
/// Print the page header
if (empty($noheader)) {
if ($course->category) {
$navigation = "id\">$course->shortname ->";
} else {
$navigation = '';
}
$strscorms = get_string("modulenameplural", "scorm");
$strscorm = get_string("modulename", "scorm");
$strreport = get_string("report", "scorm");
$strname = get_string('name');
if (empty($b)) {
print_header("$course->shortname: ".format_string($scorm->name), "$course->fullname",
"$navigation id\">$strscorms
-> id\">".format_string($scorm->name,true)." -> $strreport",
"", "", true);
} else {
print_header("$course->shortname: ".format_string($scorm->name), "$course->fullname",
"$navigation id\">$strscorms
-> id\">".format_string($scorm->name,true)."
-> id\">$strreport -> $sco->title",
"", "", true);
}
print_heading(format_string($scorm->name));
}
$scormpixdir = $CFG->modpixpath.'/scorm/pix';
if (empty($b) ) {
if ($scoes = get_records_select("scorm_scoes","scorm='$scorm->id' ORDER BY id")) {
if ($scousers=get_records_select("scorm_scoes_track", "scormid='$scorm->id' GROUP BY userid,scormid", "", "userid,scormid")) {
$table = new stdClass();
$table->head = array(' ', $strname);
$table->align = array('center', 'left');
$table->wrap = array('nowrap', 'nowrap');
$table->width = '100%';
$table->size = array(10, '*');
foreach ($scoes as $sco) {
if ($sco->launch!='') {
$table->head[]=scorm_string_wrap($sco->title);
//$table->head[]=$sco->title;
$table->align[] = 'center';
$table->wrap[] = 'nowrap';
$table->size[] = '*';
}
}
foreach ($scousers as $scouser) {
if ($userdata = scorm_get_user_data($scouser->userid)) {
$row = array();
$row[] = print_user_picture($scouser->userid, $course->id, $userdata->picture, false, true);
$row[] = "wwwroot/user/view.php?id=$scouser->userid&course=$course->id\">".
"$userdata->firstname $userdata->lastname";
foreach ($scoes as $sco) {
if ($sco->launch!='') {
$anchorstart = '';
$anchorend = '';
$scoreview = '';
if ($trackdata = scorm_get_tracks($sco->id,$scouser->userid)) {
if ($trackdata->score_raw != '') {
$scoreview = '
'.get_string('score','scorm').': '.$trackdata->score_raw;
}
if ($trackdata->status == '') {
$trackdata->status = 'notattempted';
} else {
$anchorstart = '';
$anchorend = '';
}
} else {
$trackdata->status = 'notattempted';
$trackdata->total_time = '';
}
$strstatus = get_string($trackdata->status,'scorm');
$row[] = $anchorstart.' '.$trackdata->total_time.$scoreview.$anchorend;
}
}
$table->data[] = $row;
}
}
print_table($table);
} else {
notice('No users to report');
}
}
} else {
if (!empty($user)) {
if ($userdata = scorm_get_user_data($user)) {
print_simple_box_start('center');
print_heading(format_string($sco->title));
echo '