View moodle course content somewhere else
-
21-12-2019 - |
Question
I have a special course (I know the id) , the artifacts of this course have to be displayed in some other part of my customized page.
I could do that by rendering the artifacts related to this course id from database tables like mdl_assignments, mdl_quiz etc.
But I want to know is there any inbuilt method to view the course content without any weekly/topic format.
I want just the artifact titles and the links to it
Note: I saw the code in course/view.php but it's little messed up.
I am using moodle 2.2
Thanks in adv.
Solution
Yes, there's a way. Enable webservices and use core_course_get_contents
. Read this document to know how to do this: Using web services - Moodle Wiki.
Image above, output of the webservice (credit).
Moreover, you could take a look to the method used by the web service, get_course_contents
. You can read its implementation here: https://github.com/moodle/moodle/blob/master/course/externallib.php#L61