2001-11-22 06:23:56 +00:00
|
|
|
<?PHP // $Id$
|
|
|
|
|
|
|
|
require("../../config.php");
|
|
|
|
require("lib.php");
|
|
|
|
|
|
|
|
require_variable($id); // Course Module ID
|
|
|
|
|
|
|
|
if (! $cm = get_record("course_modules", "id", $id)) {
|
|
|
|
error("Course Module ID was incorrect");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! $course = get_record("course", "id", $cm->course)) {
|
|
|
|
error("Course is misconfigured");
|
|
|
|
}
|
|
|
|
|
|
|
|
require_login($course->id);
|
|
|
|
|
|
|
|
if (! $journal = get_record("journal", "id", $cm->instance)) {
|
|
|
|
error("Course module is incorrect");
|
|
|
|
}
|
|
|
|
|
2002-05-31 09:07:11 +00:00
|
|
|
add_to_log($course->id, "journal", "view", "view.php?id=$cm->id", "$journal->id");
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2002-06-25 11:49:06 +00:00
|
|
|
if (! $cw = get_record("course_sections", "id", $cm->section)) {
|
2001-11-22 06:23:56 +00:00
|
|
|
error("Course module is incorrect");
|
|
|
|
}
|
|
|
|
|
|
|
|
print_header("$course->shortname: $journal->name", "$course->fullname",
|
|
|
|
"<A HREF=../../course/view.php?id=$course->id>$course->shortname</A> ->
|
2002-06-08 06:52:00 +00:00
|
|
|
<A HREF=index.php?id=$course->id>Journals</A> -> $journal->name", "", "", true,
|
2002-07-04 07:48:44 +00:00
|
|
|
update_module_icon($cm->id, $course->id));
|
2001-11-22 06:23:56 +00:00
|
|
|
|
|
|
|
if (isteacher($course->id)) {
|
|
|
|
echo "<P align=right><A HREF=\"report.php?id=$cm->id\">View all responses</A></P>";
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "<CENTER>\n";
|
|
|
|
|
|
|
|
print_simple_box( text_to_html($journal->intro) , "center");
|
|
|
|
|
|
|
|
echo "<BR>";
|
|
|
|
|
|
|
|
$timenow = time();
|
2002-06-25 11:49:06 +00:00
|
|
|
|
|
|
|
if ($course->format == "weeks" and $journal->days) {
|
|
|
|
$timestart = $course->startdate + (($cw->section - 1) * 608400);
|
|
|
|
if ($journal->days) {
|
|
|
|
$timefinish = $timestart + (3600 * 24 * $journal->days);
|
|
|
|
} else {
|
|
|
|
$timefinish = $course->enddate;
|
|
|
|
}
|
|
|
|
} else { // Have no time limits on the journals
|
|
|
|
|
|
|
|
$timestart = $timenow - 1;
|
|
|
|
$timefinish = $timenow + 1;
|
|
|
|
$journal->days = 0;
|
2001-11-22 06:23:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($timenow > $timestart) {
|
|
|
|
|
|
|
|
print_simple_box_start("center");
|
|
|
|
|
|
|
|
if ($timenow < $timefinish) {
|
|
|
|
$options = array ("id" => "$cm->id");
|
|
|
|
echo "<CENTER>";
|
|
|
|
print_single_button("edit.php", $options, "Start or edit my journal entry");
|
|
|
|
echo "</CENTER>";
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($entry = get_record_sql("SELECT * FROM journal_entries
|
|
|
|
WHERE user='$USER->id' AND journal='$journal->id'")) {
|
|
|
|
|
|
|
|
if (empty($entry->text)) {
|
|
|
|
echo "<P ALIGN=center><B>Blank entry</B></P>";
|
|
|
|
} else {
|
|
|
|
echo text_to_html($entry->text);
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
echo "<B><I>You have not started this journal yet.</I></B>";
|
|
|
|
}
|
|
|
|
|
|
|
|
print_simple_box_end();
|
|
|
|
|
|
|
|
if ($timenow < $timefinish) {
|
|
|
|
if ($entry->modified) {
|
|
|
|
echo "<P><FONT SIZE=-2><B>Last edited:</B> ";
|
2002-06-05 03:15:30 +00:00
|
|
|
echo userdate($entry->modified)."</FONT></P>";
|
2001-11-22 06:23:56 +00:00
|
|
|
}
|
|
|
|
if ($journal->days) {
|
|
|
|
echo "<P><FONT SIZE=-2><B>Editing period ends:</B> ";
|
2002-06-05 03:15:30 +00:00
|
|
|
echo userdate($timefinish)."</FONT></P>";
|
2001-11-22 06:23:56 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
echo "<P><FONT SIZE=-2><B>Editing period has ended:</B> ";
|
2002-06-05 03:15:30 +00:00
|
|
|
echo userdate($timefinish)."</P>";
|
2001-11-22 06:23:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($entry->comment || $entry->rating) {
|
|
|
|
print_heading("Feedback");
|
|
|
|
print_feedback($course, $entry);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
echo "<P><B>This journal won't be open until: ";
|
2002-06-05 03:15:30 +00:00
|
|
|
echo userdate($timestart)."</B></P>";
|
2001-11-22 06:23:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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<TABLE BORDER=1 CELLSPACING=0 valign=top cellpadding=10>";
|
|
|
|
|
|
|
|
echo "\n<TR>";
|
|
|
|
echo "\n<TD ROWSPAN=3 BGCOLOR=\"$THEME->body\" WIDTH=35 VALIGN=TOP>";
|
|
|
|
print_user_picture($teacher->id, $course->id, $teacher->picture);
|
|
|
|
echo "</TD>";
|
|
|
|
echo "<TD NOWRAP WIDTH=100% BGCOLOR=\"$THEME->cellheading\">$teacher->firstname $teacher->lastname";
|
2002-06-05 03:15:30 +00:00
|
|
|
echo " <FONT SIZE=2><I>".userdate($entry->timemarked)."</I>";
|
2001-11-22 06:23:56 +00:00
|
|
|
echo "</TR>";
|
|
|
|
|
|
|
|
echo "\n<TR><TD WIDTH=100% BGCOLOR=\"$THEME->cellcontent\">";
|
2002-07-23 18:02:05 +00:00
|
|
|
|
|
|
|
echo "<P ALIGN=RIGHT><FONT SIZE=-1><I>";
|
2001-11-22 06:23:56 +00:00
|
|
|
if ($RATING[$entry->rating]) {
|
2002-07-23 18:02:05 +00:00
|
|
|
echo "Overall rating: ";
|
2001-11-22 06:23:56 +00:00
|
|
|
echo $RATING[$entry->rating];
|
|
|
|
} else {
|
2002-07-23 18:02:05 +00:00
|
|
|
echo "No rating given";
|
2001-11-22 06:23:56 +00:00
|
|
|
}
|
2002-07-23 18:02:05 +00:00
|
|
|
echo "</I></FONT></P>";
|
|
|
|
|
2001-11-22 06:23:56 +00:00
|
|
|
echo text_to_html($entry->comment);
|
|
|
|
echo "</TD></TR></TABLE>";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|