From 5d0d373733a42d1b5b25716c8d11087debd62942 Mon Sep 17 00:00:00 2001 From: sam marshall Date: Wed, 23 May 2012 13:46:51 +0100 Subject: [PATCH] MDL-33212 Course page: Eye icon should override other conditions --- course/lib.php | 2 +- lib/conditionlib.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/course/lib.php b/course/lib.php index 8e073737607..cdc74a1e29e 100644 --- a/course/lib.php +++ b/course/lib.php @@ -1728,7 +1728,7 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false, // see the activity itself, or for staff) if (!$mod->uservisible) { echo '
'.$mod->availableinfo.'
'; - } else if ($canviewhidden && !empty($CFG->enableavailability)) { + } else if ($canviewhidden && !empty($CFG->enableavailability) && $mod->visible) { $ci = new condition_info($mod); $fullinfo = $ci->get_full_information(); if($fullinfo) { diff --git a/lib/conditionlib.php b/lib/conditionlib.php index 9bcd4bbe5d2..5e2207f186c 100644 --- a/lib/conditionlib.php +++ b/lib/conditionlib.php @@ -846,6 +846,16 @@ abstract class condition_info_base { } } + // If the item is marked as 'not visible' then we don't change the available + // flag (visible/available are treated distinctly), but we remove any + // availability info. If the item is hidden with the eye icon, it doesn't + // make sense to show 'Available from ' or similar, because even + // when that date arrives it will still not be available unless somebody + // toggles the eye icon. + if (!$this->item->visible) { + $information = ''; + } + $information = trim($information); return $available; } -- 2.43.0