Your IP : 127.0.0.1
<?php
namespace Mrgig\MV\Controller\Adminhtml\Report;
class ViewLogGrid extends \Magento\Backend\App\Action
{
protected $_resultPageFactory;
protected $_coreRegistry = null;
public function __construct(
\Magento\Backend\App\Action\Context $context,
\Magento\Framework\Registry $coreRegistry,
\Magento\Framework\View\Result\PageFactory $resultPageFactory,
\Magento\Framework\Controller\Result\RawFactory $resultRawFactory,
\Mrgig\MV\Model\ReportFactory $reportFactory
)
{
parent::__construct($context);
$this->coreRegistry = $coreRegistry;
$this->resultPageFactory = $resultPageFactory;
$this->resultRawFactory = $resultRawFactory;
$this->reportFactory = $reportFactory;
}
public function execute()
{
$resultPage = $this->resultPageFactory->create();
$rawResult = $this->resultRawFactory->create();
$id = $this->getRequest()->getParam('id');
$report = $this->reportFactory->create()->load($id);
if($report->getId()) {
$this->_coreRegistry->register('current_report', $report);
$grid = $resultPage->getLayout()->createBlock(\Mrgig\MV\Block\Adminhtml\Report\History\Grid::class);
return $rawResult->setContents($grid->toHtml());
}
}
protected function _isAllowed()
{
return $this->_authorization->isAllowed('Mrgig_MV::mv_report');
}
}