From 2bdeaed0d6b56e520c2bac907eb1a4c513d94eaf Mon Sep 17 00:00:00 2001 From: Thao Pham Date: Tue, 19 Nov 2019 17:29:30 +0700 Subject: [PATCH] Change structure --- .../Source => Model/Source/Config}/Status.php | 9 +- .../Api/BannerRepositoryInterface.php | 45 -- .../BannerSlider/Api/Data/BannerInterface.php | 259 --------- .../BannerSlider/Api/Data/SliderInterface.php | 217 -------- .../BannerSlider/Block/AbstractSlider.php | 139 ----- .../Block/Adminhtml/Edit/BackButton.php | 46 -- .../Block/Adminhtml/Edit/DeleteButton.php | 61 --- .../Adminhtml/Edit/SaveAndContinueButton.php | 39 -- .../Block/Adminhtml/Edit/SaveButton.php | 39 -- .../BannerSlider/Block/Category/Slider.php | 107 ---- .../Boolfly/BannerSlider/Block/Cms/Slider.php | 110 ---- .../Controller/Adminhtml/AbstractBanner.php | 77 --- .../Controller/Adminhtml/AbstractSlider.php | 77 --- .../Controller/Adminhtml/Banner/Delete.php | 46 -- .../Controller/Adminhtml/Banner/Edit.php | 60 --- .../Controller/Adminhtml/Banner/Index.php | 31 -- .../Adminhtml/Banner/MassDelete.php | 83 --- .../Adminhtml/Banner/MassStatus.php | 85 --- .../Controller/Adminhtml/Banner/NewAction.php | 31 -- .../Controller/Adminhtml/Banner/Save.php | 60 --- .../Controller/Adminhtml/Banner/Validate.php | 64 --- .../Controller/Adminhtml/Slider/Edit.php | 56 -- .../Controller/Adminhtml/Slider/Index.php | 31 -- .../Adminhtml/Slider/MassDelete.php | 83 --- .../Adminhtml/Slider/MassStatus.php | 84 --- .../Controller/Adminhtml/Slider/NewAction.php | 31 -- .../Controller/Adminhtml/Slider/Save.php | 61 --- .../Controller/Adminhtml/Slider/Validate.php | 64 --- app/code/Boolfly/BannerSlider/Helper/Data.php | 161 ------ .../Helper/RedundantImageChecker.php | 88 --- .../Boolfly/BannerSlider/Model/Banner.php | 423 --------------- .../Model/Banner/DataProvider.php | 116 ---- .../BannerSlider/Model/BannerRepository.php | 136 ----- .../Boolfly/BannerSlider/Model/ImageField.php | 33 -- .../BannerSlider/Model/ImageUploader.php | 351 ------------ .../Model/ResourceModel/Banner.php | 77 --- .../Model/ResourceModel/Banner/Collection.php | 71 --- .../Model/ResourceModel/Slider.php | 272 ---------- .../Model/ResourceModel/Slider/Collection.php | 97 ---- .../Boolfly/BannerSlider/Model/Slider.php | 304 ----------- .../Model/Slider/DataProvider.php | 192 ------- .../BannerSlider/Model/Source/AlignText.php | 74 --- .../Model/Source/CategoryTree.php | 88 --- .../BannerSlider/Model/Source/Effect.php | 71 --- .../Observer/CheckImageUploaded.php | 59 -- .../Observer/ProcessingImageUpload.php | 92 ---- .../BannerSlider/Setup/InstallSchema.php | 492 ----------------- .../Component/Listing/Columns/EditActions.php | 75 --- .../Component/Listing/Columns/Thumbnail.php | 87 --- app/code/Boolfly/BannerSlider/composer.json | 22 - app/code/Boolfly/BannerSlider/etc/acl.xml | 32 -- .../BannerSlider/etc/adminhtml/events.xml | 22 - .../BannerSlider/etc/adminhtml/menu.xml | 18 - .../BannerSlider/etc/adminhtml/routes.xml | 18 - app/code/Boolfly/BannerSlider/etc/di.xml | 37 -- app/code/Boolfly/BannerSlider/etc/module.xml | 19 - .../Boolfly/BannerSlider/registration.php | 15 - .../layout/bannerslider_banner_edit.xml | 18 - .../layout/bannerslider_banner_index.xml | 18 - .../layout/bannerslider_slider_edit.xml | 18 - .../layout/bannerslider_slider_index.xml | 18 - .../ui_component/boolfly_banner_form.xml | 267 --------- .../ui_component/boolfly_banner_listing.xml | 197 ------- .../ui_component/boolfly_slider_form.xml | 509 ------------------ .../ui_component/boolfly_slider_listing.xml | 155 ------ .../frontend/layout/catalog_category_view.xml | 18 - .../view/frontend/layout/cms_page_view.xml | 18 - .../view/frontend/templates/slider.phtml | 72 --- .../view/frontend/web/js/banner-slider.js | 67 --- 69 files changed, 4 insertions(+), 7008 deletions(-) rename {app/code/Boolfly/BannerSlider/Model/Source => Model/Source/Config}/Status.php (91%) delete mode 100644 app/code/Boolfly/BannerSlider/Api/BannerRepositoryInterface.php delete mode 100644 app/code/Boolfly/BannerSlider/Api/Data/BannerInterface.php delete mode 100644 app/code/Boolfly/BannerSlider/Api/Data/SliderInterface.php delete mode 100644 app/code/Boolfly/BannerSlider/Block/AbstractSlider.php delete mode 100644 app/code/Boolfly/BannerSlider/Block/Adminhtml/Edit/BackButton.php delete mode 100644 app/code/Boolfly/BannerSlider/Block/Adminhtml/Edit/DeleteButton.php delete mode 100644 app/code/Boolfly/BannerSlider/Block/Adminhtml/Edit/SaveAndContinueButton.php delete mode 100644 app/code/Boolfly/BannerSlider/Block/Adminhtml/Edit/SaveButton.php delete mode 100644 app/code/Boolfly/BannerSlider/Block/Category/Slider.php delete mode 100644 app/code/Boolfly/BannerSlider/Block/Cms/Slider.php delete mode 100755 app/code/Boolfly/BannerSlider/Controller/Adminhtml/AbstractBanner.php delete mode 100755 app/code/Boolfly/BannerSlider/Controller/Adminhtml/AbstractSlider.php delete mode 100644 app/code/Boolfly/BannerSlider/Controller/Adminhtml/Banner/Delete.php delete mode 100644 app/code/Boolfly/BannerSlider/Controller/Adminhtml/Banner/Edit.php delete mode 100644 app/code/Boolfly/BannerSlider/Controller/Adminhtml/Banner/Index.php delete mode 100644 app/code/Boolfly/BannerSlider/Controller/Adminhtml/Banner/MassDelete.php delete mode 100644 app/code/Boolfly/BannerSlider/Controller/Adminhtml/Banner/MassStatus.php delete mode 100644 app/code/Boolfly/BannerSlider/Controller/Adminhtml/Banner/NewAction.php delete mode 100644 app/code/Boolfly/BannerSlider/Controller/Adminhtml/Banner/Save.php delete mode 100644 app/code/Boolfly/BannerSlider/Controller/Adminhtml/Banner/Validate.php delete mode 100644 app/code/Boolfly/BannerSlider/Controller/Adminhtml/Slider/Edit.php delete mode 100644 app/code/Boolfly/BannerSlider/Controller/Adminhtml/Slider/Index.php delete mode 100644 app/code/Boolfly/BannerSlider/Controller/Adminhtml/Slider/MassDelete.php delete mode 100644 app/code/Boolfly/BannerSlider/Controller/Adminhtml/Slider/MassStatus.php delete mode 100644 app/code/Boolfly/BannerSlider/Controller/Adminhtml/Slider/NewAction.php delete mode 100644 app/code/Boolfly/BannerSlider/Controller/Adminhtml/Slider/Save.php delete mode 100644 app/code/Boolfly/BannerSlider/Controller/Adminhtml/Slider/Validate.php delete mode 100644 app/code/Boolfly/BannerSlider/Helper/Data.php delete mode 100644 app/code/Boolfly/BannerSlider/Helper/RedundantImageChecker.php delete mode 100644 app/code/Boolfly/BannerSlider/Model/Banner.php delete mode 100644 app/code/Boolfly/BannerSlider/Model/Banner/DataProvider.php delete mode 100644 app/code/Boolfly/BannerSlider/Model/BannerRepository.php delete mode 100644 app/code/Boolfly/BannerSlider/Model/ImageField.php delete mode 100755 app/code/Boolfly/BannerSlider/Model/ImageUploader.php delete mode 100644 app/code/Boolfly/BannerSlider/Model/ResourceModel/Banner.php delete mode 100644 app/code/Boolfly/BannerSlider/Model/ResourceModel/Banner/Collection.php delete mode 100644 app/code/Boolfly/BannerSlider/Model/ResourceModel/Slider.php delete mode 100644 app/code/Boolfly/BannerSlider/Model/ResourceModel/Slider/Collection.php delete mode 100644 app/code/Boolfly/BannerSlider/Model/Slider.php delete mode 100644 app/code/Boolfly/BannerSlider/Model/Slider/DataProvider.php delete mode 100644 app/code/Boolfly/BannerSlider/Model/Source/AlignText.php delete mode 100644 app/code/Boolfly/BannerSlider/Model/Source/CategoryTree.php delete mode 100644 app/code/Boolfly/BannerSlider/Model/Source/Effect.php delete mode 100644 app/code/Boolfly/BannerSlider/Observer/CheckImageUploaded.php delete mode 100644 app/code/Boolfly/BannerSlider/Observer/ProcessingImageUpload.php delete mode 100644 app/code/Boolfly/BannerSlider/Setup/InstallSchema.php delete mode 100644 app/code/Boolfly/BannerSlider/Ui/Component/Listing/Columns/EditActions.php delete mode 100644 app/code/Boolfly/BannerSlider/Ui/Component/Listing/Columns/Thumbnail.php delete mode 100644 app/code/Boolfly/BannerSlider/composer.json delete mode 100644 app/code/Boolfly/BannerSlider/etc/acl.xml delete mode 100644 app/code/Boolfly/BannerSlider/etc/adminhtml/events.xml delete mode 100644 app/code/Boolfly/BannerSlider/etc/adminhtml/menu.xml delete mode 100644 app/code/Boolfly/BannerSlider/etc/adminhtml/routes.xml delete mode 100644 app/code/Boolfly/BannerSlider/etc/di.xml delete mode 100644 app/code/Boolfly/BannerSlider/etc/module.xml delete mode 100644 app/code/Boolfly/BannerSlider/registration.php delete mode 100755 app/code/Boolfly/BannerSlider/view/adminhtml/layout/bannerslider_banner_edit.xml delete mode 100755 app/code/Boolfly/BannerSlider/view/adminhtml/layout/bannerslider_banner_index.xml delete mode 100755 app/code/Boolfly/BannerSlider/view/adminhtml/layout/bannerslider_slider_edit.xml delete mode 100755 app/code/Boolfly/BannerSlider/view/adminhtml/layout/bannerslider_slider_index.xml delete mode 100644 app/code/Boolfly/BannerSlider/view/adminhtml/ui_component/boolfly_banner_form.xml delete mode 100644 app/code/Boolfly/BannerSlider/view/adminhtml/ui_component/boolfly_banner_listing.xml delete mode 100644 app/code/Boolfly/BannerSlider/view/adminhtml/ui_component/boolfly_slider_form.xml delete mode 100644 app/code/Boolfly/BannerSlider/view/adminhtml/ui_component/boolfly_slider_listing.xml delete mode 100644 app/code/Boolfly/BannerSlider/view/frontend/layout/catalog_category_view.xml delete mode 100644 app/code/Boolfly/BannerSlider/view/frontend/layout/cms_page_view.xml delete mode 100644 app/code/Boolfly/BannerSlider/view/frontend/templates/slider.phtml delete mode 100644 app/code/Boolfly/BannerSlider/view/frontend/web/js/banner-slider.js diff --git a/app/code/Boolfly/BannerSlider/Model/Source/Status.php b/Model/Source/Config/Status.php similarity index 91% rename from app/code/Boolfly/BannerSlider/Model/Source/Status.php rename to Model/Source/Config/Status.php index 0994c5e..c4a775c 100644 --- a/app/code/Boolfly/BannerSlider/Model/Source/Status.php +++ b/Model/Source/Config/Status.php @@ -5,16 +5,16 @@ * * See COPYING.txt for license details. * * * * @author info@boolfly.com - * * @project Banner Slider + * * @project Core */ -namespace Boolfly\BannerSlider\Model\Source; +namespace Boolfly\Base\Model\Source; use Magento\Eav\Model\Entity\Attribute\Source\AbstractSource; use Magento\Eav\Model\Entity\Attribute\Source\SourceInterface; use Magento\Framework\Data\OptionSourceInterface; /** - * Banner status functionality model + * Status functionality model * * @api * @since 100.0.2 @@ -22,7 +22,7 @@ class Status extends AbstractSource implements SourceInterface, OptionSourceInterface { /**#@+ - * Banner Status values + * Status values */ const STATUS_ENABLED = 1; @@ -46,7 +46,6 @@ public static function getOptionArray() public function getAllOptions() { $result = []; - foreach (self::getOptionArray() as $index => $value) { $result[] = ['value' => $index, 'label' => $value]; } diff --git a/app/code/Boolfly/BannerSlider/Api/BannerRepositoryInterface.php b/app/code/Boolfly/BannerSlider/Api/BannerRepositoryInterface.php deleted file mode 100644 index 7e3e679..0000000 --- a/app/code/Boolfly/BannerSlider/Api/BannerRepositoryInterface.php +++ /dev/null @@ -1,45 +0,0 @@ -bannerCollectionFactory = $bannerCollectionFactory; - $this->sliderCollectionFactory = $sliderCollectionFactory; - $this->serializer = $serializer; - } - - /** - * Get banner collection - * - * @return boolean|Collection - */ - public function getBannerCollection() - { - if ($this->bannerCollection === null) { - $this->bannerCollection = false; - if ($this->getSlider() && ($sliderId = $this->getSlider()->getId())) { - $bannerCollection = $this->bannerCollectionFactory->create(); - $bannerCollection->addSliderToFilter($sliderId); - $bannerCollection->addActiveStatusFilter(); - $this->bannerCollection = $bannerCollection; - } - } - - return $this->bannerCollection; - } - - /** - * @return string - */ - protected function _toHtml() - { - if ($this->getBannerCollection() && $this->getBannerCollection()->getSize() > 0) { - return parent::_toHtml(); - } - - return ''; - } - - /** - * Get Slider - * - * @return boolean|\Boolfly\BannerSlider\Model\Slider - */ - abstract public function getSlider(); - - /** - * @return boolean|string - */ - protected function isFadeEffect() - { - $slider = $this->getSlider(); - return $slider && $slider->getAnimationEffect() == Effect::FADE_EFFECT; - } - - /** - * Return Json Encoded - * - * @return string - */ - public function getJsonData() - { - $config = [ - 'fade' => $this->isFadeEffect(), - 'autoplay' => $this->getSlider()->isAutoPlay(), - 'autoplaySpeed' => $this->getSlider()->getSpeed() ?: 5000, - ]; - - return $this->serializer->serialize($config); - } -} diff --git a/app/code/Boolfly/BannerSlider/Block/Adminhtml/Edit/BackButton.php b/app/code/Boolfly/BannerSlider/Block/Adminhtml/Edit/BackButton.php deleted file mode 100644 index d831608..0000000 --- a/app/code/Boolfly/BannerSlider/Block/Adminhtml/Edit/BackButton.php +++ /dev/null @@ -1,46 +0,0 @@ - __('Back'), - 'on_click' => sprintf("location.href = '%s';", $this->getBackUrl()), - 'class' => 'back', - 'sort_order' => 10 - ]; - } - - /** - * Get URL for back (reset) button - * - * @return string - */ - public function getBackUrl() - { - return $this->getUrl('*/*/'); - } -} diff --git a/app/code/Boolfly/BannerSlider/Block/Adminhtml/Edit/DeleteButton.php b/app/code/Boolfly/BannerSlider/Block/Adminhtml/Edit/DeleteButton.php deleted file mode 100644 index 673a426..0000000 --- a/app/code/Boolfly/BannerSlider/Block/Adminhtml/Edit/DeleteButton.php +++ /dev/null @@ -1,61 +0,0 @@ -getRequest()->getParam('id', false)) { - return [ - 'id' => 'delete', - 'label' => __('Delete'), - 'on_click' => "deleteConfirm('" .__('Are you sure you want to delete this?') ."', '" - . $this->getDeleteUrl(['id' => $id]) . "', {data: {}})", - 'class' => 'delete', - 'sort_order' => 30 - ]; - } - - return []; - } - - /** - * @param array $args - * @return string - */ - public function getDeleteUrl(array $args = []) - { - $params = array_merge($this->getDefaultUrlParams(), $args); - return $this->getUrl('*/*/delete', $params); - } - - /** - * @return array - */ - protected function getDefaultUrlParams() - { - return ['_current' => true, '_query' => ['isAjax' => null]]; - } -} diff --git a/app/code/Boolfly/BannerSlider/Block/Adminhtml/Edit/SaveAndContinueButton.php b/app/code/Boolfly/BannerSlider/Block/Adminhtml/Edit/SaveAndContinueButton.php deleted file mode 100644 index ba9dcec..0000000 --- a/app/code/Boolfly/BannerSlider/Block/Adminhtml/Edit/SaveAndContinueButton.php +++ /dev/null @@ -1,39 +0,0 @@ - __('Save and Continue Edit'), - 'class' => 'save', - 'data_attribute' => [ - 'mage-init' => ['button' => ['event' => 'saveAndContinueEdit']], - 'form-role' => 'save', - ], - 'sort_order' => 20, - ]; - } -} diff --git a/app/code/Boolfly/BannerSlider/Block/Adminhtml/Edit/SaveButton.php b/app/code/Boolfly/BannerSlider/Block/Adminhtml/Edit/SaveButton.php deleted file mode 100644 index b1e4192..0000000 --- a/app/code/Boolfly/BannerSlider/Block/Adminhtml/Edit/SaveButton.php +++ /dev/null @@ -1,39 +0,0 @@ - __('Save'), - 'class' => 'save primary', - 'data_attribute' => [ - 'mage-init' => ['button' => ['event' => 'save']], - 'form-role' => 'save', - ], - 'sort_order' => 100, - ]; - } -} diff --git a/app/code/Boolfly/BannerSlider/Block/Category/Slider.php b/app/code/Boolfly/BannerSlider/Block/Category/Slider.php deleted file mode 100644 index a6aaee7..0000000 --- a/app/code/Boolfly/BannerSlider/Block/Category/Slider.php +++ /dev/null @@ -1,107 +0,0 @@ -coreRegistry = $registry; - } - - /** - * Get Slider - * - * @return boolean|\Boolfly\BannerSlider\Model\Slider - */ - public function getSlider() - { - if ($this->slider === null) { - $this->slider = false; - $catId = $this->getCategoryId(); - if ($catId) { - /** @var SliderCollection $sliderCollection */ - $sliderCollection = $this->sliderCollectionFactory->create(); - $sliderCollection->addCategoryToFilter($catId); - $sliderCollection->addActiveStatusFilter(); - if ($sliderCollection->getSize() > 0) { - $this->slider = $sliderCollection->getFirstItem(); - } - } - } - - return $this->slider; - } - - /** - * Get Current Category - * - * @return \Magento\Catalog\Model\Category - */ - public function getCurrentCategory() - { - return $this->coreRegistry->registry('current_category'); - } - - /** - * Get Category - * - * @return boolean|mixed - */ - protected function getCategoryId() - { - $category = $this->getCurrentCategory(); - if ($category && $category->getId()) { - return $category->getId(); - } - return false; - } -} diff --git a/app/code/Boolfly/BannerSlider/Block/Cms/Slider.php b/app/code/Boolfly/BannerSlider/Block/Cms/Slider.php deleted file mode 100644 index 90eac30..0000000 --- a/app/code/Boolfly/BannerSlider/Block/Cms/Slider.php +++ /dev/null @@ -1,110 +0,0 @@ -pageFactory = $pageFactory; - } - - /** - * Get Slider - * - * @return boolean|\Boolfly\BannerSlider\Model\Slider - */ - public function getSlider() - { - if ($this->slider === null) { - $this->slider = false; - $pageId = $this->getPageId(); - if ($pageId) { - /** @var SliderCollection $sliderCollection */ - $sliderCollection = $this->sliderCollectionFactory->create(); - $sliderCollection->addCmsPageToFilter($pageId); - $sliderCollection->addActiveStatusFilter(); - if ($sliderCollection->getSize() > 0) { - $this->slider = $sliderCollection->getFirstItem(); - } - } - } - - return $this->slider; - } - - /** - * @return $this|mixed - */ - protected function getPageId() - { - if ($this->isHomepage()) { - $pageIdentifier = $this->_scopeConfig->getValue(Page::XML_PATH_HOME_PAGE); - $page = $this->pageFactory->create()->load($pageIdentifier); - return $page->getId(); - } else { - $pageId = $this->getRequest()->getParam('page_id', false); - } - - return $pageId; - } - - /** - * Check is homepage - * - * @return boolean - */ - public function isHomepage() - { - return $this->getRequest()->getFullActionName() === 'cms_index_index'; - } -} diff --git a/app/code/Boolfly/BannerSlider/Controller/Adminhtml/AbstractBanner.php b/app/code/Boolfly/BannerSlider/Controller/Adminhtml/AbstractBanner.php deleted file mode 100755 index 38b40a5..0000000 --- a/app/code/Boolfly/BannerSlider/Controller/Adminhtml/AbstractBanner.php +++ /dev/null @@ -1,77 +0,0 @@ -_coreRegistry = $coreRegistry; - $this->bannerFactory = $bannerFactory; - } - - /** - * Init action - * - * @return $this - */ - protected function _initAction() - { - $this->_view->loadLayout(); - $this->_setActiveMenu( - 'Boolfly_BannerSlider::manager' - )->_addBreadcrumb( - __('Manage Banner'), - __('Manage Banner') - ); - return $this; - } -} diff --git a/app/code/Boolfly/BannerSlider/Controller/Adminhtml/AbstractSlider.php b/app/code/Boolfly/BannerSlider/Controller/Adminhtml/AbstractSlider.php deleted file mode 100755 index 9712ba1..0000000 --- a/app/code/Boolfly/BannerSlider/Controller/Adminhtml/AbstractSlider.php +++ /dev/null @@ -1,77 +0,0 @@ -coreRegistry = $coreRegistry; - $this->sliderFactory = $sliderFactory; - } - - /** - * Init action - * - * @return $this - */ - protected function _initAction() - { - $this->_view->loadLayout(); - $this->_setActiveMenu( - 'Boolfly_BannerSlider::manager' - )->_addBreadcrumb( - __('Manage Slider'), - __('Manage Slider') - ); - return $this; - } -} diff --git a/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Banner/Delete.php b/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Banner/Delete.php deleted file mode 100644 index 088f08a..0000000 --- a/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Banner/Delete.php +++ /dev/null @@ -1,46 +0,0 @@ -getRequest()->getParam('id'); - /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ - $resultRedirect = $this->resultRedirectFactory->create(); - if ($id) { - /** @var \Boolfly\BannerSlider\Model\Banner $model */ - $model = $this->bannerFactory->create(); - try { - $model->load($id); - $model->delete(); - $this->messageManager->addSuccessMessage(__('The banner has been deleted.')); - return $resultRedirect->setPath('*/*/'); - } catch (\Exception $e) { - $this->messageManager->addErrorMessage(__('Something went wrong while deleted the banner.')); - $this->_objectManager->get('Psr\Log\LoggerInterface')->critical($e->getMessage()); - } - } - - return $resultRedirect->setPath('*/*/'); - } -} diff --git a/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Banner/Edit.php b/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Banner/Edit.php deleted file mode 100644 index 02a143e..0000000 --- a/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Banner/Edit.php +++ /dev/null @@ -1,60 +0,0 @@ -bannerFactory->create(); - $this->_coreRegistry->register('current_banner', $model); - - $id = $this->getRequest()->getParam('id'); - if ($id) { - $model->load($id); - if (!$model->getId()) { - $this->messageManager->addErrorMessage(__('This banner no longer exists.')); - $this->_redirect('bannerslider/banner/*'); - return; - } - } - $data = $this->_objectManager->get('Magento\Backend\Model\Session')->getPageData(true); - if (!empty($data)) { - foreach (ImageField::getField() as $field) { - unset($data[$field]); - } - $model->addData($data); - } - - $this->_initAction(); - $this->_addBreadcrumb( - $id ? __('Edit Banner') : __('New Banner'), - $id ? __('Edit Banner') : __('New Banner') - ); - - $this->_view->getPage()->getConfig()->getTitle()->prepend( - $model->getId() ? $model->getTitle() : __('New Banner') - ); - $this->_view->renderLayout(); - } -} diff --git a/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Banner/Index.php b/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Banner/Index.php deleted file mode 100644 index 2dec205..0000000 --- a/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Banner/Index.php +++ /dev/null @@ -1,31 +0,0 @@ -_initAction()->_addBreadcrumb(__('Content'), __('Content')); - $this->_view->getPage()->getConfig()->getTitle()->prepend(__('Manage Banner')); - $this->_view->renderLayout(); - } -} diff --git a/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Banner/MassDelete.php b/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Banner/MassDelete.php deleted file mode 100644 index ca331cf..0000000 --- a/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Banner/MassDelete.php +++ /dev/null @@ -1,83 +0,0 @@ -collectionFactory = $collectionFactory; - $this->filter = $filter; - } - - /** - * @return \Magento\Framework\App\ResponseInterface|\Magento\Framework\Controller\ResultInterface - * @throws LocalizedException - */ - public function execute() - { - $collections = $this->filter->getCollection($this->collectionFactory->create()); - $totals = 0; - try { - /** @var \Boolfly\BannerSlider\Model\Banner $item */ - foreach ($collections as $item) { - $item->delete(); - $totals++; - } - $this->messageManager->addSuccessMessage(__('A total of %1 record(s) have been deleted.', $totals)); - } catch (\Exception $e) { - $this->messageManager->addErrorMessage(__('Something went wrong while delete the banner(s).')); - } - - /** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */ - $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); - return $resultRedirect->setPath('*/*/'); - } -} diff --git a/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Banner/MassStatus.php b/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Banner/MassStatus.php deleted file mode 100644 index 2502e81..0000000 --- a/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Banner/MassStatus.php +++ /dev/null @@ -1,85 +0,0 @@ -collectionFactory = $collectionFactory; - $this->filter = $filter; - } - - /** - * @return \Magento\Framework\App\ResponseInterface|\Magento\Framework\Controller\ResultInterface - * @throws LocalizedException - */ - public function execute() - { - $collections = $this->filter->getCollection($this->collectionFactory->create()); - $status = $this->getRequest()->getParam('status'); - $totals = 0; - try { - /** @var \Boolfly\BannerSlider\Model\Banner $item */ - foreach ($collections as $item) { - $item->setStatus($status); - $item->save(); - $totals++; - } - $this->messageManager->addSuccessMessage(__('A total of %1 record(s) have been updated.', $totals)); - } catch (\Exception $e) { - $this->messageManager->addErrorMessage(__('Something went wrong while update the banner(s).')); - } - - /** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */ - $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); - return $resultRedirect->setPath('*/*/'); - } -} diff --git a/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Banner/NewAction.php b/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Banner/NewAction.php deleted file mode 100644 index 5eb5fd9..0000000 --- a/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Banner/NewAction.php +++ /dev/null @@ -1,31 +0,0 @@ -_forward('edit'); - } -} diff --git a/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Banner/Save.php b/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Banner/Save.php deleted file mode 100644 index f3ce926..0000000 --- a/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Banner/Save.php +++ /dev/null @@ -1,60 +0,0 @@ -getRequest()->getPostValue(); - /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ - $resultRedirect = $this->resultRedirectFactory->create(); - if ($data) { - /** @var \Boolfly\BannerSlider\Model\Banner $model */ - $model = $this->bannerFactory->create(); - if (!empty($data['banner_id'])) { - $model->load($data['banner_id']); - if ($data['banner_id'] != $model->getId()) { - throw new LocalizedException(__('Wrong banner Id: %1.', $data['banner_id'])); - } - } - $model->addData($data); - $this->_objectManager->get('Magento\Backend\Model\Session')->setPageData($model->getData()); - try { - $model->save(); - $this->messageManager->addSuccessMessage(__('The banner has been saved.')); - $this->_objectManager->get('Magento\Backend\Model\Session')->setPageData(false); - if ($this->getRequest()->getParam('back')) { - return $resultRedirect->setPath('*/*/edit', ['id' => $model->getId(), '_current' => true]); - } - - return $resultRedirect->setPath('*/*/'); - } catch (\Exception $e) { - $this->messageManager->addErrorMessage(__('Something went wrong while saving the banner.')); - $this->_objectManager->get('Psr\Log\LoggerInterface')->critical($e->getMessage()); - return $resultRedirect->setPath('*/*/edit', ['id' => $this->getRequest()->getParam('id')]); - } - } - - return $resultRedirect->setPath('*/*/'); - } -} diff --git a/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Banner/Validate.php b/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Banner/Validate.php deleted file mode 100644 index 072fbee..0000000 --- a/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Banner/Validate.php +++ /dev/null @@ -1,64 +0,0 @@ -resultFactory->create(ResultFactory::TYPE_JSON); - $resultJson->setData($this->validateData()); - - return $resultJson; - } - - /** - * Validate Data - * - * @return DataObject - */ - private function validateData() - { - $error = false; - $messages = []; - $response = new DataObject(); - try { - $images = $this->getRequest()->getParam(BannerInterface::IMAGE_DESKTOP); - if (!($images && is_array($images))) { - throw new LocalizedException(__('You should upload image desktop.')); - } - } catch (LocalizedException $e) { - $error = true; - $messages[] = $e->getMessage(); - } - $result = [ - 'error' => $error, - 'messages' => $messages - ]; - $response->setData($result); - - return $response; - } -} diff --git a/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Slider/Edit.php b/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Slider/Edit.php deleted file mode 100644 index f73c19d..0000000 --- a/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Slider/Edit.php +++ /dev/null @@ -1,56 +0,0 @@ -sliderFactory->create(); - $this->coreRegistry->register('current_slider', $model); - - $id = $this->getRequest()->getParam('id'); - if ($id) { - $model->load($id); - if (!$model->getId()) { - $this->messageManager->addErrorMessage(__('This slider no longer exists.')); - $this->_redirect('bannerslider/slider/*'); - return; - } - } - $data = $this->_objectManager->get('Magento\Backend\Model\Session')->getPageData(true); - if (!empty($data)) { - $model->addData($data); - } - - $this->_initAction(); - $this->_addBreadcrumb( - $id ? __('Edit Slider') : __('New Slider'), - $id ? __('Edit Slider') : __('New Slider') - ); - - $this->_view->getPage()->getConfig()->getTitle()->prepend( - $model->getId() ? $model->getTitle() : __('New Slider') - ); - $this->_view->renderLayout(); - } -} diff --git a/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Slider/Index.php b/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Slider/Index.php deleted file mode 100644 index 9d10e82..0000000 --- a/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Slider/Index.php +++ /dev/null @@ -1,31 +0,0 @@ -_initAction()->_addBreadcrumb(__('Content'), __('Content')); - $this->_view->getPage()->getConfig()->getTitle()->prepend(__('Manage Slider')); - $this->_view->renderLayout(); - } -} diff --git a/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Slider/MassDelete.php b/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Slider/MassDelete.php deleted file mode 100644 index cf95bd4..0000000 --- a/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Slider/MassDelete.php +++ /dev/null @@ -1,83 +0,0 @@ -collectionFactory = $collectionFactory; - $this->filter = $filter; - } - - /** - * @return \Magento\Framework\App\ResponseInterface|\Magento\Framework\Controller\ResultInterface - * @throws LocalizedException - */ - public function execute() - { - $collections = $this->filter->getCollection($this->collectionFactory->create()); - $totals = 0; - try { - /** @var \Boolfly\BannerSlider\Model\Slider $item */ - foreach ($collections as $item) { - $item->delete(); - $totals++; - } - $this->messageManager->addSuccessMessage(__('A total of %1 record(s) have been deleted.', $totals)); - } catch (\Exception $e) { - $this->messageManager->addErrorMessage(__('Something went wrong while delete the slider(s).')); - } - - /** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */ - $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); - return $resultRedirect->setPath('*/*/'); - } -} diff --git a/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Slider/MassStatus.php b/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Slider/MassStatus.php deleted file mode 100644 index 0aa8dfb..0000000 --- a/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Slider/MassStatus.php +++ /dev/null @@ -1,84 +0,0 @@ -collectionFactory = $collectionFactory; - $this->filter = $filter; - } - - /** - * @return \Magento\Framework\App\ResponseInterface|\Magento\Framework\Controller\ResultInterface - * @throws LocalizedException - */ - public function execute() - { - $collections = $this->filter->getCollection($this->collectionFactory->create()); - $status = $this->getRequest()->getParam('status'); - $totals = 0; - try { - /** @var \Boolfly\BannerSlider\Model\Slider $item */ - foreach ($collections as $item) { - $item->setStatus($status); - $item->save(); - $totals++; - } - $this->messageManager->addSuccessMessage(__('A total of %1 record(s) have been updated.', $totals)); - } catch (\Exception $e) { - $this->messageManager->addErrorMessage(__('Something went wrong while update the slider(s).')); - } - /** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */ - $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); - return $resultRedirect->setPath('*/*/'); - } -} diff --git a/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Slider/NewAction.php b/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Slider/NewAction.php deleted file mode 100644 index dba22c6..0000000 --- a/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Slider/NewAction.php +++ /dev/null @@ -1,31 +0,0 @@ -_forward('edit'); - } -} diff --git a/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Slider/Save.php b/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Slider/Save.php deleted file mode 100644 index df7af39..0000000 --- a/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Slider/Save.php +++ /dev/null @@ -1,61 +0,0 @@ -getRequest()->getPostValue(); - /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ - $resultRedirect = $this->resultRedirectFactory->create(); - if ($data) { - /** @var \Boolfly\BannerSlider\Model\Banner $model */ - $model = $this->sliderFactory->create(); - if (!empty($data['slider_id'])) { - $model->load($data['slider_id']); - if ($data['slider_id'] != $model->getId()) { - throw new LocalizedException(__('Wrong Slider ID: %1.', $data['slider_id'])); - } - } - $model->addData($data); - $this->_objectManager->get('Magento\Backend\Model\Session')->setPageData($model->getData()); - try { - $model->save(); - $this->messageManager->addSuccessMessage(__('The slider has been saved.')); - $this->_objectManager->get('Magento\Backend\Model\Session')->setPageData(false); - if ($this->getRequest()->getParam('back')) { - return $resultRedirect->setPath('*/*/edit', ['id' => $model->getId(), '_current' => true]); - } - - return $resultRedirect->setPath('*/*/'); - } catch (\Exception $e) { - $this->messageManager->addErrorMessage(__($e->getMessage())); - $this->messageManager->addErrorMessage(__('Something went wrong while saving the slider.')); - $this->_objectManager->get('Psr\Log\LoggerInterface')->critical($e->getMessage()); - return $resultRedirect->setPath('*/*/edit', ['id' => $this->getRequest()->getParam('id')]); - } - } - - return $resultRedirect->setPath('*/*/'); - } -} diff --git a/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Slider/Validate.php b/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Slider/Validate.php deleted file mode 100644 index 4d48a81..0000000 --- a/app/code/Boolfly/BannerSlider/Controller/Adminhtml/Slider/Validate.php +++ /dev/null @@ -1,64 +0,0 @@ -resultFactory->create(ResultFactory::TYPE_JSON); - $resultJson->setData($this->validateData()); - - return $resultJson; - } - - /** - * Validate Data - * - * @return DataObject - */ - private function validateData() - { - $error = false; - $messages = []; - $response = new DataObject(); - try { - $banners = $this->getRequest()->getParam('assigned_banners'); - if (!($banners && !empty($banners))) { - throw new LocalizedException(__('You should assign least a banner.')); - } - } catch (LocalizedException $e) { - $error = true; - $messages[] = $e->getMessage(); - } - $result = [ - 'error' => $error, - 'messages' => $messages - ]; - $response->setData($result); - - return $response; - } -} diff --git a/app/code/Boolfly/BannerSlider/Helper/Data.php b/app/code/Boolfly/BannerSlider/Helper/Data.php deleted file mode 100644 index 21549d1..0000000 --- a/app/code/Boolfly/BannerSlider/Helper/Data.php +++ /dev/null @@ -1,161 +0,0 @@ -filesystem = $filesystem; - $this->directory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA); - $this->imageFactory = $imageFactory; - $this->storeManager = $storeManager; - $this->categoryRepository = $categoryRepository; - $this->eavConfig = $eavConfig; - $this->imageUploader = $imageUploader; - } - - /** - * Get Resize Image - * - * @param $imageName - * @param integer $width - * @param integer $height - * @return boolean|string - * @throws \Exception - * @throws \Magento\Framework\Exception\NoSuchEntityException - */ - public function getResizeImage($imageName, $width = self::THUMBNAIL_WIDTH, $height = self::THUMBNAIL_HEIGHT) - { - $directoryRead = $this->filesystem->getDirectoryRead(DirectoryList::MEDIA); - $imageUploader = $this->imageUploader; - if (!$imageUploader->isFile($imageName)) { - return false; - } - $cacheDirectory = $imageUploader->getBasePath(). '/cache/' . $width . 'x' . $height. '/'; - $absolutePath = $directoryRead->getAbsolutePath($imageUploader->getBasePath()) . '/' . $imageName; - $imageResized = $directoryRead->getAbsolutePath($cacheDirectory) . $imageName; - if (!$this->directory->isFile($imageResized)) { - /** @var \Magento\Framework\Image\Adapter\AbstractAdapter $imageResize */ - $imageResize = $this->imageFactory->create(); - $imageResize->open($absolutePath); - $imageResize->constrainOnly(false); - $imageResize->keepTransparency(true); - $imageResize->keepFrame(false); - $imageResize->keepAspectRatio(true); - $imageResize->resize($width, $height); - $imageResize->save($imageResized); - } - $resizeURL = $this->getBaseMediaUrl() . ltrim($cacheDirectory . $imageName, '/'); - - return $resizeURL; - } - - /** - * Get Image Name - * - * @param $imageName - * @return boolean|string - * @throws \Magento\Framework\Exception\NoSuchEntityException - */ - public function getImageUrl($imageName) - { - return $this->imageUploader->getImageUrl($imageName); - } - - /** - * @return mixed - * @throws \Magento\Framework\Exception\NoSuchEntityException - */ - public function getBaseMediaUrl() - { - return $this->storeManager->getStore()->getBaseUrl(UrlInterface::URL_TYPE_MEDIA); - } -} diff --git a/app/code/Boolfly/BannerSlider/Helper/RedundantImageChecker.php b/app/code/Boolfly/BannerSlider/Helper/RedundantImageChecker.php deleted file mode 100644 index e9dbdc1..0000000 --- a/app/code/Boolfly/BannerSlider/Helper/RedundantImageChecker.php +++ /dev/null @@ -1,88 +0,0 @@ -resourceConnection = $resourceConnection; - $this->connection = $resourceConnection->getConnection(); - $this->imageUploader = $imageUploader; - } - - /** - * Delete the image un-used - * - * @param $image - * @throws \Magento\Framework\Exception\FileSystemException - */ - public function process($image) - { - if ($image && is_string($image) && $this->isRedundant($image)) { - $this->imageUploader->deleteImageFile($image); - } - } - - /** - * Checking Image Unused - * - * @param string $image - * @return boolean - */ - private function isRedundant($image) - { - $connection = $this->connection; - $conditionArray = []; - foreach (ImageField::getField() as $field) { - $conditionArray[] = $connection->quoteInto($field . ' = ?', $image); - } - $conditions = join(' OR ', $conditionArray); - $select = $connection->select() - ->from($connection->getTableName('boolfly_banner'), 'banner_id') - ->where($conditions) - ->limit(1); - - return ((int)$connection->fetchOne($select)) < 1; - } -} diff --git a/app/code/Boolfly/BannerSlider/Model/Banner.php b/app/code/Boolfly/BannerSlider/Model/Banner.php deleted file mode 100644 index e0d8778..0000000 --- a/app/code/Boolfly/BannerSlider/Model/Banner.php +++ /dev/null @@ -1,423 +0,0 @@ -storeManager = $storeManager; - $this->imageUploader = $imageUploader; - } - - /** - * Initialize resource model - * - * @return void - */ - public function _construct() - { - $this->_init(BannerResourceModel::class); - } - - /** - * Get Image Url - * - * @param $image - * @return boolean|string - * @throws LocalizedException - * @throws \Magento\Framework\Exception\NoSuchEntityException - */ - public function getImageUrl($image) - { - $url = false; - if ($image) { - if (is_string($image)) { - /** @var \Magento\Store\Model\Store $store */ - $store = $this->storeManager->getStore(); - $mediaBaseUrl = $store->getBaseUrl( - UrlInterface::URL_TYPE_MEDIA - ); - $url = $mediaBaseUrl - . ltrim(self::ENTITY_MEDIA_PATH, '/') - . '/' - . $image; - } else { - throw new LocalizedException( - __('Something went wrong while getting the image url.') - ); - } - } - - return $url; - } - - /** - * Get Title - * - * @return string|null - * @since 1.0.0 - */ - public function getTitle() - { - return $this->_getData(self::TITLE); - } - - /** - * Set Title - * - * @param string $title - * - * @return $this - * @since 1.0.0 - */ - public function setTitle($title) - { - return $this->setData(self::TITLE); - } - - /** - * Get Status - * - * @return boolean - * @since 1.0.0 - */ - public function getStatus() - { - return (boolean)$this->_getData(self::STATUS); - } - - /** - * Set Status - * - * @param integer|boolean $status - * - * @return $this - * @since 1.0.0 - */ - public function setStatus($status) - { - return $this->setData(self::STATUS, $status); - } - - /** - * Get Banner Url - * - * @return string|null - * @since 1.0.0 - */ - public function getBannerUrl() - { - return $this->_getData(self::BANNER_URL); - } - - /** - * Set Banner Url - * - * @param string $url - * - * @return $this - * @since 1.0.0 - */ - public function setBannerUrl($url) - { - return $this->setData(self::BANNER_URL, $url); - } - - /** - * Get Banner Description - * - * @return string|null - * @since 1.0.0 - */ - public function getDescription() - { - return $this->_getData(self::DESCRIPTION); - } - - /** - * Set Description - * - * @param string $description - * - * @return $this - * @since 1.0.0 - */ - public function setDescription($description) - { - return $this->setData(self::DESCRIPTION, $description); - } - - /** - * Get Button Text - * - * @return string|null - * @since 1.0.0 - */ - public function getButtonText() - { - return $this->_getData(self::BUTTON_TEXT); - } - - /** - * Set Button Text - * - * @param string $text - * - * @return $this - * @since 1.0.0 - */ - public function setButtonText($text) - { - return $this->setData(self::BUTTON_TEXT); - } - - /** - * Get Button Url - * - * @return string|null - * @since 1.0.0 - */ - public function getButtonUrl() - { - return $this->_getData(self::BUTTON_URL); - } - - /** - * Set Button Url - * - * @param string $url - * - * @return $this - * @since 1.0.0 - */ - public function setButtonUrl($url) - { - return $this->setData(self::BUTTON_URL, $url); - } - - /** - * Get Image Desktop Url - * - * @return string|boolean - * @since 1.0.0 - * @throws LocalizedException - * @throws \Magento\Framework\Exception\NoSuchEntityException - */ - public function getImageDesktopUrl() - { - return $this->getImageUrl($this->_getData(self::IMAGE_DESKTOP)); - } - - /** - * Set Image Desktop - * - * @param string $imageName - * - * @return $this - * @since 1.0.0 - */ - public function setImageDesktop($imageName) - { - return $this->setData(self::IMAGE_DESKTOP, $imageName); - } - - /** - * Get Image Tablet Url - * - * @return string|boolean - * @since 1.0.0 - * @throws LocalizedException - * @throws \Magento\Framework\Exception\NoSuchEntityException - */ - public function getImageTabletUrl() - { - return $this->getImageUrl($this->_getData(self::IMAGE_TABLET)); - } - - /** - * Set Image Tablet - * - * @param string $imageName - * - * @return $this - * @since 1.0.0 - */ - public function setImageTablet($imageName) - { - return $this->setData(self::IMAGE_TABLET); - } - - /** - * Get Image Mobile Url - * - * @return string|boolean - * @since 1.0.0 - * @throws LocalizedException - * @throws \Magento\Framework\Exception\NoSuchEntityException - */ - public function getImageMobileUrl() - { - return $this->getImageUrl($this->_getData(self::IMAGE_MOBILE)); - } - - /** - * Set Image Mobile - * - * @param string $imageName - * - * @return $this - * @since 1.0.0 - */ - public function setImageMobile($imageName) - { - return $this->setData(self::IMAGE_MOBILE, $imageName); - } - - /** - * Get Target Link - * - * @return string|null - * @since 1.0.0 - */ - public function getTargetLink() - { - return $this->_getData(self::TARGET_LINK); - } - - /** - * Set Target Link - * - * @param string $targetLink - * - * @return $this - * @since 1.0.0 - */ - public function setTargetLink($targetLink) - { - return $this->setData(self::TARGET_LINK, $targetLink); - } - - /** - * Get Align Text - * - * @return string|null - * @since 1.0.0 - */ - public function getAlignText() - { - return $this->_getData(self::ALIGN_TEXT); - } - - /** - * Check Button - * - * @return boolean - */ - public function hasButton() - { - return $this->getButtonUrl() || $this->getButtonText(); - } - - /** - * Set Align Text - * - * @param string $alignText - * - * @return $this - * @since 1.0.0 - */ - public function setAlignText($alignText) - { - return $this->setData(self::ALIGN_TEXT, $alignText); - } - - /** - * Return unique ID(s) for each object in system - * - * @return string[] - */ - public function getIdentities() - { - $identities = [ - self::CACHE_TAG . '_' . $this->getId(), - ]; - - if (!$this->getId() || $this->isDeleted()) { - $identities[] = self::CACHE_TAG; - } - - return array_unique($identities); - } -} diff --git a/app/code/Boolfly/BannerSlider/Model/Banner/DataProvider.php b/app/code/Boolfly/BannerSlider/Model/Banner/DataProvider.php deleted file mode 100644 index eaa9c8c..0000000 --- a/app/code/Boolfly/BannerSlider/Model/Banner/DataProvider.php +++ /dev/null @@ -1,116 +0,0 @@ -collection = $collectionFactory->create(); - $this->coreRegistry = $registry; - parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data); - $this->imageUploader = $imageUploader; - } - - /** - * {@inheritdoc} - */ - public function getData() - { - if (isset($this->loadedData)) { - return $this->loadedData; - } - /** @var BannerInterface | \Boolfly\BannerSlider\Model\Banner $banner */ - $banner = $this->coreRegistry->registry('current_banner'); - if ($banner->getId()) { - $bannerData = $banner->getData(); - foreach (ImageField::getField() as $field) { - unset($bannerData[$field]); - $imageName = $banner->getData($field); - if ($imageSrc = $banner->getImageUrl($imageName)) { - try { - $size = $this->imageUploader->getSize($imageName); - } catch (\Exception $e) { - $size = 'undefined'; - } - $bannerData[$field][] = [ - 'name' => $imageName, - 'url' => $imageSrc, - 'size' => $size - ]; - } - } - if ($banner->getButtonText() || $banner->getButtonUrl()) { - $bannerData['enable_button'] = '1'; - } else { - $bannerData['enable_button'] = '0'; - } - $this->loadedData[$banner->getId()] = $bannerData; - } else { - $this->loadedData = []; - } - - return $this->loadedData; - } -} diff --git a/app/code/Boolfly/BannerSlider/Model/BannerRepository.php b/app/code/Boolfly/BannerSlider/Model/BannerRepository.php deleted file mode 100644 index 041b408..0000000 --- a/app/code/Boolfly/BannerSlider/Model/BannerRepository.php +++ /dev/null @@ -1,136 +0,0 @@ -resource = $resource; - $this->bannerFactory = $bannerFactory; - } - - /** - * Get Banner by Id - * - * @param string $bannerId - * @param boolean $force - * @return null|BannerInterface - * @throws NoSuchEntityException - */ - public function get($bannerId, $force = false) - { - $cacheKey = 'all'; - if (!isset($this->instances[$bannerId][$cacheKey]) || $force) { - /** @var Banner $banner */ - $banner = $this->bannerFactory->create(); - $banner->load($bannerId); - if (!$banner->getId()) { - throw NoSuchEntityException::singleField('id', $bannerId); - } - $this->instances[$bannerId][$cacheKey] = $banner; - } - return $this->instances[$bannerId][$cacheKey]; - } - - /** - * Delete Banner - * - * @param Banner|BannerInterface $banner - * @return boolean - * @throws StateException - */ - public function delete(BannerInterface $banner) - { - try { - $bannerId = $banner->getId(); - $this->resource->delete($banner); - } catch (\Exception $e) { - throw new StateException( - __( - 'Cannot delete category with id %1', - $banner->getId() - ), - $e - ); - } - unset($this->instances[$bannerId]); - - return true; - } - - /** - * Save Banner - * - * @param Banner|BannerInterface $banner - * @return BannerInterface|null - * @throws CouldNotSaveException - * @throws NoSuchEntityException - */ - public function save(BannerInterface $banner) - { - $existingData = $banner->getData(); - - if ($banner->getId()) { - $banner = $this->get($banner->getId()); - } - $banner->addData($existingData); - try { - $this->resource->save($banner); - } catch (\Exception $e) { - throw new CouldNotSaveException( - __( - 'Could not save banner: %1', - $e->getMessage() - ), - $e - ); - } - unset($this->instances[$banner->getId()]); - return $this->get($banner->getId()); - } -} diff --git a/app/code/Boolfly/BannerSlider/Model/ImageField.php b/app/code/Boolfly/BannerSlider/Model/ImageField.php deleted file mode 100644 index 977939f..0000000 --- a/app/code/Boolfly/BannerSlider/Model/ImageField.php +++ /dev/null @@ -1,33 +0,0 @@ -coreFileStorageDatabase = $coreFileStorageDatabase; - $this->mediaDirectory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA); - $this->uploaderFactory = $uploaderFactory; - $this->storeManager = $storeManager; - $this->logger = $logger; - $this->baseTmpPath = $baseTmpPath; - $this->basePath = $basePath; - $this->allowedExtensions = $allowedExtensions; - $this->assetRepository = $assetRepository; - } - - /** - * Set base tmp path - * - * @param string $baseTmpPath - * - * @return void - */ - public function setBaseTmpPath($baseTmpPath) - { - $this->baseTmpPath = $baseTmpPath; - } - - /** - * Set base path - * - * @param string $basePath - * - * @return void - */ - public function setBasePath($basePath) - { - $this->basePath = $basePath; - } - - /** - * Set allowed extensions - * - * @param string[] $allowedExtensions - * - * @return void - */ - public function setAllowedExtensions($allowedExtensions) - { - $this->allowedExtensions = $allowedExtensions; - } - - /** - * Retrieve base tmp path - * - * @return string - */ - public function getBaseTmpPath() - { - return $this->baseTmpPath; - } - - /** - * Retrieve base path - * - * @return string - */ - public function getBasePath() - { - return $this->basePath; - } - - /** - * Retrieve base path - * - * @return string[] - */ - public function getAllowedExtensions() - { - return $this->allowedExtensions; - } - - /** - * Retrieve path - * - * @param string $path - * @param string $imageName - * - * @return string - */ - public function getFilePath($path, $imageName) - { - return rtrim($path, '/') . '/' . ltrim($imageName, '/'); - } - - /** - * Checking file for moving and move it - * - * @param string $imageName - * - * @return string - * - * @throws LocalizedException - */ - public function moveFileFromTmp($imageName) - { - $baseTmpPath = $this->getBaseTmpPath(); - $basePath = $this->getBasePath(); - - $baseImagePath = $this->getFilePath($basePath, $imageName); - $baseTmpImagePath = $this->getFilePath($baseTmpPath, $imageName); - - try { - $this->coreFileStorageDatabase->copyFile( - $baseTmpImagePath, - $baseImagePath - ); - $this->mediaDirectory->renameFile( - $baseTmpImagePath, - $baseImagePath - ); - } catch (\Exception $e) { - throw new LocalizedException( - __('Something went wrong while saving the file(s).') - ); - } - - return $imageName; - } - - /** - * @param $image - * @return boolean - * @throws \Magento\Framework\Exception\FileSystemException - */ - public function deleteImageFile($image) - { - return $this->mediaDirectory->delete($this->getFilePath($this->getBasePath(), $image)); - } - - /** - * Get Image Url - * - * @param $name - * @return string|boolean - * @throws \Magento\Framework\Exception\NoSuchEntityException - */ - public function getImageUrl($name) - { - if ($this->isFile($name)) { - return $this->storeManager - ->getStore() - ->getBaseUrl( - UrlInterface::URL_TYPE_MEDIA - ) . $this->getFilePath($this->getBasePath(), $name); - } - return false; - } - - /** - * @param $name - * @return mixed - */ - public function getSize($name) - { - $stat = $this->mediaDirectory->stat($this->getFilePath($this->getBasePath(), $name)); - - return $stat[7]; - } - - /** - * @param $name - * @return boolean - */ - public function isFile($name) - { - return $this->mediaDirectory->isFile($this->getFilePath($this->getBasePath(), $name)); - } - - /** - * Checking file for save and save it to tmp dir - * - * @param $fileId - * @return array - * @throws \Exception - * @throws LocalizedException - */ - public function saveFileToTmpDir($fileId) - { - $baseTmpPath = $this->getBaseTmpPath(); - - $uploader = $this->uploaderFactory->create(['fileId' => $fileId]); - $uploader->setAllowedExtensions($this->getAllowedExtensions()); - $uploader->setAllowRenameFiles(true); - - $result = $uploader->save($this->mediaDirectory->getAbsolutePath($baseTmpPath)); - - if (!$result) { - throw new LocalizedException( - __('File can not be saved to the destination folder.') - ); - } - - /** - * Workaround for prototype 1.7 methods "isJSON", "evalJSON" on Windows OS - */ - $result['tmp_name'] = str_replace('\\', '/', $result['tmp_name']); - $result['path'] = str_replace('\\', '/', $result['path']); - $result['url'] = $this->storeManager - ->getStore() - ->getBaseUrl( - UrlInterface::URL_TYPE_MEDIA - ) . $this->getFilePath($baseTmpPath, $result['file']); - $result['name'] = $result['file']; - - if (isset($result['file'])) { - try { - $relativePath = rtrim($baseTmpPath, '/') . '/' . ltrim($result['file'], '/'); - $this->coreFileStorageDatabase->saveFile($relativePath); - } catch (\Exception $e) { - $this->logger->critical($e); - throw new LocalizedException( - __('Something went wrong while saving the file(s).') - ); - } - } - - return $result; - } -} diff --git a/app/code/Boolfly/BannerSlider/Model/ResourceModel/Banner.php b/app/code/Boolfly/BannerSlider/Model/ResourceModel/Banner.php deleted file mode 100644 index f857041..0000000 --- a/app/code/Boolfly/BannerSlider/Model/ResourceModel/Banner.php +++ /dev/null @@ -1,77 +0,0 @@ -dateTime = $dateTime; - } - - /** - * Initialize resource - * - * @return void - */ - public function _construct() - { - $this->_init(InstallSchema::BANNER_TABLE_NAME, 'banner_id'); - } - - /** - * Before save - * - * @param AbstractModel $object - * @return mixed - */ - protected function _beforeSave(AbstractModel $object) - { - $gmtDate = $this->dateTime->gmtDate(); - if ($object->isObjectNew()) { - $object->setData('created_at', $gmtDate); - } - $object->setData('updated_at', $gmtDate); - if (!$object->getData('enable_button')) { - $object->setData('button_text', null); - $object->setData('button_url', null); - } - - return parent::_beforeSave($object); - } -} diff --git a/app/code/Boolfly/BannerSlider/Model/ResourceModel/Banner/Collection.php b/app/code/Boolfly/BannerSlider/Model/ResourceModel/Banner/Collection.php deleted file mode 100644 index 45e4ceb..0000000 --- a/app/code/Boolfly/BannerSlider/Model/ResourceModel/Banner/Collection.php +++ /dev/null @@ -1,71 +0,0 @@ -_init(Banner::class, BannerResourceModel::class); - } - - /** - * Only get enable banner - * - * @return Collection - */ - public function addActiveStatusFilter() - { - return $this->addFieldToFilter('status', Status::STATUS_ENABLED); - } - - /** - * @param $sliderId - * @return $this - */ - public function addSliderToFilter($sliderId) - { - if ($sliderId && is_numeric($sliderId)) { - $conditions = $this->getConnection()->quoteInto( - 'main_table.banner_id = banner_slider.banner_id AND banner_slider.slider_id = ?', - $sliderId - ); - $this->getSelect()->joinInner( - ['banner_slider' => $this->getTable(InstallSchema::BANNER_SLIDER_TABLE_NAME)], - $conditions - ); - } - - return $this; - } -} diff --git a/app/code/Boolfly/BannerSlider/Model/ResourceModel/Slider.php b/app/code/Boolfly/BannerSlider/Model/ResourceModel/Slider.php deleted file mode 100644 index 38fc956..0000000 --- a/app/code/Boolfly/BannerSlider/Model/ResourceModel/Slider.php +++ /dev/null @@ -1,272 +0,0 @@ -dateTime = $dateTime; - } - - /** - * Initialize resource - * - * @return void - */ - public function _construct() - { - $this->_init(InstallSchema::SLIDER_TABLE_NAME, 'slider_id'); - } - - /** - * Before save - * - * @param AbstractModel $object - * @return mixed - */ - protected function _beforeSave(AbstractModel $object) - { - $gmtDate = $this->dateTime->gmtDate(); - if ($object->isObjectNew()) { - $object->setData('created_at', $gmtDate); - } - $object->setData('updated_at', $gmtDate); - - return parent::_beforeSave($object); - } - - /** - * Banner Slider Table - * - * @return string - */ - public function getBannerSliderTable() - { - return $this->getTable(InstallSchema::BANNER_SLIDER_TABLE_NAME); - } - - /** - * Get Slider CMS Page Table - * - * @return string - */ - public function getSliderCmsPageTable() - { - return $this->getTable(InstallSchema::SLIDER_CMS_PAGE_TABLE_NAME); - } - - /** - * @param AbstractModel $object - * @return mixed - */ - protected function _afterLoad(AbstractModel $object) - { - $this->getLinkData($object); - return parent::_afterLoad($object); - } - - /** - * Get Link Data - * - * @param AbstractModel $object - */ - private function getLinkData(AbstractModel $object) - { - $this->getBannerLink($object); - $this->getCmsPageLink($object); - } - - /** - * Get Banner Link - * - * @param AbstractModel $object - */ - private function getBannerLink(AbstractModel $object) - { - $connection = $this->getConnection(); - $select = $connection->select() - ->from($this->getBannerSliderTable(), ['banner_id', 'position']) - ->where('slider_id = ?', $object->getId()) - ->order('position ASC'); - $bannerData = $connection->fetchPairs($select); - $object->setData('assigned_banners', $bannerData); - } - - /** - * Get Cms Page Id - * - * @param AbstractModel $object - */ - private function getCmsPageLink(AbstractModel $object) - { - $connection = $this->getConnection(); - $select = $connection->select() - ->from($this->getSliderCmsPageTable(), ['page_id']) - ->where('slider_id = ?', $object->getId()); - $data = $connection->fetchCol($select); - $object->setData('cms_pages', $data); - } - - /** - * Process data to some link tables - * - * @param AbstractModel $object - * @return mixed - */ - protected function _afterSave(AbstractModel $object) - { - $this->processLinkTable($object); - return parent::_afterSave($object); - } - - /** - * Process data to link table - * - * @param AbstractModel $object - * @return $this - */ - private function processLinkTable(AbstractModel $object) - { - $this->processBannerSliderTable($object); - $this->processSliderCmsPageTable($object); - - return $this; - } - - /** - * Save data to boolfly_banner_slider table - * - * @param AbstractModel $object - */ - private function processBannerSliderTable(AbstractModel $object) - { - $assignedBanners = $object->getDataByPath('assigned_banners'); - if ($object->getId() && is_array($assignedBanners) && !empty($assignedBanners)) { - $bannerSliderData = []; - $bannerSliderTable = $this->getBannerSliderTable(); - $select = $this->getConnection() - ->select() - ->from($bannerSliderTable, ['banner_id']) - ->where('slider_id = ?', $object->getId()); - - /** - * Remove Banner not used - */ - $oldData = $this->getConnection()->fetchCol($select); - if (!empty($oldData) && !empty($assignedBanners)) { - $bannerRemoved = array_diff($oldData, array_column($assignedBanners, 'banner_id')); - if (!empty($bannerRemoved)) { - $this->getConnection()->delete( - $bannerSliderTable, - [ - 'banner_id IN(?)' => $bannerRemoved, - 'slider_id = ?' => $object->getId() - ] - ); - } - } - foreach ($assignedBanners as $assignedBanner) { - $bannerSliderData[] = [ - 'banner_id' => $assignedBanner['banner_id'], - 'slider_id' => $object->getId(), - 'position' => $assignedBanner['position'] - ]; - } - if (!empty($bannerSliderData)) { - $this->getConnection()->insertOnDuplicate( - $bannerSliderTable, - $bannerSliderData - ); - } - }; - } - - /** - * Save data to boolfly_slider_cms_page - * - * @param AbstractModel $model - */ - private function processSliderCmsPageTable(AbstractModel $model) - { - $cmsPageIds = $model->getData('cms_pages'); - $sliderCmsPageTable = $this->getSliderCmsPageTable(); - if ($model->getId() && is_array($cmsPageIds) && !empty($cmsPageIds)) { - $cmsPageIds = array_column($cmsPageIds, 'page_id'); - $sliderCmsPageData = []; - $select = $this->getConnection() - ->select() - ->from($sliderCmsPageTable, ['page_id']) - ->where('slider_id = ?', $model->getId()); - - /** - * Remove CMS Page not used - */ - $oldData = $this->getConnection()->fetchCol($select); - if (!empty($oldData) && !empty($cmsPageIds)) { - $pageRemoved = array_diff($oldData, $cmsPageIds); - if (!empty($pageRemoved)) { - $this->getConnection()->delete( - $sliderCmsPageTable, - [ - 'page_id IN(?)' => $pageRemoved, - 'slider_id = ?' => $model->getId() - ] - ); - } - } - foreach ($cmsPageIds as $pageId) { - $sliderCmsPageData[] = [ - 'page_id' => $pageId, - 'slider_id' => $model->getId() - ]; - } - if (!empty($sliderCmsPageData)) { - $this->getConnection()->insertOnDuplicate( - $sliderCmsPageTable, - $sliderCmsPageData - ); - } - } else { - $this->getConnection()->delete( - $sliderCmsPageTable, - ['slider_id = ?' => $model->getId()] - ); - } - } -} diff --git a/app/code/Boolfly/BannerSlider/Model/ResourceModel/Slider/Collection.php b/app/code/Boolfly/BannerSlider/Model/ResourceModel/Slider/Collection.php deleted file mode 100644 index 72c4ea6..0000000 --- a/app/code/Boolfly/BannerSlider/Model/ResourceModel/Slider/Collection.php +++ /dev/null @@ -1,97 +0,0 @@ -_init(Slider::class, SliderResourceModel::class); - } - - /** - * Get Resource - * - * @return SliderResourceModel|mixed - */ - public function getResource() - { - return parent::getResource(); - } - - /** - * Only get enable banner - * - * @return Collection - */ - public function addActiveStatusFilter() - { - return $this->addFieldToFilter('status', Status::STATUS_ENABLED); - } - - /** - * @param $pageId - * @return $this - */ - public function addCmsPageToFilter($pageId) - { - if ($pageId && is_numeric($pageId)) { - $conditions = $this->getConnection()->quoteInto( - 'main_table.slider_id = cms_page.slider_id AND cms_page.page_id = ?', - $pageId - ); - $this->getSelect()->joinInner( - ['cms_page' => $this->getResource()->getSliderCmsPageTable()], - $conditions, - 'page_id' - ); - } - - return $this; - } - - /** - * Add Category To Filter - * - * @param $catId - * @return $this - */ - public function addCategoryToFilter($catId) - { - if ($catId && is_numeric($catId)) { - $this->addFieldToFilter('category_id', ['finset' => $catId]); - } - - return $this; - } -} diff --git a/app/code/Boolfly/BannerSlider/Model/Slider.php b/app/code/Boolfly/BannerSlider/Model/Slider.php deleted file mode 100644 index 999a4bc..0000000 --- a/app/code/Boolfly/BannerSlider/Model/Slider.php +++ /dev/null @@ -1,304 +0,0 @@ -_init(SliderResourceModel::class); - } - - /** - * Get Title - * - * @return string|null - * @since 1.0.0 - */ - public function getTitle() - { - return $this->_getData(self::TITLE); - } - - /** - * Set Title - * - * @param string $title - * - * @return $this - * @since 1.0.0 - */ - public function setTitle($title) - { - return $this->setData(self::TITLE, $title); - } - - /** - * Get Status - * - * @return boolean - * @since 1.0.0 - */ - public function getStatus() - { - return $this->_getData(self::STATUS); - } - - /** - * Set Status - * - * @param integer|boolean $status - * - * @return $this - * @since 1.0.0 - */ - public function setStatus($status) - { - return $this->setData(self::STATUS, (bool)$status); - } - - /** - * Get Display Title - * - * @return boolean - * @since 1.0.0 - */ - public function getDisplayTitle() - { - return (boolean)$this->_getData(self::DISPLAY_TITLE); - } - - /** - * Set Display Title - * - * @param boolean|integer $displayTitle - * - * @return $this - * @since 1.0.0 - */ - public function setDisplayTitle($displayTitle) - { - return $this->setData(self::DISPLAY_TITLE, (boolean) $displayTitle); - } - - /** - * Get Mode - * - * @return integer - * @since 1.0.0 - */ - public function getMode() - { - return (int)$this->_getData(self::MODE); - } - - /** - * Set Mode - * - * @param string|integer $mode - * - * @return $this - * @since 1.0.0 - */ - public function setMode($mode) - { - return $this->setData(self::MODE, (int)$mode); - } - - /** - * Get Animation Effect - * - * @return string|null - * @since 1.0.0 - */ - public function getAnimationEffect() - { - return $this->_getData(self::ANIMATION_EFFECT); - } - - /** - * Set Animation Effect - * - * @param string $effect - * - * @return $this - * @since 1.0.0 - */ - public function setAnimationEffect($effect) - { - return $this->setData(self::ANIMATION_EFFECT, $effect); - } - - /** - * Check Auto Play - * - * @return boolean - * @since 1.0.0 - */ - public function isAutoPlay() - { - return (boolean)$this->_getData(self::AUTO_PLAY); - } - - /** - * Set Auto Play - * - * @param integer|boolean $autoPlay - * - * @return $this - * @since 1.0.0 - */ - public function setAutoPlay($autoPlay) - { - return $this->setData(self::AUTO_PLAY, (int)$autoPlay); - } - - /** - * Get Speed - * - * @return integer|null - * @since 1.0.0 - */ - public function getSpeed() - { - return $this->_getData(self::SPEED); - } - - /** - * Set Speed - * - * @param string $speed - * - * @return $this - * @since 1.0.0 - */ - public function setSpeed($speed) - { - return $this->setData(self::SPEED, (int)$speed); - } - - /** - * Get Position - * - * @return string|null - * @since 1.0.0 - */ - public function getPosition() - { - return $this->_getData(self::POSITION); - } - - /** - * Set Position - * - * @param string $position - * - * @return $this - * @since 1.0.0 - */ - public function setPosition($position) - { - return $this->setData(self::POSITION, $position); - } - - /** - * Get Banner Id - * - * @return array - */ - public function getBannerIds() - { - $assignedBanner = $this->getData('assigned_banners'); - if (is_array($assignedBanner)) { - return array_keys($assignedBanner); - } - return []; - } - - /** - * Return unique ID(s) for each object in system - * - * @return string[] - */ - public function getIdentities() - { - $identities = [ - self::CACHE_TAG . '_' . $this->getId(), - ]; - - if (!$this->getId() || $this->isDeleted()) { - $identities[] = self::CACHE_TAG; - } - - return array_unique($identities); - } - - /** - * Get Category Id - * - * @return array - * @since 1.0.0 - */ - public function getCategoryIds() - { - return $this->_getData(self::CATEGORY_ID); - } - - /** - * After Load Slider - * - * @return mixed - */ - public function _afterLoad() - { - $categoryIds = $this->_getData(self::CATEGORY_ID); - if ($categoryIds && is_string($categoryIds)) { - $this->setData(self::CATEGORY_ID, explode(',', $categoryIds)); - } - return parent::_afterLoad(); - } - - /** - * @return mixed - */ - public function beforeSave() - { - $this->setCategoryIds($this->_getData(self::CATEGORY_ID)); - return parent::beforeSave(); - } - - /** - * Set Category Id - * - * @param array $categoryIds - * - * @return $this - * @since 1.0.0 - */ - public function setCategoryIds($categoryIds) - { - return $this->setData(self::CATEGORY_ID, implode(',', $categoryIds)); - } -} diff --git a/app/code/Boolfly/BannerSlider/Model/Slider/DataProvider.php b/app/code/Boolfly/BannerSlider/Model/Slider/DataProvider.php deleted file mode 100644 index 6f6cb33..0000000 --- a/app/code/Boolfly/BannerSlider/Model/Slider/DataProvider.php +++ /dev/null @@ -1,192 +0,0 @@ -coreRegistry = $registry; - $this->bannerCollectionFactory = $bannerCollectionFactory; - parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data); - $this->helperData = $helperData; - $this->urlBuilder = $urlBuilder; - $this->status = $status; - $this->pageCollectionFactory = $pageCollectionFactory; - } - - /** - * {@inheritdoc} - */ - public function getData() - { - if (isset($this->loadedData)) { - return $this->loadedData; - } - $this->loadedData = []; - /** @var BannerInterface | \Boolfly\BannerSlider\Model\Slider $slider */ - $slider = $this->coreRegistry->registry('current_slider'); - if ($slider->getId()) { - $this->prepareBannerData($slider); - $this->prepareCmsPageData($slider); - - $sliderData = $slider->getData(); - $this->loadedData[$slider->getId()] = $sliderData; - } - - return $this->loadedData; - } - - /** - * Prepare Banner Data - * - * @param \Boolfly\BannerSlider\Model\Slider $slider - * @throws \Exception - * @throws \Magento\Framework\Exception\NoSuchEntityException - */ - private function prepareBannerData($slider) - { - $assignedBanners = $slider->getData('assigned_banners'); - if (is_array($assignedBanners) && !empty($assignedBanners)) { - $bannerIds = array_keys($assignedBanners); - if (!empty($bannerIds)) { - $bannerCollection = $this->bannerCollectionFactory->create(); - $bannerCollection->addFieldToFilter('banner_id', ['in' => $bannerIds]); - $newBannerData = []; - /** @var \Boolfly\BannerSlider\Model\Banner $banner */ - foreach ($bannerCollection as $banner) { - $newBannerData[] = [ - 'banner_id' => $banner->getId(), - 'title' => $banner->getTitle(), - 'image_desktop' => $this->helperData->getResizeImage($banner->getData('image_desktop'), null, 50), - 'image_tablet' => $this->helperData->getResizeImage($banner->getData('image_tablet'), null, 50), - 'image_mobile' => $this->helperData->getResizeImage($banner->getData('image_mobile'), null, 50), - 'position' => $assignedBanners[$banner->getId()], - 'status' => (string) $this->status->getOptionText((int)$banner->getStatus()) - ]; - } - usort($newBannerData, function ($a, $b) { - return $a['position'] <=> $b['position']; - }); - $slider->setData('assigned_banners', $newBannerData); - } - } - } - - /** - * Prepare CMS Page Data - * - * @param \Boolfly\BannerSlider\Model\Slider $slider - */ - private function prepareCmsPageData($slider) - { - $cmsPageIds = $slider->getData('cms_pages'); - if (is_array($cmsPageIds) && !empty($cmsPageIds)) { - $pageCollection = $this->pageCollectionFactory->create(); - $pageCollection->addFieldToFilter('page_id', $cmsPageIds); - $newCmsPageData = []; - /** @var \Magento\Cms\Model\Page $page */ - foreach ($pageCollection as $page) { - $status = $page->getAvailableStatuses(); - $isActiveText = (string)$status[(int)$page->getData('is_active')]; - $newCmsPageData[] = [ - 'page_id' => $page->getId(), - 'title' => $page->getTitle(), - 'identifier' => $page->getIdentifier(), - 'is_active' => $isActiveText - ]; - } - $slider->setData('cms_pages', $newCmsPageData); - } - } - - /** - * @inheritdoc - */ - public function addFilter(Filter $filter) - { - return []; - } -} diff --git a/app/code/Boolfly/BannerSlider/Model/Source/AlignText.php b/app/code/Boolfly/BannerSlider/Model/Source/AlignText.php deleted file mode 100644 index dd9073f..0000000 --- a/app/code/Boolfly/BannerSlider/Model/Source/AlignText.php +++ /dev/null @@ -1,74 +0,0 @@ - __('Center'), - self::LEFT_ALIGN_TEXT => __('Left'), - self::RIGHT_ALIGN_TEXT => __('Right') - ]; - } - - /** - * Retrieve option array with empty value - * - * @return string[] - */ - public function getAllOptions() - { - $result = []; - - foreach (self::getOptionArray() as $index => $value) { - $result[] = ['value' => $index, 'label' => $value]; - } - - return $result; - } - - /** - * Retrieve option text by option value - * - * @param string $optionId - * @return string - */ - public function getOptionText($optionId) - { - $options = self::getOptionArray(); - - return isset($options[$optionId]) ? $options[$optionId] : null; - } -} diff --git a/app/code/Boolfly/BannerSlider/Model/Source/CategoryTree.php b/app/code/Boolfly/BannerSlider/Model/Source/CategoryTree.php deleted file mode 100644 index c2a28ee..0000000 --- a/app/code/Boolfly/BannerSlider/Model/Source/CategoryTree.php +++ /dev/null @@ -1,88 +0,0 @@ -collectionFactory = $collectionFactory; - } - - /** - * @return array|mixed - * @throws \Magento\Framework\Exception\LocalizedException - */ - public function toOptionArray() - { - return $this->getAllOptions(); - } - - /** - * @return string[] - * @throws \Magento\Framework\Exception\LocalizedException - */ - public function getAllOptions() - { - if ($this->options === null) { - $collection = $this->collectionFactory->create(); - $collection->addAttributeToSelect(['name', 'is_active', 'parent_id']); - - $categoryById = [ - CategoryModel::TREE_ROOT_ID => [ - 'value' => CategoryModel::TREE_ROOT_ID, - 'optgroup' => [], - ], - ]; - - foreach ($collection as $category) { - foreach ([$category->getId(), $category->getParentId()] as $categoryId) { - if (!isset($categoryById[$categoryId])) { - $categoryById[$categoryId] = ['value' => $categoryId]; - } - } - - $categoryById[$category->getId()]['is_active'] = $category->getIsActive(); - $categoryById[$category->getId()]['label'] = $category->getName(); - $categoryById[$category->getId()]['__disableTmpl'] = true; - $categoryById[$category->getParentId()]['optgroup'][] = &$categoryById[$category->getId()]; - } - - $this->options = $categoryById[CategoryModel::TREE_ROOT_ID]['optgroup']; - } - - return $this->options; - } -} diff --git a/app/code/Boolfly/BannerSlider/Model/Source/Effect.php b/app/code/Boolfly/BannerSlider/Model/Source/Effect.php deleted file mode 100644 index 10c5118..0000000 --- a/app/code/Boolfly/BannerSlider/Model/Source/Effect.php +++ /dev/null @@ -1,71 +0,0 @@ - __('Fade'), - self::SLIDE_EFFECT => __('Slide') - ]; - } - - /** - * Retrieve option array with empty value - * - * @return string[] - */ - public function getAllOptions() - { - $result = []; - - foreach (self::getOptionArray() as $index => $value) { - $result[] = ['value' => $index, 'label' => $value]; - } - - return $result; - } - - /** - * Retrieve option text by option value - * - * @param string $optionId - * @return string - */ - public function getOptionText($optionId) - { - $options = self::getOptionArray(); - - return isset($options[$optionId]) ? $options[$optionId] : null; - } -} diff --git a/app/code/Boolfly/BannerSlider/Observer/CheckImageUploaded.php b/app/code/Boolfly/BannerSlider/Observer/CheckImageUploaded.php deleted file mode 100644 index dd4f0c7..0000000 --- a/app/code/Boolfly/BannerSlider/Observer/CheckImageUploaded.php +++ /dev/null @@ -1,59 +0,0 @@ -redundantImageChecker = $redundantImageChecker; - } - - /** - * Dispatch event - * - * @param Observer $observer - * @throws \Magento\Framework\Exception\LocalizedException - */ - public function execute(Observer $observer) - { - $banner = $observer->getEvent()->getData('banner'); - if ($banner && $banner instanceof BannerInterface) { - foreach (ImageField::getField() as $field) { - $this->redundantImageChecker->process($banner->getOrigData($field)); - } - } - } -} diff --git a/app/code/Boolfly/BannerSlider/Observer/ProcessingImageUpload.php b/app/code/Boolfly/BannerSlider/Observer/ProcessingImageUpload.php deleted file mode 100644 index 1c5c680..0000000 --- a/app/code/Boolfly/BannerSlider/Observer/ProcessingImageUpload.php +++ /dev/null @@ -1,92 +0,0 @@ -imageUploader = $imageUploader; - $this->redundantImageChecker = $redundantImageChecker; - } - - /** - * @param Observer $observer - * @throws \Magento\Framework\Exception\LocalizedException - */ - public function execute(Observer $observer) - { - $banner = $observer->getEvent()->getData('banner'); - if ($banner && $banner instanceof BannerInterface) { - foreach (ImageField::getField() as $field) { - $this->processFile($banner, $field); - } - } - } - - /** - * Process File - * - * @param \Boolfly\BannerSlider\Model\Banner|BannerInterface $object - * @param $key - * @return $this - * @throws \Magento\Framework\Exception\LocalizedException - */ - protected function processFile(BannerInterface $object, $key) - { - $files = $object->getData($key); - $object->setData($key, null); - if (is_array($files) && !empty($files)) { - foreach ($files as $file) { - if (is_array($file) && empty($file['name'])) { - continue; - } - $name = $file['name']; - // Upload New File - if (isset($file['type']) && $file['tmp_name']) { - $this->imageUploader->moveFileFromTmp($name); - } - $object->setData($key, $name); - } - } - - return $this; - } -} diff --git a/app/code/Boolfly/BannerSlider/Setup/InstallSchema.php b/app/code/Boolfly/BannerSlider/Setup/InstallSchema.php deleted file mode 100644 index 8bc4b3b..0000000 --- a/app/code/Boolfly/BannerSlider/Setup/InstallSchema.php +++ /dev/null @@ -1,492 +0,0 @@ -startSetup(); - - $this->createBannerTable($installer); - $this->createSliderTable($installer); - $this->createBannerSliderTable($installer); - $this->createSliderCmsPageTable($installer); - - $installer->endSetup(); - } - - /** - * Create Banner Table - * - * @param SchemaSetupInterface $installer - * @throws \Zend_Db_Exception - */ - private function createBannerTable(SchemaSetupInterface $installer) - { - // Add prefix table - $tableName = $installer->getTable(self::BANNER_TABLE_NAME); - if (!$installer->tableExists($tableName)) { - $table = $installer->getConnection() - ->newTable( - $tableName - )->addColumn( - 'banner_id', - Table::TYPE_INTEGER, - null, - [ - 'unsigned' => true, - 'identity' => true, - 'nullable' => false, - 'primary' => true, - ], - 'Banner ID' - )->addColumn( - 'title', - Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Title' - )->addColumn( - 'status', - Table::TYPE_SMALLINT, - 6, - ['nullable' => false], - 'Status' - )->addColumn( - 'banner_url', - Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Banner URL' - )->addColumn( - 'description', - Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Description' - )->addColumn( - 'button_text', - Table::TYPE_TEXT, - 50, - ['nullable' => true], - 'Button Text' - )->addColumn( - 'button_url', - Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Button URL' - )->addColumn( - 'image_alt', - Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Image Alt' - )->addColumn( - 'image_desktop', - Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Image in Desktop' - )->addColumn( - 'image_tablet', - Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Image in Tablet' - )->addColumn( - 'image_mobile', - Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Image in Mobile' - )->addColumn( - 'target_link', - Table::TYPE_TEXT, - 30, - ['nullable' => true], - 'Target when click to banner' - )->addColumn( - 'align_text', - Table::TYPE_TEXT, - 10, - ['nullable' => true], - 'Placement Text in Banner' - )->addColumn( - 'created_at', - Table::TYPE_TIMESTAMP, - null, - ['nullable' => true], - 'Created At' - )->addColumn( - 'updated_at', - Table::TYPE_TIMESTAMP, - null, - ['nullable' => true], - 'Updated At' - )->addIndex( - $installer->getIdxName($tableName, ['banner_id']), - ['banner_id'] - )->setComment( - 'Banner Table' - ); - $installer->getConnection()->createTable($table); - } - } - - /** - * Create Slider Table - * - * @param SchemaSetupInterface $installer - * @throws \Zend_Db_Exception - */ - private function createSliderTable(SchemaSetupInterface $installer) - { - // Add prefix table - $tableName = $installer->getTable(self::SLIDER_TABLE_NAME); - if (!$installer->tableExists($tableName)) { - $table = $installer->getConnection() - ->newTable( - $tableName - )->addColumn( - 'slider_id', - Table::TYPE_INTEGER, - null, - [ - 'unsigned' => true, - 'identity' => true, - 'nullable' => false, - 'primary' => true, - ], - 'Slider ID' - )->addColumn( - 'title', - Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Title' - )->addColumn( - 'display_title', - Table::TYPE_SMALLINT, - 6, - ['nullable' => false], - 'Display Title' - )->addColumn( - 'status', - Table::TYPE_SMALLINT, - 6, - ['nullable' => false], - 'Status' - )->addColumn( - 'mode', - Table::TYPE_SMALLINT, - 6, - ['nullable' => true], - 'Mode' - )->addColumn( - 'animation_effect', - Table::TYPE_TEXT, - 25, - ['nullable' => true], - 'Animation Effect' - )->addColumn( - 'auto_play', - Table::TYPE_SMALLINT, - 6, - ['nullable' => false], - 'Auto Play' - )->addColumn( - 'speed', - Table::TYPE_INTEGER, - null, - ['nullable' => true], - 'Speed to change image' - )->addColumn( - 'position', - Table::TYPE_TEXT, - 50, - ['nullable' => true], - 'Position of Slider' - )->addColumn( - 'category_id', - Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Category Id' - )->addColumn( - 'created_at', - Table::TYPE_TIMESTAMP, - null, - ['nullable' => true], - 'Created At' - )->addColumn( - 'updated_at', - Table::TYPE_TIMESTAMP, - null, - ['nullable' => true], - 'Updated At' - )->addIndex( - $installer->getIdxName($tableName, ['slider_id']), - ['slider_id'] - )->setComment( - 'Slider Table' - ); - - $installer->getConnection()->createTable($table); - } - } - - /** - * Create Banner Slider Table - * - * @param SchemaSetupInterface $installer - * @throws \Zend_Db_Exception - */ - private function createBannerSliderTable(SchemaSetupInterface $installer) - { - $tableName = $installer->getTable(self::BANNER_SLIDER_TABLE_NAME); - $sliderTableName = $installer->getTable(self::SLIDER_TABLE_NAME); - $bannerTableName = $installer->getTable(self::BANNER_TABLE_NAME); - if (!$installer->tableExists($tableName)) { - $table = $installer->getConnection() - ->newTable($installer->getTable($tableName)) - ->addColumn( - 'banner_id', - Table::TYPE_INTEGER, - null, - [ - 'unsigned' => true, - 'nullable' => false, - 'primary' => true, - ], - 'Banner Id' - )->addColumn( - 'slider_id', - Table::TYPE_INTEGER, - null, - [ - 'unsigned' => true, - 'nullable' => false, - 'primary' => true, - ], - 'Slider Id' - )->addColumn( - 'position', - Table::TYPE_SMALLINT, - 6, - [ - 'nullable' => true, - ], - 'Position' - )->addIndex( - $installer->getIdxName($tableName, ['slider_id']), - ['slider_id'] - )->addIndex( - $installer->getIdxName($tableName, ['banner_id']), - ['banner_id'] - )->addForeignKey( - $installer->getFkName( - $tableName, - 'slider_id', - $sliderTableName, - 'slider_id' - ), - 'slider_id', - $sliderTableName, - 'slider_id', - Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName( - $tableName, - 'banner_id', - $bannerTableName, - 'banner_id' - ), - 'banner_id', - $bannerTableName, - 'banner_id', - Table::ACTION_CASCADE - )->setComment('Slider and Banner Relations'); - - $installer->getConnection()->createTable($table); - } - } - - /** - * Create Slider Cms Page Table - * - * @param SchemaSetupInterface $installer - * @throws \Zend_Db_Exception - */ - private function createSliderCmsPageTable(SchemaSetupInterface $installer) - { - $tableName = $installer->getTable(self::SLIDER_CMS_PAGE_TABLE_NAME); - $sliderTableName = $installer->getTable(self::SLIDER_TABLE_NAME); - $cmsPageTableName = $installer->getTable('cms_page'); - if (!$installer->tableExists($tableName)) { - $table = $installer->getConnection() - ->newTable($installer->getTable($tableName)) - ->addColumn( - 'slider_id', - Table::TYPE_INTEGER, - null, - [ - 'unsigned' => true, - 'nullable' => false, - 'primary' => true, - ], - 'Slider Id' - )->addColumn( - 'page_id', - Table::TYPE_SMALLINT, - 6, - [ - 'unsigned' => false, - 'nullable' => false, - 'primary' => true, - ], - 'Page Id' - )->addIndex( - $installer->getIdxName($tableName, ['slider_id']), - ['slider_id'] - )->addIndex( - $installer->getIdxName($tableName, ['page_id']), - ['page_id'] - )->addForeignKey( - $installer->getFkName( - $tableName, - 'slider_id', - $sliderTableName, - 'slider_id' - ), - 'slider_id', - $sliderTableName, - 'slider_id', - Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName( - $tableName, - 'page_id', - $cmsPageTableName, - 'page_id' - ), - 'page_id', - $cmsPageTableName, - 'page_id', - Table::ACTION_CASCADE - )->setComment('Slider and CMS Page Relations'); - - $installer->getConnection()->createTable($table); - } - } - - /** - * Create Slider Category Table - * - * @param SchemaSetupInterface $installer - * @throws \Zend_Db_Exception - */ - private function createSliderCategoryTable(SchemaSetupInterface $installer) - { - $tableName = $installer->getTable(self::SLIDER_CMS_PAGE_TABLE_NAME); - $sliderTableName = $installer->getTable(self::SLIDER_TABLE_NAME); - $cmsPageTableName = $installer->getTable('cms_page'); - if (!$installer->tableExists($tableName)) { - $table = $installer->getConnection() - ->newTable($installer->getTable($tableName)) - ->addColumn( - 'slider_id', - Table::TYPE_INTEGER, - null, - [ - 'unsigned' => true, - 'nullable' => false, - 'primary' => true, - ], - 'Slider Id' - )->addColumn( - 'page_id', - Table::TYPE_SMALLINT, - 6, - [ - 'unsigned' => false, - 'nullable' => false, - 'primary' => true, - ], - 'Page Id' - )->addIndex( - $installer->getIdxName($tableName, ['slider_id']), - ['slider_id'] - )->addIndex( - $installer->getIdxName($tableName, ['page_id']), - ['page_id'] - )->addForeignKey( - $installer->getFkName( - $tableName, - 'slider_id', - $sliderTableName, - 'slider_id' - ), - 'slider_id', - $sliderTableName, - 'slider_id', - Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName( - $tableName, - 'page_id', - $cmsPageTableName, - 'page_id' - ), - 'page_id', - $cmsPageTableName, - 'page_id', - Table::ACTION_CASCADE - )->setComment('Slider and CMS Page Relations'); - - $installer->getConnection()->createTable($table); - } - } -} diff --git a/app/code/Boolfly/BannerSlider/Ui/Component/Listing/Columns/EditActions.php b/app/code/Boolfly/BannerSlider/Ui/Component/Listing/Columns/EditActions.php deleted file mode 100644 index 8689f0b..0000000 --- a/app/code/Boolfly/BannerSlider/Ui/Component/Listing/Columns/EditActions.php +++ /dev/null @@ -1,75 +0,0 @@ -urlBuilder = $urlBuilder; - parent::__construct($context, $uiComponentFactory, $components, $data); - } - - /** - * Prepare Data Source - * - * @param array $dataSource - * @return array - */ - public function prepareDataSource(array $dataSource) - { - if (isset($dataSource['data']['items'])) { - $storeId = $this->context->getFilterParam('store_id'); - $fieldId = $this->getDataByPath('config/indexField'); - if ($fieldId) { - $routePath = $this->getDataByPath('options/routePath') ?: '*/*/edit'; - foreach ($dataSource['data']['items'] as &$item) { - $item[$this->getData('name')]['edit'] = [ - 'href' => $this->urlBuilder->getUrl( - $routePath, - ['id' => $item[$fieldId], 'store' => $storeId] - ), - 'label' => __('Edit'), - 'hidden' => false, - ]; - } - } - } - - return $dataSource; - } -} diff --git a/app/code/Boolfly/BannerSlider/Ui/Component/Listing/Columns/Thumbnail.php b/app/code/Boolfly/BannerSlider/Ui/Component/Listing/Columns/Thumbnail.php deleted file mode 100644 index 7439aec..0000000 --- a/app/code/Boolfly/BannerSlider/Ui/Component/Listing/Columns/Thumbnail.php +++ /dev/null @@ -1,87 +0,0 @@ -urlBuilder = $urlBuilder; - parent::__construct($context, $uiComponentFactory, $components, $data); - $this->helperData = $helperData; - } - - /** - * Prepare Data Source - * - * @param array $dataSource - * @return array - * @throws \Exception - * @throws \Magento\Framework\Exception\NoSuchEntityException - */ - public function prepareDataSource(array $dataSource) - { - if (isset($dataSource['data']['items'])) { - $fieldName = $this->getData('name'); - foreach ($dataSource['data']['items'] as &$item) { - if (empty($item[$fieldName])) { - continue; - } - $imageName = $item[$fieldName]; - $item[$fieldName . '_src'] = $this->helperData->getResizeImage($imageName, null, 50); - $item[$fieldName . '_alt'] = $item['image_alt']; - $item[$fieldName . '_link'] = $this->urlBuilder->getUrl( - 'bannerslider/banner/edit', - ['id' => $item['banner_id'], 'store' => $this->context->getRequestParam('store')] - ); - $item[$fieldName . '_orig_src'] = $this->helperData->getImageUrl($imageName); - } - } - - return $dataSource; - } -} diff --git a/app/code/Boolfly/BannerSlider/composer.json b/app/code/Boolfly/BannerSlider/composer.json deleted file mode 100644 index ebc411d..0000000 --- a/app/code/Boolfly/BannerSlider/composer.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "boolfly/module-banner-slider", - "description": "Banner Slider module", - "require": { - "php": "~7.1.3||~7.2.0||~7.3.0", - "boolfly/module-base": "100.0.*" - }, - "type": "magento2-module", - "license": [ - "OSL-3.0", - "AFL-3.0" - ], - "autoload": { - "files": [ - "registration.php" - ], - "psr-4": { - "Boolfly\\BannerSlider\\": "" - } - }, - "version": "100.0.0" -} \ No newline at end of file diff --git a/app/code/Boolfly/BannerSlider/etc/acl.xml b/app/code/Boolfly/BannerSlider/etc/acl.xml deleted file mode 100644 index ed6304d..0000000 --- a/app/code/Boolfly/BannerSlider/etc/acl.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/code/Boolfly/BannerSlider/etc/adminhtml/events.xml b/app/code/Boolfly/BannerSlider/etc/adminhtml/events.xml deleted file mode 100644 index a17c2c7..0000000 --- a/app/code/Boolfly/BannerSlider/etc/adminhtml/events.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/code/Boolfly/BannerSlider/etc/adminhtml/menu.xml b/app/code/Boolfly/BannerSlider/etc/adminhtml/menu.xml deleted file mode 100644 index 06046c8..0000000 --- a/app/code/Boolfly/BannerSlider/etc/adminhtml/menu.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - diff --git a/app/code/Boolfly/BannerSlider/etc/adminhtml/routes.xml b/app/code/Boolfly/BannerSlider/etc/adminhtml/routes.xml deleted file mode 100644 index e3fb39a..0000000 --- a/app/code/Boolfly/BannerSlider/etc/adminhtml/routes.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - diff --git a/app/code/Boolfly/BannerSlider/etc/di.xml b/app/code/Boolfly/BannerSlider/etc/di.xml deleted file mode 100644 index 746f107..0000000 --- a/app/code/Boolfly/BannerSlider/etc/di.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - BoolflyBannerCollection - BoolflyBannerCollection - BoolflySliderCollection - - - - - - boolfly_banner - Boolfly\BannerSlider\Model\ResourceModel\Banner - - - - - boolfly_slider - Boolfly\BannerSlider\Model\ResourceModel\Slider - - - diff --git a/app/code/Boolfly/BannerSlider/etc/module.xml b/app/code/Boolfly/BannerSlider/etc/module.xml deleted file mode 100644 index 74733fc..0000000 --- a/app/code/Boolfly/BannerSlider/etc/module.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/app/code/Boolfly/BannerSlider/registration.php b/app/code/Boolfly/BannerSlider/registration.php deleted file mode 100644 index 32e33fa..0000000 --- a/app/code/Boolfly/BannerSlider/registration.php +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - diff --git a/app/code/Boolfly/BannerSlider/view/adminhtml/layout/bannerslider_banner_index.xml b/app/code/Boolfly/BannerSlider/view/adminhtml/layout/bannerslider_banner_index.xml deleted file mode 100755 index d505f15..0000000 --- a/app/code/Boolfly/BannerSlider/view/adminhtml/layout/bannerslider_banner_index.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - diff --git a/app/code/Boolfly/BannerSlider/view/adminhtml/layout/bannerslider_slider_edit.xml b/app/code/Boolfly/BannerSlider/view/adminhtml/layout/bannerslider_slider_edit.xml deleted file mode 100755 index d69ea15..0000000 --- a/app/code/Boolfly/BannerSlider/view/adminhtml/layout/bannerslider_slider_edit.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - diff --git a/app/code/Boolfly/BannerSlider/view/adminhtml/layout/bannerslider_slider_index.xml b/app/code/Boolfly/BannerSlider/view/adminhtml/layout/bannerslider_slider_index.xml deleted file mode 100755 index 04dbd19..0000000 --- a/app/code/Boolfly/BannerSlider/view/adminhtml/layout/bannerslider_slider_index.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - diff --git a/app/code/Boolfly/BannerSlider/view/adminhtml/ui_component/boolfly_banner_form.xml b/app/code/Boolfly/BannerSlider/view/adminhtml/ui_component/boolfly_banner_form.xml deleted file mode 100644 index 2bdd8ce..0000000 --- a/app/code/Boolfly/BannerSlider/view/adminhtml/ui_component/boolfly_banner_form.xml +++ /dev/null @@ -1,267 +0,0 @@ - - -
- - - boolfly_banner_form.boolfly_banner_form_data_source - - Banner Information - templates/form/collapsible - true - - - - - -
- - - - false - - - - Boolfly_BannerSlider::banner - - - id - banner_id - - - - - - - - - - - - - - - false - - - - - - - - - - Are you sure you want to delete selected items? - Delete items - - - delete - - - - - - status - - - - enable - - - 1 - - - - disable - - - 0 - - - - - - - - - - - - banner_id - true - - - - - textRange - - asc - - - - - - left - - - - 1 - - false - - - - - - left - - - - 1 - - false - - - - - - left - - - - 1 - - false - - - - - text - - - - - - text - - - - - - text - - - - - - text - - - - - - text - - - - - - - select - select - - - - - - banner_id - - - - - - - diff --git a/app/code/Boolfly/BannerSlider/view/adminhtml/ui_component/boolfly_slider_form.xml b/app/code/Boolfly/BannerSlider/view/adminhtml/ui_component/boolfly_slider_form.xml deleted file mode 100644 index 54ca45d..0000000 --- a/app/code/Boolfly/BannerSlider/view/adminhtml/ui_component/boolfly_slider_form.xml +++ /dev/null @@ -1,509 +0,0 @@ - - -
- - - boolfly_slider_form.boolfly_slider_form_data_source - - Slider Information - templates/form/collapsible - true - - - - - - - - true - Remove - admin__field-wide - data.boolfly_banner_listing - - banner_id - title - image_desktop_src - image_tablet_src - image_mobile_src - status_text - - banner_id - - - - false - false - true - record - banner_id - - ${ $.provider }:${ $.dataProvider } - - - true - ui/dynamic-rows/cells/dnd - - false - - - - - container - true - true - position - - - - - ui/dynamic-rows/cells/text - text - banner_id - - - - - - ui/dynamic-rows/cells/text - - false - - - - - ui/form/element/input - number - position - - false - - - - - ui/dynamic-rows/cells/thumbnail - - false - image_desktop - - - - - ui/dynamic-rows/cells/thumbnail - - image_tablet - - - - - ui/dynamic-rows/cells/thumbnail - - image_mobile - - - - - ui/dynamic-rows/cells/text - text - status - - - - - - - data-grid-actions-cell - 1 - - - - - text - actionDelete - - - - - - - - - - - - - - true - boolfly_banner_listing - boolfly_banner_listing - boolfly_banner_listing.boolfly_banner_listing_data_source - boolfly_banner_listing.boolfly_banner_listing.banner_columns.ids - - false - true - - true - - - - -
- - - true - false - - - - - - - page_id - title - identifier - is_active_text - - page_id - true - Remove - admin__field-wide - data.cms_page_listing - - - - false - false - true - cms_page - page_id - - ${ $.provider }:${ $.dataProvider } - - - false - - false - - - - - container - true - true - - - - - ui/dynamic-rows/cells/text - text - page_id - - - - - - ui/dynamic-rows/cells/text - - false - - - - - ui/dynamic-rows/cells/text - - false - - - - - ui/dynamic-rows/cells/text - text - is_active - - - - - - - data-grid-actions-cell - 1 - - - - - text - actionDelete - - - - - - - - - - - - - - true - cms_page_listing - cms_page_listing - cms_page_listing.cms_page_listing - cms_page_listing.cms_page_listing.cms_page_columns.ids - - false - true - - true - - - -
- diff --git a/app/code/Boolfly/BannerSlider/view/adminhtml/ui_component/boolfly_slider_listing.xml b/app/code/Boolfly/BannerSlider/view/adminhtml/ui_component/boolfly_slider_listing.xml deleted file mode 100644 index 296d53b..0000000 --- a/app/code/Boolfly/BannerSlider/view/adminhtml/ui_component/boolfly_slider_listing.xml +++ /dev/null @@ -1,155 +0,0 @@ - - -- - - boolfly_slider_listing.boolfly_slider_listing_data_source - - - - slider_columns - - boolfly_slider_listing.boolfly_slider_listing_data_source - - - - - - - - - false - - - - Boolfly_BannerSlider::slider - - - id - slider_id - - - - - - - - - - - - - - - false - - - - - - - - Are you sure you want to delete selected items? - Delete items - - - delete - - - - - - status - - - - enable - - - 1 - - - - disable - - - 0 - - - - - - - - - - - - banner_id - true - - - - - textRange - - asc - - - - - text - - - - - - - select - select - - - - - - text - - - - - - text - - - - - - - select - select - - - - - - slider_id - - - - - - - diff --git a/app/code/Boolfly/BannerSlider/view/frontend/layout/catalog_category_view.xml b/app/code/Boolfly/BannerSlider/view/frontend/layout/catalog_category_view.xml deleted file mode 100644 index 7450ab3..0000000 --- a/app/code/Boolfly/BannerSlider/view/frontend/layout/catalog_category_view.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/app/code/Boolfly/BannerSlider/view/frontend/layout/cms_page_view.xml b/app/code/Boolfly/BannerSlider/view/frontend/layout/cms_page_view.xml deleted file mode 100644 index 852cf05..0000000 --- a/app/code/Boolfly/BannerSlider/view/frontend/layout/cms_page_view.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/app/code/Boolfly/BannerSlider/view/frontend/templates/slider.phtml b/app/code/Boolfly/BannerSlider/view/frontend/templates/slider.phtml deleted file mode 100644 index 24b7471..0000000 --- a/app/code/Boolfly/BannerSlider/view/frontend/templates/slider.phtml +++ /dev/null @@ -1,72 +0,0 @@ - -getBannerCollection(); -?> -
-
-
- <?= /* @escapeNotVerified */ __('Loading...') ?> -
-
-
- - - -
-
- diff --git a/app/code/Boolfly/BannerSlider/view/frontend/web/js/banner-slider.js b/app/code/Boolfly/BannerSlider/view/frontend/web/js/banner-slider.js deleted file mode 100644 index 6a938f3..0000000 --- a/app/code/Boolfly/BannerSlider/view/frontend/web/js/banner-slider.js +++ /dev/null @@ -1,67 +0,0 @@ -/********************************************************************** - * banner-slider widget - * - * @copyright Copyright © Boolfly. All rights reserved. - * @author info@boolfly.com - */ -define([ - 'jquery', - 'jquery/ui', - 'slick' -], function ($) { - - $.widget('boolfly.bannerSlider', { - options: { - fade: false, - autoplay: false, - autoplaySpeed: 5000 - }, - - /** - * Init Slick for Banner Slider - * - * @private - */ - _create: function () { - this.initSlick(); - }, - - /** - * Init Slick - */ - initSlick: function () { - var element = $(this.element); - element.slick({ - arrows: true, - dots: true, - infinite: true, - fade: this.options.fade, - autoplay: this.options.autoplay, - autoplaySpeed: this.options.autoplaySpeed, - lazyLoad: 'ondemand', - responsive:[ - { - breakpoint: 1023, - settings:{ - arrows: false, - dots: true - } - }, - { - breakpoint: 768, - settings:{ - dots: false - } - } - ] - }); - $(this.element).on('lazyLoaded', function () { - element.slick('setPosition'); - element.removeClass('no-display'); - element.parent().find('[data-role=loader]').remove(); - }) - } - }); - - return $.boolfly.bannerSlider; -}); \ No newline at end of file