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

This commit is contained in:
sam marshall
2012-05-28 16:27:37 +01:00
parent 2ddb941b0a
commit 054d245a2c
3 changed files with 19 additions and 6 deletions
+13 -3
View File
@@ -101,16 +101,16 @@ class condition_info {
// Missing basic data from course_modules
if (!isset($cm->availablefrom) || !isset($cm->availableuntil) ||
!isset($cm->showavailability) || !isset($cm->course)) {
!isset($cm->showavailability) || !isset($cm->course) || !isset($cm->visible)) {
if ($expectingmissing<CONDITION_MISSING_EVERYTHING) {
debugging('Performance warning: condition_info constructor is
faster if you pass in $cm with at least basic fields
(availablefrom,availableuntil,showavailability,course).
(availablefrom,availableuntil,showavailability,course,visible).
[This warning can be disabled, see phpdoc.]',
DEBUG_DEVELOPER);
}
$cm = $DB->get_record('course_modules',array('id'=>$cm->id),
'id,course,availablefrom,availableuntil,showavailability');
'id, course, availablefrom, availableuntil, showavailability, visible');
}
$this->cm = clone($cm);
@@ -486,6 +486,16 @@ WHERE
}
}
// 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->cm->visible) {
$information = '';
}
$information=trim($information);
return $available;
}