On rajoute les derniers modules et on modifie les CSS
This commit is contained in:
@@ -1,26 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2016 PrestaShop
|
||||
* 2007-2020 PrestaShop and Contributors
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* 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:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* 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.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2015 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* @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
|
||||
*/
|
||||
|
||||
@@ -55,7 +49,6 @@ class Configuration
|
||||
['id' => static::FAKE_ID]
|
||||
);
|
||||
|
||||
|
||||
$data = [
|
||||
'templates' => [
|
||||
'lost',
|
||||
@@ -235,7 +228,6 @@ class Configuration
|
||||
}
|
||||
$data['steps']['groups'][] = $shippingSteps;
|
||||
|
||||
|
||||
$moduleSteps = [
|
||||
'title' => $this->translator->trans('Improve your shop with modules', [], 'Modules.Welcome.Admin'),
|
||||
'subtitle' => [
|
||||
@@ -277,12 +269,12 @@ class Configuration
|
||||
* here we replace the route specific parameters with wildcard to allow regexp matching
|
||||
*
|
||||
* @param \PrestaShopBundle\Service\Routing\Router $router
|
||||
* @param $controller
|
||||
* @param array $fakeParameters
|
||||
* @param string $controller
|
||||
* @param array $fakeParameters
|
||||
*
|
||||
* @return mixed|string
|
||||
*/
|
||||
protected function generateSfBaseUrl(Router $router, $controller, $fakeParameters = [])
|
||||
protected function generateSfBaseUrl(Router $router, string $controller, $fakeParameters = [])
|
||||
{
|
||||
$url = $router->getGenerator()->generate($controller, $fakeParameters);
|
||||
$url = substr($url, strlen(basename(__PS_BASE_URI__)) + 1);
|
||||
|
||||
@@ -1,52 +1,63 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2016 PrestaShop
|
||||
* 2007-2020 PrestaShop and Contributors
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* 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:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* 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.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2015 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* @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 OnBoarding;
|
||||
|
||||
use Configuration as LegacyConfiguration;
|
||||
use Module;
|
||||
use PrestaShopBundle\Service\Routing\Router;
|
||||
use PrestaShopBundle\Translation\TranslatorComponent as Translator;
|
||||
use Smarty_Data;
|
||||
|
||||
/**
|
||||
* OnBoarding main class.
|
||||
*/
|
||||
class OnBoarding
|
||||
{
|
||||
/** @var array */
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $configuration;
|
||||
|
||||
/** @var Translator */
|
||||
/**
|
||||
* @var Module
|
||||
*/
|
||||
private $module;
|
||||
|
||||
/**
|
||||
* @var Translator
|
||||
*/
|
||||
private $translator;
|
||||
|
||||
/**
|
||||
* @var Smarty_Data
|
||||
*/
|
||||
private $smarty;
|
||||
private $module;
|
||||
|
||||
/**
|
||||
* OnBoarding constructor.
|
||||
*
|
||||
* @param Translator $translator Twig environment needed to manage the templates
|
||||
* @param Smarty_Data $smarty
|
||||
* @param Module $module
|
||||
* @param Router $router
|
||||
*/
|
||||
public function __construct($translator, $smarty, $module, Router $router)
|
||||
{
|
||||
@@ -62,24 +73,24 @@ class OnBoarding
|
||||
*/
|
||||
public function showModuleContent()
|
||||
{
|
||||
$templates = array();
|
||||
$templates = [];
|
||||
foreach ($this->configuration['templates'] as $template) {
|
||||
$templates[] = array(
|
||||
'name' => $template,
|
||||
'content' => str_replace(array("\n", "\r", "\t"), "", $this->getTemplateContent("templates/$template")),
|
||||
);
|
||||
$templates[] = [
|
||||
'name' => $template,
|
||||
'content' => str_replace(["\n", "\r", "\t"], '', $this->getTemplateContent("templates/$template")),
|
||||
];
|
||||
}
|
||||
|
||||
echo $this->getTemplateContent('content', array(
|
||||
echo $this->getTemplateContent('content', [
|
||||
'currentStep' => $this->getCurrentStep(),
|
||||
'totalSteps' => $this->getTotalSteps(),
|
||||
'totalSteps' => $this->getTotalSteps(),
|
||||
'percent_real' => ($this->getCurrentStep() / $this->getTotalSteps()) * 100,
|
||||
'percent_rounded' => round(($this->getCurrentStep() / $this->getTotalSteps())*100),
|
||||
'isShutDown' => $this->isShutDown(),
|
||||
'steps' => $this->configuration['steps'],
|
||||
'jsonSteps' => json_encode($this->configuration['steps']),
|
||||
'templates' => $templates,
|
||||
));
|
||||
'percent_rounded' => round(($this->getCurrentStep() / $this->getTotalSteps()) * 100),
|
||||
'isShutDown' => $this->isShutDown(),
|
||||
'steps' => $this->configuration['steps'],
|
||||
'jsonSteps' => json_encode($this->configuration['steps']),
|
||||
'templates' => $templates,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,13 +98,13 @@ class OnBoarding
|
||||
*/
|
||||
public function showModuleContentForNavBar($link)
|
||||
{
|
||||
echo $this->getTemplateContent('navbar', array(
|
||||
echo $this->getTemplateContent('navbar', [
|
||||
'currentStep' => $this->getCurrentStep(),
|
||||
'totalSteps' => $this->getTotalSteps(),
|
||||
'totalSteps' => $this->getTotalSteps(),
|
||||
'percent_real' => ($this->getCurrentStep() / $this->getTotalSteps()) * 100,
|
||||
'percent_rounded' => round(($this->getCurrentStep() / $this->getTotalSteps())*100),
|
||||
'percent_rounded' => round(($this->getCurrentStep() / $this->getTotalSteps()) * 100),
|
||||
'link' => $link->getAdminLink('AdminWelcome'),
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -133,7 +144,7 @@ class OnBoarding
|
||||
/**
|
||||
* Load all the steps with the localized texts.
|
||||
*
|
||||
* @param string $configPath Path where the configuration can be loaded
|
||||
* @param Router $router
|
||||
*/
|
||||
private function loadConfiguration(Router $router)
|
||||
{
|
||||
@@ -162,14 +173,14 @@ class OnBoarding
|
||||
*
|
||||
* @param array $text Step text configuration
|
||||
*
|
||||
* @return string|null Text if it exists
|
||||
* @return array|mixed|string|null
|
||||
*/
|
||||
private function getTextFromSettings($text)
|
||||
{
|
||||
if (is_array($text)) {
|
||||
switch ($text['type']) {
|
||||
case 'template':
|
||||
return $this->getTemplateContent('contents/'.$text['src']);
|
||||
return $this->getTemplateContent('contents/' . $text['src']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,15 +200,16 @@ class OnBoarding
|
||||
/**
|
||||
* Return a template.
|
||||
*
|
||||
* @param string $templateName Template name
|
||||
* @param array $additionnalParameters Additionnal parameters to inject on the Twig template
|
||||
* @param string $templateName Template name
|
||||
* @param array $additionnalParameters Additionnal parameters to inject on the Twig template
|
||||
*
|
||||
* @return string Parsed template
|
||||
* @return string|null
|
||||
*/
|
||||
private function getTemplateContent($templateName, $additionnalParameters = array())
|
||||
private function getTemplateContent($templateName, $additionnalParameters = [])
|
||||
{
|
||||
$this->smarty->assign($additionnalParameters);
|
||||
return $this->module->fetch(__DIR__.'/../views/'.$templateName.'.tpl');
|
||||
|
||||
return $this->module->fetch(__DIR__ . '/../views/' . $templateName . '.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -207,7 +219,7 @@ class OnBoarding
|
||||
*/
|
||||
private function getCurrentStep()
|
||||
{
|
||||
return (int)LegacyConfiguration::get('ONBOARDINGV2_CURRENT_STEP');
|
||||
return (int) LegacyConfiguration::get('ONBOARDINGV2_CURRENT_STEP');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -231,10 +243,10 @@ class OnBoarding
|
||||
/**
|
||||
* Return the shut down status.
|
||||
*
|
||||
* @return bool Shut down status
|
||||
* @return int
|
||||
*/
|
||||
private function isShutDown()
|
||||
{
|
||||
return (int)LegacyConfiguration::get('ONBOARDINGV2_SHUT_DOWN');
|
||||
return (int) LegacyConfiguration::get('ONBOARDINGV2_SHUT_DOWN');
|
||||
}
|
||||
}
|
||||
|
||||
34
modules/welcome/OnBoarding/index.php
Normal file
34
modules/welcome/OnBoarding/index.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* 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.md.
|
||||
* 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.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
*/
|
||||
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