/** * Display the start of a section, before the questions. * * @param structure $structure the structure of the quiz being edited. * @param \stdClass $section The quiz_section entry from DB * @return string HTML to output. */ protected function start_section($structure, $section) { $output = ''; $sectionstyle = ''; if ($structure->is_only_one_slot_in_section($section)) { $sectionstyle = ' only-has-one-slot'; } $output .= html_writer::start_tag('li', array('id' => 'section-' . $section->id, 'class' => 'section main clearfix' . $sectionstyle, 'role' => 'region', 'aria-label' => $section->heading)); $output .= html_writer::start_div('content'); $output .= html_writer::start_div('section-heading'); $headingtext = $this->heading(html_writer::span(html_writer::span($section->heading, 'instancesection'), 'sectioninstance'), 3); if (!$structure->can_be_edited()) { $editsectionheadingicon = ''; } else { $editsectionheadingicon = html_writer::link(new \moodle_url('#'), $this->pix_icon('t/editstring', get_string('sectionheadingedit', 'quiz', $section->heading), 'moodle', array('class' => 'editicon visibleifjs')), array('class' => 'editing_section', 'data-action' => 'edit_section_title')); } $output .= html_writer::div($headingtext . $editsectionheadingicon, 'instancesectioncontainer'); if (!$structure->is_first_section($section) && $structure->can_be_edited()) { $output .= $this->section_remove_icon($section); } $output .= $this->section_shuffle_questions($structure, $section); $output .= html_writer::end_div($output, 'section-heading'); return $output; }