Permalink
Browse files

MDL-33212 Course page: Eye icon should override other conditions

  • Loading branch information...
1 parent 5a5cdaf commit 5d0d373733a42d1b5b25716c8d11087debd62942 @sammarshallou sammarshallou committed May 23, 2012
Showing with 11 additions and 1 deletion.
  1. +1 −1 course/lib.php
  2. +10 −0 lib/conditionlib.php
View
@@ -1728,7 +1728,7 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
// see the activity itself, or for staff)
if (!$mod->uservisible) {
echo '<div class="availabilityinfo">'.$mod->availableinfo.'</div>';
- } 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) {
View
@@ -846,6 +846,16 @@ public function is_available(&$information, $grabthelot=false, $userid=0, $modin
}
}
+ // 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 <date>' 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;
}

0 comments on commit 5d0d373

Please sign in to comment.