public static function fetch_and_start_tour($tourid, $context, $pageurl) {
        global $PAGE;

        $params = self::validate_parameters(self::fetch_and_start_tour_parameters(), [
                'tourid'    => $tourid,
                'context'   => $context,
                'pageurl'   => $pageurl,
            ]);

        $context = \context_helper::instance_by_id($params['context']);
        self::validate_context($context);

        $tour = tourinstance::instance($params['tourid']);
        if (!$tour->should_show_for_user()) {
            return [];
        }

        $touroutput = new \tool_usertours\output\tour($tour);

        \tool_usertours\event\tour_started::create([
            'contextid' => $context->id,
            'objectid'  => $tourid,
            'other'     => [
                'pageurl' => $pageurl,
            ],
        ])->trigger();

        return [
            'tourconfig' => $touroutput->export_for_template($PAGE->get_renderer('core')),
        ];
    }
public static function fetch_and_start_tour($tourid, $context, $pageurl) {
        global $PAGE;

        $params = self::validate_parameters(self::fetch_and_start_tour_parameters(), [
                'tourid'    => $tourid,
                'context'   => $context,
                'pageurl'   => $pageurl,
            ]);

        $context = \context_helper::instance_by_id($params['context']);
        self::validate_context($context);

        $tour = tourinstance::instance($params['tourid']);
        if (!$tour->should_show_for_user()) {
            return [];
        }

        $touroutput = new \tool_usertours\output\tour($tour);

        \tool_usertours\event\tour_started::create([
            'contextid' => $context->id,
            'objectid'  => $tourid,
            'other'     => [
                'pageurl' => $pageurl,
            ],
        ])->trigger();

        return [
            'tourconfig' => $touroutput->export_for_template($PAGE->get_renderer('core')),
        ];
    }
public static function fetch_and_start_tour ( $ tourid , $ context , $ pageurl ) { global $ PAGE ; $ params = self :: validate_parameters ( self :: fetch_and_start_tour_parameters ( ) , [ 'tourid' => $ tourid , 'context' => $ context , 'pageurl' => $ pageurl , ] ) ; $ context = \ context_helper :: instance_by_id ( $ params [ 'context' ] ) ; self :: validate_context ( $ context ) ; $ tour = tourinstance :: instance ( $ params [ 'tourid' ] ) ; if ( ! $ tour -> should_show_for_user ( ) ) { return [ ] ; } $ touroutput = new \ tool_usertours \ output \ tour ( $ tour ) ; \ tool_usertours \ event \ tour_started :: create ( [ 'contextid' => $ context -> id , 'objectid' => $ tourid , 'other' => [ 'pageurl' => $ pageurl , ] , ] ) -> trigger ( ) ; return [ 'tourconfig' => $ touroutput -> export_for_template ( $ PAGE -> get_renderer ( 'core' ) ) , ] ; }
Fetch the tour configuration for the specified tour.

@param   int     $tourid     The ID of the tour to fetch.
@param   int     $context    The Context ID of the current page.
@param   string  $pageurl    The path of the current page.
@return  array               As described in fetch_and_start_tour_returns
Fetch the tour configuration for the specified tour .