function lingotek_administrative_settings_form in Lingotek Translation 6
1 string reference to 'lingotek_administrative_settings_form'
File
- ./
lingotek.admin.inc, line 24
Code
function lingotek_administrative_settings_form() {
global $_lingotek_client;
$login = variable_get('lingotek_login_id', '');
$key = variable_get('lingotek_login_key', '');
$password = variable_get('lingotek_password', '');
$community = variable_get('lingotek_community', '');
$wizard = "full";
if ($_lingotek_client
->canLogIn()) {
if ($community == '') {
$communities = lingotek_get_communities();
$num = count($communities);
//User doesn't have any communities. This should rarely happen.
if ($num == 0) {
$wizard = "signup";
drupal_set_message(t("Your user isn't part of any community. Please correct this with Lingotek."), 'error');
}
elseif ($num == 1) {
$wizard = "full";
reset($communities);
variable_set('lingotek_community', key($communities));
variable_set('lingotek_login_key', lingotek_get_cms_key());
}
else {
$wizard = "community";
}
}
else {
variable_set('lingotek_login_key', lingotek_get_cms_key());
}
}
else {
$wizard = "signup";
if ($password != '' && $login != '') {
drupal_set_message(t("Login incorrect."), 'error');
variable_del('lingotek_password');
}
}
switch ($wizard) {
case "signup":
$form = lingotek_signup_form();
break;
case "community":
//Get Community, this step could be skipped if only a member of a single community.
$form = lingotek_community_form();
break;
case "full":
default:
$form = lingotek_admin_form();
}
return system_settings_form($form);
}