changed all the POST with option/required_param functions
[moodle.git] / mod / scorm / index.php
CommitLineData
d1290cec 1<?php // $Id$
98ca59f6 2
3 require_once("../../config.php");
4
7b873234 5 $id = required_param('id', '', PARAM_INT); // course id
98ca59f6 6
7b873234 7 if (!empty($id)) {
8 if (! $course = get_record("course", "id", $id)) {
9 error("Course ID is incorrect");
10 }
11 } else {
12 error('A required parameter is missing');
98ca59f6 13 }
14
535136bd 15 require_course_login($course);
98ca59f6 16
17 add_to_log($course->id, "scorm", "view all", "index.php?id=$course->id", "");
18
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 $strlastmodified = get_string("lastmodified");
26
92a489eb 27 print_header_simple("$strscorms", "", "$strscorms",
98ca59f6 28 "", "", true, "", navmenu($course));
29
30 if ($course->format == "weeks" or $course->format == "topics") {
31 $sortorder = "cw.section ASC";
32 } else {
33 $sortorder = "m.timemodified DESC";
34 }
35
36 if (! $scorms = get_all_instances_in_course("scorm", $course)) {
37 notice("There are no scorms", "../../course/view.php?id=$course->id");
38 exit;
39 }
40
41 if ($course->format == "weeks") {
42 $table->head = array ($strweek, $strname, $strsummary);
59c71f4b 43 $table->align = array ("center", "left", "left");
98ca59f6 44 } else if ($course->format == "topics") {
45 $table->head = array ($strtopic, $strname, $strsummary);
59c71f4b 46 $table->align = array ("center", "left", "left");
98ca59f6 47 } else {
48 $table->head = array ($strlastmodified, $strname, $strsummary);
59c71f4b 49 $table->align = array ("left", "left", "left");
98ca59f6 50 }
51
52 foreach ($scorms as $scorm) {
53
54 $tt = "";
55 if ($course->format == "weeks" or $course->format == "topics") {
56 if ($scorm->section) {
57 $tt = "$scorm->section";
58 }
59 } else {
d1290cec 60 $tt = "<font size=\"1\">".userdate($scorm->timemodified);
98ca59f6 61 }
62 if (!$scorm->visible) {
63 //Show dimmed if the mod is hidden
d858c876 64 $table->data[] = array ($tt, "<a class=\"dimmed\" href=\"view.php?id=$scorm->coursemodule\">".format_string($scorm->name,true)."</a>",
65 format_text($scorm->summary));
98ca59f6 66 } else {
67 //Show normal if the mod is visible
d858c876 68 $table->data[] = array ($tt, "<a href=\"view.php?id=$scorm->coursemodule\">".format_string($scorm->name,true)."</a>",
69 format_text($scorm->summary));
98ca59f6 70 }
71 }
72
1c5d9bbb 73 echo "<br />";
98ca59f6 74
75 print_table($table);
76
77 print_footer($course);
78
ec81373f 79
98ca59f6 80?>
81