MDL-49666 qbehaviour_informationitem: respect $options->readonly
This commit is contained in:
@@ -36,7 +36,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
*/
|
||||
class qbehaviour_informationitem_renderer extends qbehaviour_renderer {
|
||||
public function controls(question_attempt $qa, question_display_options $options) {
|
||||
if ($qa->get_state() != question_state::$todo) {
|
||||
if ($options->readonly || $qa->get_state() != question_state::$todo) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
@@ -49,10 +49,17 @@ class qbehaviour_informationitem_walkthrough_test extends qbehaviour_walkthrough
|
||||
$this->check_current_state(question_state::$todo);
|
||||
$this->check_current_mark(null);
|
||||
$this->check_current_output($this->get_contains_question_text_expectation($description),
|
||||
new question_contains_tag_with_attributes('input', array('type' => 'hidden',
|
||||
'name' => $this->quba->get_field_prefix($this->slot) . '-seen', 'value' => 1)),
|
||||
$this->get_contains_hidden_expectation(
|
||||
$this->quba->get_field_prefix($this->slot) . '-seen', 1),
|
||||
$this->get_does_not_contain_feedback_expectation());
|
||||
|
||||
// Check no hidden input when read-only.
|
||||
$this->displayoptions->readonly = true;
|
||||
$this->check_current_output($this->get_contains_question_text_expectation($description),
|
||||
$this->get_does_not_contain_hidden_expectation(
|
||||
$this->quba->get_field_prefix($this->slot) . '-seen', 1));
|
||||
$this->displayoptions->readonly = false;
|
||||
|
||||
// Process a submission indicating this question has been seen.
|
||||
$this->process_submission(array('-seen' => 1));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user