]> git.mjollnir.org Git - moodle.git/commitdiff
Lots of work on site display, over many files. Improved front page
authormartin <martin>
Sat, 3 Aug 2002 08:16:31 +0000 (08:16 +0000)
committermartin <martin>
Sat, 3 Aug 2002 08:16:31 +0000 (08:16 +0000)
and display of site modules.

23 files changed:
admin/index.php
admin/site.html
admin/site.php
course/edit.php
course/lib.php
course/topics.php
course/user.php
course/view.php
course/weeks.php
index.php
lang/en/forum.php
lang/en/moodle.php
mod/choice/index.php
mod/choice/view.php
mod/forum/discuss.php
mod/forum/index.php
mod/forum/search.php
mod/forum/view.php
mod/journal/index.php
mod/journal/view.php
mod/survey/index.php
mod/survey/view.php
pix/i/course.gif [new file with mode: 0755]

index 26116958052d127d70f9005adc6311dfd81227ea..36f0a0ac78036a5bda4c014e125d4a410c59d037 100644 (file)
 
     // At this point, the databases exist, and the user is an admin
 
-    print_header("$site->fullname: Administration Page","$site->fullname: Administration Page", "Admin");
+    $stradministration = get_string("administration");
+    print_header("$site->fullname: $stradministration","$site->fullname: $stradministration", "$stradministration");
 
     $table->head  = array ("Site Management", "Course Setup", "Other");
     $table->align = array ("CENTER", "CENTER", "CENTER");
-    $table->data[0][0] = "<P><A HREF=\"site.php\">Site settings</A></P>".
-                         "<P><A HREF=\"../course/log.php?id=$site->id\">Site logs</A></P>";
-    $table->data[0][1] = "<P><A HREF=\"../course/edit.php\">Create a new course</A></P>".
-                         "<P><A HREF=\"../course/teacher.php\">Assign teachers to a course</A></P>".
-                         "<P><A HREF=\"../course/delete.php\">Delete a course</A></P>";
-    $table->data[0][2] = "<P><A HREF=\"user.php\">Edit a user's account</A></P>";
+    $table->data[0][0] = "<P><A HREF=\"site.php\">".get_string("sitesettings")."</A></P>".
+                         "<P><A HREF=\"../course/log.php?id=$site->id\">".get_string("sitelogs")."</A></P>";
+    $table->data[0][1] = "<P><A HREF=\"../course/edit.php\">".get_string("addnewcourse")."</A></P>".
+                         "<P><A HREF=\"../course/teacher.php\">".get_string("assignteachers")."</A></P>".
+                         "<P><A HREF=\"../course/delete.php\">".get_string("deletecourse")."</A></P>";
+    $table->data[0][2] = "<P><A HREF=\"user.php\">".get_string("edituser")."</A></P>";
 
     print_table($table);
 
index 4cbe232327013a43eaaccd9fec891eac3e3e05b7..c0540d350b049c59e2952ca208d42b4fd3e19fba 100644 (file)
@@ -44,4 +44,5 @@
 </TABLE>
 <INPUT type="hidden" name="id" value="<?=$form->id ?>">
 <INPUT type="hidden" name="category" value="<?=$form->category ?>">
+<INPUT type="hidden" name="format" value="<?=$form->format ?>">
 </FORM>
index 946b1328351e00116cb4fbf1a6eedd508b523d4f..39104d9a6c9e41e57cb87035eedd4b4fa5a9105f 100644 (file)
@@ -3,6 +3,7 @@
        require("../config.php");
 
     $course = get_site();
+    $course->format = "social";   // override
 
 /// If data submitted, then process and store.
 
@@ -49,7 +50,7 @@
         $form = $course;
     } else {
         $form->category = 0;
-        $form->newsitems = 1;
+        $form->format = "social";
     }
 
     print_header("Admin: Setting up site", "Administration: Setting up site",
index 674bc674eb7520d36e8531ad99a1c2cbabf62c39..e9e9507be2166bf673571e7f8340f8b4a509faa0 100644 (file)
@@ -60,7 +60,7 @@
                     $section->id = insert_record("course_sections", $section);
 
                     add_to_log($newid, "course", "new", "view.php?id=$newid", "");
-                           redirect("$CFG->wwwroot/admin/teacher.php?id=$newid", get_string("changessaved"));
+                           redirect("teacher.php?id=$newid", get_string("changessaved"));
                 } else {
                     error("Serious Error! Could not create the new course!");
                 }
