original_string: public function delete($source=null) {
          global $DB;
          if (!empty($this->courseid)) {
              $DB->delete_records('grade_outcomes_courses', array('outcomeid' => $this->id, 'courseid' => $this->courseid));
          }
          if (parent::delete($source)) {
              $context = context_system::instance();
              $fs = get_file_storage();
              $files = $fs->get_area_files($context->id, 'grade', 'outcome', $this->id);
              foreach ($files as $file) {
                  $file->delete();
              }
              return true;
          }
          return false;
      }
code: public function delete($source=null) {
          global $DB;
          if (!empty($this->courseid)) {
              $DB->delete_records('grade_outcomes_courses', array('outcomeid' => $this->id, 'courseid' => $this->courseid));
          }
          if (parent::delete($source)) {
              $context = context_system::instance();
              $fs = get_file_storage();
              $files = $fs->get_area_files($context->id, 'grade', 'outcome', $this->id);
              foreach ($files as $file) {
                  $file->delete();
              }
              return true;
          }
          return false;
      }
code_tokens: public function delete ( $ source = null ) { global $ DB ; if ( ! empty ( $ this -> courseid ) ) { $ DB -> delete_records ( 'grade_outcomes_courses' , array ( 'outcomeid' => $ this -> id , 'courseid' => $ this -> courseid ) ) ; } if ( parent :: delete ( $ source ) ) { $ context = context_system :: instance ( ) ; $ fs = get_file_storage ( ) ; $ files = $ fs -> get_area_files ( $ context -> id , 'grade' , 'outcome' , $ this -> id ) ; foreach ( $ files as $ file ) { $ file -> delete ( ) ; } return true ; } return false ; }
docstring: Deletes this outcome from the database.
  
  @param string $source from where was the object deleted (mod/forum, manual, etc.)
  @return bool success
docstring_tokens: Deletes this outcome from the database .