DeleteAccountDataProvider.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. namespace ThurData\Servers\KerioEmail\App\UI\Client\EmailAccount\Providers;
  3. use ThurData\Servers\KerioEmail\App\Helpers\KerioManager;
  4. use ThurData\Servers\KerioEmail\App\Libs\Product\ProductManager;
  5. use ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Services\Delete\DeleteAccount;
  6. use ThurData\Servers\KerioEmail\Core\UI\ResponseTemplates\HtmlDataJsonResponse;
  7. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\DataProviders\BaseDataProvider;
  8. /**
  9. *
  10. * Created by PhpStorm.
  11. * User: ThurData
  12. * Date: 18.09.19
  13. * Time: 11:28
  14. * Class DeleteAccountDataProvider
  15. */
  16. class DeleteAccountDataProvider extends BaseDataProvider
  17. {
  18. public function read()
  19. {
  20. $this->data['id'] = $this->actionElementId;
  21. }
  22. public function update()
  23. {
  24. // TODO: Implement update() method.
  25. }
  26. public function delete()
  27. {
  28. /**
  29. * hosting id
  30. */
  31. $hid = $this->request->get('id');
  32. /**
  33. * product manager allow to check product settings
  34. */
  35. $productManager = new ProductManager();
  36. $productManager->loadByHostingId($hid);
  37. return (new HtmlDataJsonResponse())->setMessageAndTranslate('emailAccountHasBeenDeleted')->setStatusSuccess();
  38. }
  39. public function massDelete()
  40. {
  41. /**
  42. * hosting id
  43. */
  44. $hid = $this->request->get('id');
  45. /**
  46. * product manager allow to check product settings
  47. */
  48. $productManager = new ProductManager();
  49. $productManager->loadByHostingId($hid);
  50. /**
  51. *
  52. */
  53. foreach($this->request->get('massActions') as $id)
  54. {
  55. $service->setFormData(['id' => $id]);
  56. }
  57. return (new HtmlDataJsonResponse())->setMessageAndTranslate('massEmailAccountHasBeenDeleted')->setStatusSuccess();
  58. }
  59. }