![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/cartforge.co/app/code/Xtento/StockImport/Block/Adminhtml/Source/ |
<?php /** * Product: Xtento_StockImport * ID: u66QkJ5rBwmimhUzUElhIKqqWRvsbhC3WLqSMk5AjmQ= * Last Modified: 2019-02-05T17:10:52+00:00 * File: app/code/Xtento/StockImport/Block/Adminhtml/Source/Grid.php * Copyright: Copyright (c) XTENTO GmbH & Co. KG <[email protected]> / All rights reserved. */ namespace Xtento\StockImport\Block\Adminhtml\Source; class Grid extends \Magento\Backend\Block\Widget\Grid { /** * @var \Xtento\StockImport\Model\ProfileFactory */ protected $profileFactory; /** * Grid constructor. * * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Backend\Helper\Data $backendHelper * @param \Xtento\StockImport\Model\ProfileFactory $profileFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Backend\Helper\Data $backendHelper, \Xtento\StockImport\Model\ProfileFactory $profileFactory, array $data = [] ) { parent::__construct($context, $backendHelper, $data); $this->profileFactory = $profileFactory; } /** * @return void * @SuppressWarnings(PHPMD.NPathComplexity) */ protected function _construct() { parent::_construct(); if ($this->getRequest()->getParam('ajax_enabled', 0) == 1) { $this->setData('use_ajax', true); $this->setData('grid_url', $this->getUrl('*/source/grid', ['_current' => 1])); } else { $this->setData('use_ajax', false); } } protected function getProfile() { return $this->profileFactory->create()->load($this->getRequest()->getParam('id')); } public function getSelectedSources() { $array = explode("&", $this->getProfile()->getSourceIds()); return $array; } protected function getFormMessages() { $formMessages = [ [ 'type' => 'notice', 'message' => __( 'Import sources control where files are retrieved (downloaded) from. Set up local directory, FTP, SFTP, etc. sources and enable them in the import profiles "Import Sources" tab.' ) ] ]; return $formMessages; } protected function _toHtml() { if ($this->getRequest()->getParam('ajax')) { return parent::_toHtml(); } return $this->_getFormMessages() . parent::_toHtml(); } protected function _getFormMessages() { $html = '<div id="messages"><div class="messages">'; foreach ($this->getFormMessages() as $formMessage) { $html .= '<div class="message message-' . $formMessage['type'] . ' ' . $formMessage['type'] . '"><div>' . $formMessage['message'] . '</div></div>'; } $html .= '</div></div>'; return $html; } }