function lingotek_list_community_integrations in Lingotek Translation 7.7
Same name and namespace in other branches
- 7.4 lingotek.setup.inc \lingotek_list_community_integrations()
- 7.5 lingotek.setup.inc \lingotek_list_community_integrations()
- 7.6 lingotek.setup.inc \lingotek_list_community_integrations()
3 calls to lingotek_list_community_integrations()
- lingotek_community_select_form in ./
lingotek.setup.inc - Community Select Screen (for Current Users) - Form
- lingotek_get_community_name in ./
lingotek.util.inc - lingotek_setup_account_settings_form_submit in ./
lingotek.setup.inc - Account Settings (for Current Users) - Form Processing
1 string reference to 'lingotek_list_community_integrations'
File
- ./
lingotek.setup.inc, line 1010
Code
function lingotek_list_community_integrations($login, $passwd) {
// API V4 Connection
$client = new LingotekSession();
$client->login_id = $login;
$client->password = $passwd;
$client->url = LINGOTEK_API_SERVER . '/lingopoint/api/4';
$options = array();
if (!$client
->canLogIn()) {
return array(
FALSE,
t('Failed to connect to the Lingotek service: @error', array(
'@error' => $client
->getLastLoginMsg(),
)),
);
}
$list_community_integrations = $client
->request("listCommunityIntegrations", array());
if ($list_community_integrations->results == "success") {
foreach ($list_community_integrations->communities as $community) {
foreach ($community->integration_methods as $integration_method) {
if (!empty($integration_method->key) && !empty($integration_method->secret)) {
// select first InboundOAuth Integration keys
$integration_method->community_name = $community->name;
$integration_method->community_id = isset($community->id) ? $community->id : $community->name;
$options[$integration_method->community_id] = $integration_method;
break;
}
}
}
}
return array(
TRUE,
$options,
);
}