public static function complete_tour($tourid, $context, $pageurl, $stepid, $stepindex) {
        $params = self::validate_parameters(self::complete_tour_parameters(), [
                'tourid'    => $tourid,
                'context'   => $context,
                'pageurl'   => $pageurl,
                'stepid'    => $stepid,
                'stepindex' => $stepindex,
            ]);

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

        $tour = tourinstance::instance($params['tourid']);
        $tour->mark_user_completed();

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

        return [];
    }
public static function complete_tour($tourid, $context, $pageurl, $stepid, $stepindex) {
        $params = self::validate_parameters(self::complete_tour_parameters(), [
                'tourid'    => $tourid,
                'context'   => $context,
                'pageurl'   => $pageurl,
                'stepid'    => $stepid,
                'stepindex' => $stepindex,
            ]);

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

        $tour = tourinstance::instance($params['tourid']);
        $tour->mark_user_completed();

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

        return [];
    }
public static function complete_tour ( $ tourid , $ context , $ pageurl , $ stepid , $ stepindex ) { $ params = self :: validate_parameters ( self :: complete_tour_parameters ( ) , [ 'tourid' => $ tourid , 'context' => $ context , 'pageurl' => $ pageurl , 'stepid' => $ stepid , 'stepindex' => $ stepindex , ] ) ; $ context = \ context_helper :: instance_by_id ( $ params [ 'context' ] ) ; self :: validate_context ( $ context ) ; $ tour = tourinstance :: instance ( $ params [ 'tourid' ] ) ; $ tour -> mark_user_completed ( ) ; \ tool_usertours \ event \ tour_ended :: create ( [ 'contextid' => $ context -> id , 'objectid' => $ params [ 'tourid' ] , 'other' => [ 'pageurl' => $ params [ 'pageurl' ] , 'stepid' => $ params [ 'stepid' ] , 'stepindex' => $ params [ 'stepindex' ] , ] , ] ) -> trigger ( ) ; return [ ] ; }
Mark the specified tour as completed for the current user.

@param   int     $tourid     The ID of the tour.
@param   int     $context    The Context ID of the current page.
@param   string  $pageurl    The path of the current page.
@param   int     $stepid     The step id
@param   int     $stepindex  The step index
@return  array               As described in complete_tour_returns
Mark the specified tour as completed for the current user .