3 require_once("../../config.php");
4 require_once("lib.php");
6 $id = required_param('id', PARAM_INT
); // Course Module ID
8 if (! $course = get_record("course", "id", $id)) {
9 error("Course ID is incorrect");
12 require_course_login($course);
14 add_to_log($course->id
, "survey", "view all", "index.php?id=$course->id", "");
16 $strsurveys = get_string("modulenameplural", "survey");
17 $strweek = get_string("week");
18 $strtopic = get_string("topic");
19 $strname = get_string("name");
20 $strstatus = get_string("status");
21 $strdone = get_string("done", "survey");
22 $strnotdone = get_string("notdone", "survey");
25 $navlinks[] = array('name' => $strsurveys, 'link' => '', 'type' => 'activity');
26 $navigation = build_navigation($navlinks);
28 print_header_simple("$strsurveys", "", $navigation,
29 "", "", true, "", navmenu($course));
31 if (! $surveys = get_all_instances_in_course("survey", $course)) {
32 notice(get_string('thereareno', 'moodle', $strsurveys), "../../course/view.php?id=$course->id");
35 if ($course->format
== "weeks") {
36 $table->head
= array ($strweek, $strname, $strstatus);
37 $table->align
= array ("CENTER", "LEFT", "LEFT");
38 } else if ($course->format
== "topics") {
39 $table->head
= array ($strtopic, $strname, $strstatus);
40 $table->align
= array ("CENTER", "LEFT", "LEFT");
42 $table->head
= array ($strname, $strstatus);
43 $table->align
= array ("LEFT", "LEFT");
48 foreach ($surveys as $survey) {
49 if (!empty($USER->id
) and survey_already_done($survey->id
, $USER->id
)) {
55 if ($survey->section
!== $currentsection) {
56 if ($survey->section
) {
57 $printsection = $survey->section
;
59 if ($currentsection !== "") {
60 $table->data
[] = 'hr';
62 $currentsection = $survey->section
;
65 if (!$survey->visible
) {
66 //Show dimmed if the mod is hidden
67 $tt_href = "<a class=\"dimmed\" href=\"view.php?id=$survey->coursemodule\">".format_string($survey->name
,true)."</a>";
69 //Show normal if the mod is visible
70 $tt_href = "<a href=\"view.php?id=$survey->coursemodule\">".format_string($survey->name
,true)."</a>";
73 if ($course->format
== "weeks" or $course->format
== "topics") {
74 $table->data
[] = array ($printsection, $tt_href, "<a href=\"view.php?id=$survey->coursemodule\">$ss</a>");
76 $table->data
[] = array ($tt_href, "<a href=\"view.php?id=$survey->coursemodule\">$ss</a>");
82 print_footer($course);