diff --git a/behaviour.php b/behaviour.php index 22c6a61..5c7f708 100644 --- a/behaviour.php +++ b/behaviour.php @@ -30,9 +30,7 @@ */ defined('MOODLE_INTERNAL') || die(); -class qbehaviour_extquiz extends question_behaviour_with_save { - - const IS_ARCHETYPAL = true; +class qbehaviour_extquiz extends question_behaviour_with_multiple_tries { /** * Special value used for {@link question_display_options::$readonly when @@ -95,7 +93,6 @@ public function get_state_string($showcorrectness) { } $remainingattempts = $this->get_remaining_attempts(); - //debugging('get_state_string: remainingattempts = ' . $remainingattempts); return get_string('triesremaining', 'qbehaviour_interactive', $remainingattempts); } @@ -183,34 +180,17 @@ public function process_finish(question_attempt_pending_step $pendingstep) { return question_attempt::KEEP; } - //NOT USED + public function process_save(question_attempt_pending_step $pendingstep) { - //$status = parent::process_save($pendingstep); - //debugging("in proces saveeeeeeee!!, question = ".$this->question->name." state = ".$pendingstep->get_state()); $prevgrade = $this->qa->get_fraction(); //si la pregunta no estava puntuada (next) if(is_null($prevgrade)){ - //debugging("previous graded NULL"); $this->process_next_without_answer($pendingstep); }else{ - //list($fraction, $state) = $this->question->grade_response($prevgrade); - //die(); $pendingstep->set_fraction($prevgrade); $pendingstep->set_state($this->qa->get_state()); } - //$pendingstep->set_state(question_state::$todo); - /* - $prevgrade = $this->qa->get_fraction(); - if (!is_null($prevgrade)) { //ja ha estat puntuada - debugging("prevgraded: with grade = ".$prevgrade); - $pendingstep->set_fraction($prevgrade); - $pendingstep->set_state(question_state::$todo); - }else{ - debugging("process without answer"); - $this->process_next_without_answer($pendingstep); - } - */ return question_attempt::KEEP; } diff --git a/behaviourtype.php b/behaviourtype.php new file mode 100644 index 0000000..0e5893d --- /dev/null +++ b/behaviourtype.php @@ -0,0 +1,43 @@ +. + +/** + * Question behaviour type for interactive behaviour. + * + * @package qbehaviour_extquiz + * @copyright 2014 Gerard Cuello + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + + +defined('MOODLE_INTERNAL') || die(); + + +/** + * Question behaviour type information for extquiz behaviour + * + * @copyright 2012 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class qbehaviour_extquiz_type extends question_behaviour_type { + public function is_archetypal() { + return true; + } + //New in Moodle 2.7 + public function allows_multiple_submitted_responses() { + return true; + } +}