public function get_child_contexts() {
        global $DB;

        if (empty($this->_path) or empty($this->_depth)) {
            debugging('Can not find child contexts of context '.$this->_id.' try rebuilding of context paths');
            return array();
        }

        $sql = "SELECT ctx.*
                  FROM {context} ctx
                 WHERE ctx.path LIKE ? AND (ctx.depth = ? OR ctx.contextlevel = ?)";
        $params = array($this->_path.'/%', $this->depth+1, CONTEXT_COURSECAT);
        $records = $DB->get_records_sql($sql, $params);

        $result = array();
        foreach ($records as $record) {
            $result[$record->id] = context::create_instance_from_record($record);
        }

        return $result;
    }
public function get_child_contexts() {
        global $DB;

        if (empty($this->_path) or empty($this->_depth)) {
            debugging('Can not find child contexts of context '.$this->_id.' try rebuilding of context paths');
            return array();
        }

        $sql = "SELECT ctx.*
                  FROM {context} ctx
                 WHERE ctx.path LIKE ? AND (ctx.depth = ? OR ctx.contextlevel = ?)";
        $params = array($this->_path.'/%', $this->depth+1, CONTEXT_COURSECAT);
        $records = $DB->get_records_sql($sql, $params);

        $result = array();
        foreach ($records as $record) {
            $result[$record->id] = context::create_instance_from_record($record);
        }

        return $result;
    }
public function get_child_contexts ( ) { global $ DB ; if ( empty ( $ this -> _path ) or empty ( $ this -> _depth ) ) { debugging ( 'Can not find child contexts of context ' . $ this -> _id . ' try rebuilding of context paths' ) ; return array ( ) ; } $ sql = "SELECT ctx.*
                  FROM {context} ctx
                 WHERE ctx.path LIKE ? AND (ctx.depth = ? OR ctx.contextlevel = ?)" ; $ params = array ( $ this -> _path . '/%' , $ this -> depth + 1 , CONTEXT_COURSECAT ) ; $ records = $ DB -> get_records_sql ( $ sql , $ params ) ; $ result = array ( ) ; foreach ( $ records as $ record ) { $ result [ $ record -> id ] = context :: create_instance_from_record ( $ record ) ; } return $ result ; }
Returns immediate child contexts of category and all subcategories,
children of subcategories and courses are not returned.

@return array
Returns immediate child contexts of category and all subcategories children of subcategories and courses are not returned .