Fixes to course display, tidy up of some code (could do with more)
authormoodler <moodler>
Thu, 7 Nov 2002 09:30:41 +0000 (09:30 +0000)
committermoodler <moodler>
Thu, 7 Nov 2002 09:30:41 +0000 (09:30 +0000)
and mainly - addition of section 0 display.

course/social.php
course/topics.php
course/weeks.php

index 19f7299..334083e 100644 (file)
       if ($USER->description) {
           $moddata[]= $editmyprofile;
       } else {
-          $moddata[]= $editmyprofile.$blinker;
+          $moddata[]= $editmyprofile." <BLINK>*</BLINK>";
       }
       $modicon[]="<IMG SRC=\"../user/user.gif\" HEIGHT=16 WIDTH=16 ALT=\"\">";
       print_side_block("", $moddata, "", $modicon);
 
       
 
-      // Then, print all the available resources (Section 0)
+/// Then, print all the available resources (Section 0)
       print_simple_box(get_string("resources"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
-      print_section($site->id, $sections[0], $mods, $modnamesused, true);
+      print_section($course->id, $sections[0], $mods, $modnamesused, true);
 
-      if (isediting($site->id)) {
+      if (isediting($course->id)) {
           echo "<DIV ALIGN=right>";
           popup_form("$CFG->wwwroot/course/mod.php?id=$course->id&section=0&add=",
                       $modnames, "section0", "", get_string("add")."...", "mods", get_string("activities"));
           echo "</DIV>";
       }      
 
-      // Print all the recent activity
+
+/// Print all the recent activity
       print_simple_box(get_string("recentactivity"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
       echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
       print_recent_activity($course);
       echo "</TD></TR></TABLE>";
       echo "<BR>";
 
-      // Print a form to search forums
+
+/// Print a form to search forums
       print_simple_box(get_string("search","forum"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
       echo "<DIV ALIGN=CENTER>";
       forum_print_search_form($course);
index bfb9164..1436533 100644 (file)
         }
     }
 
-
-    // Layout the whole page as three big columns.
-    echo "<TABLE BORDER=0 CELLPADDING=3 CELLSPACING=0 WIDTH=100%>";
-    echo "<TR VALIGN=top><TD VALIGN=top WIDTH=180>";
-    
-    // Layout the left column
+    if ($course->newsitems) {
+        $news = forum_get_course_forum($course->id, "news");
+    }
 
 
-    // Links to people
+/// Layout the whole page as three big columns.
+    echo "<TABLE BORDER=0 CELLPADDING=3 CELLSPACING=0 WIDTH=100%>";
 
-    $blinker = " <BLINK>*</BLINK>";
+/// The left column ...
 
+    echo "<TR VALIGN=top><TD VALIGN=top WIDTH=180>";
+    
+/// Links to people
     print_simple_box(get_string("people"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
     $moddata[]="<A TITLE=\"".get_string("listofallpeople")."\" HREF=\"../user/index.php?id=$course->id\">".get_string("participants")."</A>";
     $modicon[]="<IMG SRC=\"../user/users.gif\" HEIGHT=16 WIDTH=16 ALT=\"\">";
     if ($USER->description) {
         $moddata[]= $editmyprofile;
     } else {
-        $moddata[]= $editmyprofile.$blinker;
+        $moddata[]= $editmyprofile." <BLINK>*</BLINK>";
     }
     $modicon[]="<IMG SRC=\"../user/user.gif\" HEIGHT=16 WIDTH=16 ALT=\"\">";
     print_side_block("", $moddata, "", $modicon);
 
 
-    // Then all the links to module types
-
+/// Links to all activity modules by type
     $moddata = array();
     $modicon = array();
     if ($modnamesused) {
     print_simple_box(get_string("activities"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
     print_side_block("", $moddata, "", $modicon);
 
-    // Print a form to search forums
+/// Print a form to search forums
     print_simple_box(get_string("search","forum"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
     echo "<DIV ALIGN=CENTER>";
     forum_print_search_form($course);
     echo "</DIV>";
 
-    // Admin links and controls
+/// Admin links and controls
     if (isteacher($course->id)) {
         print_course_admin_links($course);
     }
 
-    // Start main column
+/// Start main column
     echo "</TD><TD WIDTH=\"*\">";
 
     print_simple_box(get_string("topicoutline"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
     
-    // Everything below uses "section" terminology - each "section" is a topic.
-
-    // Now all the sectionly modules
-    $timenow = time();
-    $section = 1;
-
     $streditsummary = get_string("editsummary");
     $stradd         = get_string("add");
 
+
     echo "<TABLE BORDER=0 CELLPADDING=8 CELLSPACING=0 WIDTH=100%>";
+
+/// Print Section 0 
+
+    $topic = 0;
+    $thistopic = $sections[$topic];
+
+    if ($thistopic->summary or $thistopic->sequence or isediting($course->id)) {
+        echo "<TR>";
+        echo "<TD NOWRAP BGCOLOR=\"$THEME->cellheading\" VALIGN=top WIDTH=20>&nbsp;</TD>";
+        echo "<TD VALIGN=top BGCOLOR=\"$THEME->cellcontent\" WIDTH=\"100%\">";
+    
+        if (isediting($course->id)) {
+            $thistopic->summary .= "&nbsp;<A TITLE=\"$streditsummary\" ".
+                                     "HREF=\"editsection.php?id=$thistopic->id\"><IMG SRC=\"../pix/t/edit.gif\" ".
+                                     "BORDER=0 ALT=\"$streditsummary\"></A></P>";
+        }
+    
+        echo text_to_html($thistopic->summary);
+    
+        print_section($course->id, $thistopic, $mods, $modnamesused);
+    
+        if (isediting($course->id)) {
+            echo "<DIV ALIGN=right>";
+            popup_form("$CFG->wwwroot/course/mod.php?id=$course->id&section=$topic&add=", 
+                        $modnames, "section$topic", "", "$stradd...", "mods", get_string("activities"));
+            echo "</DIV>";
+        }
+    
+        echo "</TD>";
+        echo "<TD NOWRAP BGCOLOR=\"$THEME->cellheading\" VALIGN=top ALIGN=CENTER WIDTH=10>&nbsp;";
+        echo "</TD>";
+        echo "</TR>";
+        echo "<TR><TD COLSPAN=3><IMG SRC=\"../pix/spacer.gif\" WIDTH=1 HEIGHT=1></TD></TR>";
+    }
+
+
+/// Now all the normal modules by topic
+/// Everything below uses "section" terminology - each "section" is a topic.
+
+    $timenow = time();
+    $section = 1;
+
     while ($section <= $course->numsections) {
 
         if (isset($USER->topic)) {         // Just display a single topic
 
     echo "</TD><TD WIDTH=210>";
 
-    // Print all the news items.
+/// Print all the news items.
 
-    if ($course->newsitems) {
-        if ($news = forum_get_course_forum($course->id, "news")) {
-            print_simple_box(get_string("latestnews"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
-            print_simple_box_start("CENTER", "100%", "#FFFFFF", 3, 0);
-            echo "<FONT SIZE=1>";
-            forum_print_latest_discussions($news->id, $course->newsitems, "minimal", "DESC", false);
-            echo "</FONT>";
-            print_simple_box_end();
-        }
+    if ($news) {
+        print_simple_box(get_string("latestnews"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
+        print_simple_box_start("CENTER", "100%", "#FFFFFF", 3, 0);
+        echo "<FONT SIZE=1>";
+        forum_print_latest_discussions($news->id, $course->newsitems, "minimal", "DESC", false);
+        echo "</FONT>";
+        print_simple_box_end();
         echo "<BR>";
     }
     
index 2e263b6..1db585b 100644 (file)
         save_session("USER");
     }
 
+    if ($course->newsitems) {
+        $news = forum_get_course_forum($course->id, "news");
+    }
+
 
-    // Layout the whole page as three big columns.
+/// Layout the whole page as three big columns.
     echo "<TABLE BORDER=0 CELLPADDING=3 CELLSPACING=0 WIDTH=100%>";
-    echo "<TR VALIGN=top><TD VALIGN=top WIDTH=180>";
-    
-    // Layout the left column
 
+/// The left column ...
 
-    // Links to people
+    echo "<TR VALIGN=top><TD VALIGN=top WIDTH=180>";
 
+/// Links to people
     print_simple_box(get_string("people"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
     $moddata[]="<A TITLE=\"".get_string("listofallpeople")."\" HREF=\"../user/index.php?id=$course->id\">".get_string("participants")."</A>";
     $modicon[]="<IMG SRC=\"../user/users.gif\" HEIGHT=16 WIDTH=16 ALT=\"\">";
     if ($USER->description) {
         $moddata[]= $editmyprofile;
     } else {
-        $moddata[]= $editmyprofile.$blinker;
+        $moddata[]= $editmyprofile." <BLINK>*</BLINK>";
     }
     $modicon[]="<IMG SRC=\"../user/user.gif\" HEIGHT=16 WIDTH=16 ALT=\"\">";
     print_side_block("", $moddata, "", $modicon);
 
 
-    // Then all the links to module types
-
+/// Then all the links to activities by type
     $moddata = array();
     $modicon = array();
     if ($modnamesused) {
     print_simple_box(get_string("activities"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
     print_side_block("", $moddata, "", $modicon);
 
-    // Print a form to search forums
+/// Print a form to search forums
     print_simple_box(get_string("search","forum"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
     echo "<DIV ALIGN=CENTER>";
     forum_print_search_form($course);
     echo "</DIV>";
+    
 
-    // Admin links and controls
+/// Admin links and controls
     if (isteacher($course->id)) {
         print_course_admin_links($course);
     }
 
-    // Start main column
+
+/// Start main column
     echo "</TD><TD WIDTH=\"*\">";
 
     print_simple_box(get_string("weeklyoutline"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
     
-    // Now all the weekly modules
+    $streditsummary = get_string("editsummary");
+    $stradd         = get_string("add");
+
+    echo "<TABLE BORDER=0 CELLPADDING=8 CELLSPACING=0 WIDTH=100%>";
+
+
+/// Print Week 0 with general activities
+
+    $week = 0;
+    $thisweek = $sections[$week];
+
+    if ($thisweek->summary or $thisweek->sequence or isediting($course->id)) {
+        echo "<TR>";
+        echo "<TD NOWRAP BGCOLOR=\"$THEME->cellheading\" VALIGN=top WIDTH=20>&nbsp;</TD>";
+        echo "<TD VALIGN=top BGCOLOR=\"$THEME->cellcontent\" WIDTH=\"100%\">";
+
+        if (isediting($course->id)) {
+            $thisweek->summary .= "&nbsp;<A TITLE=\"$streditsummary\" ".
+                                  "HREF=\"editsection.php?id=$thisweek->id\"><IMG SRC=\"../pix/t/edit.gif\" ".
+                                  "BORDER=0 ALT=\"$streditsummary\"></A></P>";
+        }
+    
+        echo text_to_html($thisweek->summary);
+    
+        print_section($course->id, $thisweek, $mods, $modnamesused);
+
+        if (isediting($course->id)) {
+            echo "<DIV ALIGN=right>";
+            popup_form("$CFG->wwwroot/course/mod.php?id=$course->id&section=$week&add=", 
+                        $modnames, "section$week", "", "$stradd...", "mods", get_string("activities"));
+            echo "</DIV>";
+        }
+
+        echo "</TD>";
+        echo "<TD NOWRAP BGCOLOR=\"$THEME->cellheading\" VALIGN=top ALIGN=CENTER WIDTH=10>";
+        echo "</TD>";
+        echo "</TR>";
+        echo "<TR><TD COLSPAN=3><IMG SRC=\"../pix/spacer.gif\" WIDTH=1 HEIGHT=1></TD></TR>";
+    }
+
+
+/// Now all the weekly sections
     $timenow = time();
     $weekdate = $course->startdate;    // this should be 0:00 Monday of that week
     $week = 1;
     $weekofseconds = 604800;
     $course->enddate = $course->startdate + ($weekofseconds * $course->numsections);
 
-    $streditsummary = get_string("editsummary");
-    $stradd         = get_string("add");
-
-    echo "<TABLE BORDER=0 CELLPADDING=8 CELLSPACING=0 WIDTH=100%>";
     while ($weekdate < $course->enddate) {
 
         $nextweekdate = $weekdate + ($weekofseconds);
 
     // Print all the news items.
 
-    if ($course->newsitems) {
-        if ($news = forum_get_course_forum($course->id, "news")) {
-            print_simple_box(get_string("latestnews"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
-            print_simple_box_start("CENTER", "100%", "#FFFFFF", 3, 0);
-            echo "<FONT SIZE=1>";
-            forum_print_latest_discussions($news->id, $course->newsitems, "minimal", "DESC", false);
-            echo "</FONT>";
-            print_simple_box_end();
-        }
+    if ($news) {
+        print_simple_box(get_string("latestnews"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
+        print_simple_box_start("CENTER", "100%", "#FFFFFF", 3, 0);
+        echo "<FONT SIZE=1>";
+        forum_print_latest_discussions($news->id, $course->newsitems, "minimal", "DESC", false);
+        echo "</FONT>";
+        print_simple_box_end();
         echo "<BR>";
     }