|
|
@@ -28,6 +28,7 @@ use ThurData\Servers\KerioEmail\Core\UI\Widget\DataTable\DataProviders\DataProvi
|
|
|
use ThurData\Servers\KerioEmail\Core\UI\Interfaces\ClientArea;
|
|
|
use ThurData\Servers\KerioEmail\Core\UI\Widget\DataTable\DataProviders\Providers\ArrayDataProvider;
|
|
|
use ThurData\Servers\KerioEmail\Core\UI\Widget\DataTable\DataTable;
|
|
|
+use ThurData\Servers\KerioEmail\Api\KerioWhmcs;
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
@@ -66,15 +67,15 @@ class Ressources extends DataTable implements ClientArea
|
|
|
->addColumn((new Column('ressource'))
|
|
|
->setOrderable(DataProvider::SORT_ASC)
|
|
|
->setSearchable(true, Column::TYPE_STRING))
|
|
|
- ->addColumn((new Column('date_created'))
|
|
|
+ ->addColumn((new Column('description'))
|
|
|
->setOrderable()
|
|
|
- ->setSearchable(true))
|
|
|
- ->addColumn((new Column('capacity'))
|
|
|
- ->setOrderable()
|
|
|
- ->setSearchable(true))
|
|
|
+ ->setSearchable(true, Column::TYPE_INT))
|
|
|
->addColumn((new Column('type'))
|
|
|
->setOrderable()
|
|
|
->setSearchable(true, Column::TYPE_INT))
|
|
|
+ ->addColumn((new Column('manager'))
|
|
|
+ ->setOrderable()
|
|
|
+ ->setSearchable(true))
|
|
|
->addColumn((new Column('status'))
|
|
|
->setOrderable()
|
|
|
->setSearchable(true));
|
|
|
@@ -114,7 +115,7 @@ class Ressources extends DataTable implements ClientArea
|
|
|
*/
|
|
|
public function replaceFieldType($key, $row)
|
|
|
{
|
|
|
- return $row[$key] == 'Location' ? di('lang')->absoluteT('kerio','ressource','type','location') : di('lang')->absoluteT('kerio','ressource','type','equipment');
|
|
|
+ return $row[$key] == 'Room' ? di('lang')->absoluteT('kerio','ressource','type','location') : di('lang')->absoluteT('kerio','ressource','type','equipment');
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -134,20 +135,10 @@ class Ressources extends DataTable implements ClientArea
|
|
|
$this->addActionButton(new EditRessourceButton());
|
|
|
$this->addActionButton(new DeleteRessourceButton());
|
|
|
|
|
|
- $mailBox = new LoginToPanelButton();
|
|
|
- $mailBox
|
|
|
- ->setRawUrl(BuildUrlExtended::getProvisioningUrl('webmail', true, true,'clientSso'))
|
|
|
- ->setRedirectParams(['actionElementId' => 'true']);
|
|
|
-
|
|
|
$actions = new SpanDropdownButton('actions');
|
|
|
$actions->addButton(new ChangeStatusButton());
|
|
|
$actions->addButton(new ChangePasswordButton());
|
|
|
|
|
|
- if ($productManager->get('ca_logInToMailboxButton') === 'on')
|
|
|
- {
|
|
|
- $actions->addButton($mailBox);
|
|
|
- }
|
|
|
-
|
|
|
$this->addActionButton($actions);
|
|
|
|
|
|
}
|
|
|
@@ -162,14 +153,39 @@ class Ressources extends DataTable implements ClientArea
|
|
|
*/
|
|
|
$hosting = Hosting::where('id', $this->getRequestValue('id'))->first();
|
|
|
|
|
|
-
|
|
|
- $ressources = (new KerioManager())
|
|
|
- ->getApiByServer($hosting->server)
|
|
|
- ->soap
|
|
|
- ->repository()
|
|
|
- ->ressources
|
|
|
- ->getByDomainName($hosting->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",
|
|
|
+ "name",
|
|
|
+ "description",
|
|
|
+ "type",
|
|
|
+ "isEnabled",
|
|
|
+ "manager");
|
|
|
+ try {
|
|
|
+ $ressources = $api->getResources($fields, $domainID);
|
|
|
+ } catch (KerioApiException $error) {
|
|
|
+ logModuleCall(
|
|
|
+ 'kerioEmail',
|
|
|
+ __FUNCTION__,
|
|
|
+ $error,
|
|
|
+ 'Debug Error',
|
|
|
+ $error->getMessage()
|
|
|
+ );
|
|
|
+ return ['error' => $error->getMessage()];
|
|
|
+ }
|
|
|
/**
|
|
|
* format model to array
|
|
|
*/
|
|
|
@@ -179,13 +195,12 @@ class Ressources extends DataTable implements ClientArea
|
|
|
/* @var $account Ressource */
|
|
|
|
|
|
$ressourceArray = [
|
|
|
- 'id' => $ressource->getId(),
|
|
|
- 'ressource' => $ressource->getDataResourceA('displayName'),
|
|
|
- 'date_created' => RessourceHelper::getFormattedData($ressource->getDataResourceA('kerioCreateTimestamp')),
|
|
|
-// 'last_login' => RessourceHelper::getFormattedData($ressource->getDataResourceA('kerioLastLogonTimestamp'), 'd/m/Y H:i'),
|
|
|
- 'capacity' => $ressource->getDataResourceA('kerioCalResCapacity'),
|
|
|
- 'type' => $ressource->getDataResourceA('kerioCalResType'),
|
|
|
- 'status' => $ressource->getDataResourceA('kerioAccountStatus')
|
|
|
+ 'id' => $ressource['id'],
|
|
|
+ 'ressource' => $ressource['name'],
|
|
|
+ 'description' => $ressource['description'],
|
|
|
+ 'type' => $ressource['type'],
|
|
|
+ 'manager' => $ressource['manager'],
|
|
|
+ 'status' => $ressource['isEnabled'] ? 'active' : 'default'
|
|
|
];
|
|
|
|
|
|
$data[] = $ressourceArray;
|