/** * Display a checkbox for shuffling question within a section. * * @param structure $structure object containing the structure of the quiz. * @param \stdClass $section data from the quiz_section table. * @return string HTML to output. */ public function section_shuffle_questions(structure $structure, $section) { $checkboxattributes = array('type' => 'checkbox', 'id' => 'shuffle-' . $section->id, 'value' => 1, 'data-action' => 'shuffle_questions', 'class' => 'cm-edit-action'); if (!$structure->can_be_edited()) { $checkboxattributes['disabled'] = 'disabled'; } if ($section->shufflequestions) { $checkboxattributes['checked'] = 'checked'; } if ($structure->is_first_section($section)) { $help = $this->help_icon('shufflequestions', 'quiz'); } else { $help = ''; } $progressspan = html_writer::span('', 'shuffle-progress'); $checkbox = html_writer::empty_tag('input', $checkboxattributes); $label = html_writer::label(get_string('shufflequestions', 'quiz') . ' ' . $help, $checkboxattributes['id'], false); return html_writer::span($progressspan . $checkbox . $label, 'instanceshufflequestions', array('data-action' => 'shuffle_questions')); }