3 require_once("../../config.php");
4 require_once("locallib.php");
6 $id = required_param('id', PARAM_INT
); // course id
9 if (! $course = get_record("course", "id", $id)) {
10 error("Course ID is incorrect");
13 error('A required parameter is missing');
16 require_course_login($course);
18 add_to_log($course->id
, "scorm", "view all", "index.php?id=$course->id", "");
20 $strscorm = get_string("modulename", "scorm");
21 $strscorms = get_string("modulenameplural", "scorm");
22 $strweek = get_string("week");
23 $strtopic = get_string("topic");
24 $strname = get_string("name");
25 $strsummary = get_string("summary");
26 $strreport = get_string("report",'scorm');
27 $strlastmodified = get_string("lastmodified");
30 $navlinks[] = array('name' => $strscorms, 'link' => '', 'type' => 'activity');
31 $navigation = build_navigation($navlinks);
33 print_header_simple("$strscorms", "", $navigation,
34 "", "", true, "", navmenu($course));
36 if ($course->format
== "weeks" or $course->format
== "topics") {
37 $sortorder = "cw.section ASC";
39 $sortorder = "m.timemodified DESC";
42 if (! $scorms = get_all_instances_in_course("scorm", $course)) {
43 notice("There are no scorms", "../../course/view.php?id=$course->id");
47 if ($course->format
== "weeks") {
48 $table->head
= array ($strweek, $strname, $strsummary, $strreport);
49 $table->align
= array ("center", "left", "left", "left");
50 } else if ($course->format
== "topics") {
51 $table->head
= array ($strtopic, $strname, $strsummary, $strreport);
52 $table->align
= array ("center", "left", "left", "left");
54 $table->head
= array ($strlastmodified, $strname, $strsummary, $strreport);
55 $table->align
= array ("left", "left", "left", "left");
58 foreach ($scorms as $scorm) {
60 $context = get_context_instance(CONTEXT_MODULE
,$scorm->coursemodule
);
62 if ($course->format
== "weeks" or $course->format
== "topics") {
63 if ($scorm->section
) {
64 $tt = "$scorm->section";
67 $tt = userdate($scorm->timemodified
);
70 if (has_capability('mod/scorm:viewreport', $context)) {
71 $trackedusers = scorm_get_count_users($scorm->id
, $scorm->groupingid
);
72 if ($trackedusers > 0) {
73 $reportshow = '<a href="report.php?id='.$scorm->coursemodule
.'">'.get_string('viewallreports','scorm',$trackedusers).'</a></div>';
75 $reportshow = get_string('noreports','scorm');
77 } else if (has_capability('mod/scorm:viewscores', $context)) {
78 require_once('locallib.php');
79 $report = scorm_grade_user($scorm, $USER->id
);
80 $reportshow = get_string('score','scorm').": ".$report;
82 if (!$scorm->visible
) {
83 //Show dimmed if the mod is hidden
84 $table->data
[] = array ($tt, "<a class=\"dimmed\" href=\"view.php?id=$scorm->coursemodule\">".format_string($scorm->name
,true)."</a>",
85 format_text($scorm->summary
), $reportshow);
87 //Show normal if the mod is visible
88 $table->data
[] = array ($tt, "<a href=\"view.php?id=$scorm->coursemodule\">".format_string($scorm->name
,true)."</a>",
89 format_text($scorm->summary
), $reportshow);
97 print_footer($course);