MDL-74302 mod_quiz: Users with preview cap should see prevent messages
This commit is contained in:
@@ -69,6 +69,7 @@ Feature: Preview a quiz as a teacher
|
||||
| TF1 | 1 | |
|
||||
| TF2 | 1 | 3.0 |
|
||||
When I am on the "Quiz 2" "mod_quiz > View" page logged in as "admin"
|
||||
And I should see "This quiz is not currently available"
|
||||
And I press "Preview quiz"
|
||||
Then I should see "if this were a real attempt, you would be blocked" in the ".alert-warning" "css_element"
|
||||
|
||||
|
||||
+10
-6
@@ -229,14 +229,18 @@ if (!$viewobj->quizhasquestions) {
|
||||
}
|
||||
}
|
||||
|
||||
// If this is not a preview and, so far, we think a button should be printed, so check if they will be
|
||||
// allowed to access it.
|
||||
if (!$canpreview && $viewobj->buttontext) {
|
||||
// Users who can preview the quiz should be able to see all messages for not being able to access the quiz.
|
||||
if ($canpreview) {
|
||||
$viewobj->preventmessages = $viewobj->accessmanager->prevent_access();
|
||||
} else if ($viewobj->buttontext) {
|
||||
// If, so far, we think a button should be printed, so check if they will be allowed to access it.
|
||||
if (!$viewobj->moreattempts) {
|
||||
$viewobj->buttontext = '';
|
||||
} else if ($canattempt
|
||||
&& $viewobj->preventmessages = $viewobj->accessmanager->prevent_access()) {
|
||||
$viewobj->buttontext = '';
|
||||
} else if ($canattempt) {
|
||||
$viewobj->preventmessages = $viewobj->accessmanager->prevent_access();
|
||||
if ($viewobj->preventmessages) {
|
||||
$viewobj->buttontext = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user