Adding course sections via web service?

Adding course sections via web service?

by Brian Huether -
Number of replies: 1

I noticed there is no existing web service function to add course sections

What I am trying to do is add courses from my existing site's backend since I have existing lessons where each lesson has a section. My site is in laravel. In my back I want to be able to add a course and sections. So in my back end I set up courses as


course

   topic1

   topic2

etc.

In laravel it is easy to set up events based on database actions. So on my site when I add a course I want it to create the course and sections on moodle (my site simply advertises my courses - course execution is via moodle). I was thinking for sections I could just do it via a database insert function, but not sure if in moodle the addition of a setion has various triggers that perform other functions, like with roles, etc.

Any tips on how to do this?

thanks,

Brian

Average of ratings: -
In reply to Brian Huether

Re: Adding course sections via web service?

by Dominique Palumbo -
Picture of Particularly helpful Moodlers Picture of Plugin developers
Hi Brian,

I think two tables are involved.

mdl_course_sections of course and mdl_course_format_options

I use that query for mysql DB
SELECT TABLE_NAME, COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME like '%section%'

And get that
TABLE_NAME COLUMN_NAME
mdl_course_sections section (keeper of course)
mdl_course_format_options sectionid (foreign key so keeper)

mdl_course_modules section (probably used when you want to add module to section)
mdl_tool_recyclebin_course section (when you delete a section so not involved)
mdl_wiki_locks sectionname (section name in the wiki so not involved)

Hope it's help.

Dominique.