使用网络服务获取课程内容

2024-01-02

我正在使用 Moodle 3.1+。我正在尝试使用网络服务获取课程内容。我创建了一个包含活动“课程”的课程。现在,当我尝试使用网络服务“core_course_get_contents”获取课程内容时,我收到以下响应。

[{"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}]}]

但回复不包含课程详细信息。

Moodle API 文档说响应包含以下详细信息,但我的响应中缺少这些详细信息。

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
} 

以下是 web 服务 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
} 
)} 

如何获取课程内容?请帮忙。


并非所有模块都支持导出其内容。根据快速grep,我发现它主要限于资源:书籍、页面、文件、网址...

如果您将 URL 资源添加到课程中,网络服务应返回其内容。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用网络服务获取课程内容 的相关文章

  • php 打印 aa aaa ab aab 直到 zzz 的算法

    你好 我需要打印从 a 到 zzz 最多 3 个字母 例如我的输出应该是 A B Z AA AB AZ BA BB ZZ AAA AAB ZZZ 我在过去的 5 个小时里努力尝试 我找不到任何逻辑 我尝试了下面的代码 PHP 有一个方便的功
  • SQL 大表中的随机行(使用 where 子句)

    我有一个网站 人们可以在其中对汽车进行投票 向用户展示 4 辆汽车 他 她可以投票选出他们最喜欢的汽车 桌子cars有重要的列 car id int 10 not auto increment so has gaps views int 7
  • 如何将自定义类型数组传递给 Postgres 函数

    我有一个自定义类型 CREATE TYPE mytype as id uuid amount numeric 13 4 我想将它传递给具有以下签名的函数 CREATE FUNCTION myschema myfunction id uuid
  • 在 Kohana 中,可以触发 404 错误吗?

    我有一个名为articles 它创建从数据库获取相关数据的文章模型 我想 如果我调用的方法返回false 触发 404 错误 这是我到目前为止所拥有的 articleName this gt uri gt segment articles
  • PMA 4.5.2.0 file_exists():open_basedir 限制生效

    从 PPA 在我的 Ubuntu 服务器上安装 phpMyAdmin 后 https launchpad net nijel archive ubuntu phpmyadmin https launchpad net nijel archi
  • 使用 PhpStorm 删除 CakePHP 中的插件后出现“成员有私人访问错误”

    从我的 CakePHP 框架中删除插件以及与其关联的所有代码行后 我在以下位置收到错误getInitializer的功能autoload static php in my vendor gt composer folder public s
  • 将 PHP mcrypt 与 Rijndael/AES 结合使用

    我正在尝试使用 php 中的 mcrypt 和密码 Rijndael 加密一些文本消息 但我不确定 MCRYPT MODE modename 根据 PHP 手册 这些可用 ecb cbc cfb ofb nofb 或 stream 但我读到
  • CSS 无法与 CodeIgniter 一起使用

    这是我的 CI 代码的一部分 class page extends CI Controller var Page public function construct parent construct this gt Page 1 this
  • 如何计算加权平均值?

    我的语言是PHP 但是算法应该是相当通用的 我有一个关联数组 比方说 评级和评级次数 ratings array 1 gt 1 2 gt 3 3 gt 6 4 gt 3 5 gt 3 这相当于 1 2 2 2 3 3 3 3 3 3 4 4
  • 通过 AJAX 发送 XML

    我在 jQuery 中创建了一个 xml 文档 如下所示 var xmlDocument
  • PHP/MySQL:如何在网站中创建评论部分[关闭]

    很难说出这里问的是什么 这个问题是含糊的 模糊的 不完整的 过于宽泛的或修辞性的 无法以目前的形式得到合理的回答 如需帮助澄清此问题以便重新打开 访问帮助中心 help reopen questions 我不会问 如何使用 PHP MySQ
  • 如何在无法重启的服务器(Apache)上使用gettext?

    我在服务器故障上问了这个问题 https serverfault com questions 104224 how do you use gettext on server apache you cant restart但我没有得到任何回应
  • 数据表 - 服务器端处理 - 数据库列合并

    我目前正在使用 DataTables 1 10 5 服务器端处理功能 http www datatables net examples data sources server side html http www datatables ne
  • PHP mkdir() 和 fopen() 不起作用 - 权限问题? umask问题?

    以下 PHP 脚本无法创建目录 它也将无法创建文件 当目录已经存在时 ini set error reporting E ALL define ABSPATH SERVER DOCUMENT ROOT echo ABSPATH br br
  • PHP 时间间隔

    我正在寻找一个看起来应该非常简单的解决方案 但似乎我不能在这里找到任何好的答案 而且我自己似乎无法让它发挥作用 我正在寻找的是设置开始时间 结束时间 然后迭代给定时间间隔之间的一组时间 例如 上午 9 00 下午 5 00 是开始时间 这些
  • 如何使用 PHP 获取列中的所有值?

    我一直在到处寻找这个问题 但仍然找不到解决方案 如何从 mySQL 列中获取所有值并将它们存储在数组中 例如 表名称 客户 列名称 ID 名称 行数 5 我想获取此表中所有 5 个名称的数组 我该如何去做呢 我正在使用 PHP 我试图 SE
  • 无法与站点通信以检查致命错误

    无法与站点通信以检查致命错误 因此 PHP 更改已恢复 您需要通过其他方式上传 PHP 文件更改 例如使用 SFTP 有什么解决办法 我正在 WordPress 中编辑头文件 遇到这个问题 尝试这个 我有同样的问题并决定调查一下 更改 wp
  • php56 - CentOS - Remi 仓库

    我刚刚在测试盒上安装了 php 5 6 正常的 cli php 解释器似乎不存在 gt php v bash php command not found gt php56 v PHP 5 6 13 cli built Sep 3 2015
  • 如何移动 Zend_Layout 的“视图”

    通常它会是这样的结构 application modules somemodule views scripts index index phtml 我如何将其移动到 application templates somemodule temp
  • 如何获取 URL 中未知的 $_GET 值的数组?

    我正在使用一个在线购物车 它接受订购的商品并通过 URL 将其唯一 ID 传递到 process php 页面 所以 URL 看起来像这样 process php code 1 231 code 2 532 code 3 342 Anoth

随机推荐