You are here

function course_signup_watchdog in Course 7

Same name and namespace in other branches
  1. 6 modules/course_signup/course_signup.module \course_signup_watchdog()
  2. 7.2 modules/course_signup/course_signup.module \course_signup_watchdog()

Track attendance.

@todo, find a better way? looking at you,

See also

signup_mark_attended_action

File

modules/course_signup/course_signup.module, line 314

Code

function course_signup_watchdog($watchdog) {
  if (preg_match('/Marked signup @signup_id attended./', $watchdog['message'])) {
    $sid = reset($watchdog['variables']);
    $signup = signup_load_signup($sid);
    $account = user_load($signup->uid);
    $complete = strpos($watchdog['message'], 'did not') === FALSE;
    if ($courseObject = course_get_course_object('course_signup', 'signup_attendance', $signup->nid, $account)) {
      $courseObject
        ->getFulfillment()
        ->setComplete($complete)
        ->save();
    }
  }
}