final public static function load($id, lesson $lesson) {
        global $DB;

        if (is_object($id) && !empty($id->qtype)) {
            $page = $id;
        } else {
            $page = $DB->get_record("lesson_pages", array("id" => $id));
            if (!$page) {
                print_error('cannotfindpages', 'lesson');
            }
        }
        $manager = lesson_page_type_manager::get($lesson);

        $class = 'lesson_page_type_'.$manager->get_page_type_idstring($page->qtype);
        if (!class_exists($class)) {
            $class = 'lesson_page';
        }

        return new $class($page, $lesson);
    }
final public static function load($id, lesson $lesson) {
        global $DB;

        if (is_object($id) && !empty($id->qtype)) {
            $page = $id;
        } else {
            $page = $DB->get_record("lesson_pages", array("id" => $id));
            if (!$page) {
                print_error('cannotfindpages', 'lesson');
            }
        }
        $manager = lesson_page_type_manager::get($lesson);

        $class = 'lesson_page_type_'.$manager->get_page_type_idstring($page->qtype);
        if (!class_exists($class)) {
            $class = 'lesson_page';
        }

        return new $class($page, $lesson);
    }
final public static function load ( $ id , lesson $ lesson ) { global $ DB ; if ( is_object ( $ id ) && ! empty ( $ id -> qtype ) ) { $ page = $ id ; } else { $ page = $ DB -> get_record ( "lesson_pages" , array ( "id" => $ id ) ) ; if ( ! $ page ) { print_error ( 'cannotfindpages' , 'lesson' ) ; } } $ manager = lesson_page_type_manager :: get ( $ lesson ) ; $ class = 'lesson_page_type_' . $ manager -> get_page_type_idstring ( $ page -> qtype ) ; if ( ! class_exists ( $ class ) ) { $ class = 'lesson_page' ; } return new $ class ( $ page , $ lesson ) ; }
This method loads a page object from the database and returns it as a
specialised object that extends lesson_page

@final
@static
@param int $id
@param lesson $lesson
@return lesson_page Specialised lesson_page object
This method loads a page object from the database and returns it as a specialised object that extends lesson_page