after managing to add modules to Moodle programmaticaly (see my old question here) I now also need to add the module at a specific place.
Lets take for example a sample course in Moodle, I have:
Section 0
- Module 1
- --> ADD NEW MODULE HERE <--
- Module 2
Section 1
- Module 1
- Module 2
Section 2
So I need to add the new module I create programatically inbetween module 1 and 2 of section 0.
I know that the order of modules come from table mdl_course_sections and its specified in the column sequence where the ids of the modules exist in comma separated values
Is there a function in Moodle that does that? Set the sequence of a section? I don't want to mess with the DB directly.