First step for SCORM2004, new communication subsystem
[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     require_course_login($course->id, false, $cm);
13     add_to_log($course->id, "scorm", "view all", "index.php?id=$course->id", "");
15     $strscorm = get_string("modulename", "scorm");
16     $strscorms = get_string("modulenameplural", "scorm");
17     $strweek = get_string("week");
18     $strtopic = get_string("topic");
19     $strname = get_string("name");
20     $strsummary = get_string("summary");
21     $strlastmodified = get_string("lastmodified");
23     print_header_simple("$strscorms", "", "$navigation $strscorms",
24                  "", "", true, "", navmenu($course));
26     if ($course->format == "weeks" or $course->format == "topics") {
27         $sortorder = "cw.section ASC";
28     } else {
29         $sortorder = "m.timemodified DESC";
30     }
32     if (! $scorms = get_all_instances_in_course("scorm", $course)) {
33         notice("There are no scorms", "../../course/view.php?id=$course->id");
34         exit;
35     }
37     if ($course->format == "weeks") {
38         $table->head  = array ($strweek, $strname, $strsummary);
39         $table->align = array ("center", "left", "left");
40     } else if ($course->format == "topics") {
41         $table->head  = array ($strtopic, $strname, $strsummary);
42         $table->align = array ("center", "left", "left");
43     } else {
44         $table->head  = array ($strlastmodified, $strname, $strsummary);
45         $table->align = array ("left", "left", "left");
46     }
48     foreach ($scorms as $scorm) {
50         $tt = "";
51         if ($course->format == "weeks" or $course->format == "topics") {
52             if ($scorm->section) {
53                 $tt = "$scorm->section";
54             }
55         } else {
56             $tt = "<font size=\"1\">".userdate($scorm->timemodified);
57         }
58         if (!$scorm->visible) {
59            //Show dimmed if the mod is hidden
60            $table->data[] = array ($tt, "<a class=\"dimmed\" href=\"view.php?id=$scorm->coursemodule\">$scorm->name</a>",
61                                    text_to_html($scorm->summary) );
62         } else {
63            //Show normal if the mod is visible
64            $table->data[] = array ($tt, "<a href=\"view.php?id=$scorm->coursemodule\">$scorm->name</a>",
65                                    text_to_html($scorm->summary) );
66         }
67     }
69     echo "<br />";
71     print_table($table);
73     print_footer($course);
76 ?>