$newpageid = lesson_unseen_question_jump($lesson->id, $USER->id, $pageid); } } elseif ($newpageid == LESSON_PREVIOUSPAGE) { $newpageid = $page->prevpageid; } elseif ($newpageid == LESSON_RANDOMPAGE) { $newpageid = lesson_random_question_jump($lesson->id, $pageid); } elseif ($newpageid == LESSON_CLUSTERJUMP) { if (has_capability('mod/lesson:manage', $context)) { if ($page->nextpageid == 0) { // if teacher, go to next page $newpageid = LESSON_EOL; } else { $newpageid = $page->nextpageid; } } else { $newpageid = lesson_cluster_jump($lesson->id, $USER->id, $pageid); } } if ($nodefaultresponse) { // Don't display feedback redirect("{$CFG->wwwroot}/mod/lesson/view.php?id={$cm->id}&pageid={$newpageid}"); } /// Set Messages // This is the warning msg for teachers to inform them that cluster and unseen does not work while logged in as a teacher if (has_capability('mod/lesson:manage', $context) and lesson_display_teacher_warning($lesson->id)) { $warningvars->cluster = get_string("clusterjump", "lesson"); $warningvars->unseen = get_string("unseenpageinbranch", "lesson"); lesson_set_message(get_string("teacherjumpwarning", "lesson", $warningvars)); } // Inform teacher that s/he will not see the timer if ($lesson->timed and has_capability('mod/lesson:manage', $context)) {
} else { $nextpageid = $page->nextpageid; } redirect("{$CFG->wwwroot}/mod/lesson/view.php?id={$cm->id}&pageid={$nextpageid}"); } else { if ($page->qtype == LESSON_ENDOFBRANCH) { // Check for endofbranches if ($answers = get_records('lesson_answers', 'pageid', $page->id, 'id')) { // print_heading(get_string('endofbranch', 'lesson')); foreach ($answers as $answer) { // just need the first answer if ($answer->jumpto == LESSON_RANDOMBRANCH) { $answer->jumpto = lesson_unseen_branch_jump($lesson->id, $USER->id); } elseif ($answer->jumpto == LESSON_CLUSTERJUMP) { if (!has_capability('mod/lesson:manage', $context)) { $answer->jumpto = lesson_cluster_jump($lesson->id, $USER->id, $pageid); } else { if ($page->nextpageid == 0) { $answer->jumpto = LESSON_EOL; } else { $answer->jumpto = $page->nextpageid; } } } else { if ($answer->jumpto == LESSON_NEXTPAGE) { if ($page->nextpageid == 0) { $answer->jumpto = LESSON_EOL; } else { $answer->jumpto = $page->nextpageid; } } else {