2016-05-14 67 views
2

目前,Moodle的支持4 MNET服務如何使用的Moodle站點基地

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

增加更多的MNET服務添加更多的MNET的服務,我需要管理員手動添加代碼/ MNET/service.php然後添加新的mnet /服務(如現有服務mnetservice_enrol)。

我打算爲mnet peer的retrive課程詳細信息添加新的服務。 get_remote_courses方法只是返回課程概覽而非課程細節。

我無法找到任何有關這是moodle官方網站的文件。這有什麼特別的嗎?或從專家的建議?

回答

1

我們可以通過yourplugin/DB與格式,將mnet.php添加更多的MNET服務:

$publishes = array(
    'mnet_enrol' => array(
     'apiversion' => 1, 
     'classname' => 'enrol_mnet_mnetservice_enrol', 
     'filename' => 'enrol.php', 
     'methods' => array(
      'available_courses', 
      'user_enrolments', 
      'enrol_user', 
      'unenrol_user', 
      'course_enrolments', 
      'category_enrolments' 
     ), 
    ), 
); 
$subscribes = array(
    'mnet_enrol' => array(
     'available_courses' => 'enrol/mnet/enrol.php/available_courses', 
     'user_enrolments' => 'enrol/mnet/enrol.php/user_enrolments', 
     'enrol_user'  => 'enrol/mnet/enrol.php/enrol_user', 
     'unenrol_user'  => 'enrol/mnet/enrol.php/unenrol_user', 
     'course_enrolments' => 'enrol/mnet/enrol.php/course_enrolments', 
     'category_enrolments'=>'enrol/mnet/enrol.php/category_enrolments' 
    ), 
); 

新MNET服務功能店mnet_remote_rpc表:

+---------------------+----------------------------------------------+ 
| functionname  | xmlrpcpath         | 
+---------------------+----------------------------------------------+ 
| user_authorise  | auth/mnet/auth.php/user_authorise   | 
| keepalive_server | auth/mnet/auth.php/keepalive_server   | 
| kill_children  | auth/mnet/auth.php/kill_children    | 
| refresh_log   | auth/mnet/auth.php/refresh_log    | 
| fetch_user_image | auth/mnet/auth.php/fetch_user_image   | 
| fetch_theme_info | auth/mnet/auth.php/fetch_theme_info   | 
| update_enrolments | auth/mnet/auth.php/update_enrolments   | 
| keepalive_client | auth/mnet/auth.php/keepalive_client   | 
| kill_child   | auth/mnet/auth.php/kill_child    | 
| available_courses | enrol/mnet/enrol.php/available_courses  | 
| user_enrolments  | enrol/mnet/enrol.php/user_enrolments   | 
| enrol_user   | enrol/mnet/enrol.php/enrol_user    | 
| unenrol_user  | enrol/mnet/enrol.php/unenrol_user   | 
| course_enrolments | enrol/mnet/enrol.php/course_enrolments  | 
| send_content_intent | portfolio/mahara/lib.php/send_content_intent | 
| send_content_ready | portfolio/mahara/lib.php/send_content_ready | 
| category_enrolments | enrol/mnet/enrol.php/category_enrolments  | 
+---------------------+----------------------------------------------+ 

它與添加新的Web服務一樣。要更新新服務,您需要在version.php中增加版本。

2

只是想在這裏發佈方法來獲取課程內容使用webservice而不是使用mnet。 Moodle支持core_course_get_contents在webservice中獲取課程內容。

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; 
相關問題