protected function render_quiz_nav_question_button(quiz_nav_question_button $button) {
        $classes = array('qnbutton', $button->stateclass, $button->navmethod, 'btn', 'btn-secondary');
        $extrainfo = array();

        if ($button->currentpage) {
            $classes[] = 'thispage';
            $extrainfo[] = get_string('onthispage', 'quiz');
        }

        // Flagged?
        if ($button->flagged) {
            $classes[] = 'flagged';
            $flaglabel = get_string('flagged', 'question');
        } else {
            $flaglabel = '';
        }
        $extrainfo[] = html_writer::tag('span', $flaglabel, array('class' => 'flagstate'));

        if (is_numeric($button->number)) {
            $qnostring = 'questionnonav';
        } else {
            $qnostring = 'questionnonavinfo';
        }

        $a = new stdClass();
        $a->number = $button->number;
        $a->attributes = implode(' ', $extrainfo);
        $tagcontents = html_writer::tag('span', '', array('class' => 'thispageholder')) .
                        html_writer::tag('span', '', array('class' => 'trafficlight')) .
                        get_string($qnostring, 'quiz', $a);
        $tagattributes = array('class' => implode(' ', $classes), 'id' => $button->id,
                                  'title' => $button->statestring, 'data-quiz-page' => $button->page);

        if ($button->url) {
            return html_writer::link($button->url, $tagcontents, $tagattributes);
        } else {
            return html_writer::tag('span', $tagcontents, $tagattributes);
        }
    }
protected function render_quiz_nav_question_button(quiz_nav_question_button $button) {
        $classes = array('qnbutton', $button->stateclass, $button->navmethod, 'btn', 'btn-secondary');
        $extrainfo = array();

        if ($button->currentpage) {
            $classes[] = 'thispage';
            $extrainfo[] = get_string('onthispage', 'quiz');
        }

        // Flagged?
        if ($button->flagged) {
            $classes[] = 'flagged';
            $flaglabel = get_string('flagged', 'question');
        } else {
            $flaglabel = '';
        }
        $extrainfo[] = html_writer::tag('span', $flaglabel, array('class' => 'flagstate'));

        if (is_numeric($button->number)) {
            $qnostring = 'questionnonav';
        } else {
            $qnostring = 'questionnonavinfo';
        }

        $a = new stdClass();
        $a->number = $button->number;
        $a->attributes = implode(' ', $extrainfo);
        $tagcontents = html_writer::tag('span', '', array('class' => 'thispageholder')) .
                        html_writer::tag('span', '', array('class' => 'trafficlight')) .
                        get_string($qnostring, 'quiz', $a);
        $tagattributes = array('class' => implode(' ', $classes), 'id' => $button->id,
                                  'title' => $button->statestring, 'data-quiz-page' => $button->page);

        if ($button->url) {
            return html_writer::link($button->url, $tagcontents, $tagattributes);
        } else {
            return html_writer::tag('span', $tagcontents, $tagattributes);
        }
    }
protected function render_quiz_nav_question_button ( quiz_nav_question_button $ button ) { $ classes = array ( 'qnbutton' , $ button -> stateclass , $ button -> navmethod , 'btn' , 'btn-secondary' ) ; $ extrainfo = array ( ) ; if ( $ button -> currentpage ) { $ classes [ ] = 'thispage' ; $ extrainfo [ ] = get_string ( 'onthispage' , 'quiz' ) ; } // Flagged? if ( $ button -> flagged ) { $ classes [ ] = 'flagged' ; $ flaglabel = get_string ( 'flagged' , 'question' ) ; } else { $ flaglabel = '' ; } $ extrainfo [ ] = html_writer :: tag ( 'span' , $ flaglabel , array ( 'class' => 'flagstate' ) ) ; if ( is_numeric ( $ button -> number ) ) { $ qnostring = 'questionnonav' ; } else { $ qnostring = 'questionnonavinfo' ; } $ a = new stdClass ( ) ; $ a -> number = $ button -> number ; $ a -> attributes = implode ( ' ' , $ extrainfo ) ; $ tagcontents = html_writer :: tag ( 'span' , '' , array ( 'class' => 'thispageholder' ) ) . html_writer :: tag ( 'span' , '' , array ( 'class' => 'trafficlight' ) ) . get_string ( $ qnostring , 'quiz' , $ a ) ; $ tagattributes = array ( 'class' => implode ( ' ' , $ classes ) , 'id' => $ button -> id , 'title' => $ button -> statestring , 'data-quiz-page' => $ button -> page ) ; if ( $ button -> url ) { return html_writer :: link ( $ button -> url , $ tagcontents , $ tagattributes ) ; } else { return html_writer :: tag ( 'span' , $ tagcontents , $ tagattributes ) ; } }
Display a quiz navigation button.

@param quiz_nav_question_button $button
@return string HTML fragment.
Display a quiz navigation button .