本文整理汇总了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);
}
示例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);