Skip to content
Snippets Groups Projects
Commit 278d6fda authored by Tim Hunt's avatar Tim Hunt
Browse files

qtype_stack now depends on and uses qbehaviour_dfexplicitvaildate.

parent 4473cf68
Branches
No related tags found
No related merge requests found
......@@ -15,7 +15,14 @@ Maxima can be [downloaded](http://maxima.sourceforge.net/download.html) as a sel
installer program for Windows, RPMs for Linux or as source for all platforms. Maxima and
GNUPlot will install themselves in suitable directories.
## 3. Add the STACK question type
## 3. Add the Deferred feedback with explicit validation question behaviour question behaviour
STACK uses this question behaviour.
1. Obtain the code. Either [download the zip file](https://github.com/timhunt/moodle-qbehaviour_dfexplicitvaildate/zipball/master), unzip it, and place it in the directory `moodle\question\behaviour\dfexplicitvaildate`. (You will need to rename the directory `moodle-qbehaviour_dfexplicitvaildate -> dfexplicitvaildate`.) Alternatively, get the code using git by running the following command in the top level folder of your Moodle install: `git clone git://github.com/timhunt/moodle-qbehaviour_dfexplicitvaildate.git question/behaviour/dfexplicitvaildate`.
2. Login to Moodle as the admin user and click on Notifications in the Site Administration panel.
## 4. Add the STACK question type
STACK is a question type for the moodle quiz.
......@@ -28,7 +35,7 @@ You must be able to connect to the CAS, and for the CAS to successfully create p
You should now have a question type available to the moodle quiz.
## 4. Add the STACK question format
## 5. Add the STACK question format
If you wish to import STACK 2 questions into STACK 3 you will need to install the STACK question format separately. This is distributed as `qformat_stack`. It provides a different _question format_ for the Moodle quiz importer.
......
......@@ -161,6 +161,27 @@ class qtype_stack_question extends question_graded_automatically {
$this->prtresults = array();
}
/**
* @return bool do any of the inputs in this question require the student
* validat the input.
*/
protected function any_inputs_require_validation() {
foreach ($this->inputs as $name => $input) {
if ($input->requires_validation()) {
return true;
}
}
return false;
}
public function make_behaviour(question_attempt $qa, $preferredbehaviour) {
if ($preferredbehaviour == 'deferredfeedback' && $this->any_inputs_require_validation()) {
return question_engine::make_behaviour('dfexplicitvaildate', $qa, $preferredbehaviour);
}
return parent::make_behaviour($qa, $preferredbehaviour);
}
public function start_attempt(question_attempt_step $step, $variant) {
// Work out the right seed to use.
......
......@@ -24,9 +24,12 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2012043001;
$plugin->version = 2012051600;
$plugin->requires = 2012020200;
$plugin->cron = 0;
$plugin->component = 'qtype_stack';
$plugin->maturity = MATURITY_ALPHA;
$plugin->dependencies = array(
'qbehaviour_dfexplicitvaildate' => 2012051600
);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment