public function question_preview_icon($quiz, $question, $label = null, $variant = null) {
        $url = quiz_question_preview_url($quiz, $question, $variant);

        // Do we want a label?
        $strpreviewlabel = '';
        if ($label) {
            $strpreviewlabel = ' ' . get_string('preview', 'quiz');
        }

        // Build the icon.
        $strpreviewquestion = get_string('previewquestion', 'quiz');
        $image = $this->pix_icon('t/preview', $strpreviewquestion);

        $action = new \popup_action('click', $url, 'questionpreview',
                                        question_preview_popup_params());

        return $this->action_link($url, $image . $strpreviewlabel, $action,
                array('title' => $strpreviewquestion, 'class' => 'preview'));
    }
public function question_preview_icon($quiz, $question, $label = null, $variant = null) {
        $url = quiz_question_preview_url($quiz, $question, $variant);

        // Do we want a label?
        $strpreviewlabel = '';
        if ($label) {
            $strpreviewlabel = ' ' . get_string('preview', 'quiz');
        }

        // Build the icon.
        $strpreviewquestion = get_string('previewquestion', 'quiz');
        $image = $this->pix_icon('t/preview', $strpreviewquestion);

        $action = new \popup_action('click', $url, 'questionpreview',
                                        question_preview_popup_params());

        return $this->action_link($url, $image . $strpreviewlabel, $action,
                array('title' => $strpreviewquestion, 'class' => 'preview'));
    }
public function question_preview_icon ( $ quiz , $ question , $ label = null , $ variant = null ) { $ url = quiz_question_preview_url ( $ quiz , $ question , $ variant ) ; // Do we want a label? $ strpreviewlabel = '' ; if ( $ label ) { $ strpreviewlabel = ' ' . get_string ( 'preview' , 'quiz' ) ; } // Build the icon. $ strpreviewquestion = get_string ( 'previewquestion' , 'quiz' ) ; $ image = $ this -> pix_icon ( 't/preview' , $ strpreviewquestion ) ; $ action = new \ popup_action ( 'click' , $ url , 'questionpreview' , question_preview_popup_params ( ) ) ; return $ this -> action_link ( $ url , $ image . $ strpreviewlabel , $ action , array ( 'title' => $ strpreviewquestion , 'class' => 'preview' ) ) ; }
Render the preview icon.

@param \stdClass $quiz the quiz settings from the database.
@param \stdClass $question data from the question and quiz_slots tables.
@param bool $label if true, show the preview question label after the icon
@param int $variant which question variant to preview (optional).
@return string HTML to output.
Render the preview icon .