diff --git a/lang/en/question.php b/lang/en/question.php
index ebb617a5a08..53799911dfd 100644
--- a/lang/en/question.php
+++ b/lang/en/question.php
@@ -25,6 +25,7 @@
$string['addmorechoiceblanks'] = 'Blanks for {no} more choices';
$string['addcategory'] = 'Add category';
$string['adminreport'] = 'Report on possible problems in your question database.';
+$string['answers'] = 'Answers';
$string['availableq'] = 'Available?';
$string['badbase'] = 'Bad base before **: {$a}**';
$string['behaviour'] = 'Behaviour';
diff --git a/question/type/calculated/edit_calculated_form.php b/question/type/calculated/edit_calculated_form.php
index a7af2824803..1daa58f41cd 100644
--- a/question/type/calculated/edit_calculated_form.php
+++ b/question/type/calculated/edit_calculated_form.php
@@ -54,9 +54,9 @@ class qtype_calculated_edit_form extends qtype_numerical_edit_form {
$this->question = $question;
$this->reload = optional_param('reload', false, PARAM_BOOL);
- if (!$this->reload) { // use database data as this is first pass
+ if (!$this->reload) { // Use database data as this is first pass.
if (isset($this->question->id)) {
- // remove prefix #{..}# if exists
+ // Remove prefix #{..}# if exists.
$this->initialname = $question->name;
$regs= array();
if (preg_match('~#\{([^[:space:]]*)#~', $question->name , $regs)) {
@@ -72,27 +72,49 @@ class qtype_calculated_edit_form extends qtype_numerical_edit_form {
$repeated = parent::get_per_answer_fields($mform, $label, $gradeoptions,
$repeatedoptions, $answersoption);
- // 1 is the answer. 3 is tolerance.
- $repeated[1]->setLabel(get_string('correctanswerformula', 'qtype_calculated') . '=');
- $repeated[3]->setLabel(get_string('tolerance', 'qtype_calculated') . '=');
+ // Reorganise answer options group. 0 is the answer. 1 is tolerance. 2 is Grade.
+ $answeroptions = $repeated[0]->getElements();
+ // Tolerance field will be part of its own group.
+ $tolerance = $answeroptions[1];
+
+ // Update Answer options group to contain only answer and grade fields.
+ $answeroptions = array($answeroptions[0], $answeroptions[2]);
+ $repeated[0]->setElements($answeroptions);
+
+ // Update answer field and group label.
+ $repeated[0]->setLabel(get_string('answerformula', 'qtype_calculated', '{no}') . ' =');
+ $answeroptions[0]->setLabel(get_string('answerformula', 'qtype_calculated', '{no}') . ' =');
+
+ // Get feedback field to re append later.
+ $feedback = array_pop($repeated);
+
+ // Create tolerance group.
+ $answertolerance = array();
+ $tolerance->setLabel(get_string('tolerance', 'qtype_calculated') . '=');
+ $answertolerance[] = $tolerance;
+ $answertolerance[] = $mform->createElement('select', 'tolerancetype',
+ get_string('tolerancetype', 'qtype_calculated'), $this->qtypeobj->tolerance_types());
+ $repeated[] = $mform->createElement('group', 'answertolerance',
+ get_string('tolerance', 'qtype_calculated'), $answertolerance, null, false);
$repeatedoptions['tolerance']['default'] = 0.01;
- $addrepeated = array();
- $addrepeated[] = $mform->createElement('select', 'tolerancetype',
- get_string('tolerancetype', 'qtype_numerical'), $this->qtypeobj->tolerance_types());
-
- $addrepeated[] = $mform->createElement('select', 'correctanswerlength',
- get_string('correctanswershows', 'qtype_calculated'), range(0, 9));
+ // Create display group.
+ $answerdisplay = array();
+ $answerdisplay[] = $mform->createElement('select', 'correctanswerlength',
+ get_string('answerdisplay', 'qtype_calculated'), range(0, 9));
$repeatedoptions['correctanswerlength']['default'] = 2;
$answerlengthformats = array(
'1' => get_string('decimalformat', 'qtype_numerical'),
'2' => get_string('significantfiguresformat', 'qtype_calculated')
);
- $addrepeated[] = $mform->createElement('select', 'correctanswerformat',
+ $answerdisplay[] = $mform->createElement('select', 'correctanswerformat',
get_string('correctanswershowsformat', 'qtype_calculated'), $answerlengthformats);
+ $repeated[] = $mform->createElement('group', 'answerdisplay',
+ get_string('answerdisplay', 'qtype_calculated'), $answerdisplay, null, false);
- array_splice($repeated, 4, 0, $addrepeated);
+ // Add feedback.
+ $repeated[] = $feedback;
return $repeated;
}
@@ -124,7 +146,7 @@ class qtype_calculated_edit_form extends qtype_numerical_edit_form {
$mform->createElement('submit', $addfieldsname, $addstring), 'listcategory');
$mform->registerNoSubmitButton('createoptionbutton');
- //editing as regular
+ // Editing as regular.
$mform->setType('single', PARAM_INT);
$mform->addElement('hidden', 'shuffleanswers', '1');
@@ -141,7 +163,7 @@ class qtype_calculated_edit_form extends qtype_numerical_edit_form {
$this->add_unit_fields($mform, $this);
$this->add_interactive_settings();
- // Hidden elements
+ // Hidden elements.
$mform->addElement('hidden', 'synchronize', '');
$mform->setType('synchronize', PARAM_INT);
$mform->addElement('hidden', 'wizard', 'datasetdefinitions');
@@ -190,7 +212,7 @@ class qtype_calculated_edit_form extends qtype_numerical_edit_form {
public function validation($data, $files) {
- // verifying for errors in {=...} in question text;
+ // Verifying for errors in {=...} in question text.
$qtext = "";
$qtextremaining = $data['questiontext']['text'];
$possibledatasets = $this->qtypeobj->find_dataset_names($data['questiontext']['text']);
diff --git a/question/type/calculated/lang/en/qtype_calculated.php b/question/type/calculated/lang/en/qtype_calculated.php
index 13df79c813b..b1123711262 100644
--- a/question/type/calculated/lang/en/qtype_calculated.php
+++ b/question/type/calculated/lang/en/qtype_calculated.php
@@ -26,6 +26,8 @@
$string['additem'] = 'Add item';
$string['addmoreanswerblanks'] = 'Add another answer blank.';
$string['addsets'] = 'Add set(s)';
+$string['answerformula'] = 'Answer {$a} formula';
+$string['answerdisplay'] = 'Answer display';
$string['answerhdr'] = 'Answer';
$string['answerstoleranceparam'] = 'Answers tolerance parameters';
$string['answerwithtolerance'] = '{$a->answer} (±{$a->tolerance} {$a->tolerancetype})';
@@ -129,6 +131,7 @@ $string['synchronizeno']='Do not synchronize';
$string['synchronizeyes']='Synchronize';
$string['synchronizeyesdisplay']='Synchronize and display the shared datasets name as prefix of the question name';
$string['tolerance'] = 'Tolerance ±';
+$string['tolerancetype'] = 'Type';
$string['trueanswerinsidelimits'] = 'Correct answer : {$a->correct} inside limits of true value {$a->true}';
$string['trueansweroutsidelimits'] = 'ERROR Correct answer : {$a->correct} outside limits of true value {$a->true}';
$string['uniform'] = 'Uniform';
diff --git a/question/type/calculated/styles.css b/question/type/calculated/styles.css
index d8f5dbf2d8e..aa94eb49113 100644
--- a/question/type/calculated/styles.css
+++ b/question/type/calculated/styles.css
@@ -20,3 +20,56 @@
direction: ltr;
text-align: left;
}
+
+/* Editing form. */
+body#page-question-type-calculated div[id^=fgroup_id_][id*=answeroptions_],
+body#page-question-type-calculatedmulti div[id^=fgroup_id_][id*=answeroptions_] {
+ background: #EEE;
+ margin-top: 0;
+ margin-bottom: 0;
+ padding-bottom: 5px;
+ padding-top: 5px;
+ border: 1px solid #BBB;
+ border-bottom: 0;
+}
+
+body#page-question-type-calculated div[id^=fgroup_id_][id*=answeroptions_] .fgrouplabel label,
+body#page-question-type-calculatedmulti div[id^=fgroup_id_][id*=answeroptions_] .fgrouplabel label {
+ font-weight: bold;
+}
+
+body#page-question-type-calculated div[id^=fgroup_id_][id*=answeroptions_] label[for^='id_answer_'],
+body#page-question-type-calculated div[id^=fgroup_id_][id*=answertolerance_] label[for^='id_tolerance_'],
+body#page-question-type-calculated div[id^=fgroup_id_][id*=answerdisplay_] label[for^='id_correctanswerlength_'],
+body#page-question-type-calculatedmulti div[id^=fgroup_id_][id*=answeroptions_] label[for^='id_answer_'],
+body#page-question-type-calculatedmulti div[id^=fgroup_id_][id*=answerdisplay_] label[for^='id_correctanswerlength_'] {
+ position: absolute;
+ left: -10000px;
+ font-weight: normal;
+ font-size: 1em;
+}
+
+body#page-question-type-calculated div[id^=fgroup_id_][id*=answertolerance_],
+body#page-question-type-calculated div[id^=fgroup_id_][id*=answerdisplay_],
+body#page-question-type-calculatedmulti div[id^=fgroup_id_][id*=answertolerance_],
+body#page-question-type-calculatedmulti div[id^=fgroup_id_][id*=answerdisplay_] {
+ background: #EEE;
+ margin-bottom: 0;
+ margin-top: 0;
+ padding-bottom: 5px;
+ padding-top: 5px;
+ border: 1px solid #BBB;
+ border-top: 0;
+ border-bottom: 0;
+}
+
+body#page-question-type-calculated div[id^=fitem_id_][id*=feedback_],
+body#page-question-type-calculatedmulti div[id^=fitem_id_][id*=feedback_] {
+ background: #EEE;
+ margin-bottom: 2em;
+ margin-top: 0;
+ padding-bottom: 5px;
+ padding-top: 5px;
+ border: 1px solid #BBB;
+ border-top: 0;
+}
diff --git a/question/type/calculatedmulti/edit_calculatedmulti_form.php b/question/type/calculatedmulti/edit_calculatedmulti_form.php
index a5156074ec0..5929420ab84 100644
--- a/question/type/calculatedmulti/edit_calculatedmulti_form.php
+++ b/question/type/calculatedmulti/edit_calculatedmulti_form.php
@@ -50,9 +50,9 @@ class qtype_calculatedmulti_edit_form extends question_edit_form {
$this->qtypeobj = question_bank::get_qtype('calculatedmulti');
$this->reload = optional_param('reload', false, PARAM_BOOL);
if (!$this->reload) {
- // use database data as this is first pass
+ // Use database data as this is first pass.
if (isset($this->question->id)) {
- // remove prefix #{..}# if exists
+ // Remove prefix #{..}# if exists.
$this->initialname = $question->name;
$regs= array();
if (preg_match('~#\{([^[:space:]]*)#~', $question->name , $regs)) {
@@ -66,13 +66,16 @@ class qtype_calculatedmulti_edit_form extends question_edit_form {
public function get_per_answer_fields($mform, $label, $gradeoptions,
&$repeatedoptions, &$answersoption) {
$repeated = array();
- $repeated[] = $mform->createElement('header', 'answerhdr', $label);
- $repeated[] = $mform->createElement('text', 'answer',
- get_string('answer', 'question'), array('size' => 50));
- $repeated[] = $mform->createElement('select', 'fraction',
+ $answeroptions = array();
+ $answeroptions[] = $mform->createElement('text', 'answer',
+ $label, array('size' => 50));
+ $answeroptions[] = $mform->createElement('select', 'fraction',
get_string('grade'), $gradeoptions);
- $repeated[] = $mform->createElement('editor', 'feedback',
- get_string('feedback', 'question'), null, $this->editoroptions);
+ $repeated[] = $mform->createElement('group', 'answeroptions',
+ $label, $answeroptions, null, false);
+
+ // Added answeroptions help button in definition_inner() after called to add_per_answer_fields.
+
$repeatedoptions['answer']['type'] = PARAM_RAW;
$repeatedoptions['fraction']['default'] = 0;
$answersoption = 'answers';
@@ -85,18 +88,24 @@ class qtype_calculatedmulti_edit_form extends question_edit_form {
$repeatedoptions['tolerance']['type'] = PARAM_FLOAT;
$repeatedoptions['tolerance']['default'] = 0.01;
- $addrepeated[] = $mform->createElement('select', 'correctanswerlength',
- get_string('correctanswershows', 'qtype_calculated'), range(0, 9));
+ // Create display group.
+ $answerdisplay = array();
+ $answerdisplay[] = $mform->createElement('select', 'correctanswerlength',
+ get_string('answerdisplay', 'qtype_calculated'), range(0, 9));
$repeatedoptions['correctanswerlength']['default'] = 2;
$answerlengthformats = array(
'1' => get_string('decimalformat', 'qtype_numerical'),
'2' => get_string('significantfiguresformat', 'qtype_calculated')
);
- $addrepeated[] = $mform->createElement('select', 'correctanswerformat',
+ $answerdisplay[] = $mform->createElement('select', 'correctanswerformat',
get_string('correctanswershowsformat', 'qtype_calculated'), $answerlengthformats);
- array_splice($repeated, 3, 0, $addrepeated);
- $repeated[1]->setLabel('...{={x}+..}...');
+ $repeated[] = $mform->createElement('group', 'answerdisplay',
+ get_string('answerdisplay', 'qtype_calculated'), $answerdisplay, null, false);
+
+ // Add feedback.
+ $repeated[] = $mform->createElement('editor', 'feedback',
+ get_string('feedback', 'question'), null, $this->editoroptions);
return $repeated;
}
@@ -145,6 +154,7 @@ class qtype_calculatedmulti_edit_form extends question_edit_form {
$this->add_per_answer_fields($mform, get_string('choiceno', 'qtype_multichoice', '{no}'),
question_bank::fraction_options_full(), max(5, QUESTION_NUMANS_START));
+ $mform->addHelpButton('answeroptions[0]', 'answeroptions', 'qtype_calculatedmulti');
$repeated = array();
// if ($this->editasmultichoice == 1) {
@@ -166,7 +176,7 @@ class qtype_calculatedmulti_edit_form extends question_edit_form {
$this->add_interactive_settings(true, true);
- //hidden elements
+ // Hidden elements.
$mform->addElement('hidden', 'synchronize', '');
$mform->setType('synchronize', PARAM_INT);
if (isset($this->question->options) && isset($this->question->options->synchronize)) {
@@ -221,7 +231,7 @@ class qtype_calculatedmulti_edit_form extends question_edit_form {
public function validation($data, $files) {
$errors = parent::validation($data, $files);
- //verifying for errors in {=...} in question text;
+ // Verifying for errors in {=...} in question text.
$qtext = '';
$qtextremaining = $data['questiontext']['text'];
$possibledatasets = $this->qtypeobj->find_dataset_names($data['questiontext']['text']);
@@ -268,7 +278,7 @@ class qtype_calculatedmulti_edit_form extends question_edit_form {
$errors['fraction['.$key.']'] = get_string('errgradesetanswerblank', 'qtype_multichoice');
}
if ($trimmedanswer != '' || $answercount == 0) {
- //verifying for errors in {=...} in answer text;
+ // Verifying for errors in {=...} in answer text.
$qanswer = '';
$qanswerremaining = $trimmedanswer;
$possibledatasets = $this->qtypeobj->find_dataset_names($trimmedanswer);
@@ -318,7 +328,7 @@ class qtype_calculatedmulti_edit_form extends question_edit_form {
$errors['answer[1]'] = get_string('notenoughanswers', 'qtype_multichoice', 2);
}
- /// Perform sanity checks on fractional grades
+ // Perform sanity checks on fractional grades.
if ($data['single']== 1 ) {
if ($maxfraction != 1) {
$errors['fraction[0]'] = get_string('errfractionsnomax', 'qtype_multichoice',
diff --git a/question/type/calculatedmulti/lang/en/qtype_calculatedmulti.php b/question/type/calculatedmulti/lang/en/qtype_calculatedmulti.php
index e70aa088337..a675114de37 100644
--- a/question/type/calculatedmulti/lang/en/qtype_calculatedmulti.php
+++ b/question/type/calculatedmulti/lang/en/qtype_calculatedmulti.php
@@ -22,7 +22,8 @@
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-
+$string['answeroptions'] = 'Choice options';
+$string['answeroptions_help'] = 'The suggested choice formula is ...{={x}+..}...';
$string['pluginname'] = 'Calculated multichoice';
$string['pluginname_help'] = 'Calculated multichoice questions are like multichoice questions which in their choice elements can be included numerical formula results using wildcards in curly brackets that are substituted with individual values when the quiz is taken. For example, if the question "What is the area of a rectangle of length {l} and width {w}?" one of the choice is {={l}*{w}} (where * denotes multiplication). ';
$string['pluginname_link'] = 'question/type/calculatedmulti';
diff --git a/question/type/calculatedsimple/styles.css b/question/type/calculatedsimple/styles.css
index b58e34713d5..d8dc446a99c 100644
--- a/question/type/calculatedsimple/styles.css
+++ b/question/type/calculatedsimple/styles.css
@@ -6,3 +6,49 @@
.que.calculatedsimple .answer input[type="text"] {
width: 30%;
}
+
+/* Editing form. */
+body#page-question-type-calculatedsimple div[id^=fgroup_id_][id*=answeroptions_] {
+ background: #EEE;
+ margin-top: 0;
+ margin-bottom: 0;
+ padding-bottom: 5px;
+ padding-top: 5px;
+ border: 1px solid #BBB;
+ border-bottom: 0;
+}
+
+body#page-question-type-calculatedsimple div[id^=fgroup_id_][id*=answeroptions_] .fgrouplabel label{
+ font-weight: bold;
+}
+
+body#page-question-type-calculatedsimple div[id^=fgroup_id_][id*=answeroptions_] label[for^='id_answer_'],
+body#page-question-type-calculatedsimple div[id^=fgroup_id_][id*=answertolerance_] label[for^='id_tolerance_'],
+body#page-question-type-calculatedsimple div[id^=fgroup_id_][id*=answerdisplay_] label[for^='id_correctanswerlength_'] {
+ position: absolute;
+ left: -10000px;
+ font-weight: normal;
+ font-size: 1em;
+}
+
+body#page-question-type-calculatedsimple div[id^=fgroup_id_][id*=answertolerance_],
+body#page-question-type-calculatedsimple div[id^=fgroup_id_][id*=answerdisplay_] {
+ background: #EEE;
+ margin-bottom: 0;
+ margin-top: 0;
+ padding-bottom: 5px;
+ padding-top: 5px;
+ border: 1px solid #BBB;
+ border-top: 0;
+ border-bottom: 0;
+}
+
+body#page-question-type-calculatedsimple div[id^=fitem_id_][id*=feedback_] {
+ background: #EEE;
+ margin-bottom: 2em;
+ margin-top: 0;
+ padding-bottom: 5px;
+ padding-top: 5px;
+ border: 1px solid #BBB;
+ border-top: 0;
+}
diff --git a/question/type/edit_question_form.php b/question/type/edit_question_form.php
index 22e37f0d455..0d267191033 100644
--- a/question/type/edit_question_form.php
+++ b/question/type/edit_question_form.php
@@ -138,7 +138,7 @@ abstract class question_edit_form extends question_wizard_form {
$contexts = $this->contexts->having_cap('moodle/question:add');
}
- // Adding question
+ // Adding question.
$mform->addElement('questioncategory', 'category', get_string('category', 'question'),
array('contexts' => $contexts));
} else if (!($this->question->formoptions->canmove ||
@@ -153,14 +153,14 @@ abstract class question_edit_form extends question_wizard_form {
array('contexts' => $this->contexts->having_cap('moodle/question:add')));
} else {
- // Editing question with permission to move from category or save as new q
+ // Editing question with permission to move from category or save as new q.
$currentgrp = array();
$currentgrp[0] = $mform->createElement('questioncategory', 'category',
get_string('categorycurrent', 'question'),
array('contexts' => array($this->categorycontext)));
if ($this->question->formoptions->canedit ||
$this->question->formoptions->cansaveasnew) {
- //not move only form
+ // Not move only form.
$currentgrp[1] = $mform->createElement('checkbox', 'usecurrentcat', '',
get_string('categorycurrentuse', 'question'));
$mform->setDefault('usecurrentcat', 1);
@@ -175,7 +175,7 @@ abstract class question_edit_form extends question_wizard_form {
array('contexts' => array($this->categorycontext)));
if ($this->question->formoptions->canedit ||
$this->question->formoptions->cansaveasnew) {
- //not move only form
+ // Not move only form.
$mform->disabledIf('categorymoveto', 'usecurrentcat', 'checked');
}
}
@@ -242,7 +242,7 @@ abstract class question_edit_form extends question_wizard_form {
$buttonarray = array();
if (!empty($this->question->id)) {
- // Editing / moving question
+ // Editing / moving question.
if ($this->question->formoptions->movecontext) {
$buttonarray[] = $mform->createElement('submit', 'submitbutton',
get_string('moveq', 'question'));
@@ -256,7 +256,7 @@ abstract class question_edit_form extends question_wizard_form {
}
$buttonarray[] = $mform->createElement('cancel');
} else {
- // Adding new question
+ // Adding new question.
$buttonarray[] = $mform->createElement('submit', 'submitbutton',
get_string('savechanges'));
$buttonarray[] = $mform->createElement('cancel');
@@ -294,11 +294,13 @@ abstract class question_edit_form extends question_wizard_form {
protected function get_per_answer_fields($mform, $label, $gradeoptions,
&$repeatedoptions, &$answersoption) {
$repeated = array();
- $repeated[] = $mform->createElement('header', 'answerhdr', $label);
- $repeated[] = $mform->createElement('text', 'answer',
- get_string('answer', 'question'), array('size' => 80));
- $repeated[] = $mform->createElement('select', 'fraction',
+ $answeroptions = array();
+ $answeroptions[] = $mform->createElement('text', 'answer',
+ $label, array('size' => 40));
+ $answeroptions[] = $mform->createElement('select', 'fraction',
get_string('grade'), $gradeoptions);
+ $repeated[] = $mform->createElement('group', 'answeroptions',
+ $label, $answeroptions, null, false);
$repeated[] = $mform->createElement('editor', 'feedback',
get_string('feedback', 'question'), array('rows' => 5), $this->editoroptions);
$repeatedoptions['answer']['type'] = PARAM_RAW;
@@ -319,6 +321,9 @@ abstract class question_edit_form extends question_wizard_form {
*/
protected function add_per_answer_fields(&$mform, $label, $gradeoptions,
$minoptions = QUESTION_NUMANS_START, $addoptions = QUESTION_NUMANS_ADD) {
+ $mform->addElement('header', 'answerhdr',
+ get_string('answers', 'question'), '');
+ $mform->setExpanded('answerhdr', 1);
$answersoption = '';
$repeatedoptions = array();
$repeated = $this->get_per_answer_fields($mform, $label, $gradeoptions,
@@ -332,7 +337,7 @@ abstract class question_edit_form extends question_wizard_form {
$this->repeat_elements($repeated, $repeatsatstart, $repeatedoptions,
'noanswers', 'addanswers', $addoptions,
- $this->get_more_choices_string());
+ $this->get_more_choices_string(), true);
}
/**
@@ -449,7 +454,7 @@ abstract class question_edit_form extends question_wizard_form {
public function set_data($question) {
question_bank::get_qtype($question->qtype)->set_default_options($question);
- // prepare question text
+ // Prepare question text.
$draftid = file_get_submitted_draft_itemid('questiontext');
if (!empty($question->questiontext)) {
@@ -468,7 +473,7 @@ abstract class question_edit_form extends question_wizard_form {
editors_get_preferred_format() : $question->questiontextformat;
$question->questiontext['itemid'] = $draftid;
- // prepare general feedback
+ // Prepare general feedback.
$draftid = file_get_submitted_draft_itemid('generalfeedback');
if (empty($question->generalfeedback)) {
@@ -504,7 +509,7 @@ abstract class question_edit_form extends question_wizard_form {
}
}
- // subclass adds data_preprocessing code here
+ // Subclass adds data_preprocessing code here.
$question = $this->data_preprocessing($question);
parent::set_data($question);
@@ -534,7 +539,7 @@ abstract class question_edit_form extends question_wizard_form {
$key = 0;
foreach ($question->options->answers as $answer) {
if ($withanswerfiles) {
- // Prepare the feedback editor to display files in draft area
+ // Prepare the feedback editor to display files in draft area.
$draftitemid = file_get_submitted_draft_itemid('answer['.$key.']');
$question->answer[$key]['text'] = file_prepare_draft_area(
$draftitemid, // draftid
@@ -562,10 +567,10 @@ abstract class question_edit_form extends question_wizard_form {
// that ->_defaultValues['fraction[0]'] has already been set, but we
// are using object notation here, so we will be setting
// ->_defaultValues['fraction'][0]. That does not work, so we have
- // to unset ->_defaultValues['fraction[0]']
+ // to unset ->_defaultValues['fraction[0]'].
unset($this->_form->_defaultValues["fraction[$key]"]);
- // Prepare the feedback editor to display files in draft area
+ // Prepare the feedback editor to display files in draft area.
$draftitemid = file_get_submitted_draft_itemid('feedback['.$key.']');
$question->feedback[$key]['text'] = file_prepare_draft_area(
$draftitemid, // draftid
@@ -637,7 +642,7 @@ abstract class question_edit_form extends question_wizard_form {
foreach ($question->hints as $hint) {
$question->hint[$key] = array();
- // prepare feedback editor to display files in draft area
+ // Prepare feedback editor to display files in draft area.
$draftitemid = file_get_submitted_draft_itemid('hint['.$key.']');
$question->hint[$key]['text'] = file_prepare_draft_area(
$draftitemid, // draftid
diff --git a/question/type/match/edit_match_form.php b/question/type/match/edit_match_form.php
index 2bbb75f7971..dc9ea7032f7 100644
--- a/question/type/match/edit_match_form.php
+++ b/question/type/match/edit_match_form.php
@@ -36,10 +36,13 @@ class qtype_match_edit_form extends question_edit_form {
protected function get_per_answer_fields($mform, $label, $gradeoptions,
&$repeatedoptions, &$answersoption) {
+ $mform->addElement('static', 'answersinstruct',
+ get_string('availablechoices', 'qtype_match'),
+ get_string('filloutthreeqsandtwoas', 'qtype_match'));
+
$repeated = array();
- $repeated[] = $mform->createElement('header', 'answerhdr', $label);
$repeated[] = $mform->createElement('editor', 'subquestions',
- get_string('question'), array('rows'=>3), $this->editoroptions);
+ $label, array('rows'=>3), $this->editoroptions);
$repeated[] = $mform->createElement('text', 'subanswers',
get_string('answer', 'question'), array('size'=>50));
$repeatedoptions['subquestions']['type'] = PARAM_RAW;
@@ -59,11 +62,6 @@ class qtype_match_edit_form extends question_edit_form {
$mform->addHelpButton('shuffleanswers', 'shuffle', 'qtype_match');
$mform->setDefault('shuffleanswers', 1);
- $mform->addElement('static', 'answersinstruct',
- get_string('availablechoices', 'qtype_match'),
- get_string('filloutthreeqsandtwoas', 'qtype_match'));
- $mform->closeHeaderBefore('answersinstruct');
-
$this->add_per_answer_fields($mform, get_string('questionno', 'question', '{no}'), 0);
$this->add_combined_feedback_fields(true);
diff --git a/question/type/match/styles.css b/question/type/match/styles.css
index 5320cdf52ea..834a8be4eae 100644
--- a/question/type/match/styles.css
+++ b/question/type/match/styles.css
@@ -4,3 +4,29 @@
.que.match .feedback .rightanswer script {
display: none;
}
+
+
+/* Editing form. */
+body#page-question-type-match div[id^=fitem_id_][id*=subquestions_] {
+ background: #EEE;
+ margin-top: 0;
+ margin-bottom: 0;
+ padding-bottom: 5px;
+ padding-top: 5px;
+ border: 1px solid #BBB;
+ border-bottom: 0;
+}
+
+body#page-question-type-match div[id^=fitem_id_][id*=subquestions_] .fitemtitle {
+ font-weight: bold;
+}
+
+body#page-question-type-match div[id^=fitem_id_][id*=subanswers_] {
+ background: #EEE;
+ margin-bottom: 2em;
+ margin-top: 0;
+ padding-bottom: 5px;
+ padding-top: 5px;
+ border: 1px solid #BBB;
+ border-top: 0;
+}
diff --git a/question/type/multichoice/edit_multichoice_form.php b/question/type/multichoice/edit_multichoice_form.php
index 031605e148f..1e2bd0d7084 100644
--- a/question/type/multichoice/edit_multichoice_form.php
+++ b/question/type/multichoice/edit_multichoice_form.php
@@ -70,9 +70,8 @@ class qtype_multichoice_edit_form extends question_edit_form {
protected function get_per_answer_fields($mform, $label, $gradeoptions,
&$repeatedoptions, &$answersoption) {
$repeated = array();
- $repeated[] = $mform->createElement('header', 'answerhdr', $label);
$repeated[] = $mform->createElement('editor', 'answer',
- get_string('answer', 'question'), array('rows' => 1), $this->editoroptions);
+ $label, array('rows' => 1), $this->editoroptions);
$repeated[] = $mform->createElement('select', 'fraction',
get_string('grade'), $gradeoptions);
$repeated[] = $mform->createElement('editor', 'feedback',
diff --git a/question/type/multichoice/styles.css b/question/type/multichoice/styles.css
index c179bb8ea7a..4e0de800708 100644
--- a/question/type/multichoice/styles.css
+++ b/question/type/multichoice/styles.css
@@ -16,3 +16,39 @@
.que.multichoice .feedback .rightanswer * {
display: inline;
}
+
+/* Editing form. */
+body#page-question-type-multichoice div[id^=fitem_id_][id*=answer_] {
+ background: #EEE;
+ margin-top: 0;
+ margin-bottom: 0;
+ padding-bottom: 5px;
+ padding-top: 5px;
+ border: 1px solid #BBB;
+ border-bottom: 0;
+}
+
+body#page-question-type-multichoice div[id^=fitem_id_][id*=answer_] .fitemtitle {
+ font-weight: bold;
+}
+
+body#page-question-type-multichoice div[id^=fitem_id_][id*=fraction_] {
+ background: #EEE;
+ margin-bottom: 0;
+ margin-top: 0;
+ padding-bottom: 5px;
+ padding-top: 5px;
+ border: 1px solid #BBB;
+ border-top: 0;
+ border-bottom: 0;
+}
+
+body#page-question-type-multichoice div[id^=fitem_id_][id*=feedback_] {
+ background: #EEE;
+ margin-bottom: 2em;
+ margin-top: 0;
+ padding-bottom: 5px;
+ padding-top: 5px;
+ border: 1px solid #BBB;
+ border-top: 0;
+}
diff --git a/question/type/numerical/edit_numerical_form.php b/question/type/numerical/edit_numerical_form.php
index 6dbd41183f4..182c808fa33 100644
--- a/question/type/numerical/edit_numerical_form.php
+++ b/question/type/numerical/edit_numerical_form.php
@@ -58,11 +58,13 @@ class qtype_numerical_edit_form extends question_edit_form {
$repeatedoptions, $answersoption);
$tolerance = $mform->createElement('text', 'tolerance',
- get_string('acceptederror', 'qtype_numerical'));
+ get_string('answererror', 'qtype_numerical'), array('size' => 15));
$repeatedoptions['tolerance']['type'] = PARAM_FLOAT;
$repeatedoptions['tolerance']['default'] = 0;
- array_splice($repeated, 3, 0, array($tolerance));
- $repeated[1]->setSize(10);
+ $elements = $repeated[0]->getElements();
+ $elements[0]->setSize(15);
+ array_splice($elements, 1, 0, array($tolerance));
+ $repeated[0]->setElements($elements);
return $repeated;
}
diff --git a/question/type/numerical/lang/en/qtype_numerical.php b/question/type/numerical/lang/en/qtype_numerical.php
index c86e0432f74..cc411fd7137 100644
--- a/question/type/numerical/lang/en/qtype_numerical.php
+++ b/question/type/numerical/lang/en/qtype_numerical.php
@@ -24,6 +24,7 @@
*/
$string['acceptederror'] = 'Accepted error';
+$string['answererror'] = 'Error';
$string['addmoreanswerblanks'] = 'Blanks for {no} more answers';
$string['addmoreunitblanks'] = 'Blanks for {no} more units';
$string['answercolon'] = 'Answer:';
diff --git a/question/type/numerical/styles.css b/question/type/numerical/styles.css
index 50958dfef3a..c6b40614f5c 100644
--- a/question/type/numerical/styles.css
+++ b/question/type/numerical/styles.css
@@ -18,3 +18,46 @@
direction: ltr;
text-align: left;
}
+
+/* Editing form. */
+body#page-question-type-numerical div[id^=fgroup_id_][id*=answeroptions_] {
+ background: #EEE;
+ margin-top: 0;
+ margin-bottom: 0;
+ padding-bottom: 5px;
+ padding-top: 5px;
+ border: 1px solid #BBB;
+ border-bottom: 0;
+}
+
+body#page-question-type-numerical div[id^=fgroup_id_][id*=answeroptions_] .fgrouplabel label{
+ font-weight: bold;
+}
+
+body#page-question-type-numerical div[id^=fgroup_id_][id*=answeroptions_] label[for^='id_answer_']{
+ position: absolute;
+ left: -10000px;
+ font-weight: normal;
+ font-size: 1em;
+}
+
+body#page-question-type-numerical div[id^=fitem_id_][id*=fraction_] {
+ background: #EEE;
+ margin-bottom: 0;
+ margin-top: 0;
+ padding-bottom: 5px;
+ padding-top: 5px;
+ border: 1px solid #BBB;
+ border-top: 0;
+ border-bottom: 0;
+}
+
+body#page-question-type-numerical div[id^=fitem_id_][id*=feedback_] {
+ background: #EEE;
+ margin-bottom: 2em;
+ margin-top: 0;
+ padding-bottom: 5px;
+ padding-top: 5px;
+ border: 1px solid #BBB;
+ border-top: 0;
+}
diff --git a/question/type/shortanswer/styles.css b/question/type/shortanswer/styles.css
index 3a1194d1880..98a65395de4 100644
--- a/question/type/shortanswer/styles.css
+++ b/question/type/shortanswer/styles.css
@@ -6,3 +6,46 @@
.que.shortanswer .answer input {
width: 80%;
}
+
+/* Editing form. */
+body#page-question-type-shortanswer div[id^=fgroup_id_][id*=answeroptions_] {
+ background: #EEE;
+ margin-top: 0;
+ margin-bottom: 0;
+ padding-bottom: 5px;
+ padding-top: 5px;
+ border: 1px solid #BBB;
+ border-bottom: 0;
+}
+
+body#page-question-type-shortanswer div[id^=fgroup_id_][id*=answeroptions_] .fgrouplabel label{
+ font-weight: bold;
+}
+
+body#page-question-type-shortanswer div[id^=fgroup_id_][id*=answeroptions_] label[for^='id_answer_']{
+ position: absolute;
+ left: -10000px;
+ font-weight: normal;
+ font-size: 1em;
+}
+
+body#page-question-type-shortanswer div[id^=fitem_id_][id*=fraction_] {
+ background: #EEE;
+ margin-bottom: 0;
+ margin-top: 0;
+ padding-bottom: 5px;
+ padding-top: 5px;
+ border: 1px solid #BBB;
+ border-top: 0;
+ border-bottom: 0;
+}
+
+body#page-question-type-shortanswer div[id^=fitem_id_][id*=feedback_] {
+ background: #EEE;
+ margin-bottom: 2em;
+ margin-top: 0;
+ padding-bottom: 5px;
+ padding-top: 5px;
+ border: 1px solid #BBB;
+ border-top: 0;
+}
diff --git a/theme/base/style/question.css b/theme/base/style/question.css
index 7184adf99d0..2a932bbdd13 100644
--- a/theme/base/style/question.css
+++ b/theme/base/style/question.css
@@ -1,4 +1,4 @@
-/* Question */
+/* Question bank */
.questionbank h2 {margin-top: 0;}
.questioncategories h3 {margin-top: 0;}
@@ -36,7 +36,7 @@
.dir-rtl #categoryquestions th { text-align: right; }
.questionbank .singleselect { margin: 0; }
-/* Question editing form */
+/* Question editing forms. */
#combinedfeedbackhdr div.fhtmleditor {padding: 0;}
#combinedfeedbackhdr div.fcheckbox {margin-bottom: 1em;}
@@ -44,6 +44,13 @@
#multitriesheader div.fitem_fgroup {margin-bottom: 1em;}
#multitriesheader div.fitem_fgroup fieldset.felement label {margin-left: 0.3em; margin-right: 0.3em;}
+body.path-question-type .fitem_fgroup .accesshide {
+ font: inherit;
+ left: 0;
+ position: static;
+}
+
+/* Questions being attempted. */
.que {clear: left;text-align: left;margin: 0 auto 1.8em auto;}
.dir-rtl .que {text-align: right;}
@@ -97,6 +104,7 @@
.que input.questionflagimage { padding-right: 3px; }
.dir-rtl .que input.questionflagimage { padding-left: 3px; padding-right: 0; }
+/* Miscellaneous. */
.importerror {margin-top: 10px;border-bottom: 1px solid #555;}
.mform .que.comment .fitemtitle {width: 20%;}