Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions Block/Adminhtml/Banner/Edit/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,7 @@ protected function _prepareForm()
{
/** @var \Magento\Framework\Data\Form $form */
$form = $this->_formFactory->create(
array(
'data' => array(
'id' => 'edit_form',
'action' => $this->getUrl('*/*/save', ['store' => $this->getRequest()->getParam('store')]),
'method' => 'post',
'enctype' => 'multipart/form-data',
),
)
['data' => ['id' => 'edit_form', 'action' => $this->getUrl('*/*/save', ['store' => $this->getRequest()->getParam('store')]), 'method' => 'post', 'enctype' => 'multipart/form-data']]
);
$form->setUseContainer(true);
$this->setForm($form);
Expand Down
2 changes: 1 addition & 1 deletion Block/Adminhtml/Banner/Edit/Tab/Banner.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ protected function _prepareLayout()

\Magento\Framework\Data\Form::setFieldsetElementRenderer(
$this->getLayout()->createBlock(
'Magestore\Bannerslider\Block\Adminhtml\Form\Renderer\Fieldset\Element',
\Magestore\Bannerslider\Block\Adminhtml\Form\Renderer\Fieldset\Element::class,
$this->getNameInLayout().'_fieldset_element'
)
);
Expand Down
4 changes: 2 additions & 2 deletions Block/Adminhtml/CoreSlider/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ protected function _prepareColumns()
'header' => __('Preview'),
'align' => 'left',
'index' => 'preview',
'renderer' => 'Magestore\Bannerslider\Block\Adminhtml\CoreSlider\Helper\Renderer\Action',
'renderer' => \Magestore\Bannerslider\Block\Adminhtml\CoreSlider\Helper\Renderer\Action::class,
]
);

Expand All @@ -137,6 +137,6 @@ protected function _prepareColumns()
*/
public function getRowUrl($row)
{
return $this->getUrl('*/slider/preview', array('sliderpreview_id' => $row->getId()));
return $this->getUrl('*/slider/preview', ['sliderpreview_id' => $row->getId()]);
}
}
2 changes: 1 addition & 1 deletion Block/Adminhtml/CoreSlider/Helper/Renderer/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function __construct(
*/
public function render(\Magento\Framework\DataObject $row)
{
$url = $this->getUrl('*/slider/preview', array('sliderpreview_id' => $row->getId()));
$url = $this->getUrl('*/slider/preview', ['sliderpreview_id' => $row->getId()]);

return '<a onclick="window.open(\'' . $url . '\', \'_blank\',\'width=1000,height=700,resizable=1,scrollbars=1\'); return false;">Preview</a>';
}
Expand Down
4 changes: 2 additions & 2 deletions Block/Adminhtml/Report/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ protected function _prepareColumns()
'width' => '70px',
'filter' => false,
'index' => 'imagename',
'renderer' => 'Magestore\Bannerslider\Block\Adminhtml\Report\Helper\Renderer\Image',
'renderer' => \Magestore\Bannerslider\Block\Adminhtml\Report\Helper\Renderer\Image::class,
]
);
$this->addColumn(
Expand All @@ -180,6 +180,6 @@ protected function _prepareColumns()
*/
public function getGridUrl()
{
return $this->getUrl('*/*/grid', array('_current' => true, 'action' => $this->getRequest()->getActionName()));
return $this->getUrl('*/*/grid', ['_current' => true, 'action' => $this->getRequest()->getActionName()]);
}
}
9 changes: 1 addition & 8 deletions Block/Adminhtml/Slider/Edit/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,7 @@ protected function _prepareForm()
{
/** @var \Magento\Framework\Data\Form $form */
$form = $this->_formFactory->create(
array(
'data' => array(
'id' => 'edit_form',
'action' => $this->getUrl('*/*/save'),
'method' => 'post',
'enctype' => 'multipart/form-data',
),
)
['data' => ['id' => 'edit_form', 'action' => $this->getUrl('*/*/save'), 'method' => 'post', 'enctype' => 'multipart/form-data']]
);
$form->setUseContainer(true);
$this->setForm($form);
Expand Down
10 changes: 5 additions & 5 deletions Block/Adminhtml/Slider/Edit/Tab/Banners.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ protected function _construct()
$this->setSaveParametersInSession(true);
$this->setUseAjax(true);
if ($this->getRequest()->getParam('id')) {
$this->setDefaultFilter(array('in_banner' => 1));
$this->setDefaultFilter(['in_banner' => 1]);
}
}

