/** * Create a fake question to be displayed in place of a question that is blocked * until the previous question has been answered. * * @param int $slot int slot number of the question to replace. * @return question_definition the placeholde question. */ protected function make_blocked_question_placeholder($slot) { $replacedquestion = $this->get_question_attempt($slot)->get_question(); question_bank::load_question_definition_classes('description'); $question = new qtype_description_question(); $question->id = $replacedquestion->id; $question->category = null; $question->parent = 0; $question->qtype = question_bank::get_qtype('description'); $question->name = ''; $question->questiontext = get_string('questiondependsonprevious', 'quiz'); $question->questiontextformat = FORMAT_HTML; $question->generalfeedback = ''; $question->defaultmark = $this->quba->get_question_max_mark($slot); $question->length = $replacedquestion->length; $question->penalty = 0; $question->stamp = ''; $question->version = 0; $question->hidden = 0; $question->timecreated = null; $question->timemodified = null; $question->createdby = null; $question->modifiedby = null; $placeholderqa = new question_attempt($question, $this->quba->get_id(), null, $this->quba->get_question_max_mark($slot)); $placeholderqa->set_slot($slot); $placeholderqa->start($this->get_quiz()->preferredbehaviour, 1); $placeholderqa->set_flagged($this->is_question_flagged($slot)); return $placeholderqa; }