MDL-57239 qbehaviour_interactive: fix Try again button when reviewing
This commit is contained in:
@@ -36,14 +36,19 @@ defined('MOODLE_INTERNAL') || die();
|
||||
*/
|
||||
class qbehaviour_interactive_renderer extends qbehaviour_renderer {
|
||||
public function controls(question_attempt $qa, question_display_options $options) {
|
||||
if ($options->readonly === qbehaviour_interactive::READONLY_EXCEPT_TRY_AGAIN) {
|
||||
if ($options->readonly === qbehaviour_interactive::TRY_AGAIN_VISIBLE ||
|
||||
$options->readonly === qbehaviour_interactive::TRY_AGAIN_VISIBLE_READONLY) {
|
||||
// We are in the try again state, so no submit button.
|
||||
return '';
|
||||
}
|
||||
return $this->submit_button($qa, $options);
|
||||
}
|
||||
|
||||
public function feedback(question_attempt $qa, question_display_options $options) {
|
||||
if (!$qa->get_state()->is_active() || !$options->readonly) {
|
||||
// Show the Try again button if we are in try-again state.
|
||||
if (!$qa->get_state()->is_active() ||
|
||||
($options->readonly !== qbehaviour_interactive::TRY_AGAIN_VISIBLE &&
|
||||
$options->readonly !== qbehaviour_interactive::TRY_AGAIN_VISIBLE_READONLY)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -54,7 +59,8 @@ class qbehaviour_interactive_renderer extends qbehaviour_renderer {
|
||||
'value' => get_string('tryagain', 'qbehaviour_interactive'),
|
||||
'class' => 'submit btn',
|
||||
);
|
||||
if ($options->readonly !== qbehaviour_interactive::READONLY_EXCEPT_TRY_AGAIN) {
|
||||
if ($options->readonly === qbehaviour_interactive::TRY_AGAIN_VISIBLE_READONLY) {
|
||||
// This means the question really was rendered with read-only option.
|
||||
$attributes['disabled'] = 'disabled';
|
||||
}
|
||||
$output = html_writer::empty_tag('input', $attributes);
|
||||
|
||||
Reference in New Issue
Block a user