diff --git a/mod/quiz/classes/output/edit_grading_page.php b/mod/quiz/classes/output/edit_grading_page.php index bd146e45c67..f086be21572 100644 --- a/mod/quiz/classes/output/edit_grading_page.php +++ b/mod/quiz/classes/output/edit_grading_page.php @@ -45,6 +45,22 @@ class edit_grading_page implements renderable, templatable { } public function export_for_template(renderer_base $output) { - return []; + $gradeitems = []; + foreach ($this->structure->get_grade_items() as $gradeitem) { + $gradeitem = clone($gradeitem); + unset($gradeitem->quizid); + $gradeitem->displayname = format_string($gradeitem->name); + $gradeitem->isused = $this->structure->is_grade_item_used($gradeitem->id); + $gradeitems[] = $gradeitem; + } + + $slots = $this->structure->get_slots(); + + return [ + 'gradeitems' => $gradeitems, + 'hasgradeitems' => !empty($gradeitems), + 'nogradeitems' => ['message' => get_string('gradeitemsnoneyet', 'quiz')], + 'slots' => $slots, + ]; } } diff --git a/mod/quiz/lang/en/quiz.php b/mod/quiz/lang/en/quiz.php index 3f91738831c..6fb7ec30551 100644 --- a/mod/quiz/lang/en/quiz.php +++ b/mod/quiz/lang/en/quiz.php @@ -191,7 +191,7 @@ $string['completionminattemptserror'] = 'Minimum number of attempts must be lowe $string['completionpassorattemptsexhausteddesc'] = 'Student must achieve a passing grade, or exhaust all available attempts to complete this activity'; $string['completionattemptsexhausted'] = 'Passing grade or all available attempts completed'; $string['completionattemptsexhausted_help'] = 'Mark quiz complete when the student has exhausted the maximum number of attempts.'; -$string['complexgrading'] = 'Complex grading setup'; +$string['complexgrading'] = 'Multiple grade setup'; $string['configadaptive'] = 'If you choose Yes for this option then the student will be allowed multiple responses to a question even within the same attempt at the quiz.'; $string['configattemptsallowed'] = 'Restriction on the number of attempts students are allowed at the quiz.'; $string['configdecimaldigits'] = 'Number of digits that should be shown after the decimal point when displaying grades.'; @@ -440,6 +440,11 @@ $string['gradeaverage'] = 'Average grade'; $string['gradeboundary'] = 'Grade boundary'; $string['gradeessays'] = 'Grade essays'; $string['gradehighest'] = 'Highest grade'; +$string['gradeitemdelete'] = 'Delete grade item {$a}'; +$string['gradeitemnewname'] = 'New name for grade item {$a}'; +$string['gradeitems'] = 'Grade items'; +$string['gradeitemsetup'] = 'Quiz grading setup (advanced view)'; +$string['gradeitemsnoneyet'] = 'This quiz does not yet have any grade items defined, just a simple overall score will be used.'; $string['grademethod'] = 'Grading method'; $string['grademethod_help'] = 'When multiple attempts are allowed, the following methods are available for calculating the final quiz grade: diff --git a/mod/quiz/templates/edit_grading_page.mustache b/mod/quiz/templates/edit_grading_page.mustache index 27ea23e9de6..c340b8ced42 100644 --- a/mod/quiz/templates/edit_grading_page.mustache +++ b/mod/quiz/templates/edit_grading_page.mustache @@ -30,123 +30,69 @@ Example context (json): { + "gradeitems": [ + { + "id": 123, + "sortorder": 1, + "name": "Reading & writing", + "displayname": "Reading & writing", + "isused": true + } + ], + "hasgradeitems": true, + "nogradeitems": { + "message": "This quiz does not yet have any grade items defined." + } } }} -
| Grade item | -Max mark | -Actions | +{{#str}} gradeitem, grades {{/str}} | +{{#str}} actions {{/str}} |
|---|---|---|---|---|
| - - - Spelling - - - - - - | -- - - 8.00 - - - - - - | -- - - - | -||
| - - - Grammar - - - - - - | -- - - 8.00 - - - - - - | -- - - - | -||
| - - - Comprehension - - - - - - | -- - - 8.00 - - - - - - | -- - - - | -||
| Total | -- - - 24.00 - - - - - - | -- | ||
| + + + {{{displayname}}} + + {{#pix}}t/editstring, core{{/pix}} + + + + | ++ {{^isused}} + + {{#pix}} t/delete, core, {{#str}} gradeitemdelete, quiz, {{{name}}} {{/str}} {{/pix}} + + {{/isused}} + | +