Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
integration
prechecker
Commits
30ebb74f
Commit
30ebb74f
authored
Apr 30, 2009
by
skodak
Browse files
MDL-18951 standardised group support in grader report
parent
9e322c8c
Changes
1
Hide whitespace changes
Inline
Side-by-side
grade/report/grader/lib.php
View file @
30ebb74f
...
...
@@ -159,6 +159,20 @@ class grade_report_grader extends grade_report {
global
$DB
;
$warnings
=
array
();
$separategroups
=
false
;
$mygroups
=
array
();
if
(
$this
->
groupmode
==
SEPARATEGROUPS
and
!
has_capability
(
'moodle/site:accessallgroups'
,
$this
->
context
))
{
$separategroups
=
true
;
$mygroups
=
groups_get_user_groups
(
$this
->
course
->
id
);
$mygroups
=
$mygroups
[
0
];
// ignore groupings
// reorder the groups fro better perf bellow
$current
=
array_search
(
$this
->
currentgroup
,
$mygroups
);
if
(
$current
!==
false
)
{
unset
(
$mygroups
[
$current
]);
array_unshift
(
$mygroups
,
$this
->
currentgroup
);
}
}
// always initialize all arrays
$queue
=
array
();
foreach
(
$data
as
$varname
=>
$postedvalue
)
{
...
...
@@ -233,6 +247,24 @@ class grade_report_grader extends grade_report {
}
}
// group access control
if
(
$separategroups
)
{
// note: we can not use $this->currentgroup because it would fail badly
// when having two browser windows each with different group
$sharinggroup
=
false
;
foreach
(
$mygroups
as
$groupid
)
{
if
(
groups_is_member
(
$groupid
,
$userid
))
{
$sharinggroup
=
true
;
break
;
}
}
if
(
!
$sharinggroup
)
{
// either group membership changed or somebedy is hacking grades of other group
$warnings
[]
=
get_string
(
'errorsavegrade'
,
'grades'
);
continue
;
}
}
$grade_item
->
update_final_grade
(
$userid
,
$finalgrade
,
'gradebook'
,
$feedback
,
FORMAT_MOODLE
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment