ltsecurityinc安防产品在线商城代码
This commit is contained in:
+41
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @author Amasty Team
|
||||
* @copyright Copyright (c) Amasty (https://www.amasty.com)
|
||||
* @package Admin Actions Log for Magento 2
|
||||
*/
|
||||
|
||||
namespace Amasty\AdminActionsLog\Controller\Adminhtml\VisitHistory;
|
||||
|
||||
use Amasty\AdminActionsLog\Api\VisitHistoryManagerInterface;
|
||||
use Amasty\AdminActionsLog\Controller\Adminhtml\AbstractVisitHistory;
|
||||
use Magento\Backend\App\Action\Context;
|
||||
|
||||
class Clear extends AbstractVisitHistory
|
||||
{
|
||||
public const ADMIN_RESOURCE = 'Amasty_AdminActionsLog::clear_logging';
|
||||
|
||||
/**
|
||||
* @var VisitHistoryManagerInterface
|
||||
*/
|
||||
private $visitHistoryManager;
|
||||
|
||||
public function __construct(
|
||||
Context $context,
|
||||
VisitHistoryManagerInterface $visitHistoryManager
|
||||
) {
|
||||
parent::__construct($context);
|
||||
$this->visitHistoryManager = $visitHistoryManager;
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$this->visitHistoryManager->clear();
|
||||
$this->messageManager->addSuccessMessage(__('Page History Log has been successfully cleared.'));
|
||||
|
||||
return $this->resultRedirectFactory->create()->setRefererUrl();
|
||||
}
|
||||
}
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @author Amasty Team
|
||||
* @copyright Copyright (c) Amasty (https://www.amasty.com)
|
||||
* @package Admin Actions Log for Magento 2
|
||||
*/
|
||||
|
||||
namespace Amasty\AdminActionsLog\Controller\Adminhtml\VisitHistory;
|
||||
|
||||
use Amasty\AdminActionsLog\Api\VisitHistoryEntryRepositoryInterface;
|
||||
use Amasty\AdminActionsLog\Controller\Adminhtml\AbstractVisitHistory;
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Framework\Controller\ResultFactory;
|
||||
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
|
||||
|
||||
class GetDetails extends AbstractVisitHistory
|
||||
{
|
||||
/**
|
||||
* @var VisitHistoryEntryRepositoryInterface
|
||||
*/
|
||||
private $visitHistoryEntryRepository;
|
||||
|
||||
/**
|
||||
* @var TimezoneInterface
|
||||
*/
|
||||
private $localeDate;
|
||||
|
||||
public function __construct(
|
||||
Context $context,
|
||||
VisitHistoryEntryRepositoryInterface $visitHistoryEntryRepository,
|
||||
TimezoneInterface $localeDate
|
||||
) {
|
||||
parent::__construct($context);
|
||||
$this->visitHistoryEntryRepository = $visitHistoryEntryRepository;
|
||||
$this->localeDate = $localeDate;
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$result = [];
|
||||
if ($id = (int)$this->getRequest()->getParam('id')) {
|
||||
$visitHistoryEntry = $this->visitHistoryEntryRepository->getById($id);
|
||||
$details = [];
|
||||
|
||||
foreach ($visitHistoryEntry->getVisitHistoryDetails() as $detail) {
|
||||
$details[] = $detail->getData();
|
||||
}
|
||||
|
||||
$sessionStart = $this->localeDate->formatDateTime(
|
||||
$visitHistoryEntry->getSessionStart() ?? '',
|
||||
\IntlDateFormatter::MEDIUM,
|
||||
\IntlDateFormatter::MEDIUM
|
||||
);
|
||||
$sessionEnd = $this->localeDate->formatDateTime(
|
||||
$visitHistoryEntry->getSessionEnd() ?? '',
|
||||
\IntlDateFormatter::MEDIUM,
|
||||
\IntlDateFormatter::MEDIUM
|
||||
);
|
||||
$result = $visitHistoryEntry->setVisitHistoryDetails($details)
|
||||
->setSessionStart($sessionStart)
|
||||
->setSessionEnd($sessionEnd)
|
||||
->getData();
|
||||
}
|
||||
|
||||
/** @var \Magento\Framework\Controller\Result\Json $resultPage */
|
||||
$resultJson = $this->resultFactory->create(ResultFactory::TYPE_JSON);
|
||||
$resultJson->setData($result);
|
||||
|
||||
return $resultJson;
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @author Amasty Team
|
||||
* @copyright Copyright (c) Amasty (https://www.amasty.com)
|
||||
* @package Admin Actions Log for Magento 2
|
||||
*/
|
||||
|
||||
namespace Amasty\AdminActionsLog\Controller\Adminhtml\VisitHistory;
|
||||
|
||||
use Amasty\AdminActionsLog\Controller\Adminhtml\AbstractVisitHistory;
|
||||
use Magento\Framework\Controller\ResultFactory;
|
||||
|
||||
class Index extends AbstractVisitHistory
|
||||
{
|
||||
public function execute()
|
||||
{
|
||||
/** @var \Magento\Backend\Model\View\Result\Page $resultPage */
|
||||
$resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE);
|
||||
$resultPage->setActiveMenu('Amasty_AdminActionsLog::page_visit_history');
|
||||
$resultPage->addBreadcrumb(__('Visit History'), __('Visit History'));
|
||||
$resultPage->getConfig()->getTitle()->prepend(__('Visit History'));
|
||||
|
||||
return $resultPage;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user