Hi Thiago,
you can also read the code of the course renderer.php to inspire you.
https://github.com/roelmann/moodle-theme_flexibase/blob/master/renderers/course_renderer.php
you can also read the code of the course renderer.php to inspire you.
https://github.com/roelmann/moodle-theme_flexibase/blob/master/renderers/course_renderer.php
from line 180 to 208
Hope it's help.
Dominique.