Expand All @@ -87,10 +87,10 @@ protected function _addColumnFilterToCollection($column)
$bannerIds = 0;
}
if ($column->getFilter()->getValue()) {
$this->getCollection()->addFieldToFilter('banner_id', array('in' => $bannerIds));
$this->getCollection()->addFieldToFilter('banner_id', ['in' => $bannerIds]);
} else {
if ($bannerIds) {
$this->getCollection()->addFieldToFilter('banner_id', array('nin' => $bannerIds));
$this->getCollection()->addFieldToFilter('banner_id', ['nin' => $bannerIds]);
}
}
} else {
Expand Down Expand Up @@ -157,7 +157,7 @@ protected function _prepareColumns()
'filter' => false,
'class' => 'xxx',
'width' => '50px',
'renderer' => 'Magestore\Bannerslider\Block\Adminhtml\Banner\Helper\Renderer\Image',
'renderer' => \Magestore\Bannerslider\Block\Adminhtml\Banner\Helper\Renderer\Image::class,
]
);
$this->addColumn(
Expand Down Expand Up @@ -213,7 +213,7 @@ protected function _prepareColumns()
'index' => 'stores',
'header_css_class' => 'col-action',
'column_css_class' => 'col-action',
'renderer' => 'Magestore\Bannerslider\Block\Adminhtml\Slider\Edit\Tab\Helper\Renderer\EditBanner',
'renderer' => \Magestore\Bannerslider\Block\Adminhtml\Slider\Edit\Tab\Helper\Renderer\EditBanner::class,
]
);

Expand Down
2 changes: 1 addition & 1 deletion Block/Adminhtml/Slider/Edit/Tab/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ protected function _prepareForm()
*/
// dependence block
$dependenceBlock = $this->getLayout()->createBlock(
'Magento\Backend\Block\Widget\Form\Element\Dependence'
\Magento\Backend\Block\Widget\Form\Element\Dependence::class
);

