Permalink
Browse files

MDL-36736 course: Availability information should not be visible for …

…hidden modules

If user is viewing hidden module, availability information should only be visible to
user when editing and module is visible. If editing and module is hidden, then hide
availablilty information as it's invalid.
When user is not editing and activity is hidden then don't add availability information.
  • Loading branch information...
1 parent caeb7f9 commit c874cee03a88e35ed8e0f418b51fb32c27841f43 Rajesh Taneja committed with danpoltawski Nov 21, 2012
Showing with 14 additions and 11 deletions.
  1. +14 −11 course/lib.php
View
@@ -1694,17 +1694,20 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
if (!$mod->uservisible) {
echo '<div class="availabilityinfo">'.$mod->availableinfo.'</div>';
} else if ($canviewhidden && !empty($CFG->enableavailability)) {
- $visibilityclass = '';
- if (!$mod->visible) {
- $visibilityclass = 'hide';
- }
- $ci = new condition_info($mod);
- $fullinfo = $ci->get_full_information();
- if($fullinfo) {
- echo '<div class="availabilityinfo '.$visibilityclass.'">'.get_string($mod->showavailability
- ? 'userrestriction_visible'
- : 'userrestriction_hidden','condition',
- $fullinfo).'</div>';
+ // Don't add availability information if user is not editing and activity is hidden.
+ if ($mod->visible || $PAGE->user_is_editing()) {
+ $hidinfoclass = '';
+ if (!$mod->visible) {
+ $hidinfoclass = 'hide';
+ }
+ $ci = new condition_info($mod);
+ $fullinfo = $ci->get_full_information();
+ if($fullinfo) {
+ echo '<div class="availabilityinfo '.$hidinfoclass.'">'.get_string($mod->showavailability
+ ? 'userrestriction_visible'
+ : 'userrestriction_hidden','condition',
+ $fullinfo).'</div>';
+ }
}
}

0 comments on commit c874cee

Please sign in to comment.