adding some strings
[moodle-linuxchix.git] / mod / survey / index.php
blob7ea8a4fed4ef46c6c3bd98b0dae0cd1dc09b1d20
1 <?php // $Id$
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");
24 $navlinks = array();
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("There are no surveys.", "../../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");
41 } else {
42 $table->head = array ($strname, $strstatus);
43 $table->align = array ("LEFT", "LEFT");
46 $currentsection = '';
48 foreach ($surveys as $survey) {
49 if (!empty($USER->id) and survey_already_done($survey->id, $USER->id)) {
50 $ss = $strdone;
51 } else {
52 $ss = $strnotdone;
54 $printsection = "";
55 if ($survey->section !== $currentsection) {
56 if ($survey->section) {
57 $printsection = $survey->section;
59 if ($currentsection !== "") {
60 $table->data[] = 'hr';
62 $currentsection = $survey->section;
64 //Calculate the href
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>";
68 } else {
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>");
75 } else {
76 $table->data[] = array ($tt_href, "<a href=\"view.php?id=$survey->coursemodule\">$ss</a>");
80 echo "<br />";
81 print_table($table);
82 print_footer($course);