Skip to content
Snippets Groups Projects
Commit f3f5f4b3 authored by Chris Sangwin's avatar Chris Sangwin
Browse files

Teachers now enter information into the testing form using the strict CAS...

Teachers now enter information into the testing form using the strict CAS syntax.  They may not get the same HTML formatting as students see.  See notes on add_to_moodleform_testinput in inputbase.class.php
parent 956775f2
No related branches found
No related tags found
No related merge requests found
......@@ -44,7 +44,7 @@ class qtype_stack_question_test_form extends moodleform {
foreach ($question->inputs as $inputname => $input) {
// We do not require these to be filled in, (or contain valid input), as the teacher may want to test such cases.
$input->add_to_moodleform($mform);
$input->add_to_moodleform_testinput($mform);
}
// TODO I would really like to add a button here:
......
......@@ -43,7 +43,7 @@ class stack_algebraic_input extends stack_input {
return html_writer::empty_tag('input', $attributes);
}
public function add_to_moodleform(MoodleQuickForm $mform) {
public function add_to_moodleform_testinput(MoodleQuickForm $mform) {
$mform->addElement('text', $this->name, $this->name, array('size' => $this->parameters['boxWidth']));
$mform->setDefault($this->name, $this->parameters['syntaxHint']);
}
......
......@@ -51,7 +51,7 @@ class stack_boolean_input extends stack_input {
$state->contents, '', $attributes);
}
public function add_to_moodleform(MoodleQuickForm $mform) {
public function add_to_moodleform_testinput(MoodleQuickForm $mform) {
$mform->addElement('select', $this->name, $this->name, $this->get_choices());
}
......
......@@ -57,7 +57,7 @@ class stack_dropdown_input extends stack_input {
array('' => stack_string('notanswered')), $attributes);
}
public function add_to_moodleform(MoodleQuickForm $mform) {
public function add_to_moodleform_testinput(MoodleQuickForm $mform) {
$values = $this->get_choices();
if (empty($values)) {
$mform->addElement('static', $this->name, stack_string('ddl_empty'));
......
......@@ -318,10 +318,13 @@ abstract class stack_input {
public abstract function render(stack_input_state $state, $fieldname, $readonly);
/**
* Add this input to a MoodleForm. This is currently used in questiontestform.php.
* Add this input the MoodleForm, but only used in questiontestform.php.
* It enables the teacher to enter the data as a CAS variable where necessary when the student might get some
* html page formatting help. E.g. teachers will want to enter information into textareas input as a single list, or variable name representing a list,
* and matrix elements as a single CAS variable, or using Maxima's syntax matrix([...]).
* @param MoodleQuickForm $mform the form to add elements to.
*/
public abstract function add_to_moodleform(MoodleQuickForm $mform);
public abstract function add_to_moodleform_testinput(MoodleQuickForm $mform);
/**
* Generate the HTML that gives the results of validating the student's input.
......
......@@ -43,7 +43,7 @@ class stack_singlechar_input extends stack_input {
return html_writer::empty_tag('input', $attributes);
}
public function add_to_moodleform(MoodleQuickForm $mform) {
public function add_to_moodleform_testinput(MoodleQuickForm $mform) {
$mform->addElement('text', $this->name, $this->name, array('size' => 1, 'maxlength' => 1));
}
......
......@@ -58,9 +58,8 @@ class stack_textarea_input extends stack_input {
return html_writer::tag('textarea', htmlspecialchars($current), $attributes);
}
public function add_to_moodleform(MoodleQuickForm $mform) {
$mform->addElement('textarea', $this->name, $this->name,
array('rows' => $this->parameters['boxHeight'], 'cols' => $this->parameters['boxWidth']));
public function add_to_moodleform_testinput(MoodleQuickForm $mform) {
$mform->addElement('text', $this->name, $this->name, array('size' => $this->parameters['boxWidth']));
$mform->setDefault($this->name, $this->parameters['syntaxHint']);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment