Moodle core_course_create_courses - 从特定模板创建课程
我正在尝试使用 Moodle API 从模板创建新课程,但没有成功。 下面的代码确实创建了包含所有详细信息但不包含模板课程内容的课程。 知道如何实现这一目标吗?
我有一个 ID = 9 或 ShortCourseName = TEMPLATE 的模板课程
这是让我头晕的最后一块拼图。
https://DOMAIN/webservice/rest/server.php?wstoken=TOKEN&wsfunction=core_course_create_courses
&courses[0][fullname]=Test Full name
&courses[0][shortname]=testshortname
&courses[0][categoryid]=1
&courses[0][idnumber]=41-11
&courses[0][courseformatoptions][0][name]=TEMPLATE
&courses[0][courseformatoptions][0][value]=9
&courses[0][format]=tiles
&courses[0][startdate]=1641013490
&courses[0][enddate]=1647839103
&moodlewsrestformat=jsoncode
I am trying to use Moodle API to create a new course from a TEMPLATE, but no luck.
Below is a code that does create a course with all the detials but no content from the TEMPLATE course.
Any idea how to achieve this?
I have a template course with ID = 9 or ShortCourseName = TEMPLATE
This is the last piece of the puzzle that makes my head spin.
https://DOMAIN/webservice/rest/server.php?wstoken=TOKEN&wsfunction=core_course_create_courses
&courses[0][fullname]=Test Full name
&courses[0][shortname]=testshortname
&courses[0][categoryid]=1
&courses[0][idnumber]=41-11
&courses[0][courseformatoptions][0][name]=TEMPLATE
&courses[0][courseformatoptions][0][value]=9
&courses[0][format]=tiles
&courses[0][startdate]=1641013490
&courses[0][enddate]=1647839103
&moodlewsrestformat=jsoncode
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

发布评论
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
根据 https://docs.moodle.org/311/en/Adding_a_new_course#Course_templates< /a> - 您可以使用管理设置中的“上传课程”功能(站点管理 > 课程 > 上传)从模板创建课程课程),通过上传的 CSV 创建一门或多门课程。
Web 服务函数 core_course_create_courses 的代码不包含对从模板创建课程的任何支持 - 如果您需要此类功能,那么您需要聘请开发人员来编写自定义 Web 服务函数。或者,您可以尝试寻找开发人员来扩展现有的核心代码并提供回 Moodle 核心的补丁,以允许在 Moodle 的未来版本中支持此功能 - 有一个请求此功能的开放票证:https://tracker.moodle.org/browse/MDL-69219(可能还有其他重复项)票,但那是我找到的)。
According to https://docs.moodle.org/311/en/Adding_a_new_course#Course_templates - you can create a course from a template by using the "Upload courses" feature in the admin settings (Site admin > Courses > Upload coures), to create one or more courses via an uploaded CSV.
The code for the webservice function core_course_create_courses does not include any support for creating courses from templates - if you want such functionality, then you'll need to hire a developer to write a custom webservice function. Alternatively, you could try to find a developer to extend the existing core code and provide a patch back to Moodle core, to allow this to be supported in future versions of Moodle - there is an open ticket requesting this feature at: https://tracker.moodle.org/browse/MDL-69219 (there may be other duplicate tickets, but that's the one I found).