php - 如何使用 Moodle 站点库添加更多 Mnet 服务

标签 php networking moodle xml-rpc

目前,moodle 支持 4 个 mnet 服务

1. Remote enrolment service 
2. Portfolio services 
3. SSO (Identity Provider)
4. SSO (Service Provider)

要添加更多 mnet 服务,我需要手动添加 admin/mnet/service.php 代码,然后在 mnet/service 中添加新服务(如现有服务 mnetservice_enrol)。

我打算添加新服务,以便从 mnet 对等方检索类(class)详细信息。 get_remote_courses 方法仅返回类(class)概述,不返回类(class)详细信息。

我在moodle官方网站上找不到任何关于此的文档。有这方面的教程吗?或者专家的一些建议?

最佳答案

只是想在这里发布使用 webservice 而不是使用 mnet 获取类(class)内容的方法。 Moodle 支持 Web 服务中的 core_course_get_contents 来获取类(class)内容。

require_once('../../config.php');

$token = '5733b5401924f1e6dafefd326cafeaca';
$domainname = 'http://192.168.1.252';
$courseid = optional_param('remoteid', 0, PARAM_INT);

require_once($CFG->dirroot . '/lib/zend/Zend/Http/Client.php');

$functionname = 'core_course_get_contents';

$serverurl = $domainname . '/webservice/rest/server.php'. '?wstoken=' . $token . '&wsfunction='.$functionname.'&moodlewsrestformat=json';

$client = new Zend_Http_Client($serverurl);
$client->setParameterPost('courseid', $courseid);
$response = $client->request(Zend_Http_Client::POST);

echo $response;

关于php - 如何使用 Moodle 站点库添加更多 Mnet 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37224956/

相关文章:

PHP 表单不将信息保存到 SQL 数据库

php - FFmpeg infile 路径,我的域

c - IP 片段的 UDP 校验和如何变化?

c - 有没有办法使用 C 程序在 .txt 文件上获取 linux 命令(如 ifconfig)的输出?

moodle - 在 Moodle 中添加 CSS 类到表单元素

windows - 如何在 Windows 本地主机上使用 CodeRunner 模块安装 moodle?

php - SQL 查询中的数组?

linux - 我可以使用原始套接字拦截网络数据包(不仅是嗅探)吗?

python - 通过遍历列表用 python 创建 XML 文件

php - 从 PHP 从 HTML 表单调用输入时的未定义值