public function make_behaviour(question_attempt $qa, $preferredbehaviour) { if ($preferredbehaviour == 'interactive') { return question_engine::make_behaviour('interactivecountback', $qa, $preferredbehaviour); } return question_engine::make_archetypal_behaviour($preferredbehaviour, $qa); }
public function make_behaviour(question_attempt $qa, $preferredbehaviour) { global $CFG; // check that regexpadaptivewithhelp behaviour has been installed // if not installed, then the regexp questions will follow the "standard" behaviours // and Help button will not be available // NOTE: from 2.2 you cannot install regexp if corresponding behaviours have not been installed first // see plugin->dependencies in version.php file // only use the regexpadaptivewithhelp behaviour is question uses hint if ($this->usehint) { if ($preferredbehaviour == 'adaptive' && file_exists($CFG->dirroot . '/question/behaviour/regexpadaptivewithhelp/')) { return question_engine::make_behaviour('regexpadaptivewithhelp', $qa, $preferredbehaviour); } if ($preferredbehaviour == 'adaptivenopenalty' && file_exists($CFG->dirroot . '/question/behaviour/regexpadaptivewithhelpnopenalty/')) { return question_engine::make_behaviour('regexpadaptivewithhelpnopenalty', $qa, $preferredbehaviour); } } return question_engine::make_archetypal_behaviour($preferredbehaviour, $qa); }