-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 378c447
Showing
77 changed files
with
3,697 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* MageSpecialist | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Open Software License (OSL 3.0) | ||
* that is bundled with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* http://opensource.org/licenses/osl-3.0.php | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to info@magespecialist.it so we can send you a copy immediately. | ||
* | ||
* @copyright Copyright (c) 2018 Skeeller srl (http://www.magespecialist.it) | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
/** | ||
* Copyright © MageSpecialist - Skeeller srl. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace MSP\NotifierEvent\Controller\Adminhtml\Rule; | ||
|
||
use Magento\Backend\App\Action; | ||
use Magento\Framework\Controller\ResultInterface; | ||
use MSP\NotifierEventApi\Api\RuleRepositoryInterface; | ||
use MSP\NotifierEventApi\Api\Data\RuleInterface; | ||
|
||
class Delete extends Action | ||
{ | ||
/** | ||
* @see _isAllowed() | ||
*/ | ||
const ADMIN_RESOURCE = 'MSP_NotifierEvent::rule'; | ||
|
||
/** | ||
* @var RuleRepositoryInterface | ||
*/ | ||
private $ruleRepository; | ||
|
||
/** | ||
* Delete constructor. | ||
* @param Action\Context $context | ||
* @param RuleRepositoryInterface $ruleRepository | ||
*/ | ||
public function __construct( | ||
Action\Context $context, | ||
RuleRepositoryInterface $ruleRepository | ||
) { | ||
parent::__construct($context); | ||
$this->ruleRepository = $ruleRepository; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function execute(): ResultInterface | ||
{ | ||
$ruleId = (int) $this->getRequest()->getParam(RuleInterface::ID); | ||
|
||
try { | ||
$rule = $this->ruleRepository->get($ruleId); | ||
$this->ruleRepository->deleteById($rule->getId()); | ||
$this->messageManager->addSuccessMessage(__('Rule "%1" deleted.', $rule->getName())); | ||
} catch (\Exception $e) { | ||
$this->messageManager->addErrorMessage(__('Could not delete rule: %1.', $e->getMessage())); | ||
} | ||
|
||
$result = $this->resultRedirectFactory->create(); | ||
$result->setPath('*/*/index'); | ||
|
||
return $result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
/** | ||
* Copyright © MageSpecialist - Skeeller srl. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace MSP\NotifierEvent\Controller\Adminhtml\Rule; | ||
|
||
use Magento\Backend\App\Action; | ||
use Magento\Framework\Controller\ResultFactory; | ||
use Magento\Framework\Controller\ResultInterface; | ||
use Magento\Framework\Exception\NoSuchEntityException; | ||
use MSP\NotifierEventApi\Api\RuleRepositoryInterface; | ||
use MSP\NotifierEventApi\Api\Data\RuleInterface; | ||
|
||
class Edit extends Action | ||
{ | ||
/** | ||
* @see _isAllowed() | ||
*/ | ||
const ADMIN_RESOURCE = 'MSP_NotifierEvent::rule'; | ||
|
||
/** | ||
* @var RuleRepositoryInterface | ||
*/ | ||
private $ruleRepository; | ||
|
||
/** | ||
* Edit constructor. | ||
* @param Action\Context $context | ||
* @param RuleRepositoryInterface $ruleRepository | ||
*/ | ||
public function __construct( | ||
Action\Context $context, | ||
RuleRepositoryInterface $ruleRepository | ||
) { | ||
parent::__construct($context); | ||
$this->ruleRepository = $ruleRepository; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function execute(): ResultInterface | ||
{ | ||
$ruleId = (int) $this->getRequest()->getParam(RuleInterface::ID); | ||
try { | ||
$rule = $this->ruleRepository->get($ruleId); | ||
$result = $this->resultFactory->create(ResultFactory::TYPE_PAGE); | ||
$result | ||
->setActiveMenu('MSP_NotifierEvent::rule') | ||
->addBreadcrumb(__('Edit Rule'), __('Edit Rule')); | ||
|
||
$result->getConfig() | ||
->getTitle() | ||
->prepend(__('Edit Rule: %name', ['name' => $rule->getName()])); | ||
} catch (NoSuchEntityException $e) { | ||
$result = $this->resultRedirectFactory->create(); | ||
$this->messageManager->addErrorMessage( | ||
__('Rule with id "%value" does not exist.', ['value' => $ruleId]) | ||
); | ||
$result->setPath('*/*'); | ||
} | ||
|
||
return $result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
/** | ||
* Copyright © MageSpecialist - Skeeller srl. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace MSP\NotifierEvent\Controller\Adminhtml\Rule; | ||
|
||
use Magento\Backend\App\Action; | ||
use Magento\Backend\Model\View\Result\Page; | ||
use Magento\Framework\Controller\ResultFactory; | ||
use Magento\Framework\Controller\ResultInterface; | ||
|
||
/** | ||
* Index Controller | ||
*/ | ||
class Index extends Action | ||
{ | ||
/** | ||
* @see _isAllowed() | ||
*/ | ||
const ADMIN_RESOURCE = 'MSP_NotifierEvent::rule'; | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function execute(): ResultInterface | ||
{ | ||
/** @var Page $resultPage */ | ||
$resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE); | ||
$resultPage | ||
->setActiveMenu('MSP_NotifierEvent::rule') | ||
->addBreadcrumb(__('Rules'), __('List')); | ||
$resultPage->getConfig()->getTitle()->prepend(__('Manage Rules')); | ||
|
||
return $resultPage; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
/** | ||
* Copyright © MageSpecialist - Skeeller srl. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace MSP\NotifierEvent\Controller\Adminhtml\Rule; | ||
|
||
use Magento\Backend\App\Action; | ||
use Magento\Backend\Model\View\Result\Page; | ||
use Magento\Framework\Controller\ResultFactory; | ||
use Magento\Framework\Controller\ResultInterface; | ||
|
||
/** | ||
* NewAction Controller | ||
*/ | ||
class NewAction extends Action | ||
{ | ||
/** | ||
* @see _isAllowed() | ||
*/ | ||
const ADMIN_RESOURCE = 'MSP_NotifierEvent::rule'; | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function execute(): ResultInterface | ||
{ | ||
/** @var Page $resultPage */ | ||
$resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE); | ||
$resultPage->setActiveMenu('MSP_NotifierEvent::rule'); | ||
$resultPage->getConfig()->getTitle()->prepend(__('New Rule')); | ||
|
||
return $resultPage; | ||
} | ||
} |
Oops, something went wrong.