Skip to content

Commit

Permalink
MDL-33212 Course page: Eye icon should override other conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
sammarshallou committed May 23, 2012
1 parent 5a5cdaf commit 5d0d373
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion course/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
10 changes: 10 additions & 0 deletions lib/conditionlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 5d0d373

Please sign in to comment.