protected function ensure_categories_loaded() {
        global $DB;
        $this->ensure_category_loaded();
        if (!is_null(end($this->_categories))) {
            return; // Already done.
        }
        $idstoload = array_keys($this->_categories);
        array_shift($idstoload);
        $categories = $DB->get_records_list('course_categories', 'id', $idstoload);
        foreach ($idstoload as $catid) {
            $this->_categories[$catid] = $categories[$catid];
        }
    }
protected function ensure_categories_loaded() {
        global $DB;
        $this->ensure_category_loaded();
        if (!is_null(end($this->_categories))) {
            return; // Already done.
        }
        $idstoload = array_keys($this->_categories);
        array_shift($idstoload);
        $categories = $DB->get_records_list('course_categories', 'id', $idstoload);
        foreach ($idstoload as $catid) {
            $this->_categories[$catid] = $categories[$catid];
        }
    }
protected function ensure_categories_loaded ( ) { global $ DB ; $ this -> ensure_category_loaded ( ) ; if ( ! is_null ( end ( $ this -> _categories ) ) ) { return ; // Already done. } $ idstoload = array_keys ( $ this -> _categories ) ; array_shift ( $ idstoload ) ; $ categories = $ DB -> get_records_list ( 'course_categories' , 'id' , $ idstoload ) ; foreach ( $ idstoload as $ catid ) { $ this -> _categories [ $ catid ] = $ categories [ $ catid ] ; } }
Ensures that the category the current course is within, as well as all of
its parent categories, have been loaded.

@return void
Ensures that the category the current course is within as well as all of its parent categories have been loaded .