// dependence field map array
Expand Down
6 changes: 3 additions & 3 deletions Block/Adminhtml/Slider/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ protected function _prepareColumns()
*/
protected function _prepareMassaction()
{
$this->setMassactionIdField('entity_id');
$this->setMassactionIdField('slider_id');
$this->getMassactionBlock()->setFormFieldName('slider');

$this->getMassactionBlock()->addItem(
Expand Down Expand Up @@ -229,7 +229,7 @@ protected function _prepareMassaction()
*/
public function getGridUrl()
{
return $this->getUrl('*/*/grid', array('_current' => true));
return $this->getUrl('*/*/grid', ['_current' => true]);
}

/**
Expand All @@ -241,7 +241,7 @@ public function getRowUrl($row)
{
return $this->getUrl(
'*/*/edit',
array('slider_id' => $row->getId())
['slider_id' => $row->getId()]
);
}
}
6 changes: 3 additions & 3 deletions Block/Bannerslider.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function appendChildBlockSliders(
foreach ($sliderCollection as $slider) {
$this->append(
$this->getLayout()->createBlock(
'Magestore\Bannerslider\Block\SliderItem'
\Magestore\Bannerslider\Block\SliderItem::class
)->setSliderId($slider->getId())
);
}
Expand Down Expand Up @@ -147,11 +147,11 @@ public function setCategoryPosition($position)
$categoryPathIds = $category->getPathIds();

foreach ($sliderCollection as $slider) {
$sliderCategoryIds = explode(',', $slider->getCategoryIds());
$sliderCategoryIds = explode(',', (string) $slider->getCategoryIds());
if (count(array_intersect($categoryPathIds, $sliderCategoryIds)) > 0) {
$this->append(
$this->getLayout()->createBlock(
'Magestore\Bannerslider\Block\SliderItem'
\Magestore\Bannerslider\Block\SliderItem::class
)->setSliderId($slider->getId())
);
}
Expand Down
28 changes: 6 additions & 22 deletions Block/SliderItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,28 +201,12 @@ public function setSliderId($sliderId)
*/
public function setStyleSlideTemplate($styleSlideId)
{
switch ($styleSlideId) {
//Evolution slide
case SliderModel::STYLESLIDE_EVOLUTION_ONE:
case SliderModel::STYLESLIDE_EVOLUTION_TWO:
case SliderModel::STYLESLIDE_EVOLUTION_THREE:
case SliderModel::STYLESLIDE_EVOLUTION_FOUR:
$this->setTemplate(self::STYLESLIDE_EVOLUTION_TEMPLATE);
break;

case SliderModel::STYLESLIDE_POPUP:
$this->setTemplate(self::STYLESLIDE_POPUP_TEMPLATE);
break;
//Note all page
case SliderModel::STYLESLIDE_SPECIAL_NOTE:
$this->setTemplate(self::STYLESLIDE_SPECIAL_NOTE_TEMPLATE);
break;

// Flex slide
default:
$this->setTemplate(self::STYLESLIDE_FLEXSLIDER_TEMPLATE);
break;
}
match ($styleSlideId) {
SliderModel::STYLESLIDE_EVOLUTION_ONE, SliderModel::STYLESLIDE_EVOLUTION_TWO, SliderModel::STYLESLIDE_EVOLUTION_THREE, SliderModel::STYLESLIDE_EVOLUTION_FOUR => $this->setTemplate(self::STYLESLIDE_EVOLUTION_TEMPLATE),
SliderModel::STYLESLIDE_POPUP => $this->setTemplate(self::STYLESLIDE_POPUP_TEMPLATE),
SliderModel::STYLESLIDE_SPECIAL_NOTE => $this->setTemplate(self::STYLESLIDE_SPECIAL_NOTE_TEMPLATE),
default => $this->setTemplate(self::STYLESLIDE_FLEXSLIDER_TEMPLATE),
};
}

public function isShowTitle()
Expand Down
29 changes: 12 additions & 17 deletions Controller/Adminhtml/AbstractAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public function __construct(
protected function _createMainCollection()
{
/** @var \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection $collection */
$collection = $this->_objectManager->create('Magestore\Bannerslider\Model\ResourceModel\Banner\Collection');
$collection = $this->_objectManager->create(\Magestore\Bannerslider\Model\ResourceModel\Banner\Collection::class);
return $collection;
}

Expand All @@ -184,22 +184,17 @@ protected function _createMainCollection()
*/
protected function _getBackResultRedirect(\Magento\Framework\Controller\Result\Redirect $resultRedirect, $paramCrudId = null)
{
switch ($this->getRequest()->getParam('back')) {
case 'edit':
$resultRedirect->setPath(
'*/*/edit',
[
static::PARAM_CRUD_ID => $paramCrudId,
'_current' => true,
]
);
break;
case 'new':
$resultRedirect->setPath('*/*/new', ['_current' => true]);
break;
default:
$resultRedirect->setPath('*/*/');
}
match ($this->getRequest()->getParam('back')) {
'edit' => $resultRedirect->setPath(
'*/*/edit',
[
static::PARAM_CRUD_ID => $paramCrudId,
'_current' => true,
]
),
'new' => $resultRedirect->setPath('*/*/new', ['_current' => true]),
default => $resultRedirect->setPath('*/*/'),
};

return $resultRedirect;
}
Expand Down
33 changes: 14 additions & 19 deletions Controller/Adminhtml/Banner.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,25 +53,20 @@ protected function _isAllowed()
*/
protected function _getBackResultRedirect(\Magento\Framework\Controller\Result\Redirect $resultRedirect, $paramCrudId = null)
{
switch ($this->getRequest()->getParam('back')) {
case 'edit':
$resultRedirect->setPath(
'*/*/edit',
[
static::PARAM_CRUD_ID => $paramCrudId,
'_current' => true,
'store' => $this->getRequest()->getParam('store'),
'current_slider_id' => $this->getRequest()->getParam('current_slider_id'),
'saveandclose' => $this->getRequest()->getParam('saveandclose'),
]
);
break;
case 'new':
$resultRedirect->setPath('*/*/new', ['_current' => true]);
break;
default:
$resultRedirect->setPath('*/*/');
}
match ($this->getRequest()->getParam('back')) {
'edit' => $resultRedirect->setPath(
'*/*/edit',
[
static::PARAM_CRUD_ID => $paramCrudId,
'_current' => true,
'store' => $this->getRequest()->getParam('store'),
'current_slider_id' => $this->getRequest()->getParam('current_slider_id'),
'saveandclose' => $this->getRequest()->getParam('saveandclose'),
]
),
'new' => $resultRedirect->setPath('*/*/new', ['_current' => true]),
default => $resultRedirect->setPath('*/*/'),
};

return $resultRedirect;
}
Expand Down
6 changes: 3 additions & 3 deletions Controller/Adminhtml/Banner/Save.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function execute()
$fileName = '';
}

if ($imageRequest && strlen($fileName)) {
if ($imageRequest && strlen((string) $fileName)) {
/*
* Save image upload
*/
Expand All @@ -76,7 +76,7 @@ public function execute()
$uploader->setFilesDispersion(true);

/** @var \Magento\Framework\Filesystem\Directory\Read $mediaDirectory */
$mediaDirectory = $this->_objectManager->get('Magento\Framework\Filesystem')
$mediaDirectory = $this->_objectManager->get(\Magento\Framework\Filesystem::class)
->getDirectoryRead(DirectoryList::MEDIA);
$result = $uploader->save(
$mediaDirectory->getAbsolutePath(\Magestore\Bannerslider\Model\Banner::BASE_MEDIA_PATH)
Expand All @@ -102,7 +102,7 @@ public function execute()

/** @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate */
// $localeDate = $this->_objectManager->get('Magento\Framework\Stdlib\DateTime\TimezoneInterface');
$localeDate = $this->_objectManager->get('Magento\Framework\Stdlib\DateTime\Timezone');
$localeDate = $this->_objectManager->get(\Magento\Framework\Stdlib\DateTime\Timezone::class);

$data['start_time'] = $localeDate->date($data['start_time'], null, 'UTC')->format('Y-m-d H:i');
$data['end_time'] = $localeDate->date($data['end_time'], null, 'UTC')->format('Y-m-d H:i');
Expand Down
2 changes: 1 addition & 1 deletion Controller/Adminhtml/Report/ExportCsv.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function execute()

/** @var \\Magento\Framework\View\Result\Page $resultPage */
$resultPage = $this->_resultPageFactory->create();
$content = $resultPage->getLayout()->createBlock('Magestore\Bannerslider\Block\Adminhtml\Report\Grid')->getCsv();
$content = $resultPage->getLayout()->createBlock(\Magestore\Bannerslider\Block\Adminhtml\Report\Grid::class)->getCsv();

return $this->_fileFactory->create($fileName, $content, DirectoryList::VAR_DIR);
}
Expand Down
2 changes: 1 addition & 1 deletion Controller/Adminhtml/Report/ExportExcel.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function execute()

/** @var \\Magento\Framework\View\Result\Page $resultPage */
$resultPage = $this->_resultPageFactory->create();
$content = $resultPage->getLayout()->createBlock('Magestore\Bannerslider\Block\Adminhtml\Report\Grid')->getExcel();
$content = $resultPage->getLayout()->createBlock(\Magestore\Bannerslider\Block\Adminhtml\Report\Grid::class)->getExcel();

return $this->_fileFactory->create($fileName, $content, DirectoryList::VAR_DIR);
}
Expand Down
2 changes: 1 addition & 1 deletion Controller/Adminhtml/Report/ExportXml.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function execute()

/** @var \\Magento\Framework\View\Result\Page $resultPage */
$resultPage = $this->_resultPageFactory->create();
$content = $resultPage->getLayout()->createBlock('Magestore\Bannerslider\Block\Adminhtml\Report\Grid')->getXml();
$content = $resultPage->getLayout()->createBlock(\Magestore\Bannerslider\Block\Adminhtml\Report\Grid::class)->getXml();

return $this->_fileFactory->create($fileName, $content, DirectoryList::VAR_DIR);
}
Expand Down
2 changes: 1 addition & 1 deletion Controller/Adminhtml/Slider/ExportCsv.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function execute()

/** @var \\Magento\Framework\View\Result\Page $resultPage */
$resultPage = $this->_resultPageFactory->create();
$content = $resultPage->getLayout()->createBlock('Magestore\Bannerslider\Block\Adminhtml\Slider\Grid')->getCsv();
$content = $resultPage->getLayout()->createBlock(\Magestore\Bannerslider\Block\Adminhtml\Slider\Grid::class)->getCsv();

return $this->_fileFactory->create($fileName, $content, DirectoryList::VAR_DIR);
}
Expand Down
2 changes: 1 addition & 1 deletion Controller/Adminhtml/Slider/ExportExcel.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function execute()

/** @var \\Magento\Framework\View\Result\Page $resultPage */
$resultPage = $this->_resultPageFactory->create();
$content = $resultPage->getLayout()->createBlock('Magestore\Bannerslider\Block\Adminhtml\Slider\Grid')->getExcel();
$content = $resultPage->getLayout()->createBlock(\Magestore\Bannerslider\Block\Adminhtml\Slider\Grid::class)->getExcel();

return $this->_fileFactory->create($fileName, $content, DirectoryList::VAR_DIR);
}
Expand Down
2 changes: 1 addition & 1 deletion Controller/Adminhtml/Slider/ExportXml.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function execute()

/** @var \\Magento\Framework\View\Result\Page $resultPage */
$resultPage = $this->_resultPageFactory->create();
$content = $resultPage->getLayout()->createBlock('Magestore\Bannerslider\Block\Adminhtml\Slider\Grid')->getXml();
$content = $resultPage->getLayout()->createBlock(\Magestore\Bannerslider\Block\Adminhtml\Slider\Grid::class)->getXml();

return $this->_fileFactory->create($fileName, $content, DirectoryList::VAR_DIR);
}
Expand Down
2 changes: 1 addition & 1 deletion Controller/Adminhtml/Slider/MassDelete.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function execute()
} else {
try {
foreach ($sliderIds as $sliderUd) {
$slider = $this->_objectManager->create('Magestore\Bannerslider\Model\Slider')
$slider = $this->_objectManager->create(\Magestore\Bannerslider\Model\Slider::class)
->load($sliderUd);
$slider->delete();
}
Expand Down
Loading