]> git.mjollnir.org Git - moodle.git/commitdiff
Use $course->hiddensections in topics and weeks
authormoodler <moodler>
Fri, 30 Apr 2004 12:17:49 +0000 (12:17 +0000)
committermoodler <moodler>
Fri, 30 Apr 2004 12:17:49 +0000 (12:17 +0000)
course/format/topics/format.php
course/format/weeks/format.php

index 7d088aa84e416930ef355ebd19c1a64850de9150..865b47c6b64670358bb2833a4bb5cfe21af69a29 100644 (file)
             }
         }
 
-        $currenttopic = ($course->marker == $section);
-
-        if (!$thissection->visible) {
-            $colorsides = "bgcolor=\"$THEME->hidden\" class=\"topicsoutlinesidehidden\"";
-            $colormain  = "bgcolor=\"$THEME->cellcontent\" class=\"topicsoutlinecontenthidden\"";
-        } else if ($currenttopic) {
-            $colorsides = "bgcolor=\"$THEME->cellheading2\" class=\"topicsoutlinesidehighlight\"";
-            $colormain  = "bgcolor=\"$THEME->cellcontent\" class=\"topicsoutlinecontenthighlight\"";
-        } else {
-            $colorsides = "bgcolor=\"$THEME->cellheading\" class=\"topicsoutlineside\"";
-            $colormain  = "bgcolor=\"$THEME->cellcontent\" class=\"topicsoutlinecontent\"";
-        }
+        $showsection = (isteacher($course->id) or $thissection->visible or !$course->hiddensections);
 
-        //If is student and the section isn't visible and hidden topics are invisible
-        if (!isteacher($course->id) and !$thissection->visible and $course->hiddentopics == 1) {
-            $showtopicheader = false; //Don't show section at all
-        } else {
-            $showtopicheader = true; //Show section (full or collapsed)
-        }
+        if ($showsection) {
+
+            $currenttopic = ($course->marker == $section);
+
+            if (!$thissection->visible) {
+                $colorsides = "bgcolor=\"$THEME->hidden\" class=\"topicsoutlinesidehidden\"";
+                $colormain  = "bgcolor=\"$THEME->cellcontent\" class=\"topicsoutlinecontenthidden\"";
+            } else if ($currenttopic) {
+                $colorsides = "bgcolor=\"$THEME->cellheading2\" class=\"topicsoutlinesidehighlight\"";
+                $colormain  = "bgcolor=\"$THEME->cellcontent\" class=\"topicsoutlinecontenthighlight\"";
+            } else {
+                $colorsides = "bgcolor=\"$THEME->cellheading\" class=\"topicsoutlineside\"";
+                $colormain  = "bgcolor=\"$THEME->cellcontent\" class=\"topicsoutlinecontent\"";
+            }
 
-        if ($showtopicheader) {
             echo "<tr>";
             echo "<td nowrap $colorsides valign=top width=20>";
             echo "<p align=center><font size=3><b>$section</b></font></p>";
index 2ddec0a01a6c322507472618ff9e9a2ab5e98d93..ca26ccf258b342014df85e652b94bfda7c80ebf4 100644 (file)
             }
         }
 
