]> git.mjollnir.org Git - moodle.git/commitdiff
Fairly radical improvement to the Journal index, putting all the
authormoodler <moodler>
Wed, 27 Aug 2003 08:13:16 +0000 (08:13 +0000)
committermoodler <moodler>
Wed, 27 Aug 2003 08:13:16 +0000 (08:13 +0000)
information on one page.

mod/journal/index.php
mod/journal/lib.php

index 838c8d63ea3adaf141ba279e7ab59e30e66c3e3a..e39993d9165cdf2a482ede4056902b51743d9c63 100644 (file)
@@ -13,7 +13,7 @@
     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);
  
 ?>
index 8fe9e853fde7fa67d6b6c1ba3509393874706c99..940e262dabca233ed3d18700cdc2d3e60302c794 100644 (file)
@@ -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 "<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