|
Apache/2.4.41 (Ubuntu) Linux vmi616275.contaboserver.net 5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) server ip : 62.171.164.128 | your ip : 127.0.0.1 safemode OFF > / home / dev2.destoffenstraat.com / app / code / MageArray / News / Controller / Adminhtml / Newspost / |
Filename | /home/dev2.destoffenstraat.com/app/code/MageArray/News/Controller/Adminhtml/Newspost/ExportXml.php |
Size | 1.76 kb |
Permission | rwxrwxrwx |
Owner | root : root |
Create time | 17-Aug-2025 10:26 |
Last modified | 06-Apr-2021 18:06 |
Last accessed | 22-Aug-2025 20:18 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
<?php
namespace MageArray\News\Controller\Adminhtml\Newspost;
use Magento\Backend\App\Action;
use Magento\Backend\App\Action\Context;
use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Framework\App\Response\Http\FileFactory;
use Magento\Framework\View\Result\PageFactory;
/**
* Class ExportXml
* @package MageArray\News\Controller\Adminhtml\Newspost
*/
class ExportXml extends Action
{
/**
* @var FileFactory
*/
protected $_fileFactory;
/**
* @var PageFactory
*/
protected $_resultPageFactory;
/**
* ExportXml constructor.
* @param Context $context
* @param FileFactory $fileFactory
* @param PageFactory $resultPageFactory
*/
public function __construct(
Context $context,
FileFactory $fileFactory,
PageFactory $resultPageFactory
) {
$this->_fileFactory = $fileFactory;
parent::__construct($context);
$this->_resultPageFactory = $resultPageFactory;
}
/**
* @return \Magento\Framework\App\ResponseInterface
* @throws \Exception
*/
public function execute()
{
/** @var \Magento\Backend\Model\View\Result\Page $resultPage */
$resultPage = $this->_resultPageFactory->create();
$fileName = 'News.xml';
$exportBlock = $resultPage->getLayout()
->createBlock(
'MageArray\News\Block\Adminhtml\Newspost\GridExport'
);
$content = $exportBlock->getExcelFile($fileName);
return $this->_fileFactory
->create($fileName, $content, DirectoryList::VAR_DIR);
}
/**
* @return bool
*/
protected function _isAllowed()
{
return $this->_authorization
->isAllowed('MageArray_News::newscomment');
}
}
namespace MageArray\News\Controller\Adminhtml\Newspost;
use Magento\Backend\App\Action;
use Magento\Backend\App\Action\Context;
use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Framework\App\Response\Http\FileFactory;
use Magento\Framework\View\Result\PageFactory;
/**
* Class ExportXml
* @package MageArray\News\Controller\Adminhtml\Newspost
*/
class ExportXml extends Action
{
/**
* @var FileFactory
*/
protected $_fileFactory;
/**
* @var PageFactory
*/
protected $_resultPageFactory;
/**
* ExportXml constructor.
* @param Context $context
* @param FileFactory $fileFactory
* @param PageFactory $resultPageFactory
*/
public function __construct(
Context $context,
FileFactory $fileFactory,
PageFactory $resultPageFactory
) {
$this->_fileFactory = $fileFactory;
parent::__construct($context);
$this->_resultPageFactory = $resultPageFactory;
}
/**
* @return \Magento\Framework\App\ResponseInterface
* @throws \Exception
*/
public function execute()
{
/** @var \Magento\Backend\Model\View\Result\Page $resultPage */
$resultPage = $this->_resultPageFactory->create();
$fileName = 'News.xml';
$exportBlock = $resultPage->getLayout()
->createBlock(
'MageArray\News\Block\Adminhtml\Newspost\GridExport'
);
$content = $exportBlock->getExcelFile($fileName);
return $this->_fileFactory
->create($fileName, $content, DirectoryList::VAR_DIR);
}
/**
* @return bool
*/
protected function _isAllowed()
{
return $this->_authorization
->isAllowed('MageArray_News::newscomment');
}
}