You can get a data structure that contains lots of information about the structure of the course by calling get_fast_modinfo($courseid);
Blocks
How to query all the topics per course inside a block ?
This discussion has been locked so you can no longer reply to it.