Putting SCORM into maintree CVS, to make it easier to test.
[moodle.git] / mod / scorm / index.php
1 <?PHP // $Id$
3     require_once("../../config.php");
5     require_variable($id);   // course
7     if (! $course = get_record("course", "id", $id)) {
8         error("Course ID is incorrect");
9     }
11     if ($course->category) {
12         require_login($course->id);
13         $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
14     }
16     add_to_log($course->id, "scorm", "view all", "index.php?id=$course->id", "");
18     $strscorm = get_string("modulename", "scorm");
19     $strscorms = get_string("modulenameplural", "scorm");
20     $strweek = get_string("week");
21     $strtopic = get_string("topic");
22     $strname = get_string("name");
23     $strsummary = get_string("summary");
24     $strlastmodified = get_string("lastmodified");
26     print_header("$course->shortname: $strscorms", "$course->fullname", "$navigation $strscorms", 
27                  "", "", true, "", navmenu($course));
29     if ($course->format == "weeks" or $course->format == "topics") {
30         $sortorder = "cw.section ASC";
31     } else {
32         $sortorder = "m.timemodified DESC";
33     }
35     if (! $scorms = get_all_instances_in_course("scorm", $course)) {
36         notice("There are no scorms", "../../course/view.php?id=$course->id");
37         exit;
38     }
40     if ($course->format == "weeks") {
41         $table->head  = array ($strweek, $strname, $strsummary);
42         $table->align = array ("CENTER", "LEFT", "LEFT");
43     } else if ($course->format == "topics") {
44         $table->head  = array ($strtopic, $strname, $strsummary);
45         $table->align = array ("CENTER", "LEFT", "LEFT");
46     } else {
47         $table->head  = array ($strlastmodified, $strname, $strsummary);
48         $table->align = array ("LEFT", "LEFT", "LEFT");
49     }
51     foreach ($scorms as $scorm) {
53         $tt = "";
54         if ($course->format == "weeks" or $course->format == "topics") {
55             if ($scorm->section) {
56                 $tt = "$scorm->section";
57             }
58         } else {
59             $tt = "<FONT SIZE=1>".userdate($scorm->timemodified);
60         }
61         if (!$scorm->visible) {
62            //Show dimmed if the mod is hidden
63            $table->data[] = array ($tt, "<A class=\"dimmed\" HREF=\"view.php?id=$scorm->coursemodule\">$scorm->name</A>",
64                                    text_to_html($scorm->summary) );
65         } else {
66            //Show normal if the mod is visible
67            $table->data[] = array ($tt, "<A HREF=\"view.php?id=$scorm->coursemodule\">$scorm->name</A>",
68                                    text_to_html($scorm->summary) );
69         }
70     }
72     echo "<BR>";
74     print_table($table);
76     print_footer($course);
78  
79 ?>