You are here

function CourseObjectPoll::unEnroll in Course 7

Same name and namespace in other branches
  1. 6 modules/course_poll/course_poll.classes.inc \CourseObjectPoll::unEnroll()

Remove poll votes for this user.

Overrides CourseObject::unEnroll

File

modules/course_poll/course_poll.classes.inc, line 72

Class

CourseObjectPoll
Parent class for poll tracking.

Code

function unEnroll() {
  $account = $this
    ->getCourse()
    ->getUser();
  db_delete('poll_vote')
    ->condition('nid', $this
    ->getNode()->nid)
    ->condition('uid', $account->uid)
    ->execute();
  db_update('poll_choice')
    ->expression('chvotes', 'chvotes - 1')
    ->condition('chid', $this
    ->getFulfillment($account)
    ->getOption('instance'))
    ->execute();
}