mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 09:56: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
|
@ -83,8 +83,7 @@ class quiz_grading_report extends quiz_default_report {
|
|||
}
|
||||
|
||||
$currentgroup = groups_get_activity_group($this->cm, true);
|
||||
$this->users = get_users_by_capability($this->context, 'mod/quiz:attempt','','','','',$currentgroup,'',false);
|
||||
|
||||
$this->users = get_users_by_capability($this->context, array('mod/quiz:reviewmyattempts', 'mod/quiz:attempt'),'','','','',$currentgroup,'',false);
|
||||
|
||||
if (!empty($questionid)) {
|
||||
if (!isset($gradeableqs[$questionid])){
|
||||
|
|
|
@ -14,7 +14,7 @@ if ($groupid && $groupmode = groups_get_activity_groupmode($cm)) { // Groups a
|
|||
$groups = groups_get_activity_allowed_groups($cm);
|
||||
if (array_key_exists($groupid, $groups)){
|
||||
$group = $groups[$groupid];
|
||||
if (!$groupusers = get_users_by_capability($modcontext, 'mod/quiz:attempt','','','','',$group->id,'',false)){
|
||||
if (!$groupusers = get_users_by_capability($modcontext, array('mod/quiz:reviewmyattempts', 'mod/quiz:attempt'),'','','','',$group->id,'',false)){
|
||||
print_error('nostudentsingroup');
|
||||
} else {
|
||||
$groupusers = array_keys($groupusers);
|
||||
|
|
|
@ -35,7 +35,7 @@ class quiz_overview_report extends quiz_default_report {
|
|||
|
||||
/// find out current groups mode
|
||||
$currentgroup = groups_get_activity_group($cm, true);
|
||||
if (!$students = get_users_by_capability($this->context, 'mod/quiz:attempt','','','','','','',false)){
|
||||
if (!$students = get_users_by_capability($this->context, array('mod/quiz:reviewmyattempts', 'mod/quiz:attempt'),'','','','','','',false)){
|
||||
$students = array();
|
||||
} else {
|
||||
$students = array_keys($students);
|
||||
|
@ -47,7 +47,7 @@ class quiz_overview_report extends quiz_default_report {
|
|||
$groupstudents = array();
|
||||
} else {
|
||||
// all users who can attempt quizzes and who are in the currently selected group
|
||||
if (!$groupstudents = get_users_by_capability($this->context, 'mod/quiz:attempt','','','','',$currentgroup,'',false)){
|
||||
if (!$groupstudents = get_users_by_capability($this->context, array('mod/quiz:reviewmyattempts', 'mod/quiz:attempt'),'','','','',$currentgroup,'',false)){
|
||||
$groupstudents = array();
|
||||
} else {
|
||||
$groupstudents = array_keys($groupstudents);
|
||||
|
|
|
@ -104,7 +104,7 @@ class quiz_responses_report extends quiz_default_report {
|
|||
$displayoptions['qmfilter'] = $qmfilter;
|
||||
|
||||
//work out the sql for this table.
|
||||
if (!$students = get_users_by_capability($context, 'mod/quiz:attempt','','','','','','',false)){
|
||||
if (!$students = get_users_by_capability($context, array('mod/quiz:reviewmyattempts', 'mod/quiz:attempt'),'','','','','','',false)){
|
||||
$students = array();
|
||||
} else {
|
||||
$students = array_keys($students);
|
||||
|
@ -116,7 +116,7 @@ class quiz_responses_report extends quiz_default_report {
|
|||
$groupstudents = array();
|
||||
} else {
|
||||
// all users who can attempt quizzes and who are in the currently selected group
|
||||
if (!$groupstudents = get_users_by_capability($context, 'mod/quiz:attempt','','','','',$currentgroup,'',false)){
|
||||
if (!$groupstudents = get_users_by_capability($context, array('mod/quiz:reviewmyattempts', 'mod/quiz:attempt'),'','','','',$currentgroup,'',false)){
|
||||
$groupstudents = array();
|
||||
} else {
|
||||
$groupstudents = array_keys($groupstudents);
|
||||
|
|
|
@ -65,7 +65,7 @@ class quiz_statistics_report extends quiz_default_report {
|
|||
$nostudentsingroup = false;//true if a group is selected and their is noeone in it.
|
||||
if (!empty($currentgroup)) {
|
||||
// all users who can attempt quizzes and who are in the currently selected group
|
||||
$groupstudents = get_users_by_capability($context, 'mod/quiz:attempt','','','','',$currentgroup,'',false);
|
||||
$groupstudents = get_users_by_capability($context, array('mod/quiz:reviewmyattempts', 'mod/quiz:attempt'),'','','','',$currentgroup,'',false);
|
||||
if (!$groupstudents){
|
||||
$nostudentsingroup = true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue