You are here

function course_signup_watchdog in Course 6

Same name and namespace in other branches
  1. 7.2 modules/course_signup/course_signup.module \course_signup_watchdog()
  2. 7 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 270

Code

function course_signup_watchdog($watchdog) {
  if (strpos($watchdog['message'], 'Marked signup') !== FALSE) {
    $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();
    }
  }
}