|
|
@@ -20,56 +20,15 @@ class InfoSettingDataProvider extends BaseDataProvider
|
|
|
|
|
|
public function read()
|
|
|
{
|
|
|
- $this->data['domain'] = $this->getWhmcsParamByKey('domain');
|
|
|
|
|
|
- $api = new KerioWhmcs('whmcsKerioEmail', 'Thurdata', '1.0');
|
|
|
- try {
|
|
|
- $api->login($this->getWhmcsParamByKey('serverhostname'), $this->getWhmcsParamByKey('serverusername'), $this->getWhmcsParamByKey('serverpassword'));
|
|
|
- $domainID = $api->getDomainId($this->getWhmcsParamByKey('domain'));
|
|
|
- } catch (KerioApiException $error) {
|
|
|
- logModuleCall(
|
|
|
- 'kerioEmail',
|
|
|
- __FUNCTION__,
|
|
|
- $error,
|
|
|
- 'Debug Error',
|
|
|
- $error->getMessage()
|
|
|
- );
|
|
|
- return ['error' => $error->getMessage()];
|
|
|
- }
|
|
|
- $fields = array(
|
|
|
- "id",
|
|
|
- "loginName",
|
|
|
- "isEnabled");
|
|
|
- try {
|
|
|
- $users = $api->getUsers($fields,$domainID);
|
|
|
- } catch (KerioApiException $error) {
|
|
|
- logModuleCall(
|
|
|
- 'kerioEmail',
|
|
|
- __FUNCTION__,
|
|
|
- $error,
|
|
|
- 'Debug Error',
|
|
|
- $error->getMessage()
|
|
|
- );
|
|
|
- return ['error' => $error->getMessage()];
|
|
|
- }
|
|
|
- $api->logout();
|
|
|
+ logModuleCall(
|
|
|
+ 'kerioEmail',
|
|
|
+ __FUNCTION__,
|
|
|
+ $this->data,
|
|
|
+ 'Debug Data',
|
|
|
+ $this->availableValues
|
|
|
+ );
|
|
|
|
|
|
- foreach($users as $user) {
|
|
|
- if($user['isEnabled']){
|
|
|
- $this->availableValues['manager'][ $user['id']] = $user['loginName'] . '@' . $this->getWhmcsParamByKey('domain');
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- $lang = di('lang');
|
|
|
- $this->availableValues['status'] = [
|
|
|
- Kerio::ACC_STATUS_ACTIVE => $lang->absoluteT('kerio','account','status','active'),
|
|
|
- Kerio::ACC_STATUS_CLOSED => $lang->absoluteT('kerio','account','status','closed'),
|
|
|
- ];
|
|
|
-
|
|
|
- $this->availableValues['type'] = [
|
|
|
- Kerio::RES_TYPE_LOCATION => $lang->absoluteT('kerio','ressource','type','location'),
|
|
|
- Kerio::RES_TYPE_EQUIPMENT => $lang->absoluteT('kerio','ressource','type','equipment')
|
|
|
- ];
|
|
|
}
|
|
|
|
|
|
public function create()
|