mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 17:36:38 +02:00
quiz: MDL-14926 New capability mod/quiz:reviewmyattempts, separate from mod/quiz:attempt. Merged from MOODLE_19_STABLE.
This commit is contained in:
parent
894687e8a3
commit
96c7d771df
14 changed files with 64 additions and 34 deletions
|
@ -493,6 +493,20 @@ class quiz_attempt extends quiz {
|
|||
(!$this->is_preview_user() || $this->attempt->preview);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the appropriate capability to see whether this user may review their own attempt.
|
||||
* If not, prints an error.
|
||||
*/
|
||||
public function check_review_capability() {
|
||||
if (!$this->has_capability('mod/quiz:viewreports')) {
|
||||
if ($this->get_review_options()->quizstate == QUIZ_STATE_IMMEDIATELY) {
|
||||
$this->require_capability('mod/quiz:attempt');
|
||||
} else {
|
||||
$this->require_capability('mod/quiz:reviewmyattempts');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function get_question_state($questionid) {
|
||||
$this->ensure_state_loaded($questionid);
|
||||
return $this->states[$questionid];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue