From: moodler Date: Fri, 30 Apr 2004 12:17:49 +0000 (+0000) Subject: Use $course->hiddensections in topics and weeks X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=db7da819d59cfe038c9b55825a1243852711ad0d;p=moodle.git Use $course->hiddensections in topics and weeks --- diff --git a/course/format/topics/format.php b/course/format/topics/format.php index 7d088aa84e..865b47c6b6 100644 --- a/course/format/topics/format.php +++ b/course/format/topics/format.php @@ -167,27 +167,23 @@ } } - $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 ""; echo ""; echo "

$section

"; diff --git a/course/format/weeks/format.php b/course/format/weeks/format.php index 2ddec0a01a..ca26ccf258 100644 --- a/course/format/weeks/format.php +++ b/course/format/weeks/format.php @@ -155,93 +155,98 @@ } } - $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 ""; - echo ""; - echo "

$section

"; - echo ""; - - echo ""; - - if (!isteacher($course->id) and !$thissection->visible) { // Hidden for students - echo "

$weekday - $endweekday "; - echo "(".get_string("notavailable").")"; - echo "

"; - echo ""; + $showsection = (isteacher($course->id) or $thissection->visible or !$course->hiddensections); - } else { - - echo "

$weekday - $endweekday

"; - - echo format_text($thissection->summary, FORMAT_HTML); - - if (isediting($course->id)) { - echo " id\">". - "pixpath/t/edit.gif\" height=11 width=11 border=0>
"; - } + if ($showsection) { - echo '
'; + $currentweek = (($weekdate <= $timenow) && ($timenow < $nextweekdate)); - print_section($course, $thissection, $mods, $modnamesused); - - if (isediting($course->id)) { - echo "
"; - popup_form("$CFG->wwwroot/course/mod.php?id=$course->id&section=$section&add=", - $modnames, "section$section", "", "$stradd..."); - echo "
"; + 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 ""; + echo ""; + echo "

$section

"; echo ""; - } - echo ""; - echo ""; - - if ($displaysection == $section) { - echo "id&week=all\" title=\"$strshowallweeks\">". - "pixpath/i/all.gif\" height=25 width=16 border=0>
"; - } else { - $strshowonlyweek = get_string("showonlyweek", "", $section); - echo "id&week=$section\" title=\"$strshowonlyweek\">". - "pixpath/i/one.gif\" height=16 width=16 border=0>
"; - } - - if (isediting($course->id)) { - if ($thissection->visible) { // Show the hide/show eye - echo "id&hide=$section\" title=\"$strweekhide\">". - "pixpath/i/hide.gif\" vspace=3 height=16 width=16 border=0>
"; + + echo ""; + + if (!isteacher($course->id) and !$thissection->visible) { // Hidden for students + echo "

$weekday - $endweekday "; + echo "(".get_string("notavailable").")"; + echo "

"; + echo ""; + } else { - echo "id&show=$section\" title=\"$strweekshow\">". - "pixpath/i/show.gif\" vspace=3 height=16 width=16 border=0>
"; + + echo "

$weekday - $endweekday

"; + + echo format_text($thissection->summary, FORMAT_HTML); + + if (isediting($course->id)) { + echo " id\">". + "pixpath/t/edit.gif\" height=11 width=11 border=0>
"; + } + + echo '
'; + + print_section($course, $thissection, $mods, $modnamesused); + + if (isediting($course->id)) { + echo "
"; + popup_form("$CFG->wwwroot/course/mod.php?id=$course->id&section=$section&add=", + $modnames, "section$section", "", "$stradd..."); + echo "
"; + } + + echo ""; } + echo ""; + echo ""; - if ($section > 1) { // Add a arrow to move section up - echo "id§ion=$section&move=-1\" title=\"$strmoveup\">". - "pixpath/t/up.gif\" vspace=3 height=11 width=11 border=0>
"; + if ($displaysection == $section) { + echo "id&week=all\" title=\"$strshowallweeks\">". + "pixpath/i/all.gif\" height=25 width=16 border=0>
"; + } else { + $strshowonlyweek = get_string("showonlyweek", "", $section); + echo "id&week=$section\" title=\"$strshowonlyweek\">". + "pixpath/i/one.gif\" height=16 width=16 border=0>
"; } - - if ($section < $course->numsections) { // Add a arrow to move section down - echo "id§ion=$section&move=1\" title=\"$strmovedown\">". - "pixpath/t/down.gif\" vspace=3 height=11 width=11 border=0>
"; + + if (isediting($course->id)) { + if ($thissection->visible) { // Show the hide/show eye + echo "id&hide=$section\" title=\"$strweekhide\">". + "pixpath/i/hide.gif\" vspace=3 height=16 width=16 border=0>
"; + } else { + echo "id&show=$section\" title=\"$strweekshow\">". + "pixpath/i/show.gif\" vspace=3 height=16 width=16 border=0>
"; + } + + if ($section > 1) { // Add a arrow to move section up + echo "id§ion=$section&move=-1\" title=\"$strmoveup\">". + "pixpath/t/up.gif\" vspace=3 height=11 width=11 border=0>
"; + } + + if ($section < $course->numsections) { // Add a arrow to move section down + echo "id§ion=$section&move=1\" title=\"$strmovedown\">". + "pixpath/t/down.gif\" vspace=3 height=11 width=11 border=0>
"; + } + } - + + echo ""; + echo ""; + echo ""; } - echo ""; - echo ""; - echo ""; - $section++; $weekdate = $nextweekdate; }