You are here

public function CourseObjectWebform::unEnroll in Course 7

Remove all webform submissions associated with this fulfillment.

Overrides CourseObject::unEnroll

File

modules/course_webform/course_webform.classes.inc, line 78

Class

CourseObjectWebform
Parent class for webform course tracking.

Code

public function unEnroll() {
  parent::unEnroll();
  $fulfillment = $this
    ->getFulfillment();
  $node = $this
    ->getNode();
  if ($sids = $fulfillment
    ->getOption('sids')) {
    module_load_include('inc', 'webform', 'includes/webform.submissions');
    foreach ($sids as $sid) {
      if ($submission = webform_get_submission($node->nid, $sid)) {
        webform_submission_delete($node, $submission);
      }
    }
  }
}