Я использую Moodle 3.1+. Я пытаюсь получить содержимое курса с помощью webservice. Я создал курс с уроком деятельности. Теперь, когда я пытаюсь получить содержимое курса с помощью webservice 'core_course_get_contents', я получаю следующий ответ.Получить содержимое курса с помощью webservice
[{"id":36,"name":" 0","visible":1,"summary":"","summaryformat":1,"modules":[{"id":18,"url":"http:\/\/localhost\/moodle\/mod\/lesson\/view.php?id=18","name":"Lesson1","instance":1,"visible":1,"modicon":"http:\/\/localhost\/moodle\/theme\/image.php\/mentornetz\/lesson\/1483338014\/icon","modname":"lesson","modplural":"Lessons","indent":0}]}]
Но ответ не содержит деталей урока.
Документация API Moodle гласит, что ответ содержит данные ниже, которые отсутствуют в моем ответе.
contents list of (
object {
type string //a file or a folder or external link
filename string //filename
filepath string //filepath
filesize int //filesize
fileurl string Optional //downloadable file url
content string Optional //Raw content, will be used when type is content
timecreated int //Time created
timemodified int //Time modified
sortorder int //Content sort order
userid int //User who added this content to moodle
author string //Content owner
license string //Content license
}
Ниже приводится ответ на WebService core_course_get_course_module
object {
cm object {
id int //The course module id
course int //The course id
module int //The module type id
name string //The activity name
modname string //The module component name (forum, assign, etc..)
instance int //The activity instance id
section int //The module section id
sectionnum int //The module section number
groupmode int //Group mode
groupingid int //Grouping id
completion int //If completion is enabled
idnumber string Optional //Module id number
added int Optional //Time added
score int Optional //Score
indent int Optional //Indentation
visible int Optional //If visible
visibleold int Optional //Visible old
completiongradeitemnumber int Optional //Completion grade item
completionview int Optional //Completion view setting
completionexpected int Optional //Completion time expected
showdescription int Optional //If the description is showed
availability string Optional //Availability settings
}
warnings Optional //list of warnings
list of (
//warning
object {
item string Optional //item
itemid int Optional //item id
warningcode string //the warning code can be used by the client app to implement specific behaviour
message string //untranslated english message to explain the warning
}
)}
Как я могу получить содержимое курса? Пожалуйста помоги.
Ну, что говорит их документация по API, как это сделать? – arkascha
@arkascha Недостаточно наличия документации. – user1690835
В документации говорится, что 'core_course_get_contents' поставляет модули курсов, включая их URL. Тогда, вероятно, вам нужно сделать следующий вызов 'core_course_get_course_module', чтобы получить более подробную информацию об определенном модуле в этом курсе. Я думаю, что это довольно очевидно из документации по адресу https://docs.moodle.org/dev/Web_service_API_functions – arkascha