22
33namespace Hexasoft \FraudLabsPro \Controller \Adminhtml \Order ;
44
5+ use Psr \Log \LoggerInterface ;
56use Magento \Backend \App \Action ;
6- use Magento \Sales \Api \OrderManagementInterface ;
77use Magento \Sales \Api \OrderRepositoryInterface ;
8- use Psr \ Log \ LoggerInterface ;
8+ use Magento \ Sales \ Api \ OrderManagementInterface ;
99
10+ // Flpsummarytab class
1011class FlpsummaryTab extends \Magento \Sales \Controller \Adminhtml \Order
1112{
12- /**
13- * @var \Magento\Framework\View\LayoutFactory
14- */
15- protected $ layoutFactory ;
1613
17- /**
18- * @param Action\Context $context
19- * @param \Magento\Framework\Registry $coreRegistry
20- * @param \Magento\Framework\App\Response\Http\FileFactory $fileFactory
21- * @param \Magento\Framework\Translate\InlineInterface $translateInline
22- * @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
23- * @param \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
24- * @param \Magento\Framework\View\Result\LayoutFactory $resultLayoutFactory
25- * @param \Magento\Framework\Controller\Result\RawFactory $resultRawFactory
26- * @param OrderManagementInterface $orderManagement
27- * @param OrderRepositoryInterface $orderRepository
28- * @param LoggerInterface $logger
29- * @param \Magento\Framework\View\LayoutFactory $layoutFactory
30- *
31- * @SuppressWarnings(PHPMD.ExcessiveParameterList)
32- * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
33- */
14+ // used for LayoutFactory
15+ protected $ layout_factorys ;
16+
17+ // construct function
3418 public function __construct (
35- Action \Context $ context ,
36- \Magento \Framework \Registry $ coreRegistry ,
37- \Magento \Framework \App \Response \Http \FileFactory $ fileFactory ,
38- \Magento \Framework \Translate \InlineInterface $ translateInline ,
39- \Magento \Framework \View \Result \PageFactory $ resultPageFactory ,
40- \Magento \Framework \Controller \Result \JsonFactory $ resultJsonFactory ,
41- \Magento \Framework \View \Result \LayoutFactory $ resultLayoutFactory ,
42- \Magento \Framework \Controller \Result \RawFactory $ resultRawFactory ,
43- OrderManagementInterface $ orderManagement ,
44- OrderRepositoryInterface $ orderRepository ,
45- LoggerInterface $ logger ,
46- \Magento \Framework \View \LayoutFactory $ layoutFactory
19+ Action \Context $ contexts ,
20+ \Magento \Framework \Registry $ core_registrys ,
21+ \Magento \Framework \App \Response \Http \FileFactory $ file_factorys ,
22+ \Magento \Framework \Translate \InlineInterface $ translate_inlines ,
23+ \Magento \Framework \View \Result \PageFactory $ result_page_factorys ,
24+ \Magento \Framework \Controller \Result \JsonFactory $ result_json_factorys ,
25+ \Magento \Framework \View \Result \LayoutFactory $ result_layout_factorys ,
26+ \Magento \Framework \Controller \Result \RawFactory $ result_raw_factorys ,
27+ OrderManagementInterface $ order_managements ,
28+ OrderRepositoryInterface $ order_repositorys ,
29+ LoggerInterface $ loggers ,
30+ \Magento \Framework \View \LayoutFactory $ layout_factorys
4731 ) {
48- $ this ->layoutFactory = $ layoutFactory ;
32+ $ this ->layoutFactorys = $ layout_factorys ;
4933 parent ::__construct (
50- $ context ,
51- $ coreRegistry ,
52- $ fileFactory ,
53- $ translateInline ,
54- $ resultPageFactory ,
55- $ resultJsonFactory ,
56- $ resultLayoutFactory ,
57- $ resultRawFactory ,
58- $ orderManagement ,
59- $ orderRepository ,
60- $ logger
34+ $ contexts ,
35+ $ core_registrys ,
36+ $ file_factorys ,
37+ $ translate_inlines ,
38+ $ result_page_factorys ,
39+ $ result_json_factorys ,
40+ $ result_layout_factorys ,
41+ $ result_raw_factorys ,
42+ $ order_managements ,
43+ $ order_repositorys ,
44+ $ loggers
6145 );
6246 }
6347
64- /**
65- * Generate order history for ajax request
66- *
67- * @return \Magento\Framework\Controller\Result\Raw
68- */
48+ // execute function
6949 public function execute ()
7050 {
51+ // initiliase order
7152 $ this ->_initOrder ();
72- $ layout = $ this ->layoutFactory ->create ();
73- $ html = $ layout ->createBlock ('Hexasoft\FraudLabsPro\Block\Adminhtml\Order\View\Tab\Flpsummary ' )
74- ->toHtml ();
75- $ this ->_translateInline ->processResponseBody ($ html );
76- /** @var \Magento\Framework\Controller\Result\Raw $resultRaw */
77- $ resultRaw = $ this ->resultRawFactory ->create ();
78- $ resultRaw ->setContents ($ html );
79- return $ resultRaw ;
53+
54+ //create layout
55+ $ layouts = $ this ->layoutFactorys ->create ();
56+
57+ //create block
58+ $ htmls = $ layouts ->createBlock ('Hexasoft\FraudLabsPro\Block\Adminhtml\Order\View\Tab\Flpsummary ' )->toHtml ();
59+
60+ // process response body of block
61+ $ this ->_translateInline ->processResponseBody ($ htmls );
62+
63+ // create result to be display
64+ $ results = $ this ->resultRawFactory ->create ();
65+
66+ // set content of body
67+ $ results ->setContents ($ htmls );
68+
69+ return $ results ;
8070 }
8171}
0 commit comments