3 require_once("../../config.php");
5 $id = required_param('id', PARAM_INT
); // course id
8 if (! $course = get_record("course", "id", $id)) {
9 error("Course ID is incorrect");
12 error('A required parameter is missing');
15 require_course_login($course);
17 add_to_log($course->id
, "scorm", "view all", "index.php?id=$course->id", "");
19 $strscorm = get_string("modulename", "scorm");
20 $strscorms = get_string("modulenameplural", "scorm");
21 $strweek = get_string("week");
22 $strtopic = get_string("topic");
23 $strname = get_string("name");
24 $strsummary = get_string("summary");
25 $strreport = get_string("report",'scorm');
26 $strlastmodified = get_string("lastmodified");
28 $crumbs[] = array('name' => $strscorms, 'link' => '', 'type' => 'activity');
29 $navigation = build_navigation($crumbs);
31 print_header_simple("$strscorms", "", $navigation,
32 "", "", true, "", navmenu($course));
34 if ($course->format
== "weeks" or $course->format
== "topics") {
35 $sortorder = "cw.section ASC";
37 $sortorder = "m.timemodified DESC";
40 if (! $scorms = get_all_instances_in_course("scorm", $course)) {
41 notice("There are no scorms", "../../course/view.php?id=$course->id");
45 if ($course->format
== "weeks") {
46 $table->head
= array ($strweek, $strname, $strsummary, $strreport);
47 $table->align
= array ("center", "left", "left", "left");
48 } else if ($course->format
== "topics") {
49 $table->head
= array ($strtopic, $strname, $strsummary, $strreport);
50 $table->align
= array ("center", "left", "left", "left");
52 $table->head
= array ($strlastmodified, $strname, $strsummary, $strreport);
53 $table->align
= array ("left", "left", "left", "left");
56 foreach ($scorms as $scorm) {
58 $context = get_context_instance(CONTEXT_MODULE
,$scorm->coursemodule
);
60 if ($course->format
== "weeks" or $course->format
== "topics") {
61 if ($scorm->section
) {
62 $tt = "$scorm->section";
65 $tt = userdate($scorm->timemodified
);
68 if (has_capability('mod/scorm:viewreport', $context)) {
69 $trackedusers = get_record('scorm_scoes_track', 'scormid', $scorm->id
, '', '', '', '', 'count(distinct(userid)) as c');
70 if ($trackedusers->c
> 0) {
71 $reportshow = '<a href="report.php?id='.$scorm->coursemodule
.'">'.get_string('viewallreports','scorm',$trackedusers->c
).'</a></div>';
73 $reportshow = get_string('noreports','scorm');
75 } else if (has_capability('mod/scorm:viewscores', $context)) {
76 require_once('locallib.php');
77 $report = scorm_grade_user($scorm, $USER->id
);
78 $reportshow = get_string('score','scorm').": ".$report;
80 if (!$scorm->visible
) {
81 //Show dimmed if the mod is hidden
82 $table->data
[] = array ($tt, "<a class=\"dimmed\" href=\"view.php?id=$scorm->coursemodule\">".format_string($scorm->name
,true)."</a>",
83 format_text($scorm->summary
), $reportshow);
85 //Show normal if the mod is visible
86 $table->data
[] = array ($tt, "<a href=\"view.php?id=$scorm->coursemodule\">".format_string($scorm->name
,true)."</a>",
87 format_text($scorm->summary
), $reportshow);
95 print_footer($course);