Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-31726 Pre-fill question type combined feedback

  • Loading branch information...
commit 086cced7490e18b3a821d0e973da1bb4d75183a2 1 parent 9da506c
Colin Chambers authored
Showing with 8 additions and 3 deletions.
  1. +4 −2 lang/en/question.php
  2. +4 −1 question/type/edit_question_form.php
View
6 lang/en/question.php
@@ -1,5 +1,4 @@
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
@@ -110,7 +109,7 @@
* Activity context - Questions only available in the activity module
* Course context - Questions available in all activity modules in the course
-* Course category context - Questions available in all activity modules and courses in the course category
+* Course category context - Questions available in all activity modules and courses in the course category
* System context - Questions available in all courses and activities on the site
Categories are also used for random questions, as questions are selected from a particular category.';
@@ -319,6 +318,7 @@
$string['contexterror'] = 'You shouldn\'t have got here if you\'re not moving a category to another context.';
$string['correct'] = 'Correct';
$string['correctfeedback'] = 'For any correct response';
+$string['correctfeedbackdefault'] = 'Your answer is correct.';
$string['decimalplacesingrades'] = 'Decimal places in grades';
$string['defaultmark'] = 'Default mark';
$string['errorsavingflags'] = 'Error saving the flag state.';
@@ -344,6 +344,7 @@
$string['includesubcategories'] = 'Also show questions from sub-categories';
$string['incorrect'] = 'Incorrect';
$string['incorrectfeedback'] = 'For any incorrect response';
+$string['incorrectfeedbackdefault'] = 'Your answer is incorrect.';
$string['information'] = 'Information';
$string['invalidanswer'] = 'Incomplete answer';
$string['makecopy'] = 'Make copy';
@@ -365,6 +366,7 @@
$string['parent'] = 'Parent';
$string['partiallycorrect'] = 'Partially correct';
$string['partiallycorrectfeedback'] = 'For any partially correct response';
+$string['partiallycorrectfeedbackdefault'] = 'Your answer is partially correct.';
$string['penaltyforeachincorrecttry'] = 'Penalty for each incorrect try';
$string['penaltyforeachincorrecttry_help'] = 'When you run your questions using the \'Interactive with multiple tries\' or \'Adaptive mode\' behaviour, so that the the student will have several tries to get the question right, then this option controls how much they are penalised for each incorrect try.
View
5 question/type/edit_question_form.php
@@ -348,9 +348,12 @@ protected function add_combined_feedback_fields($withshownumpartscorrect = false
$fields = array('correctfeedback', 'partiallycorrectfeedback', 'incorrectfeedback');
foreach ($fields as $feedbackname) {
- $mform->addElement('editor', $feedbackname, get_string($feedbackname, 'question'),
+ $element = $mform->addElement('editor', $feedbackname,
+ get_string($feedbackname, 'question'),
array('rows' => 5), $this->editoroptions);
$mform->setType($feedbackname, PARAM_RAW);
+ // Using setValue() as setDefault() does not work for the editor class.
+ $element->setValue(array('text'=>get_string($feedbackname.'default', 'question')));
if ($withshownumpartscorrect && $feedbackname == 'partiallycorrectfeedback') {
$mform->addElement('advcheckbox', 'shownumcorrect',
Please sign in to comment.
Something went wrong with that request. Please try again.