我需要將成績從我的moodle匯出到另一個網站,我在網上尋找你需要在moodle上創建一個網路服務(我已經做到了),現在我需要一個帶有php代碼的網頁來使用我的網路服務,我在網上搜索對于一些示例(我是 Web 開發的新手),并在這里找到有人談論它,有人可以解釋一下這段代碼是如何作業的,我如何使用將我的成績匯出到我的其他網站。
編碼:
<?php
$token = 'meutoken';
$domainname = 'http://meumoodle';
$functionname = 'core_user_get_users';
$restformat = 'json'; //Also possible in Moodle 2.2 and later: 'json'
//Setting it to 'json' will fail all calls on earlier Moodle version
//////// moodle_user_create_users ////////
/// PARAMETERS - NEED TO BE CHANGED IF YOU CALL A DIFFERENT FUNCTION
$user1 = new stdClass();
$user1->key = 'username';
$user1->value = 'myvalue';
$users = array($user1);
$params = array('criteria' => $users);
$serverurl = $domainname . '/webservice/rest/server.php'. '?wstoken=' . $token .
'&wsfunction='.$functionname;
//require_once('./curl.php');
$curl = new cURL();
//if rest format == 'xml', then we do not add the param for backward compatibility with Moodle
< 2.2
$restformat = ($restformat == 'json')?'&moodlewsrestformat=' . $restformat:'';
$resp = $curl->get($serverurl . $restformat, $params);
$json = json_encode($resp);
$obj = json_decode($resp);
?>
uj5u.com熱心網友回復:
您還可以一次性手動匯出成績,或通過 URL 匯出成績而無需任何開發。
要從課程中匯出成績,請轉到課程,然后是課程管理選單,然后是成績簿,然后匯出
要通過 URL 匯出,請參閱https://docs.moodle.org/400/en/Grade_export#Grade_publishing
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/484414.html
