public function test_with_parts() { $row = new stdClass(); $row->id = 123; $row->hint = 'A hint'; $row->hintformat = FORMAT_HTML; $row->shownumcorrect = 1; $row->clearwrong = 1; $hint = question_hint_with_parts::load_from_record($row); $this->assertEquals($row->id, $hint->id); $this->assertEquals($row->hint, $hint->hint); $this->assertEquals($row->hintformat, $hint->hintformat); $this->assertNotEmpty($hint->shownumcorrect); $this->assertNotEmpty($hint->clearwrong); }
protected function make_hint($hint) { return question_hint_with_parts::load_from_record($hint); }
/** * Constructor. * @param int the hint id from the database. * @param string $hint The hint text * @param int the corresponding text FORMAT_... type. * @param bool $shownumcorrect whether the number of right parts should be shown. * @param bool $clearwrong whether the wrong parts should be reset. * @param string options a number of specific hint keys, separated by line break character. */ public function __construct($id, $hint, $hintformat, $shownumcorrect, $clearwrong, $options) { parent::__construct($id, $hint, $hintformat, $shownumcorrect, $clearwrong); $this->options = $options; }
public function adjust_display_options(question_display_options $options) { parent::adjust_display_options($options); $options->suppresschoicefeedback = !$this->showchoicefeedback; }
public function adjust_display_options(question_display_options $options) { parent::adjust_display_options($options); $options->statewhichincorrect = $this->statewhichincorrect; }