From: moodler
Date: Wed, 27 Aug 2003 08:13:16 +0000 (+0000)
Subject: Fairly radical improvement to the Journal index, putting all the
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=2a0d8c5b05ace0c7ea1b26366d98f3b75c5c3bdb;p=moodle.git
Fairly radical improvement to the Journal index, putting all the
information on one page.
---
diff --git a/mod/journal/index.php b/mod/journal/index.php
index 838c8d63ea..e39993d916 100644
--- a/mod/journal/index.php
+++ b/mod/journal/index.php
@@ -13,7 +13,7 @@
add_to_log($course->id, "journal", "view all", "index.php?id=$course->id", "");
if ($course->category) {
- $navigation = "id\">$course->shortname ->";
+ $navigation = "id\">$course->shortname ->";
}
$strjournal = get_string("modulename", "journal");
@@ -37,14 +37,11 @@
$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) {
@@ -55,36 +52,15 @@
} 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)."coursemodule\">";
+ journal_user_complete_index($course, $USER, $journal, $journalopen, "$strsection $journal->section");
- if ($journalopen) {
- $text .= "$stredit
";
- } else {
- $text .= "$strview
";
- }
- 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 "
";
- print_table($table);
-
print_footer($course);
?>
diff --git a/mod/journal/lib.php b/mod/journal/lib.php
index 8fe9e853fd..940e262dab 100644
--- a/mod/journal/lib.php
+++ b/mod/journal/lib.php
@@ -28,7 +28,8 @@ function journal_user_complete($course, $user, $mod, $journal) {
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();
@@ -37,6 +38,51 @@ function journal_user_complete($course, $user, $mod, $journal) {
}
}
+function journal_user_complete_index($course, $user, $journal, $journalopen, $heading) {
+
+ if ($heading) {
+ echo "$heading - $journal->name
";
+ } else {
+ echo "$journal->name
";
+ }
+
+ print_simple_box_start("left", "90%");
+ echo format_text($journal->intro);
+ print_simple_box_end();
+ echo "
";
+ echo "
";
+
+ print_simple_box_start("right", "90%");
+
+ if ($journalopen) {
+ echo "coursemodule\">";
+ echo get_string("edit")."
";
+ } else {
+ echo "coursemodule\">";
+ echo get_string("view")."
";
+ }
+
+ if ($entry = get_record("journal_entries", "userid", $user->id, "journal", $journal->id)) {
+ if ($entry->modified) {
+ echo "".get_string("lastedited").": ".userdate($entry->modified)."
";
+ }
+ 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 "
";
+ echo "
";
+
+}
+
function journal_cron () {
// Function to be run periodically according to the moodle cron