public function load_page($pageid, lesson $lesson) {
        global $DB;
        if (!($page =$DB->get_record('lesson_pages', array('id'=>$pageid, 'lessonid'=>$lesson->id)))) {
            print_error('cannotfindpages', 'lesson');
        }
        $pagetype = get_class($this->types[$page->qtype]);
        $page = new $pagetype($page, $lesson);
        return $page;
    }
public function load_page($pageid, lesson $lesson) {
        global $DB;
        if (!($page =$DB->get_record('lesson_pages', array('id'=>$pageid, 'lessonid'=>$lesson->id)))) {
            print_error('cannotfindpages', 'lesson');
        }
        $pagetype = get_class($this->types[$page->qtype]);
        $page = new $pagetype($page, $lesson);
        return $page;
    }
public function load_page ( $ pageid , lesson $ lesson ) { global $ DB ; if ( ! ( $ page = $ DB -> get_record ( 'lesson_pages' , array ( 'id' => $ pageid , 'lessonid' => $ lesson -> id ) ) ) ) { print_error ( 'cannotfindpages' , 'lesson' ) ; } $ pagetype = get_class ( $ this -> types [ $ page -> qtype ] ) ; $ page = new $ pagetype ( $ page , $ lesson ) ; return $ page ; }
Loads a page for the provided lesson given it's id

This function loads a page from the lesson when given both the lesson it belongs
to as well as the page's id.
If the page doesn't exist an error is thrown

@param int $pageid The id of the page to load
@param lesson $lesson The lesson the page belongs to
@return lesson_page A class that extends lesson_page
Loads a page for the provided lesson given it s id