MDL-39471 mod_assign: Comment visibility in blind marking.
Students can now see the identity of anyone making comments. Markers on the otherhand can only see the identity of themselves when making comments.
This commit is contained in:
@@ -22,6 +22,8 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['blindmarkingname'] = 'Participant {$a}';
|
||||
$string['blindmarkingviewfullname'] = 'Participant {$a->participantnumber} ({$a->participantfullname})';
|
||||
$string['default'] = 'Enabled by default';
|
||||
$string['default_help'] = 'If set, this submission method will be enabled by default for all new assignments.';
|
||||
$string['enabled'] = 'Submission comments';
|
||||
|
||||
@@ -131,32 +131,55 @@ function assignsubmission_comments_comment_display($comments, $options) {
|
||||
if ($assignment->is_blind_marking() && !empty($comments)) {
|
||||
// Blind marking is being used, may need to map unique anonymous ids to the comments.
|
||||
$usermappings = array();
|
||||
$hiddenuserstr = trim(get_string('hiddenuser', 'assign'));
|
||||
$guestuser = guest_user();
|
||||
|
||||
// Check group users first.
|
||||
$userinteam = false;
|
||||
if ($assignment->get_instance()->teamsubmission && has_capability('mod/assign:submit', $context)) {
|
||||
$assignment->set_course(get_course($course));
|
||||
$userinteam = $assignment->can_edit_group_submission($submission->groupid);
|
||||
}
|
||||
|
||||
foreach ($comments as $comment) {
|
||||
// Anonymize the comments.
|
||||
if (empty($usermappings[$comment->userid])) {
|
||||
// The blind-marking information for this commenter has not been generated; do so now.
|
||||
|
||||
if (has_capability('mod/assign:viewblinddetails', $context) && $USER->id != $comment->userid) {
|
||||
$anonid = $assignment->get_uniqueid_for_user($comment->userid);
|
||||
$commenter = new stdClass();
|
||||
$commenter->firstname = $hiddenuserstr;
|
||||
$commenter->lastname = $anonid;
|
||||
$commenter->picture = 0;
|
||||
$commenter->id = $guestuser->id;
|
||||
$commenter->email = $guestuser->email;
|
||||
$commenter->imagealt = $guestuser->imagealt;
|
||||
// Show participant information and the user's full name to users with the view blind details capability.
|
||||
$a = new stdClass();
|
||||
$a->participantnumber = $anonid;
|
||||
$a->participantfullname = $comment->fullname;
|
||||
$comment->fullname = get_string('blindmarkingviewfullname', 'assignsubmission_comments', $a);
|
||||
} else if ($USER->id == $comment->userid || $submission->userid == $USER->id || $userinteam) { //@codingStandardsIgnoreLine
|
||||
// Do not anonymize the user details for this comment.
|
||||
} else {
|
||||
// Anonymize the comments.
|
||||
if (empty($usermappings[$comment->userid])) {
|
||||
$anonid = $assignment->get_uniqueid_for_user($comment->userid);
|
||||
// The blind-marking information for this commenter has not been generated; do so now.
|
||||
$commenter = new stdClass();
|
||||
$commenter->firstname = get_string('blindmarkingname', 'assignsubmission_comments', $anonid);
|
||||
$commenter->lastname = '';
|
||||
$commenter->firstnamephonetic = '';
|
||||
$commenter->lastnamephonetic = '';
|
||||
$commenter->middlename = '';
|
||||
$commenter->alternatename = '';
|
||||
$commenter->picture = 0;
|
||||
$commenter->id = $guestuser->id;
|
||||
$commenter->email = $guestuser->email;
|
||||
$commenter->imagealt = $guestuser->imagealt;
|
||||
|
||||
// Temporarily store blind-marking information for use in later comments if necessary.
|
||||
$usermappings[$comment->userid]->fullname = fullname($commenter);
|
||||
$usermappings[$comment->userid]->avatar = $assignment->get_renderer()->user_picture($commenter,
|
||||
array('size'=>18, 'link' => false));
|
||||
// Temporarily store blind-marking information for use in later comments if necessary.
|
||||
$usermappings[$comment->userid] = new stdClass();
|
||||
$usermappings[$comment->userid]->fullname = fullname($commenter);
|
||||
$usermappings[$comment->userid]->avatar = $assignment->get_renderer()->user_picture($commenter,
|
||||
array('size' => 18, 'link' => false));
|
||||
}
|
||||
|
||||
// Set blind-marking information for this comment.
|
||||
$comment->fullname = $usermappings[$comment->userid]->fullname;
|
||||
$comment->avatar = $usermappings[$comment->userid]->avatar;
|
||||
$comment->profileurl = null;
|
||||
}
|
||||
|
||||
// Set blind-marking information for this comment.
|
||||
$comment->fullname = $usermappings[$comment->userid]->fullname;
|
||||
$comment->avatar = $usermappings[$comment->userid]->avatar;
|
||||
$comment->profileurl = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user