index 3cb84d29f12942e0a0c5b9c4436941eb06010d90..4c1866bc75a539983306a5f8f75180254b716f41 100644 (file)
@@ -174,12 +174,28 @@ function print_log($course, $user=0, $date=0, $order="ORDER BY l.time ASC") {
 }
 
 
-function print_all_courses($cat=1) {
+function print_all_courses($cat=1, $style="full", $maxcount=999) {
+    global $CFG;
 
     if ($courses = get_records("course", "category", $cat, "fullname ASC")) {
-        foreach ($courses as $course) {
-            print_course($course);
-            echo "<BR>\n";
+        if ($style == "minimal") {
+            $count = 0;
+            $icon  = "<IMG SRC=\"pix/i/course.gif\" HEIGHT=16 WIDTH=16 ALT=\"Course\">";
+            foreach ($courses as $course) {
+                $moddata[]="<A HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->fullname</A>";
+                $modicon[]=$icon;
+                if ($count++ >= $maxcount) {
+                    break;
+                }
+            }   
+            $fulllist = "<P><A HREF=\"$CFG->wwwroot/course/\">".get_string("fulllistofcourses")."</A>...";
+            print_side_block("", $moddata, "$fulllist", $modicon);
+
+        } else {
+            foreach ($courses as $course) {
+                print_course($course);
+                echo "<BR>\n";
+            }
         }
 
     } else {
@@ -398,6 +414,7 @@ function get_all_mods($courseid, &$mods, &$modnames, &$modnamesplural, &$modname
 
     $mods          = NULL;    // course modules indexed by id
     $modnames      = NULL;    // all course module names
+    $modnamesplural= NULL;    // all course module names (plural form)
     $modnamesused  = NULL;    // course module names used
 
     if ($allmods = get_records_sql("SELECT * FROM modules") ) {
@@ -414,7 +431,7 @@ function get_all_mods($courseid, &$mods, &$modnames, &$modnamesplural, &$modname
                                      FROM modules m, course_modules cm
                                      WHERE cm.course = '$courseid' 
                                        AND cm.deleted = '0'
-                                       AND cm.module = m.id") ) {
+                                       AND cm.module = m.id ") ) {
         foreach($rawmods as $mod) {    // Index the mods
             $mods[$mod->id] = $mod;
             $mods[$mod->id]->modfullname = $modnames[$mod->modname];
@@ -432,6 +449,31 @@ function get_all_sections($courseid) {
                             ORDER BY section");
 }
 
+function print_section($courseid, $section, $mods, $modnamesused, $absolute=false) {
+    global $CFG;
+
+
+    echo "<P>";
+    if ($section->sequence) {
+
+        $sectionmods = explode(",", $section->sequence);
+
+        foreach ($sectionmods as $modnumber) {
+            $mod = $mods[$modnumber];
+            $instancename = get_field("$mod->modname", "name", "id", "$mod->instance");
+            echo "<IMG SRC=\"$CFG->wwwroot/mod/$mod->modname/icon.gif\" HEIGHT=16 WIDTH=16 ALT=\"$mod->modfullname\">";
+            echo " <A TITLE=\"$mod->modfullname\"";
+            echo "   HREF=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\">$instancename</A>";
+            if (isediting($courseid)) {
+                echo make_editing_buttons($mod->id, $absolute);
+            }
+            echo "<BR>\n";
+        }
+    }
+    echo "</P>\n";
+}
+
+
 function print_log_graph($course, $userid=0, $type="course.png", $date=0) {
     global $CFG;
     echo "<IMG BORDER=0 SRC=\"$CFG->wwwroot/course/loggraph.php?id=$course->id&user=$userid&type=$type&date=$date\">";
@@ -654,20 +696,28 @@ function move_module($id, $move) {
     }
 }
 
-function make_editing_buttons($moduleid) {
+function make_editing_buttons($moduleid, $absolute=false) {
+    global $CFG;
+
     $delete   = get_string("delete");
     $moveup   = get_string("moveup");
     $movedown = get_string("movedown");
     $update   = get_string("update");
+
+    if ($absolute) {
+        $path = "$CFG->wwwroot/course/";
+    } else {
+        $path = "";
+    }
     return "&nbsp; &nbsp; 
-          <A HREF=mod.php?delete=$moduleid><IMG 
-             SRC=../pix/t/delete.gif BORDER=0 ALT=\"$delete\"></A>
-          <A HREF=mod.php?id=$moduleid&move=-1><IMG 
-             SRC=../pix/t/up.gif BORDER=0 ALT=\"$moveup\"></A>
-          <A HREF=mod.php?id=$moduleid&move=1><IMG 
-             SRC=../pix/t/down.gif BORDER=0 ALT=\"$movedown\"></A>
-          <A HREF=mod.php?update=$moduleid><IMG 
-             SRC=../pix/t/edit.gif BORDER=0 ALT=\"$update\"></A>";
+          <A HREF=\"".$path."mod.php?delete=$moduleid\"><IMG 
+             SRC=".$path."../pix/t/delete.gif BORDER=0 ALT=\"$delete\"></A>
+          <A HREF=\"".$path."mod.php?id=$moduleid&move=-1\"><IMG 
+             SRC=".$path."../pix/t/up.gif BORDER=0 ALT=\"$moveup\"></A>
+          <A HREF=\"".$path."mod.php?id=$moduleid&move=1\"><IMG 
+             SRC=".$path."../pix/t/down.gif BORDER=0 ALT=\"$movedown\"></A>
+          <A HREF=\"".$path."mod.php?update=$moduleid\"><IMG 
+             SRC=".$path."../pix/t/edit.gif BORDER=0 ALT=\"$update\"></A>";
 }
 
 function print_side_block($heading="", $list=NULL, $footer="", $icons=NULL) {
index 731a1e290441282084668e0ac54f58f8525feb23..fad8072cdc3ef72240bc4005f2b7ebe0f7e3524a 100644 (file)
 
         echo text_to_html($thissection->summary);
 
-        echo "<P>";
-        if ($thissection->sequence) {
-
-            $thissectionmods = explode(",", $thissection->sequence);
-
-            foreach ($thissectionmods as $modnumber) {
-                $mod = $mods[$modnumber];
-                $instancename = get_field("$mod->modname", "name", "id", "$mod->instance");
-                echo "<IMG SRC=\"../mod/$mod->modname/icon.gif\" HEIGHT=16 WIDTH=16 ALT=\"$mod->modfullname\">";
-                echo " <A TITLE=\"$mod->modfullname\"";
-                echo "   HREF=\"../mod/$mod->modname/view.php?id=$mod->id\">$instancename</A>";
-                if (isediting($course->id)) {
-                    echo make_editing_buttons($mod->id);
-                }
-                echo "<BR>\n";
-            }
-        }
-        echo "</UL></P>\n";
+        print_section($course->id, $thissection, $mods, $modnamesused);
 
         if (isediting($course->id)) {
             echo "<DIV ALIGN=right>";
index f6d7a0a2ad29a690c47f9f810f13edb3ccf4ea9a..fede41a7ca802730c21791c58bccb60432d738cd 100644 (file)
@@ -56,7 +56,7 @@
     echo "</TR></TABLE>";
 
 
-    get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused);
+    get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused, $modsectioncounts);
 
     switch ($mode) {
         case "today" :
index e74a8997a7bfb632a3980038e380151cc57ad863..724da490da846f5bc659347f78f3513e369c37cc 100644 (file)
@@ -48,7 +48,7 @@
     print_header("$courseword: $course->fullname", "$course->fullname", "$course->shortname", "search.search", "", true,
                   update_course_icon($course->id));
 
-    get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused);
+    get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused, $modsectioncounts);
 
     switch ($course->format) {
         case "weeks":
index fbdd73ffe662567eec46eb72a47fb0904e873e50..234e45fcd767638477995dd7592e0887578e0a11 100644 (file)
@@ -4,11 +4,11 @@
 
     include("../mod/forum/lib.php");
 
-    if (! $sections = get_all_sections($course->id, $course->numsections) ) {
+    if (! $sections = get_all_sections($course->id)) {
         $section->course = $course->id;   // Create a default section.
         $section->section = 0;
         $section->id = insert_record("course_sections", $section);
-        if (! $sections = get_all_sections($course->id, $course->numsections) ) {
+        if (! $sections = get_all_sections($course->id) ) {
             error("Error finding or creating section structures for this course");
         }
     }
 
         echo text_to_html($thisweek->summary);
 
-        echo "<P>";
-        if ($thisweek->sequence) {
-
-            $thisweekmods = explode(",", $thisweek->sequence);
-
-            foreach ($thisweekmods as $modnumber) {
-                $mod = $mods[$modnumber];
-                $instancename = get_field("$mod->modname", "name", "id", "$mod->instance");
-                echo "<IMG SRC=\"../mod/$mod->modname/icon.gif\" HEIGHT=16 WIDTH=16 ALT=\"$mod->modfullname\">";
-                echo " <A TITLE=\"$mod->modfullname\"";
-                echo "   HREF=\"../mod/$mod->modname/view.php?id=$mod->id\">$instancename</A>";
-                if (isediting($course->id)) {
-                    echo make_editing_buttons($mod->id);
-                }
-                echo "<BR>\n";
-            }
-        }
-        echo "</UL></P>\n";
+        print_section($course->id, $thisweek, $mods, $modnamesused);
 
         if (isediting($course->id)) {
             echo "<DIV ALIGN=right>";
index 79b51b176c551836bcd7d889179b9e64d68c1906..7dc5e3719b0e1f11d0dc8fc77cfcde22c3117c0c 100644 (file)
--- a/index.php
+++ b/index.php
 <TABLE WIDTH="100%" BORDER="0" CELLSPACING="5" CELLPADDING="5">
   <TR>
     <TD VALIGN="TOP" NOWRAP>
-      <? $readings = reading_list_all_readings();
+      <? 
+
+         $sections = get_all_sections($site->id);
       
-         if ($site->newsitems > 0 or $readings or isediting($site->id)) {
+         if ($site->newsitems > 0 or $sections[0]->sequence or isediting($site->id)) {
       
-             print_simple_box(get_string("mainmenu"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
-
              if ($site->newsitems > 0 ) {
-                 echo "<LI><A TITLE=\"".
-                      get_string("availablecourses").
-                      "\" HREF=\"course/\"><B>".
-                      get_string("courses").
-                      "</B></A><BR></LI>";
+                 print_simple_box(get_string("courses"), "CENTER", "100%", "$THEME->cellheading");
+
+                 print_all_courses($cat=1, "minimal", 10);
              } 
 
-             if ($readings) {
-                 foreach ($readings as $reading) {
-                    echo "<LI>$reading";
-                 }
+             if ($sections[0]->sequence or isediting($site->id)) {
+                 get_all_mods($site->id, $mods, $modnames, $modnamesplural, $modnamesused);
+                 print_simple_box(get_string("mainmenu"), "CENTER", "100%", "$THEME->cellheading");
+             }   
+
+             if ($sections[0]->sequence) {
+                 print_section($site->id, $sections[0], $mods, $modnamesused, true);
              }
+
              if (isediting($site->id)) {
-                 echo "<P align=right><A HREF=\"$CFG->wwwroot/course/mod.php?id=$site->id&section=0&add=reading\">".
-                      get_string("addreading", "reading")."</A>...</P>";
-             } else {
-                 echo "<BR><BR>";
+                 echo "<DIV ALIGN=right>";
+                 popup_form("$CFG->wwwroot/course/mod.php?id=$site->id&section=0&add=", 
+                             $modnames, "section0", "", "Add...");
+                 echo "</DIV>";
              }
          }
      
-
          if (isadmin()) {
-             print_simple_box(get_string("admin"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
-             echo "<LI><A HREF=\"$CFG->wwwroot/admin/\">".get_string("adminpage")."...</A></LI>";
-             echo "<LI><A HREF=\"$CFG->wwwroot/course/log.php?id=$site->id\">".get_string("sitelogs")."...</A></LI>";
-             echo "<LI><A HREF=\"$CFG->wwwroot/admin/site.php\">".get_string("sitesettings")."...</A></LI>";
+             print_simple_box(get_string("administration"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
+             $icon = "<IMG SRC=\"pix/i/settings.gif\" HEIGHT=16 WIDTH=16 ALT=\"\">";
+             $moddata[]="<A HREF=\"course/log.php?id=$site->id\">".get_string("sitelogs")."</A>";
+             $modicon[]=$icon;
+             $moddata[]="<A HREF=\"admin/site.php\">".get_string("sitesettings")."</A>";
+             $modicon[]=$icon;
+             $moddata[]="<A HREF=\"course/edit.php\">".get_string("addnewcourse")."</A>";
+             $modicon[]=$icon;
+             $moddata[]="<A HREF=\"course/teacher.php\">".get_string("assignteachers")."</A>";
+             $modicon[]=$icon;
+             $moddata[]="<A HREF=\"course/delete.php\">".get_string("deletecourse")."</A>";
+             $modicon[]=$icon;
+             $moddata[]="<A HREF=\"admin/user.php\">".get_string("edituser")."</A>";
+             $modicon[]=$icon;
+             print_side_block("", $moddata, "", $modicon);
          }
       ?>
 
index fda7afb82a68bd1bbde20a1b58974bbcc03bd05e..7643e539a6905648fcbddf66af781760e6b0aa6f 100644 (file)
@@ -20,7 +20,7 @@ $string[forums] = "Forums";
 $string[generalforum] = "Standard forum for general use";
 $string[generalforums] = "General forums";
 $string[inforum] = "in \$a";
-$string[intronews] = "General news and announcements about this course";
+$string[intronews] = "General news and announcements";
 $string[introsocial] = "An open forum for chatting about anything you want to";
 $string[introteacher] = "A forum for teacher-only notes and discussion";
 $string[learningforums] = "Learning forums";
index fa7102efe918643e8926659ec7e50de569705d89..aeb1393a087090e6c13dac7ecb082371665b82a5 100644 (file)
@@ -1,21 +1,17 @@
 <?PHP // $Id$ 
 
-#------------------------------------------------------------
-$string[modulename] = "Site";
-$string[modulenameplural] = "Sites";
-#------------------------------------------------------------
-
-
 $string[activity] = "Activity";
 $string[activityreport] = "Activity report";
+$string[addnewcourse] = "Add a new course";
 $string[address] = "Address";
 $string[admin] = "Admin";
-$string[adminpage] = "Admin page";
+$string[administration] = "Administration";
 $string[again] = "again";
 $string[alllogs] = "All logs";
 $string[allfieldsrequired] = "All fields are required";
 $string[alphanumerical] = "Can only contain alphabetical letters or numbers";
 $string[alreadyconfirmed] = "Registration has already been confirmed";
+$string[assignteachers] = "Assign teachers";
 $string[availablecourses] = "Available Courses";
 $string[category] = "Category";
 $string[changepassword] = "Change password";
@@ -31,8 +27,10 @@ $string[createaccount] = "Create my new account";
 $string[createuserandpass] = "Create a new username and password to log in with";
 $string[currentlocaltime] = "your current local time";
 $string[delete] = "Delete";
+$string[deletecourse] = "Delete a course";
 $string[editcoursesettings] = "Edit course settings";
 $string[editmyprofile] = "Edit my profile";
+$string[edituser] = "Edit user accounts";
 $string[email] = "Email address";
 $string[emailformat] = "Email format";
 $string[emailconfirm] = "Confirm your account";
@@ -68,6 +66,7 @@ $string[firstname] = "First name";
 $string[firsttime] = "Is this your first time here?";
 $string[forgotten] = "Forgotten your username or password?";
 $string[format] = "Format";
+$string[fulllistofcourses] = "Full list of courses";
 $string[fullprofile] = "Full profile";
 $string[fullname] = "Full name";
 $string[guestsno] = "No, do not allow guests in";
index b5a3ebc677bb04ad2aa42b2a9958fa5ea4ed0d72..9d4f8598dff4f5c3c309d8e76d9ceaa52532e6b8 100644 (file)
 
     add_to_log($course->id, "choice", "view all", "index?id=$course->id", "");
 
+    if ($course->category) {
+        $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
+    }
+
     print_header("$course->shortname: Choices", "$course->fullname",
-                 "<A HREF=../../course/view.php?id=$course->id>$course->shortname</A> -> Choices", "");
+                 "$navigation Choices", "");
 
 
     if (! $choices = get_all_instances_in_course("choice", $course->id, "cw.section ASC")) {
index 196b551548ce7a99265a34a8b972786aeb6ca7a1..5800e95ab72eb8df10efd281921247b2ee3aa413 100644 (file)
 
     add_to_log($course->id, "choice", "view", "view.php?id=$cm->id", "$choice->id");
 
+    if ($course->category) {
+        $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
+    }
     print_header("$course->shortname: $choice->name", "$course->fullname",
-                 "<A HREF=../../course/view.php?id=$course->id>$course->shortname</A> -> 
-                  <A HREF=index.php?id=$course->id>Choices</A> -> $choice->name", "", "", true,
+                 "$navigation <A HREF=index.php?id=$course->id>Choices</A> -> $choice->name", "", "", true,
                   update_module_icon($cm->id, $course->id));
 
     if (isteacher($course->id)) {
index 38e3b281f2660dd06b818a2f1901d16f4b19d716..f73ae0a4409cc3811ff658801e24f26d6cf8dbac 100644 (file)
@@ -11,7 +11,7 @@
     optional_variable($mode);   // If set, changes the layout of the thread
 
     if (! $discussion = get_record("forum_discussions", "id", $d)) {
-        error("Discussion ID was incorrect");
+        error("Discussion ID was incorrect or no longer exists");
     }
 
     if (! $course = get_record("course", "id", $discussion->course)) {
index 1960be4db029d3d13832f8b08307fac713b7e4af..11d0f8d485fcbaf5692b0541c652d2682134539c 100644 (file)
                         $generalforums[] = $forum;
                     }
                     break;
+                default:
+                    if (!$course->category) {
+                        $generalforums[] = $forum;
+                    }
+                    break;
             }
         }
     }
         unset($table->data);
     } 
 
-    // Add extra field for section number, at the front
-    array_unshift($table->head, "");
-    array_unshift($table->align, "CENTER");
-
-    if ($learningforums = get_all_instances_in_course("forum", $course->id)) {
-        foreach ($learningforums as $forum) {
-            $count = count_records("forum_discussions", "forum", "$forum->id");
-
-            $forum->intro = forum_shorten_post($forum->intro);
-
-            if ($can_subscribe) {
-                if (forum_is_forcesubscribed($forum->id)) {
-                    $sublink = get_string("yes");
-                } else {
-                    if (forum_is_subscribed($USER->id, $forum->id)) {
-                        $subscribed = get_string("yes");
-                        $subtitle = get_string("unsubscribe", "forum");
+    if ($course->category) {    // Only real courses have learning forums
+        // Add extra field for section number, at the front
+        array_unshift($table->head, "");
+        array_unshift($table->align, "CENTER");
+    
+        if ($learningforums = get_all_instances_in_course("forum", $course->id)) {
+            foreach ($learningforums as $forum) {
+                $count = count_records("forum_discussions", "forum", "$forum->id");
+    
+                $forum->intro = forum_shorten_post($forum->intro);
+    
+                if (!$forum->section) {     // some forums are in the "0" section
+                    $forum->section = "";
+                }
+    
+                if ($can_subscribe) {
+                    if (forum_is_forcesubscribed($forum->id)) {
+                        $sublink = get_string("yes");
                     } else {
-                        $subscribed = get_string("no");
-                        $subtitle = get_string("subscribe", "forum");
+                        if (forum_is_subscribed($USER->id, $forum->id)) {
+                            $subscribed = get_string("yes");
+                            $subtitle = get_string("unsubscribe", "forum");
+                        } else {
+                            $subscribed = get_string("no");
+                            $subtitle = get_string("subscribe", "forum");
+                        }
+                        $sublink = "<A TITLE=\"$subtitle\" HREF=\"subscribe.php?id=$forum->id\">$subscribed</A>";
                     }
-                    $sublink = "<A TITLE=\"$subtitle\" HREF=\"subscribe.php?id=$forum->id\">$subscribed</A>";
+                    $table->data[] = array ("$forum->section", "<A HREF=\"view.php?f=$forum->id\">$forum->name</A>", 
+                                            "$forum->intro", "$count", "$sublink");
+                } else {
+                    $table->data[] = array ("$forum->section", "<A HREF=\"view.php?f=$forum->id\">$forum->name</A>", 
+                                            "$forum->intro", "$count");
                 }
-                $table->data[] = array ("$forum->section", "<A HREF=\"view.php?f=$forum->id\">$forum->name</A>", 
-                                        "$forum->intro", "$count", "$sublink");
-            } else {
-                $table->data[] = array ("$forum->section", "<A HREF=\"view.php?f=$forum->id\">$forum->name</A>", 
-                                        "$forum->intro", "$count");
             }
+            print_heading(get_string("learningforums", "forum"));
+            print_table($table);
         }
-        print_heading(get_string("learningforums", "forum"));
-        print_table($table);
     }
 
     echo "<DIV ALIGN=CENTER>";
index 9fb571d4ceeafa2b42715f83695793ee3c9fe8cc..9773bebac861fee286afc8b1a5c9cebbd2137ee8 100644 (file)
@@ -12,7 +12,9 @@
         error("Course id is incorrect.");
     }
 
-    require_login($course->id);
+    if ($course->category) {
+        require_login($course->id);
+    }
 
     add_to_log($course->id, "forum", "search", "search.php?id=$course->id&search=$search", "$search"); 
 
index 1b5462ea98c00098b8a8b49e15a0cc137045db2d..2e1553e21b0d252be351287143303986db7b779a 100644 (file)
@@ -22,7 +22,7 @@
 
     } else if ($f) {
         if (! $forum = get_record("forum", "id", $f)) {
-            error("Forum ID was incorrect");
+            error("Forum ID was incorrect or no longer exists");
         }
         if (! $course = get_record("course", "id", $forum->course)) {
             error("Forum is misconfigured - don't know what course it's from");
index 41517f72ca0d2925504e4078ac87bc89d7f49d85..0004c21e80ccf362f968c90dadd87ab02a42ddf2 100644 (file)
     require_login($course->id);
     add_to_log($course->id, "journal", "view all", "index.php?id=$course->id", "");
 
-    print_header("$course->shortname: Journals", "$course->fullname",
-                 "<A HREF=../../course/view.php?id=$course->id>$course->shortname</A> -> Journals", "");
+    if ($course->category) {
+        $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
+    }
+
+    print_header("$course->shortname: Journals", "$course->fullname", "$navigation Journals", "");
 
 
     if (! $journals = get_all_instances_in_course("journal", $course->id, "cw.section ASC")) {
index 2fa243371a809897266ac727b54db7d92594be94..dfee3a28c08aeb41bfe8a6c6627adbf3dcf942d7 100644 (file)
         error("Course module is incorrect");
     }
 
+    if ($course->category) {
+        $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
+    }
     print_header("$course->shortname: $journal->name", "$course->fullname",
-                 "<A HREF=../../course/view.php?id=$course->id>$course->shortname</A> -> 
-                  <A HREF=index.php?id=$course->id>Journals</A> -> $journal->name", "", "", true,
+                 "$navigation <A HREF=index.php?id=$course->id>Journals</A> -> $journal->name", "", "", true,
                   update_module_icon($cm->id, $course->id));
 
     if (isteacher($course->id)) {
index 4232ac7e2753c18d8db0596d394e8d094c46db20..95d3323ef6e66f662c40da03b24083b7007abd47 100644 (file)
 
     add_to_log($course->id, "survey", "view all", "index.php?id=$course->id", "");
 
-    print_header("$course->shortname: Surveys", "$course->fullname",
-                 "<A HREF=../../course/view.php?id=$course->id>$course->shortname</A> -> Surveys", "");
+    if ($course->category) {
+        $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
+    }
+    print_header("$course->shortname: Surveys", "$course->fullname", "$navigation Surveys", "");
 
 
     if (! $surveys = get_all_instances_in_course("survey", $course->id, "cw.section ASC")) {
index 53a75ebf09d0f707c0f577e5cd772a4502acba99..dd8903fafe1746bade8659fb21d26f47264ba8e4 100644 (file)
     if (! $survey = get_record("survey", "id", $cm->instance)) {
         error("Survey ID was incorrect");
     }
-
+    if ($course->category) {
+        $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
+    }
     print_header("$course->shortname: $survey->name", "$course->fullname",
-                 "<A HREF=../../course/view.php?id=$course->id>$course->shortname</A> ->
-                  <A HREF=index.php?id=$course->id>Surveys</A> -> $survey->name", "", "", true,
+                 "$navigation <A HREF=index.php?id=$course->id>Surveys</A> -> $survey->name", "", "", true,
                   update_module_icon($cm->id, $course->id));
 
     if (isteacher($course->id)) {
diff --git a/pix/i/course.gif b/pix/i/course.gif
new file mode 100755 (executable)
index 0000000..c84041d
Binary files /dev/null and b/pix/i/course.gif differ