public function add_question_in_place_of_other($slot, question_definition $question, $maxmark = null) {
        $newslot = $this->next_slot_number();

        $oldqa = $this->get_question_attempt($slot);
        $oldqa->set_slot($newslot);
        $this->questionattempts[$newslot] = $oldqa;

        if ($maxmark === null) {
            $maxmark = $oldqa->get_max_mark();
        }

        $qa = new question_attempt($question, $this->get_id(), $this->observer, $maxmark);
        $qa->set_slot($slot);
        $this->questionattempts[$slot] = $qa;

        $this->observer->notify_attempt_moved($oldqa, $slot);
        $this->observer->notify_attempt_added($qa);

        return $newslot;
    }
public function add_question_in_place_of_other($slot, question_definition $question, $maxmark = null) {
        $newslot = $this->next_slot_number();

        $oldqa = $this->get_question_attempt($slot);
        $oldqa->set_slot($newslot);
        $this->questionattempts[$newslot] = $oldqa;

        if ($maxmark === null) {
            $maxmark = $oldqa->get_max_mark();
        }

        $qa = new question_attempt($question, $this->get_id(), $this->observer, $maxmark);
        $qa->set_slot($slot);
        $this->questionattempts[$slot] = $qa;

        $this->observer->notify_attempt_moved($oldqa, $slot);
        $this->observer->notify_attempt_added($qa);

        return $newslot;
    }
public function add_question_in_place_of_other ( $ slot , question_definition $ question , $ maxmark = null ) { $ newslot = $ this -> next_slot_number ( ) ; $ oldqa = $ this -> get_question_attempt ( $ slot ) ; $ oldqa -> set_slot ( $ newslot ) ; $ this -> questionattempts [ $ newslot ] = $ oldqa ; if ( $ maxmark === null ) { $ maxmark = $ oldqa -> get_max_mark ( ) ; } $ qa = new question_attempt ( $ question , $ this -> get_id ( ) , $ this -> observer , $ maxmark ) ; $ qa -> set_slot ( $ slot ) ; $ this -> questionattempts [ $ slot ] = $ qa ; $ this -> observer -> notify_attempt_moved ( $ oldqa , $ slot ) ; $ this -> observer -> notify_attempt_added ( $ qa ) ; return $ newslot ; }
Add another question to this usage, in the place of an existing slot.
The question_attempt that was in that slot is moved to the end at a new
slot number, which is returned.

The added question is not started until you call {@link start_question()}
on it.

@param int $slot the slot-number of the question to replace.
@param question_definition $question the question to add.
@param number $maxmark the maximum this question will be marked out of in
this attempt (optional). If not given, the max mark from the $qa we
are replacing is used.
@return int the new slot number of the question that was displaced.
Add another question to this usage in the place of an existing slot . The question_attempt that was in that slot is moved to the end at a new slot number which is returned .