-        $currentweek = (($weekdate <= $timenow) && ($timenow < $nextweekdate));
-
-        if (!$thissection->visible) {
-            $colorsides = "bgcolor=\"$THEME->hidden\" class=\"weeklyoutlinesidehidden\"";
-            $colormain  = "bgcolor=\"$THEME->cellcontent\" class=\"weeklyoutlinecontenthidden\"";
-        } else if ($currentweek) {
-            $colorsides = "bgcolor=\"$THEME->cellheading2\" class=\"weeklyoutlinesidehighlight\"";
-            $colormain  = "bgcolor=\"$THEME->cellcontent\" class=\"weeklyoutlinecontenthighlight\"";
-        } else {
-            $colorsides = "bgcolor=\"$THEME->cellheading\" class=\"weeklyoutlineside\"";
-            $colormain  = "bgcolor=\"$THEME->cellcontent\" class=\"weeklyoutlinecontent\"";
-        }
-
-        echo "<tr>";
-        echo "<td nowrap $colorsides valign=top width=20>";
-        echo "<p align=center><font size=3><b>$section</b></font></p>";
-        echo "</td>";
-
-        echo "<td valign=top $colormain width=\"100%\">";
-
-        if (!isteacher($course->id) and !$thissection->visible) {   // Hidden for students
-            echo "<p class=\"weeklydatetext\">$weekday - $endweekday ";
-            echo "(".get_string("notavailable").")";
-            echo "</p>";
-            echo "</td>";
+        $showsection = (isteacher($course->id) or $thissection->visible or !$course->hiddensections);
 
-        } else {
-
-            echo "<p class=\"weeklydatetext\">$weekday - $endweekday</p>";
-
-            echo format_text($thissection->summary, FORMAT_HTML);
-
-            if (isediting($course->id)) {
-                echo " <a title=\"$streditsummary\" href=\"editsection.php?id=$thissection->id\">".
-                     "<img src=\"$CFG->pixpath/t/edit.gif\" height=11 width=11 border=0></a><br />";
-            }
+        if ($showsection) {
 
-            echo '<br clear="all">';
+            $currentweek = (($weekdate <= $timenow) && ($timenow < $nextweekdate));
 
-            print_section($course, $thissection, $mods, $modnamesused);
-
-            if (isediting($course->id)) {
-                echo "<div align=right>";
-                popup_form("$CFG->wwwroot/course/mod.php?id=$course->id&amp;section=$section&add=",
-                            $modnames, "section$section", "", "$stradd...");
-                echo "</div>";
+            if (!$thissection->visible) {
+                $colorsides = "bgcolor=\"$THEME->hidden\" class=\"weeklyoutlinesidehidden\"";
+                $colormain  = "bgcolor=\"$THEME->cellcontent\" class=\"weeklyoutlinecontenthidden\"";
+            } else if ($currentweek) {
+                $colorsides = "bgcolor=\"$THEME->cellheading2\" class=\"weeklyoutlinesidehighlight\"";
+                $colormain  = "bgcolor=\"$THEME->cellcontent\" class=\"weeklyoutlinecontenthighlight\"";
+            } else {
+                $colorsides = "bgcolor=\"$THEME->cellheading\" class=\"weeklyoutlineside\"";
+                $colormain  = "bgcolor=\"$THEME->cellcontent\" class=\"weeklyoutlinecontent\"";
             }
 
+            echo "<tr>";
+            echo "<td nowrap $colorsides valign=top width=20>";
+            echo "<p align=center><font size=3><b>$section</b></font></p>";
             echo "</td>";
-        }
-        echo "<td nowrap $colorsides valign=top align=center width=10>";
-        echo "<font size=1>";
-
-        if ($displaysection == $section) {
-            echo "<a href=\"view.php?id=$course->id&week=all\" title=\"$strshowallweeks\">".
-                 "<img src=\"$CFG->pixpath/i/all.gif\" height=25 width=16 border=0></a><br />";
-        } else {
-            $strshowonlyweek = get_string("showonlyweek", "", $section);
-            echo "<a href=\"view.php?id=$course->id&week=$section\" title=\"$strshowonlyweek\">".
-                 "<img src=\"$CFG->pixpath/i/one.gif\" height=16 width=16 border=0></a><br />";
-        }
-
-        if (isediting($course->id)) {
-            if ($thissection->visible) {        // Show the hide/show eye
-                echo "<a href=\"view.php?id=$course->id&hide=$section\" title=\"$strweekhide\">".
-                     "<img src=\"$CFG->pixpath/i/hide.gif\" vspace=3 height=16 width=16 border=0></a><br />";
+    
+            echo "<td valign=top $colormain width=\"100%\">";
+    
+            if (!isteacher($course->id) and !$thissection->visible) {   // Hidden for students
+                echo "<p class=\"weeklydatetext\">$weekday - $endweekday ";
+                echo "(".get_string("notavailable").")";
+                echo "</p>";
+                echo "</td>";
+    
             } else {
-                echo "<a href=\"view.php?id=$course->id&show=$section\" title=\"$strweekshow\">".
-                     "<img src=\"$CFG->pixpath/i/show.gif\" vspace=3 height=16 width=16 border=0></a><br />";
+    
+                echo "<p class=\"weeklydatetext\">$weekday - $endweekday</p>";
+    
+                echo format_text($thissection->summary, FORMAT_HTML);
+    
+                if (isediting($course->id)) {
+                    echo " <a title=\"$streditsummary\" href=\"editsection.php?id=$thissection->id\">".
+                         "<img src=\"$CFG->pixpath/t/edit.gif\" height=11 width=11 border=0></a><br />";
+                }
+    
+                echo '<br clear="all">';
+    
+                print_section($course, $thissection, $mods, $modnamesused);
+    
+                if (isediting($course->id)) {
+                    echo "<div align=right>";
+                    popup_form("$CFG->wwwroot/course/mod.php?id=$course->id&amp;section=$section&add=",
+                                $modnames, "section$section", "", "$stradd...");
+                    echo "</div>";
+                }
+    
+                echo "</td>";
             }
+            echo "<td nowrap $colorsides valign=top align=center width=10>";
+            echo "<font size=1>";
 
-            if ($section > 1) {                       // Add a arrow to move section up
-                echo "<a href=\"view.php?id=$course->id&section=$section&move=-1\" title=\"$strmoveup\">".
-                     "<img src=\"$CFG->pixpath/t/up.gif\" vspace=3 height=11 width=11 border=0></a><br />";
+            if ($displaysection == $section) {
+                echo "<a href=\"view.php?id=$course->id&week=all\" title=\"$strshowallweeks\">".
+                     "<img src=\"$CFG->pixpath/i/all.gif\" height=25 width=16 border=0></a><br />";
+            } else {
+                $strshowonlyweek = get_string("showonlyweek", "", $section);
+                echo "<a href=\"view.php?id=$course->id&week=$section\" title=\"$strshowonlyweek\">".
+                     "<img src=\"$CFG->pixpath/i/one.gif\" height=16 width=16 border=0></a><br />";
             }
-
-            if ($section < $course->numsections) {    // Add a arrow to move section down
-                echo "<a href=\"view.php?id=$course->id&section=$section&move=1\" title=\"$strmovedown\">".
-                     "<img src=\"$CFG->pixpath/t/down.gif\" vspace=3 height=11 width=11 border=0></a><br />";
+    
+            if (isediting($course->id)) {
+                if ($thissection->visible) {        // Show the hide/show eye
+                    echo "<a href=\"view.php?id=$course->id&hide=$section\" title=\"$strweekhide\">".
+                         "<img src=\"$CFG->pixpath/i/hide.gif\" vspace=3 height=16 width=16 border=0></a><br />";
+                } else {
+                    echo "<a href=\"view.php?id=$course->id&show=$section\" title=\"$strweekshow\">".
+                         "<img src=\"$CFG->pixpath/i/show.gif\" vspace=3 height=16 width=16 border=0></a><br />";
+                }
+    
+                if ($section > 1) {                       // Add a arrow to move section up
+                    echo "<a href=\"view.php?id=$course->id&section=$section&move=-1\" title=\"$strmoveup\">".
+                         "<img src=\"$CFG->pixpath/t/up.gif\" vspace=3 height=11 width=11 border=0></a><br />";
+                }
+    
+                if ($section < $course->numsections) {    // Add a arrow to move section down
+                    echo "<a href=\"view.php?id=$course->id&section=$section&move=1\" title=\"$strmovedown\">".
+                         "<img src=\"$CFG->pixpath/t/down.gif\" vspace=3 height=11 width=11 border=0></a><br />";
+                }
+    
             }
-
+    
+            echo "</td>";
+            echo "</tr>";
+            echo "<tr><td colspan=3><img src=\"../pix/spacer.gif\" width=1 height=1></td></tr>";
         }
 
-        echo "</td>";
-        echo "</tr>";
-        echo "<tr><td colspan=3><img src=\"../pix/spacer.gif\" width=1 height=1></td></tr>";
-
         $section++;
         $weekdate = $nextweekdate;
     }