MDL-11517 reserved word MOD used in table alias in questions backup code
[moodle-pu.git] / mod / journal / index.php
blob2cdc0e46c7ad6f89e61bf5f7a6955e2dfe7df6fc
1 <?php // $Id$
3 require_once("../../config.php");
4 require_once("lib.php");
6 $id = required_param('id', PARAM_INT); // 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 $navlinks = array();
21 $navlinks[] = array('name' => $strjournals, 'link' => '', 'type' => 'activity');
22 $navigation = build_navigation($navlinks);
24 print_header_simple("$strjournals", "", $navigation,
25 "", "", true, "", navmenu($course));
28 if (! $journals = get_all_instances_in_course("journal", $course)) {
29 notice("There are no journals", "../../course/view.php?id=$course->id");
30 die;
33 $timenow = time();
35 if ($course->format == "weeks") {
36 $strsection = $strweek;
37 } else if ($course->format == "topics") {
38 $strsection = $strtopic;
39 } else {
40 $strsection = "";
43 foreach ($journals as $journal) {
45 $journal->timestart = $course->startdate + (($journal->section - 1) * 608400);
46 if (!empty($journal->daysopen)) {
47 $journal->timefinish = $journal->timestart + (3600 * 24 * $journal->daysopen);
48 } else {
49 $journal->timefinish = 9999999999;
52 $journalopen = ($journal->timestart < $timenow && $timenow < $journal->timefinish);
54 journal_user_complete_index($course, $USER, $journal, $journalopen, "$strsection $journal->section");
58 echo "<br />";
60 print_footer($course);