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." + } } }} -

Quiz grading setup (advanced view)

+

{{#str}} gradeitemsetup, quiz {{/str}}

-

Grade items

+

{{#str}} gradeitems, quiz {{/str}}

- +{{^hasgradeitems}} + {{#nogradeitems}} + {{> core/notification_info}} + {{/nogradeitems}} +{{/hasgradeitems}} + +{{#hasgradeitems}} +
- - - + + - - - - - - - - - - - - - - - - - - - - + {{#gradeitems}} + + + + + {{/gradeitems}}
Grade itemMax markActions{{#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}} +
+{{/hasgradeitems}}
- - +

Mark scheme

diff --git a/mod/quiz/tests/behat/editing_multiple_grades.feature b/mod/quiz/tests/behat/editing_multiple_grades.feature index 37e5a892050..ce20ee23283 100644 --- a/mod/quiz/tests/behat/editing_multiple_grades.feature +++ b/mod/quiz/tests/behat/editing_multiple_grades.feature @@ -28,9 +28,10 @@ Feature: Setup multiple grades for a quiz Scenario: Navigation to, and display of, grading setup Given the following "mod_quiz > grade items" exist: - | quiz | name | - | Quiz 1 | Intuition | - | Quiz 1 | Intelligence | + | quiz | name | + | Quiz 1 | Intuition | + | Quiz 1 | Intelligence | + | Quiz 1 | Unused grade item | And quiz "Quiz 1" contains the following questions: | question | page | grade item | | Question A | 1 | Intuition | @@ -38,3 +39,6 @@ Feature: Setup multiple grades for a quiz | Question C | 2 | Intuition | When I am on the "Quiz 1" "mod_quiz > multiple grades setup" page logged in as teacher Then I should see "Grade items" + And "Delete" "icon" should not exist in the "Intuition" "table_row" + And "Delete" "icon" should not exist in the "Intelligence" "table_row" + And "Delete" "icon" should exist in the "Unused grade item" "table_row"