我想使用“ enrol_manual_enrol_users”功能。一个必填字段来执行此“ roleid”。我想从Moodle中提取角色列表,并将其呈现给用户,以选择应将学生注册为哪个角色。我看不到任何返回角色列表的函数。有内置的Web服务吗?
答案 0 :(得分:0)
AFAIK不需要检索Moodle角色的Web Servies API(Overview)。您可以在mdl_role表中找到角色ID。除非进行修改,否则它们将如下所示:
+------+--------+------------------+---------------+-------------+------------------+
| "id" | "name" | "shortname" | "description" | "sortorder" | "archetype" |
+------+--------+------------------+---------------+-------------+------------------+
| "1" | "" | "manager" | "" | "1" | "manager" |
| "2" | "" | "coursecreator" | "" | "2" | "coursecreator" |
| "3" | "" | "editingteacher" | "" | "3" | "editingteacher" |
| "4" | "" | "teacher" | "" | "4" | "teacher" |
| "5" | "" | "student" | "" | "5" | "student" |
| "6" | "" | "guest" | "" | "6" | "guest" |
| "7" | "" | "user" | "" | "7" | "user" |
| "8" | "" | "frontpage" | "" | "8" | "frontpage" |
+------+--------+------------------+---------------+-------------+------------------+
很可能您只需要学生和老师的角色。
由于使用了Moodle Core API,因此建议在设置中使用activating the built-in API documentation(管理块>插件> Web服务> API文档)。
官方Web Services Forum也是一个想知道的想法。