protected final function any_write_log($contextid, $user) {
        if (empty($this->activitylogs[$contextid])) {
            return false;
        }

        // No specific user, we look at all activity logs.
        $it = $this->activitylogs[$contextid];
        if ($user) {
            if (empty($this->activitylogs[$contextid][$user->id])) {
                return false;
            }
            $it = array($user->id => $this->activitylogs[$contextid][$user->id]);
        }
        foreach ($it as $events) {
            foreach ($events as $log) {
                if ($log->crud === 'c' || $log->crud === 'u') {
                    return true;
                }
            }
        }

        return false;
    }
protected final function any_write_log($contextid, $user) {
        if (empty($this->activitylogs[$contextid])) {
            return false;
        }

        // No specific user, we look at all activity logs.
        $it = $this->activitylogs[$contextid];
        if ($user) {
            if (empty($this->activitylogs[$contextid][$user->id])) {
                return false;
            }
            $it = array($user->id => $this->activitylogs[$contextid][$user->id]);
        }
        foreach ($it as $events) {
            foreach ($events as $log) {
                if ($log->crud === 'c' || $log->crud === 'u') {
                    return true;
                }
            }
        }

        return false;
    }
protected final function any_write_log ( $ contextid , $ user ) { if ( empty ( $ this -> activitylogs [ $ contextid ] ) ) { return false ; } // No specific user, we look at all activity logs. $ it = $ this -> activitylogs [ $ contextid ] ; if ( $ user ) { if ( empty ( $ this -> activitylogs [ $ contextid ] [ $ user -> id ] ) ) { return false ; } $ it = array ( $ user -> id => $ this -> activitylogs [ $ contextid ] [ $ user -> id ] ) ; } foreach ( $ it as $ events ) { foreach ( $ events as $ log ) { if ( $ log -> crud === 'c' || $ log -> crud === 'u' ) { return true ; } } } return false ; }
Do activity logs contain any write log of user in this context?

If user is empty we look for any write log in this context.

@param int $contextid
@param \stdClass|false $user
@return bool
Do activity logs contain any write log of user in this context?