2004-05-20 17:06:19 +00:00
|
|
|
<?PHP // $Id$
|
|
|
|
|
|
|
|
// This script uses installed report plugins to print quiz reports
|
|
|
|
|
|
|
|
require_once("../../config.php");
|
|
|
|
require_once("lib.php");
|
|
|
|
|
|
|
|
optional_variable($id); // Course Module ID, or
|
|
|
|
|
|
|
|
if ($id) {
|
|
|
|
if (! $cm = get_record("course_modules", "id", $id)) {
|
|
|
|
error("Course Module ID was incorrect");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! $course = get_record("course", "id", $cm->course)) {
|
|
|
|
error("Course is misconfigured");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! $scorm = get_record("scorm", "id", $cm->instance)) {
|
|
|
|
error("Course module is incorrect");
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
if (! $scorm = get_record("scorm", "id", $q)) {
|
|
|
|
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);
|
|
|
|
|
|
|
|
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 = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
|
|
|
|
}
|
|
|
|
|
|
|
|
$strscorms = get_string("modulenameplural", "scorm");
|
|
|
|
$strscorm = get_string("modulename", "scorm");
|
|
|
|
$strreport = get_string("report", "scorm");
|
|
|
|
|
|
|
|
print_header("$course->shortname: $scorm->name", "$course->fullname",
|
|
|
|
"$navigation <A HREF=index.php?id=$course->id>$strscorms</A>
|
|
|
|
-> <a href=\"view.php?id=$cm->id\">$scorm->name</a> -> $strreport",
|
|
|
|
"", "", true);
|
|
|
|
|
|
|
|
print_heading($scorm->name);
|
|
|
|
}
|
|
|
|
if ($scoes =get_records_select("scorm_scoes","scorm='$scorm->id' ORDER BY id")) {
|
|
|
|
if ($sco_users=get_records_select("scorm_sco_users", "scormid='$scorm->id' GROUP BY userid")) {
|
|
|
|
|
|
|
|
$strname = get_string("name");
|
|
|
|
|
|
|
|
$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_round($sco->title);
|
|
|
|
$table->align[] = "center";
|
|
|
|
$table->wrap[] = "nowrap";
|
|
|
|
$table->size[] = "*";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($sco_users as $sco_user) {
|
|
|
|
$user_data=scorm_get_scoes_records($sco_user);
|
2004-07-19 14:53:43 +00:00
|
|
|
$userpict = "";
|
|
|
|
if (isset($user_data->picture)) {
|
|
|
|
$userpict = $user_data->picture;
|
|
|
|
}
|
|
|
|
$picture = print_user_picture($sco_user->userid, $course->id, $userpict, false, true);
|
|
|
|
$row="";
|
2004-05-20 17:06:19 +00:00
|
|
|
$row[] = $picture;
|
|
|
|
if (is_array($user_data)) {
|
|
|
|
$data = current($user_data);
|
|
|
|
$row[] = "<a href=\"$CFG->wwwroot/user/view.php?id=$data->userid&course=$course->id\">".
|
|
|
|
"$data->firstname $data->lastname</a>";
|
|
|
|
foreach ($user_data as $data) {
|
2004-05-27 12:44:11 +00:00
|
|
|
$scoreview = "";
|
2004-05-21 01:42:17 +00:00
|
|
|
if ($data->cmi_core_score_raw > 0)
|
|
|
|
$scoreview = "<br />".get_string("score","scorm").": ".$data->cmi_core_score_raw;
|
2004-06-21 11:27:52 +00:00
|
|
|
if ( $data->cmi_core_lesson_status == "")
|
|
|
|
$data->cmi_core_lesson_status = "not attempted";
|
2004-05-21 01:42:17 +00:00
|
|
|
$row[]="<img src=\"pix/".scorm_remove_spaces($data->cmi_core_lesson_status).".gif\"
|
2004-05-20 17:06:19 +00:00
|
|
|
alt=\"".get_string(scorm_remove_spaces($data->cmi_core_lesson_status),"scorm")."\"
|
|
|
|
title=\"".get_string(scorm_remove_spaces($data->cmi_core_lesson_status),"scorm")."\"> "
|
2004-05-21 01:42:17 +00:00
|
|
|
.$data->cmi_core_total_time.$scoreview;
|
2004-05-20 17:06:19 +00:00
|
|
|
}
|
|
|
|
}
|
2004-07-19 14:53:43 +00:00
|
|
|
$table->data[] = $row;
|
2004-05-20 17:06:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
print_table($table);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
notice("No users to report");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (empty($noheader)) {
|
|
|
|
print_footer($course);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
?>
|