3 require("../../config.php");
6 require_variable($id); // course
8 if (! $course = get_record("course", "id", $id)) {
9 error("Course ID is incorrect");
12 require_login($course->id);
13 add_to_log($course->id, "journal", "view all", "index.php?id=$course->id", "");
15 if ($course->category) {
16 $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
19 $strjournal = get_string("modulename", "journal");
20 $strjournals = get_string("modulenameplural", "journal");
21 $stredit = get_string("edit");
22 $strview = get_string("view");
23 $strweek = get_string("week");
24 $strtopic = get_string("topic");
25 $strquestion = get_string("question");
26 $stranswer = get_string("answer");
28 print_header("$course->shortname: $strjournals", "$course->fullname", "$navigation $strjournals", "");
31 if (! $journals = get_all_instances_in_course("journal", $course->id, "cw.section ASC")) {
32 notice("There are no journals", "../../course/view.php?id=$course->id");
38 if ($course->format == "weeks") {
39 $table->head = array ($strweek, $strquestion, $stranswer);
40 $table->align = array ("CENTER", "LEFT", "LEFT");
41 } else if ($course->format == "topics") {
42 $table->head = array ($strtopic, $strquestion, $stranswer);
43 $table->align = array ("CENTER", "LEFT", "LEFT");
45 $table->head = array ($strquestion, $stranswer);
46 $table->align = array ("LEFT", "LEFT");
49 foreach ($journals as $journal) {
51 $entry = get_record_sql("SELECT text FROM journal_entries
52 WHERE user='$USER->id' AND journal='$journal->id'");
54 $journal->timestart = $course->startdate + (($journal->section - 1) * 608400);
55 if ($journal->daysopen) {
56 $journal->timefinish = $journal->timestart + (3600 * 24 * $journal->daysopen);
58 $journal->timefinish = 9999999999;
60 $journalopen = ($journal->timestart < $timenow && $timenow < $journal->timefinish);
63 $text = text_to_html($entry->text)."<P ALIGN=right><A HREF=\"view.php?id=$journal->coursemodule\">";
65 $text .= "$stredit</A></P>";
67 $text .= "$strview</A></P>";
69 if ($course->format == "weeks" or $course->format == "topics") {
70 $table->data[] = array ("$journal->section",
71 text_to_html($journal->intro),
74 $table->data[] = array (text_to_html($journal->intro),
83 print_footer($course);