Review.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. /**
  7. * Review reports admin controller
  8. *
  9. * @author Magento Core Team <core@magentocommerce.com>
  10. */
  11. namespace Magento\Reports\Controller\Adminhtml\Report;
  12. /**
  13. * @api
  14. * @since 100.0.2
  15. */
  16. abstract class Review extends \Magento\Backend\App\Action
  17. {
  18. /**
  19. * @var \Magento\Framework\App\Response\Http\FileFactory
  20. */
  21. protected $_fileFactory;
  22. /**
  23. * @param \Magento\Backend\App\Action\Context $context
  24. * @param \Magento\Framework\App\Response\Http\FileFactory $fileFactory
  25. */
  26. public function __construct(
  27. \Magento\Backend\App\Action\Context $context,
  28. \Magento\Framework\App\Response\Http\FileFactory $fileFactory
  29. ) {
  30. $this->_fileFactory = $fileFactory;
  31. parent::__construct($context);
  32. }
  33. /**
  34. * Add reports and reviews breadcrumbs
  35. *
  36. * @return $this
  37. */
  38. public function _initAction()
  39. {
  40. $this->_view->loadLayout();
  41. $this->_addBreadcrumb(__('Reports'), __('Reports'));
  42. $this->_addBreadcrumb(__('Review'), __('Reviews'));
  43. return $this;
  44. }
  45. /**
  46. * Determine if action is allowed for reports module
  47. *
  48. * @return bool
  49. */
  50. protected function _isAllowed()
  51. {
  52. switch ($this->getRequest()->getActionName()) {
  53. case 'customer':
  54. return $this->_authorization->isAllowed('Magento_Reports::review_customer');
  55. break;
  56. case 'product':
  57. return $this->_authorization->isAllowed('Magento_Reports::review_product');
  58. break;
  59. default:
  60. return $this->_authorization->isAllowed('Magento_Reports::review');
  61. break;
  62. }
  63. }
  64. }