TaskHistoryProvider.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /* * ********************************************************************
  3. * ProxmoxAddon product developed. (Aug 23, 2018)
  4. * *
  5. *
  6. * CREATED BY MODULESGARDEN -> http://modulesgarden.com
  7. * CONTACT -> contact@modulesgarden.com
  8. *
  9. *
  10. * This software is furnished under a license and may be used and copied
  11. * only in accordance with the terms of such license and with the
  12. * inclusion of the above copyright notice. This software or any other
  13. * copies thereof may not be provided or otherwise made available to any
  14. * other person. No title to and ownership of the software is hereby
  15. * transferred.
  16. *
  17. *
  18. * ******************************************************************** */
  19. namespace ModulesGarden\ProxmoxAddon\App\UI\TaskHistory\Providers;
  20. use ModulesGarden\ProxmoxAddon as main;
  21. use ModulesGarden\ProxmoxAddon\Core\UI\Interfaces\AdminArea;
  22. use ModulesGarden\ProxmoxAddon\Core\UI\ResponseTemplates\HtmlDataJsonResponse;
  23. use ModulesGarden\ProxmoxAddon\Core\UI\Widget\Forms\DataProviders\BaseModelDataProvider;
  24. use function ModulesGarden\ProxmoxAddon\Core\Helper\sl;
  25. /**
  26. *
  27. * Description of RangeVmProvider
  28. *
  29. * @author Pawel Kopec <pawelk@modulesgardne.com>
  30. */
  31. class TaskHistoryProvider extends BaseModelDataProvider implements AdminArea
  32. {
  33. public function __construct()
  34. {
  35. parent::__construct(main\App\Models\TaskHistory::class);
  36. }
  37. public function delete()
  38. {
  39. parent::delete();
  40. sl('lang')->addReplacementConstant('name', $this->formData['name']);
  41. return (new HtmlDataJsonResponse())->setMessageAndTranslate('Task History :name: has been deleted successfully');
  42. }
  43. public function deleteMass()
  44. {
  45. if (!$this->getRequestValue('massActions'))
  46. {
  47. return;
  48. }
  49. main\App\Models\TaskHistory::destroy($this->getRequestValue('massActions'));
  50. return (new HtmlDataJsonResponse())->setMessageAndTranslate('The selected task history have been deleted successfully')
  51. ->setStatusSuccess()
  52. ->setCallBackFunction($this->callBackFunction);
  53. }
  54. }