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");
29 $navlinks[] = array('name' => $strscorms, 'link' => '', 'type' => 'activity');
30 $navigation = build_navigation($navlinks);
32 print_header_simple("$strscorms", "", $navigation,
33 "", "", true, "", navmenu($course));
35 if ($course->format
== "weeks" or $course->format
== "topics") {
36 $sortorder = "cw.section ASC";
38 $sortorder = "m.timemodified DESC";
41 if (! $scorms = get_all_instances_in_course("scorm", $course)) {
42 notice("There are no scorms", "../../course/view.php?id=$course->id");
46 if ($course->format
== "weeks") {
47 $table->head
= array ($strweek, $strname, $strsummary, $strreport);
48 $table->align
= array ("center", "left", "left", "left");
49 } else if ($course->format
== "topics") {
50 $table->head
= array ($strtopic, $strname, $strsummary, $strreport);
51 $table->align
= array ("center", "left", "left", "left");
53 $table->head
= array ($strlastmodified, $strname, $strsummary, $strreport);
54 $table->align
= array ("left", "left", "left", "left");
57 foreach ($scorms as $scorm) {
59 $context = get_context_instance(CONTEXT_MODULE
,$scorm->coursemodule
);
61 if ($course->format
== "weeks" or $course->format
== "topics") {
62 if ($scorm->section
) {
63 $tt = "$scorm->section";
66 $tt = userdate($scorm->timemodified
);
69 if (has_capability('mod/scorm:viewreport', $context)) {
70 $trackedusers = get_record('scorm_scoes_track', 'scormid', $scorm->id
, '', '', '', '', 'count(distinct(userid)) as c');
71 if ($trackedusers->c
> 0) {
72 $reportshow = '<a href="report.php?id='.$scorm->coursemodule
.'">'.get_string('viewallreports','scorm',$trackedusers->c
).'</a></div>';
74 $reportshow = get_string('noreports','scorm');
76 } else if (has_capability('mod/scorm:viewscores', $context)) {
77 require_once('locallib.php');
78 $report = scorm_grade_user($scorm, $USER->id
);
79 $reportshow = get_string('score','scorm').": ".$report;
81 if (!$scorm->visible
) {
82 //Show dimmed if the mod is hidden
83 $table->data
[] = array ($tt, "<a class=\"dimmed\" href=\"view.php?id=$scorm->coursemodule\">".format_string($scorm->name
,true)."</a>",
84 format_text($scorm->summary
), $reportshow);
86 //Show normal if the mod is visible
87 $table->data
[] = array ($tt, "<a href=\"view.php?id=$scorm->coursemodule\">".format_string($scorm->name
,true)."</a>",
88 format_text($scorm->summary
), $reportshow);
96 print_footer($course);