original_string: public function evaluate_submission($submission, $data, $canpublish, $canoverride) {
          global $DB, $USER;
  
          $data = file_postupdate_standard_editor($data, 'feedbackauthor', array(), $this->context);
          $record = new stdclass();
          $record->id = $submission->id;
          if ($canoverride) {
              $record->gradeover = $this->raw_grade_value($data->gradeover, $this->grade);
              $record->gradeoverby = $USER->id;
              $record->feedbackauthor = $data->feedbackauthor;
              $record->feedbackauthorformat = $data->feedbackauthorformat;
          }
          if ($canpublish) {
              $record->published = !empty($data->published);
          }
          $DB->update_record('workshop_submissions', $record);
      }
code: public function evaluate_submission($submission, $data, $canpublish, $canoverride) {
          global $DB, $USER;
  
          $data = file_postupdate_standard_editor($data, 'feedbackauthor', array(), $this->context);
          $record = new stdclass();
          $record->id = $submission->id;
          if ($canoverride) {
              $record->gradeover = $this->raw_grade_value($data->gradeover, $this->grade);
              $record->gradeoverby = $USER->id;
              $record->feedbackauthor = $data->feedbackauthor;
              $record->feedbackauthorformat = $data->feedbackauthorformat;
          }
          if ($canpublish) {
              $record->published = !empty($data->published);
          }
          $DB->update_record('workshop_submissions', $record);
      }
code_tokens: public function evaluate_submission ( $ submission , $ data , $ canpublish , $ canoverride ) { global $ DB , $ USER ; $ data = file_postupdate_standard_editor ( $ data , 'feedbackauthor' , array ( ) , $ this -> context ) ; $ record = new stdclass ( ) ; $ record -> id = $ submission -> id ; if ( $ canoverride ) { $ record -> gradeover = $ this -> raw_grade_value ( $ data -> gradeover , $ this -> grade ) ; $ record -> gradeoverby = $ USER -> id ; $ record -> feedbackauthor = $ data -> feedbackauthor ; $ record -> feedbackauthorformat = $ data -> feedbackauthorformat ; } if ( $ canpublish ) { $ record -> published = ! empty ( $ data -> published ) ; } $ DB -> update_record ( 'workshop_submissions' , $ record ) ; }
docstring: Evaluates a submission.
  
  @param  stdClass $submission the submission
  @param  stdClass $data       the submission data to be updated
  @param  bool $canpublish     whether the user can publish the submission
  @param  bool $canoverride    whether the user can override the submission grade
  @return void
  @since  Moodle 3.4
docstring_tokens: Evaluates a submission .