You are here

function opigno_quiz_get_continue_course in Opigno Quiz App 7

1 call to opigno_quiz_get_continue_course()
opigno_quiz_get_continue_group in ./opigno_quiz_app.module

File

./opigno_quiz_app.module, line 2092
Module file. Defines module hooks.

Code

function opigno_quiz_get_continue_course($node, $uid) {
  $lessons = opigno_quiz_app_course_lessons($node->nid);
  if (!empty($lessons[$node->nid])) {
    $lessons_ids = array_keys($lessons[$node->nid]);
    foreach ($lessons_ids as $lesson_id) {
      $results = quiz_get_score_data(array(
        $lesson_id,
      ), $uid, FALSE);
      foreach ($results as $score) {
        if ($score->percent_pass > $score->percent_score) {
          return $lesson_id;
        }
      }
    }
  }
  return NULL;
}