protected function ensure_category_loaded() {
        if (is_array($this->_categories)) {
            return; // Already done.
        }
        if (is_null($this->_course)) {
            throw new coding_exception('Attempt to get the course category for this page before the course was set.');
        }
        if ($this->_course->category == 0) {
            $this->_categories = array();
        } else {
            $this->load_category($this->_course->category);
        }
    }
protected function ensure_category_loaded() {
        if (is_array($this->_categories)) {
            return; // Already done.
        }
        if (is_null($this->_course)) {
            throw new coding_exception('Attempt to get the course category for this page before the course was set.');
        }
        if ($this->_course->category == 0) {
            $this->_categories = array();
        } else {
            $this->load_category($this->_course->category);
        }
    }
protected function ensure_category_loaded ( ) { if ( is_array ( $ this -> _categories ) ) { return ; // Already done. } if ( is_null ( $ this -> _course ) ) { throw new coding_exception ( 'Attempt to get the course category for this page before the course was set.' ) ; } if ( $ this -> _course -> category == 0 ) { $ this -> _categories = array ( ) ; } else { $ this -> load_category ( $ this -> _course -> category ) ; } }
This function ensures that the category of the current course has been
loaded, and if not, the function loads it now.

@return void
@throws coding_exception
This function ensures that the category of the current course has been loaded and if not the function loads it now .