You are here

function course_poll_fulfill in Course 7.2

Same name and namespace in other branches
  1. 8.3 modules/course_poll/course_poll.module \course_poll_fulfill()
  2. 8.2 modules/course_poll/course_poll.module \course_poll_fulfill()
  3. 6 modules/course_poll/course_poll.module \course_poll_fulfill()
  4. 7 modules/course_poll/course_poll.module \course_poll_fulfill()
  5. 3.x modules/course_poll/course_poll.module \course_poll_fulfill()

Fulfill the voting object.

1 string reference to 'course_poll_fulfill'
course_poll_form_poll_view_voting_alter in modules/course_poll/course_poll.module
Implements hook_form_FORMID_alter().

File

modules/course_poll/course_poll.module, line 29

Code

function course_poll_fulfill(&$form, &$form_state) {
  global $user;
  $nid = $form['#node']->nid;
  $chid = $form_state['values']['choice'];

  // Find the course object associated with this poll.
  if ($courseObject = course_get_course_object('course_poll', 'poll', $nid)) {
    $courseObject
      ->getFulfillment($user)
      ->setOption('instance', $chid)
      ->setComplete()
      ->save();
  }
}