original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: 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
docstring_tokens: Do activity logs contain any write log of user in this context?