Incorrect variable name used for parameter.
[moodle-linuxchix.git] / mod / journal / index.php
blob60329fb8cfd7d66c70791bf57eb54af5d858110a
1 <?php // $Id$
3 require_once("../../config.php");
4 require_once("lib.php");
6 require_variable($id); // course
8 if (! $course = get_record("course", "id", $id)) {
9 error("Course ID is incorrect");
12 require_course_login($course);
13 add_to_log($course->id, "journal", "view all", "index.php?id=$course->id", "");
15 $strjournal = get_string("modulename", "journal");
16 $strjournals = get_string("modulenameplural", "journal");
17 $strweek = get_string("week");
18 $strtopic = get_string("topic");
20 print_header_simple("$strjournals", "", "$strjournals",
21 "", "", true, "", navmenu($course));
24 if (! $journals = get_all_instances_in_course("journal", $course)) {
25 notice("There are no journals", "../../course/view.php?id=$course->id");
26 die;
29 $timenow = time();
31 if ($course->format == "weeks") {
32 $strsection = $strweek;
33 } else if ($course->format == "topics") {
34 $strsection = $strtopic;
35 } else {
36 $strsection = "";
39 foreach ($journals as $journal) {
41 $journal->timestart = $course->startdate + (($journal->section - 1) * 608400);
42 if (!empty($journal->daysopen)) {
43 $journal->timefinish = $journal->timestart + (3600 * 24 * $journal->daysopen);
44 } else {
45 $journal->timefinish = 9999999999;
48 $journalopen = ($journal->timestart < $timenow && $timenow < $journal->timefinish);
50 journal_user_complete_index($course, $USER, $journal, $journalopen, "$strsection $journal->section");
54 echo "<br />";
56 print_footer($course);