In our Moodle, we will have a collection of courses written by experts and saved as course backups. We want new Moodle users (teachers or managers) to be able to copy these, then add their own teachers and students. We'd be doing this via Web services. But as far as I can see, there is no built-in Web service that copies a course from a backup, and nothing in OKTech's Web services either.
So I need to write my own Web service. Luckily, Rosario Carcò has written a script that restores courses from backups, available at uploaduser.php enhanced to upload also courses. From it, I see that my Web service will have to call import_backup_file_silently from /backup/lib.php. Its specification being:
* import_backup_file_silently($pathtofile, * $destinationcourse, * $emptyfirst=false, * $userdata=false, * $preferences=array()) * * From the corresponding X-REF: * this function will restore an entire backup.zip into the specified course * using standard moodle backup/restore functions, but silently. * @param string $pathtofile the absolute path to the backup file. * @param int $destinationcourse the course id to restore to. * @param boolean $emptyfirst whether to delete all coursedata first. * @param boolean $userdata whether to include any userdata that may be in the backup file. * @param array $preferences optional, 0 will be used. Can contain: * metacourse * logs * course_files * messagesSo that's what I'll be trying.