public function start_attempt_button($buttontext, moodle_url $url,
            mod_quiz_preflight_check_form $preflightcheckform = null,
            $popuprequired = false, $popupoptions = null) {

        if (is_string($preflightcheckform)) {
            // Calling code was not updated since the API change.
            debugging('The third argument to start_attempt_button should now be the ' .
                    'mod_quiz_preflight_check_form from ' .
                    'quiz_access_manager::get_preflight_check_form, not a warning message string.');
        }

        $button = new single_button($url, $buttontext);
        $button->class .= ' quizstartbuttondiv';
        if ($popuprequired) {
            $button->class .= ' quizsecuremoderequired';
        }

        $popupjsoptions = null;
        if ($popuprequired && $popupoptions) {
            $action = new popup_action('click', $url, 'popup', $popupoptions);
            $popupjsoptions = $action->get_js_options();
        }

        if ($preflightcheckform) {
            $checkform = $preflightcheckform->render();
        } else {
            $checkform = null;
        }

        $this->page->requires->js_call_amd('mod_quiz/preflightcheck', 'init',
                array('.quizstartbuttondiv [type=submit]', get_string('startattempt', 'quiz'),
                       '#mod_quiz_preflight_form', $popupjsoptions));

        return $this->render($button) . $checkform;
    }
public function start_attempt_button($buttontext, moodle_url $url,
            mod_quiz_preflight_check_form $preflightcheckform = null,
            $popuprequired = false, $popupoptions = null) {

        if (is_string($preflightcheckform)) {
            // Calling code was not updated since the API change.
            debugging('The third argument to start_attempt_button should now be the ' .
                    'mod_quiz_preflight_check_form from ' .
                    'quiz_access_manager::get_preflight_check_form, not a warning message string.');
        }

        $button = new single_button($url, $buttontext);
        $button->class .= ' quizstartbuttondiv';
        if ($popuprequired) {
            $button->class .= ' quizsecuremoderequired';
        }

        $popupjsoptions = null;
        if ($popuprequired && $popupoptions) {
            $action = new popup_action('click', $url, 'popup', $popupoptions);
            $popupjsoptions = $action->get_js_options();
        }

        if ($preflightcheckform) {
            $checkform = $preflightcheckform->render();
        } else {
            $checkform = null;
        }

        $this->page->requires->js_call_amd('mod_quiz/preflightcheck', 'init',
                array('.quizstartbuttondiv [type=submit]', get_string('startattempt', 'quiz'),
                       '#mod_quiz_preflight_form', $popupjsoptions));

        return $this->render($button) . $checkform;
    }
public function start_attempt_button ( $ buttontext , moodle_url $ url , mod_quiz_preflight_check_form $ preflightcheckform = null , $ popuprequired = false , $ popupoptions = null ) { if ( is_string ( $ preflightcheckform ) ) { // Calling code was not updated since the API change. debugging ( 'The third argument to start_attempt_button should now be the ' . 'mod_quiz_preflight_check_form from ' . 'quiz_access_manager::get_preflight_check_form, not a warning message string.' ) ; } $ button = new single_button ( $ url , $ buttontext ) ; $ button -> class .= ' quizstartbuttondiv' ; if ( $ popuprequired ) { $ button -> class .= ' quizsecuremoderequired' ; } $ popupjsoptions = null ; if ( $ popuprequired && $ popupoptions ) { $ action = new popup_action ( 'click' , $ url , 'popup' , $ popupoptions ) ; $ popupjsoptions = $ action -> get_js_options ( ) ; } if ( $ preflightcheckform ) { $ checkform = $ preflightcheckform -> render ( ) ; } else { $ checkform = null ; } $ this -> page -> requires -> js_call_amd ( 'mod_quiz/preflightcheck' , 'init' , array ( '.quizstartbuttondiv [type=submit]' , get_string ( 'startattempt' , 'quiz' ) , '#mod_quiz_preflight_form' , $ popupjsoptions ) ) ; return $ this -> render ( $ button ) . $ checkform ; }
Generates the view attempt button

@param string $buttontext the label to display on the button.
@param moodle_url $url The URL to POST to in order to start the attempt.
@param mod_quiz_preflight_check_form $preflightcheckform deprecated.
@param bool $popuprequired whether the attempt needs to be opened in a pop-up.
@param array $popupoptions the options to use if we are opening a popup.
@return string HTML fragment.
Generates the view attempt button