/** * Checks to see if a page is a cluster page or is * a page that is enclosed by a cluster page and an end of cluster or end of lesson * May call this function: {@link lesson_is_page_in_cluster()} * * @param int $lesson Id of the lesson to which the page belongs. * @param int $pageid Id of the page. * @return boolean True or false. **/ function lesson_display_cluster_jump($lesson, $pageid) { global $DB; if ($pageid == 0) { // first page return false; } // get all of the lesson pages $params = array("lessonid" => $lesson); if (!($lessonpages = $DB->get_records_select("lesson_pages", "lessonid = :lessonid", $params))) { // adding first page return false; } if ($lessonpages[$pageid]->qtype == LESSON_CLUSTER) { return true; } return lesson_is_page_in_cluster($lessonpages, $pageid); }
/** * Checks to see if a page is a cluster page or is * a page that is enclosed by a cluster page and an end of cluster or end of lesson * May call this function: {@link lesson_is_page_in_cluster()} * * @param int $lesson Id of the lesson to which the page belongs. * @param int $pageid Id of the page. * @return boolean True or false. **/ function lesson_display_cluster_jump($lesson, $pageid) { if ($pageid == 0) { // first page return false; } // get all of the lesson pages if (!($lessonpages = get_records_select("lesson_pages", "lessonid = {$lesson}"))) { // adding first page return false; } if ($lessonpages[$pageid]->qtype == LESSON_CLUSTER) { return true; } return lesson_is_page_in_cluster($lessonpages, $pageid); }