original_string: public function check_examples_assessed_before_submission($userid) {
  
          if ($this->useexamples and $this->examplesmode == self::EXAMPLES_BEFORE_SUBMISSION
              and !has_capability('mod/workshop:manageexamples', $this->context)) {
  
              // Check that all required examples have been assessed by the user.
              $examples = $this->get_examples_for_reviewer($userid);
              foreach ($examples as $exampleid => $example) {
                  if (is_null($example->assessmentid)) {
                      $examples[$exampleid]->assessmentid = $this->add_allocation($example, $userid, 0);
                  }
                  if (is_null($example->grade)) {
                      return false;
                  }
              }
          }
          return true;
      }
code: public function check_examples_assessed_before_submission($userid) {
  
          if ($this->useexamples and $this->examplesmode == self::EXAMPLES_BEFORE_SUBMISSION
              and !has_capability('mod/workshop:manageexamples', $this->context)) {
  
              // Check that all required examples have been assessed by the user.
              $examples = $this->get_examples_for_reviewer($userid);
              foreach ($examples as $exampleid => $example) {
                  if (is_null($example->assessmentid)) {
                      $examples[$exampleid]->assessmentid = $this->add_allocation($example, $userid, 0);
                  }
                  if (is_null($example->grade)) {
                      return false;
                  }
              }
          }
          return true;
      }
code_tokens: public function check_examples_assessed_before_submission ( $ userid ) { if ( $ this -> useexamples and $ this -> examplesmode == self :: EXAMPLES_BEFORE_SUBMISSION and ! has_capability ( 'mod/workshop:manageexamples' , $ this -> context ) ) { // Check that all required examples have been assessed by the user. $ examples = $ this -> get_examples_for_reviewer ( $ userid ) ; foreach ( $ examples as $ exampleid => $ example ) { if ( is_null ( $ example -> assessmentid ) ) { $ examples [ $ exampleid ] -> assessmentid = $ this -> add_allocation ( $ example , $ userid , 0 ) ; } if ( is_null ( $ example -> grade ) ) { return false ; } } } return true ; }
docstring: Check whether the given user has assessed all his required examples before submission.
  
  @param  int $userid the user to check
  @return bool        false if there are examples missing assessment, true otherwise.
  @since  Moodle 3.4
docstring_tokens: Check whether the given user has assessed all his required examples before submission .