course)) { error("Course is misconfigured"); } require_login($course->id); if (! $journal = get_record("journal", "id", $cm->instance)) { error("Course module is incorrect"); } add_to_log("View journal: $journal->name", $course->id); if (! $cw = get_record("course_weeks", "id", $cm->week)) { error("Course module is incorrect"); } print_header("$course->shortname: $journal->name", "$course->fullname", "id>$course->shortname -> id>Journals -> $journal->name", ""); if ($USER->editing) { print_update_module_icon($cm->id); } if (isteacher($course->id)) { echo "

id\">View all responses

"; } echo "
\n"; print_simple_box( text_to_html($journal->intro) , "center"); echo "
"; $timenow = time(); $timestart = $course->startdate + (($cw->week - 1) * 608400); if ($journal->days) { $timefinish = $timestart + (3600 * 24 * $journal->days); } else { $timefinish = $course->enddate; } if ($timenow > $timestart) { print_simple_box_start("center"); if ($timenow < $timefinish) { $options = array ("id" => "$cm->id"); echo "
"; print_single_button("edit.php", $options, "Start or edit my journal entry"); echo "
"; } if ($entry = get_record_sql("SELECT * FROM journal_entries WHERE user='$USER->id' AND journal='$journal->id'")) { if (empty($entry->text)) { echo "

Blank entry

"; } else { echo text_to_html($entry->text); } } else { echo "You have not started this journal yet."; } print_simple_box_end(); if ($timenow < $timefinish) { if ($entry->modified) { echo "

Last edited: "; echo journaldate($entry->modified)."

"; } if ($journal->days) { echo "

Editing period ends: "; echo journaldate($timefinish)."

"; } } else { echo "

Editing period has ended: "; echo journaldate($timefinish)."

"; } if ($entry->comment || $entry->rating) { print_heading("Feedback"); print_feedback($course, $entry); } } else { echo "

This journal won't be open until: "; echo journaldate($timestart)."

"; } print_footer($course); // Functions function print_feedback($course, $entry) { global $CFG, $THEME, $RATING; if (! $teacher = get_record("user", "id", $entry->teacher)) { error("Weird journal error"); } echo "\n"; echo "\n"; echo "\n"; echo ""; echo "\n
body\" WIDTH=35 VALIGN=TOP>"; print_user_picture($teacher->id, $course->id, $teacher->picture); echo "cellheading\">$teacher->firstname $teacher->lastname"; echo "  ".journaldate($entry->timemarked).""; echo "
cellcontent\">"; echo "

Overall: "; if ($RATING[$entry->rating]) { echo $RATING[$entry->rating]; } else { echo "Error"; } echo "

"; echo text_to_html($entry->comment); echo "
"; } ?>