original_string: public function delete_submission(stdclass $submission) {
          global $DB;
  
          $assessments = $DB->get_records('workshop_assessments', array('submissionid' => $submission->id), '', 'id');
          $this->delete_assessment(array_keys($assessments));
  
          $fs = get_file_storage();
          $fs->delete_area_files($this->context->id, 'mod_workshop', 'submission_content', $submission->id);
          $fs->delete_area_files($this->context->id, 'mod_workshop', 'submission_attachment', $submission->id);
  
          $DB->delete_records('workshop_submissions', array('id' => $submission->id));
  
          // Event information.
          $params = array(
              'context' => $this->context,
              'courseid' => $this->course->id,
              'relateduserid' => $submission->authorid,
              'other' => array(
                  'submissiontitle' => $submission->title
              )
          );
          $params['objectid'] = $submission->id;
          $event = \mod_workshop\event\submission_deleted::create($params);
          $event->add_record_snapshot('workshop', $this->dbrecord);
          $event->trigger();
      }
code: public function delete_submission(stdclass $submission) {
          global $DB;
  
          $assessments = $DB->get_records('workshop_assessments', array('submissionid' => $submission->id), '', 'id');
          $this->delete_assessment(array_keys($assessments));
  
          $fs = get_file_storage();
          $fs->delete_area_files($this->context->id, 'mod_workshop', 'submission_content', $submission->id);
          $fs->delete_area_files($this->context->id, 'mod_workshop', 'submission_attachment', $submission->id);
  
          $DB->delete_records('workshop_submissions', array('id' => $submission->id));
  
          // Event information.
          $params = array(
              'context' => $this->context,
              'courseid' => $this->course->id,
              'relateduserid' => $submission->authorid,
              'other' => array(
                  'submissiontitle' => $submission->title
              )
          );
          $params['objectid'] = $submission->id;
          $event = \mod_workshop\event\submission_deleted::create($params);
          $event->add_record_snapshot('workshop', $this->dbrecord);
          $event->trigger();
      }
code_tokens: public function delete_submission ( stdclass $ submission ) { global $ DB ; $ assessments = $ DB -> get_records ( 'workshop_assessments' , array ( 'submissionid' => $ submission -> id ) , '' , 'id' ) ; $ this -> delete_assessment ( array_keys ( $ assessments ) ) ; $ fs = get_file_storage ( ) ; $ fs -> delete_area_files ( $ this -> context -> id , 'mod_workshop' , 'submission_content' , $ submission -> id ) ; $ fs -> delete_area_files ( $ this -> context -> id , 'mod_workshop' , 'submission_attachment' , $ submission -> id ) ; $ DB -> delete_records ( 'workshop_submissions' , array ( 'id' => $ submission -> id ) ) ; // Event information. $ params = array ( 'context' => $ this -> context , 'courseid' => $ this -> course -> id , 'relateduserid' => $ submission -> authorid , 'other' => array ( 'submissiontitle' => $ submission -> title ) ) ; $ params [ 'objectid' ] = $ submission -> id ; $ event = \ mod_workshop \ event \ submission_deleted :: create ( $ params ) ; $ event -> add_record_snapshot ( 'workshop' , $ this -> dbrecord ) ; $ event -> trigger ( ) ; }
docstring: Removes the submission and all relevant data
  
  @param stdClass $submission record to delete
  @return void
docstring_tokens: Removes the submission and all relevant data