original_string: public function user_can_view_aggregate($userid = null) {
          if (empty($userid)) {
              global $USER;
              $userid = $USER->id;
          }
  
          // If the item doesnt belong to anyone or its another user's items and they can see the aggregate on items they don't own.
          // Note that viewany doesnt mean you can see the aggregate or ratings of your own items.
          if ((empty($this->itemuserid) or $this->itemuserid != $userid)
              && $this->settings->permissions->viewany
              && $this->settings->pluginpermissions->viewany ) {
  
              return true;
          }
  
          // If its the current user's item and they have permission to view the aggregate on their own items.
          if ($this->itemuserid == $userid
              && $this->settings->permissions->view
              && $this->settings->pluginpermissions->view) {
  
              return true;
          }
  
          return false;
      }
code: public function user_can_view_aggregate($userid = null) {
          if (empty($userid)) {
              global $USER;
              $userid = $USER->id;
          }
  
          // If the item doesnt belong to anyone or its another user's items and they can see the aggregate on items they don't own.
          // Note that viewany doesnt mean you can see the aggregate or ratings of your own items.
          if ((empty($this->itemuserid) or $this->itemuserid != $userid)
              && $this->settings->permissions->viewany
              && $this->settings->pluginpermissions->viewany ) {
  
              return true;
          }
  
          // If its the current user's item and they have permission to view the aggregate on their own items.
          if ($this->itemuserid == $userid
              && $this->settings->permissions->view
              && $this->settings->pluginpermissions->view) {
  
              return true;
          }
  
          return false;
      }
code_tokens: public function user_can_view_aggregate ( $ userid = null ) { if ( empty ( $ userid ) ) { global $ USER ; $ userid = $ USER -> id ; } // If the item doesnt belong to anyone or its another user's items and they can see the aggregate on items they don't own. // Note that viewany doesnt mean you can see the aggregate or ratings of your own items. if ( ( empty ( $ this -> itemuserid ) or $ this -> itemuserid != $ userid ) && $ this -> settings -> permissions -> viewany && $ this -> settings -> pluginpermissions -> viewany ) { return true ; } // If its the current user's item and they have permission to view the aggregate on their own items. if ( $ this -> itemuserid == $ userid && $ this -> settings -> permissions -> view && $ this -> settings -> pluginpermissions -> view ) { return true ; } return false ; }
docstring: Returns true if the user is able to view the aggregate for this rating object.
  
  @param int|null $userid If left empty the current user is assumed.
  @return bool true if the user is able to view the aggregate for this rating object
docstring_tokens: Returns true if the user is able to view the aggregate for this rating object .