data['id'] = $this->actionElementId; } /** * */ public function update() { // TODO: Implement update() method. } /** * @return HtmlDataJsonResponse|void */ public function delete() { /** * hosting id */ $hid = $this->request->get('id'); $api = new KerioWhmcs('whmcsKerioEmail', 'Thurdata', '1.0'); try { $api->login($this->getWhmcsParamByKey('serverhostname'), $this->getWhmcsParamByKey('serverusername'), $this->getWhmcsParamByKey('serverpassword')); $domains = $api->getDomains(['id','name','aliasList']); } catch (KerioApiException $error) { logModuleCall( 'kerioEmail', __FUNCTION__, $error, 'Debug Error', $error->getMessage() ); return ['error' => $error->getMessage()]; } foreach($domains as $domain) { if(($domain['name']) === $this->getWhmcsParamByKey('domain')){ $domainID = $domain['id']; $domainName = $domain['name']; $aliasList = $domain['aliasList']; } } $newList = array_diff($aliasList, [ $this->formData['id']]); logModuleCall( 'kerioEmail', __FUNCTION__, $aliasList, 'Debug Error', $newList ); return (new HtmlDataJsonResponse())->setMessageAndTranslate('domainAliasHasBeenDeleted')->setStatusSuccess(); } public function massDelete() { /** * hosting id */ $hid = $this->request->get('id'); /** * load product configuration */ $productManager = new ProductManager(); $productManager->loadByHostingId($hid); /** * load kerio manager by hosting id */ $service = (new KerioManager()) ->getApiByHosting($hid) ->soap ->service() ->deleteDomainAlias(); /** * */ foreach($this->request->get('massActions') as $id) { $service->setFormData(['id' => $id]); $result = $service->run(); } return (new HtmlDataJsonResponse()) ->setMessageAndTranslate('massDomainAliasHasBeenDeleted') ->setStatusSuccess(); } }