public static function list_plans_for_template($templateorid, $status = 0, $skip = 0, $limit = 100) {
        $template = $templateorid;
        if (!is_object($template)) {
            $template = new template($template);
        }

        // First we do a permissions check.
        if (!$template->can_read()) {
             throw new required_capability_exception($template->get_context(), 'moodle/competency:templateview',
                'nopermissions', '');
        }

        return plan::get_records_for_template($template->get('id'), $status, $skip, $limit);
    }