MDL-40990 quiz: option to require prev Q finished before next shown
Further improvements to this code, including resolving edge cases: * The new feature can only be used when it is possible for the previous question in the quiz to be complete. * Also, this new feature cannot be used in combination with shuffle questions, because that make no sense; nor in combination with sequential navigation, because to make that work properly would be a lot of effort. If someone needs that to work later, it should be possible for them to implement it. * There were changes in the edit renderer API, to try to make things more consistent, and to make it less likely we will need to change things again in the future. See mod/quiz/upgrade.txt. * As part of this change, the styling of the Edit quiz page was tweaked to make slighly more efficient use of the horizontal space, and to be more symmetrical.
This commit is contained in:
@@ -821,35 +821,6 @@ class question_usage_by_activity {
|
||||
$this->observer->notify_attempt_modified($newqa);
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace a question with a dummy description question in this usage.
|
||||
*
|
||||
* @param object $slot
|
||||
*/
|
||||
public function replace_question_with_a_description_qtye($slot) {
|
||||
global $OUTPUT;
|
||||
// Create a description qtye for the message.
|
||||
question_bank::load_question_definition_classes('description');
|
||||
$q = new qtype_description_question();
|
||||
$q->id = $slot->questionid;
|
||||
$q->name = 'Description';
|
||||
$q->questiontext = get_string('questiondependsonprevious', 'quiz');
|
||||
$q->generalfeedback = '';
|
||||
$q->qtype = question_bank::get_qtype('description');
|
||||
$q->options = new question_display_options();
|
||||
$q->options->flags = 0;
|
||||
|
||||
$oldqa = $this->get_question_attempt($slot->slot);
|
||||
$newqa = new question_attempt($q, $oldqa->get_usage_id(), $this->observer, $slot->maxmark);
|
||||
$newqa->get_question()->options->flags = 1;
|
||||
|
||||
$newqa->set_database_id($oldqa->get_database_id());
|
||||
$newqa->set_slot($slot->slot);
|
||||
$this->questionattempts[$slot->slot] = $newqa;
|
||||
$this->start_question($slot->slot);
|
||||
$this->render_question($slot->slot, $q->options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Regrade all the questions in this usage (without changing their max mark).
|
||||
* @param bool $finished whether each question should be forced to be finished
|
||||
|
||||
Reference in New Issue
Block a user