mirror of
https://github.com/moodle/moodle.git
synced 2025-04-20 07:56:06 +02:00
MDL-42069 mod_quiz add lastname sort for manual grading
This commit is contained in:
parent
56cc9b387e
commit
a41945ea74
@ -79,7 +79,8 @@ class quiz_grading_settings_form extends moodleform {
|
||||
'date' => get_string('bydate', 'quiz_grading'),
|
||||
);
|
||||
if ($this->shownames) {
|
||||
$orderoptions['student'] = get_string('bystudentname', 'quiz_grading');
|
||||
$orderoptions['studentfirstname'] = get_string('bystudentfirstname', 'quiz_grading');
|
||||
$orderoptions['studentlastname'] = get_string('bystudentlastname', 'quiz_grading');
|
||||
}
|
||||
if ($this->showidnumbers) {
|
||||
$orderoptions['idnumber'] = get_string('bystudentidnumber', 'quiz_grading');
|
||||
|
@ -30,7 +30,8 @@ $string['automaticallygraded'] = 'Automatically graded';
|
||||
$string['backtothelistofquestions'] = 'Back to the list of questions';
|
||||
$string['bydate'] = 'By date';
|
||||
$string['bystudentidnumber'] = 'By student id number';
|
||||
$string['bystudentname'] = 'By student name';
|
||||
$string['bystudentfirstname'] = 'By student first name';
|
||||
$string['bystudentlastname'] = 'By student last name';
|
||||
$string['cannotloadquestioninfo'] = 'Unable to load questiontype specific question information';
|
||||
$string['cannotgradethisattempt'] = 'Cannot grade this attempt.';
|
||||
$string['changeoptions'] = 'Change options';
|
||||
|
@ -89,9 +89,9 @@ class quiz_grading_report extends quiz_default_report {
|
||||
$showidnumbers = has_capability('quiz/grading:viewidnumber', $this->context);
|
||||
|
||||
// Validate order.
|
||||
if (!in_array($order, array('random', 'date', 'student', 'idnumber'))) {
|
||||
if (!in_array($order, array('random', 'date', 'studentfirstname', 'studentlastname', 'idnumber'))) {
|
||||
$order = self::DEFAULT_ORDER;
|
||||
} else if (!$shownames && $order == 'student') {
|
||||
} else if (!$shownames && ($order == 'studentfirstname' || $order == 'studentlastname')) {
|
||||
$order = self::DEFAULT_ORDER;
|
||||
} else if (!$showidnumbers && $order == 'idnumber') {
|
||||
$order = self::DEFAULT_ORDER;
|
||||
@ -547,10 +547,17 @@ class quiz_grading_report extends quiz_default_report {
|
||||
WHERE sortqas.questionattemptid = qa.id
|
||||
AND sortqas.state $statetest
|
||||
)";
|
||||
} else if ($orderby == 'student' || $orderby == 'idnumber') {
|
||||
} else if ($orderby == 'studentfirstname' || $orderby == 'studentlastname' || $orderby == 'idnumber') {
|
||||
$qubaids->from .= " JOIN {user} u ON quiza.userid = u.id ";
|
||||
if ($orderby == 'student') {
|
||||
$orderby = $DB->sql_fullname('u.firstname', 'u.lastname');
|
||||
// For name sorting, map orderby form value to
|
||||
// actual column names; 'idnumber' maps naturally
|
||||
switch ($orderby) {
|
||||
case "studentlastname":
|
||||
$orderby = "u.lastname, u.firstname";
|
||||
break;
|
||||
case "studentfirstname":
|
||||
$orderby = "u.firstname, u.lastname";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user