Now, in topics format, every course can decide about how to
authorstronk7 <stronk7>
Tue, 27 Apr 2004 16:36:01 +0000 (16:36 +0000)
committerstronk7 <stronk7>
Tue, 27 Apr 2004 16:36:01 +0000 (16:36 +0000)
display hidden topics (collapsed or invisible)
Now it can be set in every course and it's applicable in topics format

course/edit.html
course/format/topics/format.php

index b795910beb3b789528b182e907f9027bb9eafb6c..aedce100b8743a0a60c0998feca0c19c37a5ebab 100644 (file)
     helpbutton("courseavailability", get_string("availability")); ?>
     </td>
 </tr>
+<tr valign=top>
+    <td align="right"><P><?php  print_string("hiddentopics") ?>:</td>
+    <td><?php
+    unset($choices);
+    $choices["0"] = get_string("hiddentopicscollapsed");
+    $choices["1"] = get_string("hiddentopicsinvisible");
+    choose_from_menu ($choices, "hiddentopics", $form->hiddentopics, "");
+    helpbutton("coursehiddentopics", get_string("hiddentopics")); ?>
+    </td>
+</tr>
 <tr valign=top>
     <td align="right"><P><?php  print_string("enrolmentkey") ?>:</td>
     <td><input type="text" name="password" size=25 value="<?php  p($form->password) ?>">
index 12b303f77cc6f2a0551b410f11305458c78b9b53..7d088aa84e416930ef355ebd19c1a64850de9150 100644 (file)
             $colormain  = "bgcolor=\"$THEME->cellcontent\" class=\"topicsoutlinecontent\"";
         }
 
-        echo "<tr>";
-        echo "<td nowrap $colorsides valign=top width=20>";
-        echo "<p align=center><font size=3><b>$section</b></font></p>";
-        echo "</td>";
-
-        if (!isteacher($course->id) and !$thissection->visible) {   // Hidden for students
-            echo "<td valign=top align=center $colormain width=\"100%\">";
-            echo get_string("notavailable");
-            echo "</td>";
-
+        //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 {
-            echo "<td valign=top $colormain width=\"100%\">";
+            $showtopicheader = true; //Show section (full or collapsed)
+        }
 
-            echo format_text($thissection->summary, FORMAT_HTML);
+        if ($showtopicheader) {
+            echo "<tr>";
+            echo "<td nowrap $colorsides valign=top width=20>";
+            echo "<p align=center><font size=3><b>$section</b></font></p>";
+            echo "</td>";
 
-            if (isediting($course->id)) {
-                echo " <a title=\"$streditsummary\" href=editsection.php?id=$thissection->id>".
-                     "<img src=\"$CFG->pixpath/t/edit.gif\" border=0 height=11 width=11></a><br />";
-            }
+            if (!isteacher($course->id) and !$thissection->visible) {   // Hidden for students
+                echo "<td valign=top align=center $colormain width=\"100%\">";
+                echo get_string("notavailable");
+                echo "</td>";
+            } else {
+                echo "<td valign=top $colormain width=\"100%\">";
 
-            echo '<br clear="all">';
+                echo format_text($thissection->summary, FORMAT_HTML);
 
-            print_section($course, $thissection, $mods, $modnamesused);
+                if (isediting($course->id)) {
+                    echo " <a title=\"$streditsummary\" href=editsection.php?id=$thissection->id>".
+                         "<img src=\"$CFG->pixpath/t/edit.gif\" border=0 height=11 width=11></a><br />";
+                }
 
-            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 '<br clear="all">';
 
-            echo "</td>";
-        }
-        echo "<td nowrap $colorsides valign=top align=center width=10>";
-        echo "<font size=1>";
+                print_section($course, $thissection, $mods, $modnamesused);
 
-        if ($displaysection == $section) {      // Show the zoom boxes
-            echo "<a href=\"view.php?id=$course->id&topic=all\" title=\"$strshowalltopics\">".
-                 "<img src=\"$CFG->pixpath/i/all.gif\" height=25 width=16 border=0></a><br />";
-        } else {
-            $strshowonlytopic = get_string("showonlytopic", "", $section);
-            echo "<a href=\"view.php?id=$course->id&topic=$section\" title=\"$strshowonlytopic\">".
-                 "<img src=\"$CFG->pixpath/i/one.gif\" height=16 width=16 border=0></a><br />";
-        }
+                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 (isediting($course->id)) {
-            if ($course->marker == $section) {  // Show the "light globe" on/off
-                echo "<a href=\"view.php?id=$course->id&marker=0\" title=\"$strmarkedthistopic\">".
-                     "<img src=\"$CFG->pixpath/i/marked.gif\" vspace=3 height=16 width=16 border=0></a><br />";
-            } else {
-                echo "<a href=\"view.php?id=$course->id&marker=$section\" title=\"$strmarkthistopic\">".
-                     "<img src=\"$CFG->pixpath/i/marker.gif\" vspace=3 height=16 width=16 border=0></a><br />";
+                echo "</td>";
             }
+            echo "<td nowrap $colorsides valign=top align=center width=10>";
+            echo "<font size=1>";
 
-            if ($thissection->visible) {        // Show the hide/show eye
-                echo "<a href=\"view.php?id=$course->id&hide=$section\" title=\"$strtopichide\">".
-                     "<img src=\"$CFG->pixpath/i/hide.gif\" vspace=3 height=16 width=16 border=0></a><br />";
+            if ($displaysection == $section) {      // Show the zoom boxes
+                echo "<a href=\"view.php?id=$course->id&topic=all\" title=\"$strshowalltopics\">".
+                     "<img src=\"$CFG->pixpath/i/all.gif\" height=25 width=16 border=0></a><br />";
             } else {
-                echo "<a href=\"view.php?id=$course->id&show=$section\" title=\"$strtopicshow\">".
-                     "<img src=\"$CFG->pixpath/i/show.gif\" vspace=3 height=16 width=16 border=0></a><br />";
+                $strshowonlytopic = get_string("showonlytopic", "", $section);
+                echo "<a href=\"view.php?id=$course->id&topic=$section\" title=\"$strshowonlytopic\">".
+                     "<img src=\"$CFG->pixpath/i/one.gif\" 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 (isediting($course->id)) {
+                if ($course->marker == $section) {  // Show the "light globe" on/off
+                    echo "<a href=\"view.php?id=$course->id&marker=0\" title=\"$strmarkedthistopic\">".
+                         "<img src=\"$CFG->pixpath/i/marked.gif\" vspace=3 height=16 width=16 border=0></a><br />";
+                } else {
+                    echo "<a href=\"view.php?id=$course->id&marker=$section\" title=\"$strmarkthistopic\">".
+                         "<img src=\"$CFG->pixpath/i/marker.gif\" vspace=3 height=16 width=16 border=0></a><br />";
+                }
+
+                if ($thissection->visible) {        // Show the hide/show eye
+                    echo "<a href=\"view.php?id=$course->id&hide=$section\" title=\"$strtopichide\">".
+                         "<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=\"$strtopicshow\">".
+                         "<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 />";
+                }
 
-            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++;
     }
     echo "</table>";