add_to_log($course->id, "journal", "view all", "index.php?id=$course->id", "");
if ($course->category) {
- $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
+ $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
}
$strjournal = get_string("modulename", "journal");
$timenow = time();
if ($course->format == "weeks") {
- $table->head = array ($strweek, $strquestion, $stranswer);
- $table->align = array ("CENTER", "LEFT", "LEFT");
+ $strsection = $strweek;
} else if ($course->format == "topics") {
- $table->head = array ($strtopic, $strquestion, $stranswer);
- $table->align = array ("CENTER", "LEFT", "LEFT");
+ $strsection = $strtopic;
} else {
- $table->head = array ($strquestion, $stranswer);
- $table->align = array ("LEFT", "LEFT");
+ $strsection = "";
}
foreach ($journals as $journal) {
} else {
$journal->timefinish = 9999999999;
}
- $journalopen = ($journal->timestart < $timenow && $timenow < $journal->timefinish);
- $entrytext = get_field("journal_entries", "text", "userid", $USER->id, "journal", $journal->id);
+ $journalopen = ($journal->timestart < $timenow && $timenow < $journal->timefinish);
- $text = text_to_html($entrytext)."<p align=right><a href=\"view.php?id=$journal->coursemodule\">";
+ journal_user_complete_index($course, $USER, $journal, $journalopen, "$strsection $journal->section");
- if ($journalopen) {
- $text .= "$stredit</a></p>";
- } else {
- $text .= "$strview</a></p>";
- }
- if (!empty($journal->section)) {
- $section = "$journal->section";
- } else {
- $section = "";
- }
- if ($course->format == "weeks" or $course->format == "topics") {
- $table->data[] = array ($section,
- text_to_html($journal->intro),
- $text);
- } else {
- $table->data[] = array (text_to_html($journal->intro),
- $text);
- }
}
echo "<br />";
- print_table($table);
-
print_footer($course);
?>
echo format_text($entry->text, $entry->format);
}
if ($entry->teacher) {
- journal_print_feedback($course, $entry);
+ $grades = make_grades_menu($journal->assessed);
+ journal_print_feedback($course, $entry, $grades);
}
print_simple_box_end();
}
}
+function journal_user_complete_index($course, $user, $journal, $journalopen, $heading) {
+
+ if ($heading) {
+ echo "<h3>$heading - $journal->name</h3>";
+ } else {
+ echo "<h3>$journal->name</h3>";
+ }
+
+ print_simple_box_start("left", "90%");
+ echo format_text($journal->intro);
+ print_simple_box_end();
+ echo "<br clear=all />";
+ echo "<br />";
+
+ print_simple_box_start("right", "90%");
+
+ if ($journalopen) {
+ echo "<p align=right><a href=\"edit.php?id=$journal->coursemodule\">";
+ echo get_string("edit")."</a></p>";
+ } else {
+ echo "<p align=right><a href=\"view.php?id=$journal->coursemodule\">";
+ echo get_string("view")."</a></p>";
+ }
+
+ if ($entry = get_record("journal_entries", "userid", $user->id, "journal", $journal->id)) {
+ if ($entry->modified) {
+ echo "<p align=\"center\"><font size=1>".get_string("lastedited").": ".userdate($entry->modified)."</font></p>";
+ }
+ if ($entry->text) {
+ echo format_text($entry->text, $entry->format);
+ }
+ if ($entry->teacher) {
+ $grades = make_grades_menu($journal->assessed);
+ journal_print_feedback($course, $entry, $grades);
+ }
+ } else {
+ print_string("noentry", "journal");
+ }
+
+ print_simple_box_end();
+ echo "<br clear=all />";
+ echo "<br />";
+
+}
+
function journal_cron () {
// Function to be run periodically according to the moodle cron