當前位置: 首頁>>代碼示例>>PHP>>正文


PHP webservice::get_not_associated_external_functions方法代碼示例

本文整理匯總了PHP中webservice::get_not_associated_external_functions方法的典型用法代碼示例。如果您正苦於以下問題:PHP webservice::get_not_associated_external_functions方法的具體用法?PHP webservice::get_not_associated_external_functions怎麽用?PHP webservice::get_not_associated_external_functions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在webservice的用法示例。


在下文中一共展示了webservice::get_not_associated_external_functions方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: definition

 function definition()
 {
     global $CFG;
     $mform = $this->_form;
     $data = $this->_customdata;
     $mform->addElement('header', 'addfunction', get_string('addfunctions', 'webservice'));
     require_once $CFG->dirroot . "/webservice/lib.php";
     $webservicemanager = new webservice();
     $functions = $webservicemanager->get_not_associated_external_functions($data['id']);
     //we add the descriptions to the functions
     foreach ($functions as $functionid => $functionname) {
         //retrieve full function information (including the description)
         $function = external_function_info($functionname);
         $functions[$functionid] = $function->name . ':' . $function->description;
     }
     $mform->addElement('searchableselector', 'fids', get_string('name'), $functions, array('multiple'));
     $mform->addElement('hidden', 'id');
     $mform->setType('id', PARAM_INT);
     $mform->addElement('hidden', 'action');
     $mform->setType('action', PARAM_ACTION);
     $this->add_action_buttons(true, get_string('addfunctions', 'webservice'));
     $this->set_data($data);
 }
開發者ID:nickread,項目名稱:moodle,代碼行數:23,代碼來源:forms.php

示例2: webservice

}
foreach ($capabilities as $capability) {
    assign_capability($capability->name, CAP_ALLOW, $roleid, $context->id, true);
}
$context->mark_dirty();
// Create a new service with all functions for the user.
$webservicemanager = new webservice();
if (!($service = $DB->get_record('external_services', array('shortname' => 'mdk_all')))) {
    $service = new stdClass();
    $service->name = 'MDK: All functions';
    $service->shortname = 'mdk_all';
    $service->enabled = 1;
    $service->restrictedusers = 1;
    $service->downloadfiles = 1;
    $service->id = $webservicemanager->add_external_service($service);
}
$functions = $webservicemanager->get_not_associated_external_functions($service->id);
foreach ($functions as $function) {
    $webservicemanager->add_external_function_to_service($function->name, $service->id);
}
if (!$webservicemanager->get_ws_authorised_user($service->id, $user->id)) {
    $adduser = new stdClass();
    $adduser->externalserviceid = $service->id;
    $adduser->userid = $user->id;
    $webservicemanager->add_ws_authorised_user($adduser);
}
// Generate a token for the user.
if (!($token = $DB->get_field('external_tokens', 'token', array('userid' => $user->id, 'externalserviceid' => $service->id)))) {
    $token = external_generate_token(EXTERNAL_TOKEN_PERMANENT, $service->id, $user->id, $context, 0, '');
}
mtrace('User \'webservice\' token: ' . $token);
開發者ID:junpataleta,項目名稱:mdk,代碼行數:31,代碼來源:webservices.php


注:本文中的webservice::get_not_associated_external_functions方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。