2

Moodle API has functions like

core_course_create_courses() 
core_course_duplicate_course() 
core_course_get_contents()

These all work fine. Is there a way to set and edit the contents of a course?

We are syncing our SIS (Student Information System) to Moodle and we want o create for every course in our SIS a course in Moodle. But we need to set contents. Even to be able to set an url back to the course in our SIS would be something.

2 Answers2

0

The course_get_contents function in course/externallib.php returns the activity modules for a course.

I don't think there is a web service for creating modules for a course.

Also, I think a web service function will need to be created for each activity module because the parameters will be different in most cases.

So you will need to create a web service:

https://docs.moodle.org/dev/Adding_a_web_service_to_a_plugin

Then I would recommend using add_moduleinfo() to create the module.

Have a look at this example for the facetoface module.

Create Moodle activities programmatically

Community
  • 1
  • 1
Russell England
  • 9,436
  • 1
  • 27
  • 41
0

One option may be to create a block that programmatically sets the URL to link back to the SIS course (you might even be able to use an iframe to embed something from there?). You can then set the block to default onto every course, either through config.php or by adding it to the front page and telling it where to display. I have used this previously to add information/links from several sources and provide links to external resources based on the course (eg module evaluations, lecture capture) although not specifically a student information system.

If you want the block in the main content area rather than a side block, you could then use a theme (or edit your own) to add a custom block region in the main content area (see the flexibase theme for multiple examples of this, there are others with custom block regions too).