first commit
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2020 PrestaShop and Contributors
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2020 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
namespace PrestaShop\Module\Mbo\Controller\Admin;
|
||||
|
||||
use PrestaShopBundle\Controller\Admin\Improve\Modules\ModuleAbstractController;
|
||||
use PrestaShopBundle\Security\Annotation\AdminSecurity;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* Responsible of "Improve > Modules > Modules Catalog" page display.
|
||||
*/
|
||||
class ModuleCatalogController extends ModuleAbstractController
|
||||
{
|
||||
/**
|
||||
* Module Catalog page
|
||||
*
|
||||
* @AdminSecurity("is_granted(['read', 'create', 'update', 'delete'], 'ADMINMODULESSF_')")
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
return $this->render(
|
||||
'@PrestaShop/Admin/Module/catalog.html.twig',
|
||||
[
|
||||
'layoutHeaderToolbarBtn' => $this->getToolbarButtons(),
|
||||
'layoutTitle' => $this->trans('Modules catalog', 'Admin.Navigation.Menu'),
|
||||
'requireAddonsSearch' => true,
|
||||
'requireBulkActions' => false,
|
||||
'showContentHeader' => true,
|
||||
'enableSidebar' => true,
|
||||
'help_link' => $this->generateSidebarLink('AdminModules'),
|
||||
'requireFilterStatus' => false,
|
||||
'level' => $this->authorizationLevel(self::CONTROLLER_NAME),
|
||||
'errorMessage' => $this->trans(
|
||||
'You do not have permission to add this.',
|
||||
'Admin.Notifications.Error'
|
||||
),
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2020 PrestaShop and Contributors
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2020 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
namespace PrestaShop\Module\Mbo\Controller\Admin;
|
||||
|
||||
use PrestaShop\Module\Mbo\RecommendedModule\RecommendedModulePresenterInterface;
|
||||
use PrestaShop\Module\Mbo\Tab\TabCollectionProviderInterface;
|
||||
use PrestaShopBundle\Controller\Admin\FrameworkBundleAdminController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException;
|
||||
|
||||
/**
|
||||
* Responsible of render json data for ajax display of Recommended Modules.
|
||||
*/
|
||||
class ModuleRecommendedController extends FrameworkBundleAdminController
|
||||
{
|
||||
/**
|
||||
* @var RequestStack
|
||||
*/
|
||||
private $requestStack;
|
||||
|
||||
/**
|
||||
* @var TabCollectionProviderInterface
|
||||
*/
|
||||
private $tabCollectionProvider;
|
||||
|
||||
/**
|
||||
* @var RecommendedModulePresenterInterface
|
||||
*/
|
||||
private $recommendedModulePresenter;
|
||||
|
||||
/**
|
||||
* @param RequestStack $requestStack
|
||||
* @param TabCollectionProviderInterface $tabCollectionProvider
|
||||
* @param RecommendedModulePresenterInterface $recommendedModulePresenter
|
||||
*/
|
||||
public function __construct(
|
||||
RequestStack $requestStack,
|
||||
TabCollectionProviderInterface $tabCollectionProvider,
|
||||
RecommendedModulePresenterInterface $recommendedModulePresenter
|
||||
) {
|
||||
parent::__construct();
|
||||
$this->requestStack = $requestStack;
|
||||
$this->tabCollectionProvider = $tabCollectionProvider;
|
||||
$this->recommendedModulePresenter = $recommendedModulePresenter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
$response = new JsonResponse();
|
||||
try {
|
||||
$tabCollection = $this->tabCollectionProvider->getTabCollection();
|
||||
$tabClassName = $this->requestStack->getCurrentRequest()->get('tabClassName');
|
||||
$tab = $tabCollection->getTab($tabClassName);
|
||||
$response->setData([
|
||||
'content' => $this->renderView(
|
||||
'@Modules/ps_mbo/views/templates/admin/controllers/module_catalog/recommended-modules.html.twig',
|
||||
[
|
||||
'recommendedModulesInstalled' => $this->recommendedModulePresenter->presentCollection($tab->getRecommendedModulesInstalled()),
|
||||
'recommendedModulesNotInstalled' => $this->recommendedModulePresenter->presentCollection($tab->getRecommendedModulesNotInstalled()),
|
||||
]
|
||||
),
|
||||
]);
|
||||
} catch (ServiceUnavailableHttpException $exception) {
|
||||
$response->setData([
|
||||
'content' => $this->renderView('@Modules/ps_mbo/views/templates/admin/error.html.twig'),
|
||||
]);
|
||||
$response->setStatusCode($exception->getStatusCode());
|
||||
$response->headers->add($exception->getHeaders());
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2020 PrestaShop and Contributors
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2020 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
namespace PrestaShop\Module\Mbo\Controller\Admin;
|
||||
|
||||
use PrestaShop\Module\Mbo\AddonsSelectionLinkProvider;
|
||||
use PrestaShop\Module\Mbo\ExternalContentProvider\ExternalContentProviderInterface;
|
||||
use PrestaShopBundle\Controller\Admin\FrameworkBundleAdminController;
|
||||
use PrestaShopBundle\Security\Annotation\AdminSecurity;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException;
|
||||
|
||||
/**
|
||||
* Responsible of "Improve > Modules > Modules Catalog > Modules Selection" page display.
|
||||
*/
|
||||
class ModuleSelectionController extends FrameworkBundleAdminController
|
||||
{
|
||||
/**
|
||||
* @var RequestStack
|
||||
*/
|
||||
private $requestStack;
|
||||
|
||||
/**
|
||||
* @var ExternalContentProviderInterface
|
||||
*/
|
||||
private $externalContentProvider;
|
||||
|
||||
/**
|
||||
* @var AddonsSelectionLinkProvider
|
||||
*/
|
||||
private $addonsSelectionLinkProvider;
|
||||
|
||||
/**
|
||||
* @param RequestStack $requestStack
|
||||
* @param ExternalContentProviderInterface $externalContentCollectionProvider
|
||||
* @param AddonsSelectionLinkProvider $addonsSelectionLinkProvider
|
||||
*/
|
||||
public function __construct(
|
||||
RequestStack $requestStack,
|
||||
ExternalContentProviderInterface $externalContentCollectionProvider,
|
||||
AddonsSelectionLinkProvider $addonsSelectionLinkProvider
|
||||
) {
|
||||
parent::__construct();
|
||||
$this->requestStack = $requestStack;
|
||||
$this->externalContentProvider = $externalContentCollectionProvider;
|
||||
$this->addonsSelectionLinkProvider = $addonsSelectionLinkProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* @AdminSecurity("is_granted('read', request.get('_legacy_controller'))")
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
$response = new Response();
|
||||
|
||||
try {
|
||||
$response->setContent($this->renderView(
|
||||
'@Modules/ps_mbo/views/templates/admin/controllers/module_catalog/addons_store.html.twig',
|
||||
[
|
||||
'pageContent' => $this->externalContentProvider->getContent($this->addonsSelectionLinkProvider->getLinkUrl()),
|
||||
'layoutHeaderToolbarBtn' => [],
|
||||
'layoutTitle' => $this->trans('Module selection', 'Admin.Navigation.Menu'),
|
||||
'requireAddonsSearch' => true,
|
||||
'requireBulkActions' => false,
|
||||
'showContentHeader' => true,
|
||||
'enableSidebar' => true,
|
||||
'help_link' => $this->generateSidebarLink($this->requestStack->getCurrentRequest()->get('_legacy_controller')),
|
||||
'requireFilterStatus' => false,
|
||||
'level' => $this->authorizationLevel($this->requestStack->getCurrentRequest()->get('_legacy_controller')),
|
||||
]
|
||||
));
|
||||
} catch (ServiceUnavailableHttpException $exception) {
|
||||
$response->setContent($this->renderView('@Modules/ps_mbo/views/templates/admin/error.html.twig'));
|
||||
$response->setStatusCode($exception->getStatusCode());
|
||||
$response->headers->add($exception->getHeaders());
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
100
modules/ps_mbo/src/Controller/Admin/ThemeCatalogController.php
Normal file
100
modules/ps_mbo/src/Controller/Admin/ThemeCatalogController.php
Normal file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2020 PrestaShop and Contributors
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2020 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
namespace PrestaShop\Module\Mbo\Controller\Admin;
|
||||
|
||||
use PrestaShop\Module\Mbo\AddonsSelectionLinkProvider;
|
||||
use PrestaShop\Module\Mbo\ExternalContentProvider\ExternalContentProviderInterface;
|
||||
use PrestaShopBundle\Controller\Admin\FrameworkBundleAdminController;
|
||||
use PrestaShopBundle\Security\Annotation\AdminSecurity;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException;
|
||||
|
||||
/**
|
||||
* Responsible of "Improve > Design > Themes Catalog" page display.
|
||||
*/
|
||||
class ThemeCatalogController extends FrameworkBundleAdminController
|
||||
{
|
||||
/**
|
||||
* @var RequestStack
|
||||
*/
|
||||
private $requestStack;
|
||||
|
||||
/**
|
||||
* @var ExternalContentProviderInterface
|
||||
*/
|
||||
private $externalContentProvider;
|
||||
|
||||
/**
|
||||
* @var AddonsSelectionLinkProvider
|
||||
*/
|
||||
private $addonsSelectionLinkProvider;
|
||||
|
||||
/**
|
||||
* @param RequestStack $requestStack
|
||||
* @param ExternalContentProviderInterface $externalContentCollectionProvider
|
||||
* @param AddonsSelectionLinkProvider $addonsSelectionLinkProvider
|
||||
*/
|
||||
public function __construct(
|
||||
RequestStack $requestStack,
|
||||
ExternalContentProviderInterface $externalContentCollectionProvider,
|
||||
AddonsSelectionLinkProvider $addonsSelectionLinkProvider
|
||||
) {
|
||||
parent::__construct();
|
||||
$this->requestStack = $requestStack;
|
||||
$this->externalContentProvider = $externalContentCollectionProvider;
|
||||
$this->addonsSelectionLinkProvider = $addonsSelectionLinkProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* @AdminSecurity("is_granted('read', request.get('_legacy_controller'))")
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
$response = new Response();
|
||||
|
||||
try {
|
||||
$response->setContent($this->renderView(
|
||||
'@Modules/ps_mbo/views/templates/admin/controllers/theme_catalog/addons_store.html.twig',
|
||||
[
|
||||
'pageContent' => $this->externalContentProvider->getContent($this->addonsSelectionLinkProvider->getLinkUrl()),
|
||||
'layoutHeaderToolbarBtn' => [],
|
||||
'layoutTitle' => $this->trans('Themes Catalog', 'Admin.Navigation.Menu'),
|
||||
'requireAddonsSearch' => true,
|
||||
'requireBulkActions' => false,
|
||||
'showContentHeader' => true,
|
||||
'enableSidebar' => true,
|
||||
'help_link' => $this->generateSidebarLink($this->requestStack->getCurrentRequest()->get('_legacy_controller')),
|
||||
'requireFilterStatus' => false,
|
||||
'level' => $this->authorizationLevel($this->requestStack->getCurrentRequest()->get('_legacy_controller')),
|
||||
]
|
||||
));
|
||||
} catch (ServiceUnavailableHttpException $exception) {
|
||||
$response->setContent($this->renderView('@Modules/ps_mbo/views/templates/admin/error.html.twig'));
|
||||
$response->setStatusCode($exception->getStatusCode());
|
||||
$response->headers->add($exception->getHeaders());
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
28
modules/ps_mbo/src/Controller/Admin/index.php
Normal file
28
modules/ps_mbo/src/Controller/Admin/index.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2020 PrestaShop and Contributors
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2020 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../');
|
||||
exit;
|
||||
28
modules/ps_mbo/src/Controller/index.php
Normal file
28
modules/ps_mbo/src/Controller/index.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2020 PrestaShop and Contributors
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2020 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../');
|
||||
exit;
|
||||
Reference in New Issue
Block a user