original_string: public function can_view_analysis() {
          global $USER;
  
          $context = context_module::instance($this->cm->id);
          if (has_capability('mod/feedback:viewreports', $context, $this->userid)) {
              return true;
          }
  
          if (intval($this->get_feedback()->publish_stats) != 1 ||
                  !has_capability('mod/feedback:viewanalysepage', $context, $this->userid)) {
              return false;
          }
  
          if ((!isloggedin() && $USER->id == $this->userid) || isguestuser($this->userid)) {
              // There is no tracking for the guests, assume that they can view analysis if condition above is satisfied.
              return $this->feedback->course == SITEID;
          }
  
          return $this->is_already_submitted(true);
      }
code: public function can_view_analysis() {
          global $USER;
  
          $context = context_module::instance($this->cm->id);
          if (has_capability('mod/feedback:viewreports', $context, $this->userid)) {
              return true;
          }
  
          if (intval($this->get_feedback()->publish_stats) != 1 ||
                  !has_capability('mod/feedback:viewanalysepage', $context, $this->userid)) {
              return false;
          }
  
          if ((!isloggedin() && $USER->id == $this->userid) || isguestuser($this->userid)) {
              // There is no tracking for the guests, assume that they can view analysis if condition above is satisfied.
              return $this->feedback->course == SITEID;
          }
  
          return $this->is_already_submitted(true);
      }
code_tokens: public function can_view_analysis ( ) { global $ USER ; $ context = context_module :: instance ( $ this -> cm -> id ) ; if ( has_capability ( 'mod/feedback:viewreports' , $ context , $ this -> userid ) ) { return true ; } if ( intval ( $ this -> get_feedback ( ) -> publish_stats ) != 1 || ! has_capability ( 'mod/feedback:viewanalysepage' , $ context , $ this -> userid ) ) { return false ; } if ( ( ! isloggedin ( ) && $ USER -> id == $ this -> userid ) || isguestuser ( $ this -> userid ) ) { // There is no tracking for the guests, assume that they can view analysis if condition above is satisfied. return $ this -> feedback -> course == SITEID ; } return $ this -> is_already_submitted ( true ) ; }
docstring: Checks if current user is able to view feedback on this course.
  
  @return bool
docstring_tokens: Checks if current user is able to view feedback on this course .