First step to SCORM2004, new communication subsystem
[moodle.git] / mod / scorm / index.php
CommitLineData
d1290cec 1<?php // $Id$
98ca59f6 2
3 require_once("../../config.php");
4
5 require_variable($id); // course
6
7 if (! $course = get_record("course", "id", $id)) {
8 error("Course ID is incorrect");
9 }
10
92a489eb 11 require_course_login($course->id);
98ca59f6 12
13 add_to_log($course->id, "scorm", "view all", "index.php?id=$course->id", "");
14
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");
22
92a489eb 23 print_header_simple("$strscorms", "", "$strscorms",
98ca59f6 24 "", "", true, "", navmenu($course));
25
26 if ($course->format == "weeks" or $course->format == "topics") {
27 $sortorder = "cw.section ASC";
28 } else {
29 $sortorder = "m.timemodified DESC";
30 }
31
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 }
36
37 if ($course->format == "weeks") {
38 $table->head = array ($strweek, $strname, $strsummary);
59c71f4b 39 $table->align = array ("center", "left", "left");
98ca59f6 40 } else if ($course->format == "topics") {
41 $table->head = array ($strtopic, $strname, $strsummary);
59c71f4b 42 $table->align = array ("center", "left", "left");
98ca59f6 43 } else {
44 $table->head = array ($strlastmodified, $strname, $strsummary);
59c71f4b 45 $table->align = array ("left", "left", "left");
98ca59f6 46 }
47
48 foreach ($scorms as $scorm) {
49
50 $tt = "";
51 if ($course->format == "weeks" or $course->format == "topics") {
52 if ($scorm->section) {
53 $tt = "$scorm->section";
54 }
55 } else {
d1290cec 56 $tt = "<font size=\"1\">".userdate($scorm->timemodified);
98ca59f6 57 }
58 if (!$scorm->visible) {
59 //Show dimmed if the mod is hidden
d1290cec 60 $table->data[] = array ($tt, "<a class=\"dimmed\" href=\"view.php?id=$scorm->coursemodule\">$scorm->name</a>",
98ca59f6 61 text_to_html($scorm->summary) );
62 } else {
63 //Show normal if the mod is visible
d1290cec 64 $table->data[] = array ($tt, "<a href=\"view.php?id=$scorm->coursemodule\">$scorm->name</a>",
98ca59f6 65 text_to_html($scorm->summary) );
66 }
67 }
68
1c5d9bbb 69 echo "<br />";
98ca59f6 70
71 print_table($table);
72
73 print_footer($course);
74
ec81373f 75
98ca59f6 76?>
77