ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* Plumrocket Inc.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the End-user License Agreement
|
||||
* that is available through the world-wide-web at this URL:
|
||||
* http://wiki.plumrocket.net/wiki/EULA
|
||||
* If you are unable to obtain it through the world-wide-web, please
|
||||
* send an email to support@plumrocket.com so we can send you a copy immediately.
|
||||
*
|
||||
* @package Plumrocket_CookieConsent
|
||||
* @copyright Copyright (c) 2020 Plumrocket Inc. (http://www.plumrocket.com)
|
||||
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\CookieConsent\Ui\DataProvider\Cookie\Item\Form;
|
||||
|
||||
use Magento\Ui\DataProvider\Modifier\PoolInterface;
|
||||
use Plumrocket\CookieConsent\Model\ResourceModel\Cookie\Collection as CookieCollection;
|
||||
use Plumrocket\CookieConsent\Model\ResourceModel\Cookie\CollectionFactory;
|
||||
use Plumrocket\CookieConsent\Ui\DataProvider\AbstractForm\DataProvider as AbstractFormDataProvider;
|
||||
|
||||
/**
|
||||
* @method CookieCollection getCollection()
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class DataProvider extends AbstractFormDataProvider
|
||||
{
|
||||
/**
|
||||
* CheckboxDataProvider constructor.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $primaryFieldName
|
||||
* @param string $requestFieldName
|
||||
* @param \Magento\Ui\DataProvider\Modifier\PoolInterface $pool
|
||||
* @param \Plumrocket\CookieConsent\Model\ResourceModel\Cookie\CollectionFactory $collectionFactory
|
||||
* @param array $meta
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(
|
||||
$name,
|
||||
$primaryFieldName,
|
||||
$requestFieldName,
|
||||
PoolInterface $pool,
|
||||
CollectionFactory $collectionFactory,
|
||||
array $meta = [],
|
||||
array $data = []
|
||||
) {
|
||||
parent::__construct($name, $primaryFieldName, $requestFieldName, $pool, $meta, $data);
|
||||
$this->collection = $collectionFactory->create();
|
||||
}
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/**
|
||||
* Plumrocket Inc.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the End-user License Agreement
|
||||
* that is available through the world-wide-web at this URL:
|
||||
* http://wiki.plumrocket.net/wiki/EULA
|
||||
* If you are unable to obtain it through the world-wide-web, please
|
||||
* send an email to support@plumrocket.com so we can send you a copy immediately.
|
||||
*
|
||||
* @package Plumrocket_CookieConsent
|
||||
* @copyright Copyright (c) 2020 Plumrocket Inc. (http://www.plumrocket.com)
|
||||
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\CookieConsent\Ui\DataProvider\Cookie\Item\Form\Modifier;
|
||||
|
||||
use Magento\Ui\DataProvider\Modifier\ModifierInterface;
|
||||
use Plumrocket\CookieConsent\Model\Cookie\Attribute\DurationDecorator;
|
||||
use Plumrocket\CookieConsent\Ui\Locator\LocatorInterface;
|
||||
|
||||
/**
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Duration implements ModifierInterface
|
||||
{
|
||||
/**
|
||||
* @var \Plumrocket\CookieConsent\Ui\Locator\LocatorInterface
|
||||
*/
|
||||
private $locator;
|
||||
|
||||
/**
|
||||
* @var \Plumrocket\CookieConsent\Model\Cookie\Attribute\DurationDecorator
|
||||
*/
|
||||
private $durationDecorator;
|
||||
|
||||
/**
|
||||
* @param \Plumrocket\CookieConsent\Ui\Locator\LocatorInterface $locator
|
||||
* @param \Plumrocket\CookieConsent\Model\Cookie\Attribute\DurationDecorator $durationDecorator
|
||||
*/
|
||||
public function __construct(LocatorInterface $locator, DurationDecorator $durationDecorator)
|
||||
{
|
||||
$this->locator = $locator;
|
||||
$this->durationDecorator = $durationDecorator;
|
||||
}
|
||||
|
||||
public function modifyData(array $data)
|
||||
{
|
||||
if ($cookieId = $this->locator->getModel()->getId()) {
|
||||
$data[$cookieId] = $this->durationDecorator->unserializeParams($data[$cookieId]);
|
||||
} else {
|
||||
$data[$cookieId] = $this->durationDecorator->unserializeParams([]);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function modifyMeta(array $meta)
|
||||
{
|
||||
return $meta;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
/**
|
||||
* Plumrocket Inc.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the End-user License Agreement
|
||||
* that is available through the world-wide-web at this URL:
|
||||
* http://wiki.plumrocket.net/wiki/EULA
|
||||
* If you are unable to obtain it through the world-wide-web, please
|
||||
* send an email to support@plumrocket.com so we can send you a copy immediately.
|
||||
*
|
||||
* @package Plumrocket_CookieConsent
|
||||
* @copyright Copyright (c) 2020 Plumrocket Inc. (http://www.plumrocket.com)
|
||||
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\CookieConsent\Ui\DataProvider\Cookie\Item\Form\Modifier;
|
||||
|
||||
use Magento\Catalog\Model\Attribute\ScopeOverriddenValue;
|
||||
use Magento\Catalog\Model\ResourceModel\Eav\AttributeFactory;
|
||||
use Magento\Framework\App\Request\DataPersistorInterface;
|
||||
use Magento\Framework\App\ResourceConnection;
|
||||
use Magento\Framework\Stdlib\ArrayManager;
|
||||
use Magento\Store\Model\StoreManagerInterface;
|
||||
use Magento\Ui\DataProvider\Mapper\FormElement;
|
||||
use Plumrocket\CookieConsent\Api\Data\CookieInterface;
|
||||
use Plumrocket\CookieConsent\Model\ResourceModel\AbstractAttributeCollection;
|
||||
use Plumrocket\CookieConsent\Model\ResourceModel\Cookie;
|
||||
use Plumrocket\CookieConsent\Model\ResourceModel\Cookie\Attribute\CollectionFactory;
|
||||
use Plumrocket\CookieConsent\Ui\DataProvider\AbstractForm\EavModifier as AbstractFormEavModifier;
|
||||
use Plumrocket\CookieConsent\Ui\Locator\LocatorInterface;
|
||||
|
||||
/**
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Eav extends AbstractFormEavModifier
|
||||
{
|
||||
public const DATA_SOURCE_DEFAULT = 'cookie_item';
|
||||
public const DATA_PERSISTOR_KEY = CookieInterface::DATA_PERSISTOR_KEY;
|
||||
public const ENTITY = CookieInterface::class;
|
||||
|
||||
/**
|
||||
* @var \Plumrocket\CookieConsent\Model\ResourceModel\Cookie\Attribute\CollectionFactory
|
||||
*/
|
||||
private $attributesCollectionFactory;
|
||||
|
||||
/**
|
||||
* Eav constructor.
|
||||
*
|
||||
* @param \Magento\Framework\App\ResourceConnection $resource
|
||||
* @param \Plumrocket\CookieConsent\Ui\Locator\LocatorInterface $locator
|
||||
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
|
||||
* @param \Magento\Ui\DataProvider\Mapper\FormElement $formElementMapper
|
||||
* @param \Magento\Catalog\Model\ResourceModel\Eav\AttributeFactory $eavAttributeFactory
|
||||
* @param \Magento\Framework\Stdlib\ArrayManager $arrayManager
|
||||
* @param \Magento\Catalog\Model\Attribute\ScopeOverriddenValue $scopeOverriddenValue
|
||||
* @param \Magento\Framework\App\Request\DataPersistorInterface $dataPersistor
|
||||
* @param \Plumrocket\CookieConsent\Model\ResourceModel\Cookie $modelResource
|
||||
* @param CollectionFactory $attributesCollectionFactory
|
||||
* @param array $attributesToDisable
|
||||
* @param array $attributesToEliminate
|
||||
*/
|
||||
public function __construct(
|
||||
ResourceConnection $resource,
|
||||
LocatorInterface $locator,
|
||||
StoreManagerInterface $storeManager,
|
||||
FormElement $formElementMapper,
|
||||
AttributeFactory $eavAttributeFactory,
|
||||
ArrayManager $arrayManager,
|
||||
ScopeOverriddenValue $scopeOverriddenValue,
|
||||
DataPersistorInterface $dataPersistor,
|
||||
Cookie $modelResource,
|
||||
CollectionFactory $attributesCollectionFactory,
|
||||
$attributesToDisable = [],
|
||||
$attributesToEliminate = []
|
||||
) {
|
||||
parent::__construct(
|
||||
$resource,
|
||||
$locator,
|
||||
$storeManager,
|
||||
$formElementMapper,
|
||||
$eavAttributeFactory,
|
||||
$arrayManager,
|
||||
$scopeOverriddenValue,
|
||||
$dataPersistor,
|
||||
$modelResource,
|
||||
$attributesToDisable,
|
||||
$attributesToEliminate
|
||||
);
|
||||
$this->attributesCollectionFactory = $attributesCollectionFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Plumrocket\CookieConsent\Model\ResourceModel\AbstractAttributeCollection
|
||||
*/
|
||||
protected function getAttributesCollection(): AbstractAttributeCollection
|
||||
{
|
||||
return $this->attributesCollectionFactory->create();
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* Plumrocket Inc.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the End-user License Agreement
|
||||
* that is available through the world-wide-web at this URL:
|
||||
* http://wiki.plumrocket.net/wiki/EULA
|
||||
* If you are unable to obtain it through the world-wide-web, please
|
||||
* send an email to support@plumrocket.com so we can send you a copy immediately.
|
||||
*
|
||||
* @package Plumrocket_CookieConsent
|
||||
* @copyright Copyright (c) 2020 Plumrocket Inc. (http://www.plumrocket.com)
|
||||
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\CookieConsent\Ui\DataProvider\Cookie\Item\Form\Modifier;
|
||||
|
||||
use Plumrocket\CookieConsent\Ui\DataProvider\AbstractForm\SystemModifier;
|
||||
|
||||
/**
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class System extends SystemModifier
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $actionUrls = [
|
||||
self::KEY_SUBMIT_URL => 'pr_cookie/item/save',
|
||||
];
|
||||
}
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/**
|
||||
* Plumrocket Inc.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the End-user License Agreement
|
||||
* that is available through the world-wide-web at this URL:
|
||||
* http://wiki.plumrocket.net/wiki/EULA
|
||||
* If you are unable to obtain it through the world-wide-web, please
|
||||
* send an email to support@plumrocket.com so we can send you a copy immediately.
|
||||
*
|
||||
* @package Plumrocket_CookieConsent
|
||||
* @copyright Copyright (c) 2020 Plumrocket Inc. (http://www.plumrocket.com)
|
||||
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\CookieConsent\Ui\DataProvider\Cookie\Item\Listing;
|
||||
|
||||
use Plumrocket\CookieConsent\Model\ResourceModel\Cookie\Grid\CollectionFactory;
|
||||
use Plumrocket\CookieConsent\Model\ResourceModel\Cookie\Grid\Collection;
|
||||
use Plumrocket\CookieConsent\Ui\DataProvider\AbstractListing\DataProvider as AbstractListingDataProvider;
|
||||
|
||||
/**
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class DataProvider extends AbstractListingDataProvider
|
||||
{
|
||||
/**
|
||||
* DataProvider constructor.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $primaryFieldName
|
||||
* @param string $requestFieldName
|
||||
* @param \Plumrocket\CookieConsent\Model\ResourceModel\Cookie\Grid\CollectionFactory $collectionFactory
|
||||
* @param array $addFieldStrategies
|
||||
* @param array $addFilterStrategies
|
||||
* @param array $meta
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(
|
||||
$name,
|
||||
$primaryFieldName,
|
||||
$requestFieldName,
|
||||
CollectionFactory $collectionFactory,
|
||||
array $addFieldStrategies = [],
|
||||
array $addFilterStrategies = [],
|
||||
array $meta = [],
|
||||
array $data = []
|
||||
) {
|
||||
parent::__construct(
|
||||
$name,
|
||||
$primaryFieldName,
|
||||
$requestFieldName,
|
||||
$addFieldStrategies,
|
||||
$addFilterStrategies,
|
||||
$meta,
|
||||
$data
|
||||
);
|
||||
$this->collection = $collectionFactory->create();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $field
|
||||
* @param string $direction
|
||||
* @return void
|
||||
*/
|
||||
public function addOrder($field, $direction)
|
||||
{
|
||||
if ($field === Collection::DOMAIN_LABEL) {
|
||||
$this->getCollection()->getSelect()->order($field . ' ' . $direction);
|
||||
} else {
|
||||
parent::addOrder($field, $direction);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user