Merge branch 'master' of https://github.com/thelia/thelia
@@ -934,12 +934,12 @@
|
|||||||
<default key="_controller">Thelia\Controller\Admin\ModuleController::processUpdateAction</default>
|
<default key="_controller">Thelia\Controller\Admin\ModuleController::processUpdateAction</default>
|
||||||
</route>
|
</route>
|
||||||
|
|
||||||
<route id="admin.module.toggle-activation" path="/admin/modules/toggle-activation/{module_id}">
|
<route id="admin.module.toggle-activation" path="/admin/module/toggle-activation/{module_id}">
|
||||||
<default key="_controller">Thelia\Controller\Admin\ModuleController::toggleActivationAction</default>
|
<default key="_controller">Thelia\Controller\Admin\ModuleController::toggleActivationAction</default>
|
||||||
<requirement key="module_id">\d+</requirement>
|
<requirement key="module_id">\d+</requirement>
|
||||||
</route>
|
</route>
|
||||||
|
|
||||||
<route id="admin.module.delete" path="/admin/modules/delete">
|
<route id="admin.module.delete" path="/admin/module/delete">
|
||||||
<default key="_controller">Thelia\Controller\Admin\ModuleController::deleteAction</default>
|
<default key="_controller">Thelia\Controller\Admin\ModuleController::deleteAction</default>
|
||||||
</route>
|
</route>
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,11 @@
|
|||||||
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
|
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
|
||||||
<default key="_view">account-password</default>
|
<default key="_view">account-password</default>
|
||||||
</route>
|
</route>
|
||||||
|
|
||||||
|
<route id="customer.order.pdf.delivery" path="/account/order/pdf/delivery/{order_id}">
|
||||||
|
<default key="_controller">Thelia\Controller\Front\OrderController::generateDeliveryPdf</default>
|
||||||
|
<requirement key="order_id">\d+</requirement>
|
||||||
|
</route>
|
||||||
<!-- end customer routes -->
|
<!-- end customer routes -->
|
||||||
|
|
||||||
<!-- customer address routes -->
|
<!-- customer address routes -->
|
||||||
@@ -152,10 +157,6 @@
|
|||||||
</route>
|
</route>
|
||||||
<!-- end order management process -->
|
<!-- end order management process -->
|
||||||
|
|
||||||
<route id="mail.test" path="/mail/test">
|
|
||||||
<default key="_controller">Thelia\Controller\Front\Mail::test</default>
|
|
||||||
</route>
|
|
||||||
|
|
||||||
<!-- contact management -->
|
<!-- contact management -->
|
||||||
<route id="contact.send" path="/contact" methods="post">
|
<route id="contact.send" path="/contact" methods="post">
|
||||||
<default key="_controller">Thelia\Controller\Front\ContactController::sendAction</default>
|
<default key="_controller">Thelia\Controller\Front\ContactController::sendAction</default>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
<!-- The assets manager -->
|
<!-- The assets manager -->
|
||||||
<service id="assetic.asset.manager" class="Thelia\Core\Template\Assets\AsseticAssetManager" >
|
<service id="assetic.asset.manager" class="Thelia\Core\Template\Assets\AsseticAssetManager" >
|
||||||
<argument>%kernel.environment%</argument>
|
<argument>%kernel.debug%</argument>
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
<!-- Smarty parser plugins -->
|
<!-- Smarty parser plugins -->
|
||||||
|
|||||||
@@ -202,48 +202,28 @@ class OrderController extends BaseAdminController
|
|||||||
|
|
||||||
public function generateInvoicePdf($order_id)
|
public function generateInvoicePdf($order_id)
|
||||||
{
|
{
|
||||||
return $this->generatePdf($order_id, ConfigQuery::read('pdf_invoice_file', 'invoice'));
|
if (null !== $response = $this->checkAuth(AdminResources::ORDER, array(), AccessManager::UPDATE)) return $response;
|
||||||
|
|
||||||
|
return $this->generateBackOfficeOrderPdf($order_id, ConfigQuery::read('pdf_invoice_file', 'invoice'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function generateDeliveryPdf($order_id)
|
public function generateDeliveryPdf($order_id)
|
||||||
{
|
|
||||||
return $this->generatePdf($order_id, ConfigQuery::read('pdf_delivery_file', 'delivery'));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function generatePdf($order_id, $fileName)
|
|
||||||
{
|
{
|
||||||
if (null !== $response = $this->checkAuth(AdminResources::ORDER, array(), AccessManager::UPDATE)) return $response;
|
if (null !== $response = $this->checkAuth(AdminResources::ORDER, array(), AccessManager::UPDATE)) return $response;
|
||||||
|
|
||||||
$html = $this->renderRaw(
|
return $this->generateBackOfficeOrderPdf($order_id, ConfigQuery::read('pdf_delivery_file', 'delivery'));
|
||||||
$fileName,
|
|
||||||
array(
|
|
||||||
'order_id' => $order_id
|
|
||||||
),
|
|
||||||
TemplateHelper::getInstance()->getActivePdfTemplate()->getPath()
|
|
||||||
);
|
|
||||||
|
|
||||||
$order = OrderQuery::create()->findPk($order_id);
|
|
||||||
|
|
||||||
try {
|
|
||||||
$pdfEvent = new PdfEvent($html);
|
|
||||||
|
|
||||||
$this->dispatch(TheliaEvents::GENERATE_PDF, $pdfEvent);
|
|
||||||
|
|
||||||
if ($pdfEvent->hasPdf()) {
|
|
||||||
return Response::create($pdfEvent->getPdf(), 200,
|
|
||||||
array(
|
|
||||||
'Content-type' => "application/pdf",
|
|
||||||
'Content-Disposition' => sprintf('Attachment;filename=%s.pdf', $order->getRef()),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
\Thelia\Log\Tlog::getInstance()->error(sprintf('error during generating invoice pdf for order id : %d with message "%s"', $order_id, $e->getMessage()));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function generateBackOfficeOrderPdf($order_id, $fileName)
|
||||||
|
{
|
||||||
|
if(null === $response = $this->generateOrderPdf($order_id, $fileName)){
|
||||||
$this->redirect(URL::getInstance()->absoluteUrl($this->getRoute("admin.order.update.view", array(
|
$this->redirect(URL::getInstance()->absoluteUrl($this->getRoute("admin.order.update.view", array(
|
||||||
'order_id' => $order_id
|
'order_id' => $order_id
|
||||||
))));
|
))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,10 +45,6 @@ class TranslationsController extends BaseAdminController
|
|||||||
// Find modules
|
// Find modules
|
||||||
$modules = ModuleQuery::create()->joinI18n($this->getCurrentEditionLocale())->orderByPosition()->find();
|
$modules = ModuleQuery::create()->joinI18n($this->getCurrentEditionLocale())->orderByPosition()->find();
|
||||||
|
|
||||||
TemplateHelper::getInstance()->getList(TemplateDefinition::BACK_OFFICE);
|
|
||||||
TemplateHelper::getInstance()->getList(TemplateDefinition::PDF);
|
|
||||||
TemplateHelper::getInstance()->getList(TemplateDefinition::FRONT_OFFICE);
|
|
||||||
|
|
||||||
// Get related strings, if all input data are here
|
// Get related strings, if all input data are here
|
||||||
$item_to_translate = $this->getRequest()->get('item_to_translate');
|
$item_to_translate = $this->getRequest()->get('item_to_translate');
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,8 @@
|
|||||||
/*************************************************************************************/
|
/*************************************************************************************/
|
||||||
namespace Thelia\Controller;
|
namespace Thelia\Controller;
|
||||||
|
|
||||||
|
use Thelia\Core\Event\PdfEvent;
|
||||||
|
use Thelia\Core\Event\TheliaEvents;
|
||||||
use Thelia\Core\HttpFoundation\Response;
|
use Thelia\Core\HttpFoundation\Response;
|
||||||
use Symfony\Component\DependencyInjection\ContainerAware;
|
use Symfony\Component\DependencyInjection\ContainerAware;
|
||||||
|
|
||||||
@@ -31,7 +33,9 @@ use Symfony\Component\Routing\Exception\MissingMandatoryParametersException;
|
|||||||
use Symfony\Component\Routing\Exception\RouteNotFoundException;
|
use Symfony\Component\Routing\Exception\RouteNotFoundException;
|
||||||
use Symfony\Component\Routing\Router;
|
use Symfony\Component\Routing\Router;
|
||||||
use Thelia\Core\Security\SecurityContext;
|
use Thelia\Core\Security\SecurityContext;
|
||||||
|
use Thelia\Core\Template\TemplateHelper;
|
||||||
use Thelia\Core\Translation\Translator;
|
use Thelia\Core\Translation\Translator;
|
||||||
|
use Thelia\Model\OrderQuery;
|
||||||
use Thelia\Tools\URL;
|
use Thelia\Tools\URL;
|
||||||
use Thelia\Tools\Redirect;
|
use Thelia\Tools\Redirect;
|
||||||
use Thelia\Core\Template\ParserContext;
|
use Thelia\Core\Template\ParserContext;
|
||||||
@@ -52,7 +56,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class BaseController extends ContainerAware
|
abstract class BaseController extends ContainerAware
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -73,6 +77,21 @@ class BaseController extends ContainerAware
|
|||||||
return new Response($json_data, $status, array('content-type' => 'application/json'));
|
return new Response($json_data, $status, array('content-type' => 'application/json'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $pdf
|
||||||
|
* @param $fileName
|
||||||
|
* @param $status
|
||||||
|
* @return \Symfony\Component\HttpFoundation\Response
|
||||||
|
*/
|
||||||
|
protected function pdfResponse($pdf, $fileName, $status = 200)
|
||||||
|
{
|
||||||
|
return Response::create($pdf, $status,
|
||||||
|
array(
|
||||||
|
'Content-type' => "application/pdf",
|
||||||
|
'Content-Disposition' => sprintf('Attachment;filename=%s.pdf', $fileName),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dispatch a Thelia event
|
* Dispatch a Thelia event
|
||||||
*
|
*
|
||||||
@@ -207,6 +226,35 @@ class BaseController extends ContainerAware
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function generateOrderPdf($order_id, $fileName)
|
||||||
|
{
|
||||||
|
$html = $this->renderRaw(
|
||||||
|
$fileName,
|
||||||
|
array(
|
||||||
|
'order_id' => $order_id
|
||||||
|
),
|
||||||
|
TemplateHelper::getInstance()->getActivePdfTemplate()->getPath()
|
||||||
|
);
|
||||||
|
|
||||||
|
$order = OrderQuery::create()->findPk($order_id);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdfEvent = new PdfEvent($html);
|
||||||
|
|
||||||
|
$this->dispatch(TheliaEvents::GENERATE_PDF, $pdfEvent);
|
||||||
|
|
||||||
|
if ($pdfEvent->hasPdf()) {
|
||||||
|
return $this->pdfResponse($pdfEvent->getPdf(), $order->getRef());
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
\Thelia\Log\Tlog::getInstance()->error(sprintf('error during generating invoice pdf for order id : %d with message "%s"', $order_id, $e->getMessage()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* redirect request to the specified url
|
* redirect request to the specified url
|
||||||
@@ -311,20 +359,28 @@ class BaseController extends ContainerAware
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @return a ParserInterface instance parser
|
||||||
* return an instance of SmartyParser
|
|
||||||
*
|
|
||||||
* Caution : maybe there is still not default template defined.
|
|
||||||
*
|
|
||||||
* @return ParserInterface instance parser
|
|
||||||
*/
|
*/
|
||||||
protected function getParser()
|
abstract protected function getParser($template = null);
|
||||||
{
|
|
||||||
return $this->container->get("thelia.parser");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function render($inline)
|
/**
|
||||||
{
|
* Render the given template, and returns the result as an Http Response.
|
||||||
return $this->getParser()->fetch(sprintf("string:%s", $inline));
|
*
|
||||||
}
|
* @param $templateName the complete template name, with extension
|
||||||
|
* @param array $args the template arguments
|
||||||
|
* @param int $status http code status
|
||||||
|
* @return \Thelia\Core\HttpFoundation\Response
|
||||||
|
*/
|
||||||
|
abstract protected function render($templateName, $args = array(), $status = 200);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render the given template, and returns the result as a string.
|
||||||
|
*
|
||||||
|
* @param $templateName the complete template name, with extension
|
||||||
|
* @param array $args the template arguments
|
||||||
|
* @param null $templateDir
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
abstract protected function renderRaw($templateName, $args = array(), $templateDir = null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,9 +24,13 @@ namespace Thelia\Controller\Front;
|
|||||||
|
|
||||||
use Symfony\Component\Routing\Router;
|
use Symfony\Component\Routing\Router;
|
||||||
use Thelia\Controller\BaseController;
|
use Thelia\Controller\BaseController;
|
||||||
|
use Thelia\Core\HttpFoundation\Response;
|
||||||
|
use Thelia\Core\Security\Exception\AuthenticationException;
|
||||||
|
use Thelia\Core\Template\TemplateHelper;
|
||||||
use Thelia\Model\AddressQuery;
|
use Thelia\Model\AddressQuery;
|
||||||
use Thelia\Model\ConfigQuery;
|
use Thelia\Model\ConfigQuery;
|
||||||
use Thelia\Model\ModuleQuery;
|
use Thelia\Model\ModuleQuery;
|
||||||
|
use Thelia\Tools\Redirect;
|
||||||
use Thelia\Tools\URL;
|
use Thelia\Tools\URL;
|
||||||
|
|
||||||
class BaseFrontController extends BaseController
|
class BaseFrontController extends BaseController
|
||||||
@@ -88,12 +92,59 @@ class BaseFrontController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* @return ParserInterface instance parser
|
* @return ParserInterface instance parser
|
||||||
*/
|
*/
|
||||||
protected function getParser()
|
protected function getParser($template = null)
|
||||||
{
|
{
|
||||||
$parser = $this->container->get("thelia.parser");
|
$parser = $this->container->get("thelia.parser");
|
||||||
|
|
||||||
$parser->setTemplate(ConfigQuery::getActiveTemplate());
|
// Define the template that should be used
|
||||||
|
$parser->setTemplate($template ?: TemplateHelper::getInstance()->getActiveFrontTemplate()->getPath());
|
||||||
|
|
||||||
return $parser;
|
return $parser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render the given template, and returns the result as an Http Response.
|
||||||
|
*
|
||||||
|
* @param $templateName the complete template name, with extension
|
||||||
|
* @param array $args the template arguments
|
||||||
|
* @param int $status http code status
|
||||||
|
* @return \Thelia\Core\HttpFoundation\Response
|
||||||
|
*/
|
||||||
|
protected function render($templateName, $args = array(), $status = 200)
|
||||||
|
{
|
||||||
|
return Response::create($this->renderRaw($templateName, $args), $status);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render the given template, and returns the result as a string.
|
||||||
|
*
|
||||||
|
* @param $templateName the complete template name, with extension
|
||||||
|
* @param array $args the template arguments
|
||||||
|
* @param null $templateDir
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function renderRaw($templateName, $args = array(), $templateDir = null)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Add the template standard extension
|
||||||
|
$templateName .= '.html';
|
||||||
|
|
||||||
|
$session = $this->getSession();
|
||||||
|
|
||||||
|
// Prepare common template variables
|
||||||
|
$args = array_merge($args, array(
|
||||||
|
'locale' => $session->getLang()->getLocale(),
|
||||||
|
'lang_code' => $session->getLang()->getCode(),
|
||||||
|
'lang_id' => $session->getLang()->getId(),
|
||||||
|
'current_url' => $this->getRequest()->getUri()
|
||||||
|
));
|
||||||
|
|
||||||
|
// Render the template.
|
||||||
|
|
||||||
|
$data = $this->getParser($templateDir)->render($templateName, $args);
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,48 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*************************************************************************************/
|
|
||||||
/* */
|
|
||||||
/* Thelia */
|
|
||||||
/* */
|
|
||||||
/* Copyright (c) OpenStudio */
|
|
||||||
/* email : info@thelia.net */
|
|
||||||
/* web : http://www.thelia.net */
|
|
||||||
/* */
|
|
||||||
/* This program is free software; you can redistribute it and/or modify */
|
|
||||||
/* it under the terms of the GNU General Public License as published by */
|
|
||||||
/* the Free Software Foundation; either version 3 of the License */
|
|
||||||
/* */
|
|
||||||
/* This program is distributed in the hope that it will be useful, */
|
|
||||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
|
||||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
|
||||||
/* GNU General Public License for more details. */
|
|
||||||
/* */
|
|
||||||
/* You should have received a copy of the GNU General Public License */
|
|
||||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
||||||
/* */
|
|
||||||
/*************************************************************************************/
|
|
||||||
|
|
||||||
namespace Thelia\Controller\Front;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class Mail
|
|
||||||
* @package Thelia\Controller\Front
|
|
||||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
|
||||||
*/
|
|
||||||
class Mail extends BaseFrontController
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* This is a demo how to send a mail using swiftmailer + smarty
|
|
||||||
*/
|
|
||||||
public function test()
|
|
||||||
{
|
|
||||||
$message = \Swift_Message::newInstance('Wonderful Subject')
|
|
||||||
->setFrom(array('john@doe.com' => 'John Doe'))
|
|
||||||
->setTo(array('mraynaud@openstudio.fr' => 'name'))
|
|
||||||
->setBody($this->render('Here is the message itself'))
|
|
||||||
;
|
|
||||||
|
|
||||||
$this->getMailer()->send($message);
|
|
||||||
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -23,6 +23,9 @@
|
|||||||
namespace Thelia\Controller\Front;
|
namespace Thelia\Controller\Front;
|
||||||
|
|
||||||
use Propel\Runtime\Exception\PropelException;
|
use Propel\Runtime\Exception\PropelException;
|
||||||
|
use Thelia\Core\Event\PdfEvent;
|
||||||
|
use Thelia\Core\HttpFoundation\Response;
|
||||||
|
use Thelia\Core\Template\TemplateHelper;
|
||||||
use Thelia\Exception\TheliaProcessException;
|
use Thelia\Exception\TheliaProcessException;
|
||||||
use Thelia\Form\Exception\FormValidationException;
|
use Thelia\Form\Exception\FormValidationException;
|
||||||
use Thelia\Core\Event\Order\OrderEvent;
|
use Thelia\Core\Event\Order\OrderEvent;
|
||||||
@@ -34,6 +37,7 @@ use Thelia\Log\Tlog;
|
|||||||
use Thelia\Model\AddressQuery;
|
use Thelia\Model\AddressQuery;
|
||||||
use Thelia\Model\AreaDeliveryModuleQuery;
|
use Thelia\Model\AreaDeliveryModuleQuery;
|
||||||
use Thelia\Model\Base\OrderQuery;
|
use Thelia\Model\Base\OrderQuery;
|
||||||
|
use Thelia\Model\ConfigQuery;
|
||||||
use Thelia\Model\ModuleQuery;
|
use Thelia\Model\ModuleQuery;
|
||||||
use Thelia\Model\Order;
|
use Thelia\Model\Order;
|
||||||
use Thelia\Tools\URL;
|
use Thelia\Tools\URL;
|
||||||
@@ -67,7 +71,6 @@ class OrderController extends BaseFrontController
|
|||||||
$deliveryModule = ModuleQuery::create()->findPk($deliveryModuleId);
|
$deliveryModule = ModuleQuery::create()->findPk($deliveryModuleId);
|
||||||
|
|
||||||
/* check that the delivery address belongs to the current customer */
|
/* check that the delivery address belongs to the current customer */
|
||||||
$deliveryAddress = AddressQuery::create()->findPk($deliveryAddressId);
|
|
||||||
if ($deliveryAddress->getCustomerId() !== $this->getSecurityContext()->getCustomerUser()->getId()) {
|
if ($deliveryAddress->getCustomerId() !== $this->getSecurityContext()->getCustomerUser()->getId()) {
|
||||||
throw new \Exception("Delivery address does not belong to the current customer");
|
throw new \Exception("Delivery address does not belong to the current customer");
|
||||||
}
|
}
|
||||||
@@ -242,4 +245,20 @@ class OrderController extends BaseFrontController
|
|||||||
|
|
||||||
return $order;
|
return $order;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function generateInvoicePdf($order_id)
|
||||||
|
{
|
||||||
|
/* check customer */
|
||||||
|
$this->checkAuth();
|
||||||
|
return $this->generateOrderPdf($order_id, ConfigQuery::read('pdf_invoice_file', 'invoice'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function generateDeliveryPdf($order_id)
|
||||||
|
{
|
||||||
|
/* check customer */
|
||||||
|
$this->checkAuth();
|
||||||
|
return $this->generateOrderPdf($order_id, ConfigQuery::read('pdf_delivery_file', 'delivery'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,13 +40,13 @@ use Symfony\Component\Filesystem\Exception\IOException;
|
|||||||
*/
|
*/
|
||||||
class AsseticAssetManager implements AssetManagerInterface
|
class AsseticAssetManager implements AssetManagerInterface
|
||||||
{
|
{
|
||||||
protected $developmentMode;
|
protected $debugMode;
|
||||||
|
|
||||||
protected $source_file_extensions = array('less', 'js', 'coffee', 'html', 'tpl', 'htm', 'xml');
|
protected $source_file_extensions = array('less', 'js', 'coffee', 'html', 'tpl', 'htm', 'xml');
|
||||||
|
|
||||||
public function __construct($developmentMode)
|
public function __construct($debugMode)
|
||||||
{
|
{
|
||||||
$this->developmentMode = $developmentMode;
|
$this->debugMode = $debugMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -336,7 +336,7 @@ class AsseticAssetManager implements AssetManagerInterface
|
|||||||
Tlog::getInstance()->addDebug("Asset destination full path: $asset_destination_path");
|
Tlog::getInstance()->addDebug("Asset destination full path: $asset_destination_path");
|
||||||
|
|
||||||
// We generate an asset only if it does not exists, or if the asset processing is forced in development mode
|
// We generate an asset only if it does not exists, or if the asset processing is forced in development mode
|
||||||
if (! file_exists($asset_destination_path) || ($this->developmentMode && ConfigQuery::read('process_assets', true)) ) {
|
if (! file_exists($asset_destination_path) || ($this->debugMode && ConfigQuery::read('process_assets', true)) ) {
|
||||||
|
|
||||||
$writer = new AssetWriter($output_directory);
|
$writer = new AssetWriter($output_directory);
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ use Thelia\Core\Template\Loop\Argument\Argument;
|
|||||||
|
|
||||||
use Thelia\Model\LangQuery;
|
use Thelia\Model\LangQuery;
|
||||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||||
|
use Thelia\Type\TypeCollection;
|
||||||
|
use Thelia\Type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Language loop, to get a list of available languages
|
* Language loop, to get a list of available languages
|
||||||
@@ -56,7 +58,14 @@ class Lang extends BaseLoop implements PropelSearchLoopInterface
|
|||||||
return new ArgumentCollection(
|
return new ArgumentCollection(
|
||||||
Argument::createIntTypeArgument('id', null),
|
Argument::createIntTypeArgument('id', null),
|
||||||
Argument::createIntListTypeArgument('exclude'),
|
Argument::createIntListTypeArgument('exclude'),
|
||||||
Argument::createBooleanTypeArgument('default_only', false)
|
Argument::createBooleanTypeArgument('default_only', false),
|
||||||
|
new Argument(
|
||||||
|
'order',
|
||||||
|
new TypeCollection(
|
||||||
|
new Type\EnumListType(array('id', 'id_reverse', 'alpha', 'alpha_reverse', 'position', 'position_reverse'))
|
||||||
|
),
|
||||||
|
'position'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,6 +88,30 @@ class Lang extends BaseLoop implements PropelSearchLoopInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
$search->orderByPosition(Criteria::ASC);
|
$search->orderByPosition(Criteria::ASC);
|
||||||
|
$orders = $this->getOrder();
|
||||||
|
|
||||||
|
foreach ($orders as $order) {
|
||||||
|
switch ($order) {
|
||||||
|
case "id":
|
||||||
|
$search->orderById(Criteria::ASC);
|
||||||
|
break;
|
||||||
|
case "id_reverse":
|
||||||
|
$search->orderById(Criteria::DESC);
|
||||||
|
break;
|
||||||
|
case "alpha":
|
||||||
|
$search->orderByTitle(Criteria::ASC);
|
||||||
|
break;
|
||||||
|
case "alpha_reverse":
|
||||||
|
$search->orderByTitle(Criteria::DESC);
|
||||||
|
break;
|
||||||
|
case "position":
|
||||||
|
$search->orderByPosition(Criteria::ASC);
|
||||||
|
break;
|
||||||
|
case "position_reverse":
|
||||||
|
$search->orderByPosition(Criteria::DESC);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $search;
|
return $search;
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
/*************************************************************************************/
|
/*************************************************************************************/
|
||||||
|
|
||||||
namespace Thelia\Core\Template;
|
namespace Thelia\Core\Template;
|
||||||
use Thelia\Model\ConfigQuery;
|
|
||||||
|
|
||||||
class TemplateDefinition
|
class TemplateDefinition
|
||||||
{
|
{
|
||||||
@@ -30,7 +29,8 @@ class TemplateDefinition
|
|||||||
const BACK_OFFICE = 2;
|
const BACK_OFFICE = 2;
|
||||||
const PDF = 3;
|
const PDF = 3;
|
||||||
|
|
||||||
const BACK_OFFICE_SUBDIR = 'admin/';
|
const FRONT_OFFICE_SUBDIR = 'frontOffice/';
|
||||||
|
const BACK_OFFICE_SUBDIR = 'backOffice/';
|
||||||
const PDF_SUBDIR = 'pdf/';
|
const PDF_SUBDIR = 'pdf/';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -58,6 +58,8 @@ class TemplateDefinition
|
|||||||
$this->path = self::BACK_OFFICE_SUBDIR . $name;
|
$this->path = self::BACK_OFFICE_SUBDIR . $name;
|
||||||
else if ($type == self::PDF)
|
else if ($type == self::PDF)
|
||||||
$this->path = self::PDF_SUBDIR . $name;
|
$this->path = self::PDF_SUBDIR . $name;
|
||||||
|
else if ($type == self::FRONT_OFFICE)
|
||||||
|
$this->path = self::FRONT_OFFICE_SUBDIR . $name;
|
||||||
else
|
else
|
||||||
$this->path = $name;
|
$this->path = $name;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ class TemplateHelper
|
|||||||
$baseDir = THELIA_TEMPLATE_DIR.TemplateDefinition::PDF_SUBDIR;
|
$baseDir = THELIA_TEMPLATE_DIR.TemplateDefinition::PDF_SUBDIR;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$baseDir = THELIA_TEMPLATE_DIR;
|
$baseDir = THELIA_TEMPLATE_DIR.TemplateDefinition::FRONT_OFFICE_SUBDIR;
|
||||||
|
|
||||||
$exclude = array(TemplateDefinition::BACK_OFFICE_SUBDIR, TemplateDefinition::PDF_SUBDIR);
|
$exclude = array(TemplateDefinition::BACK_OFFICE_SUBDIR, TemplateDefinition::PDF_SUBDIR);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,14 @@ class CheckPermission extends BaseInstall
|
|||||||
'upload_max_filesize' => 2097152
|
'upload_max_filesize' => 2097152
|
||||||
);
|
);
|
||||||
|
|
||||||
|
protected $extensions = array(
|
||||||
|
'curl',
|
||||||
|
'gd',
|
||||||
|
'intl',
|
||||||
|
'mcrypt',
|
||||||
|
'pdo_mysql',
|
||||||
|
);
|
||||||
|
|
||||||
protected $validationMessages = array();
|
protected $validationMessages = array();
|
||||||
|
|
||||||
/** @var bool If permissions are OK */
|
/** @var bool If permissions are OK */
|
||||||
@@ -103,6 +111,14 @@ class CheckPermission extends BaseInstall
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($this->extensions as $extension) {
|
||||||
|
$this->validationMessages[$extension] = array(
|
||||||
|
'text' => '',
|
||||||
|
'hint' => $this->getI18nExtensionHint(),
|
||||||
|
'status' => true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
parent::__construct($verifyInstall);
|
parent::__construct($verifyInstall);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,6 +155,15 @@ class CheckPermission extends BaseInstall
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($this->extensions as $extension) {
|
||||||
|
$this->validationMessages[$extension]['text'] = $this->getI18nExtensionText($extension, true);
|
||||||
|
if (false === extension_loaded($extension)) {
|
||||||
|
$this->isValid = false;
|
||||||
|
$this->validationMessages[$extension]['status'] = false;
|
||||||
|
$this->validationMessages[$extension]['text'] = $this->getI18nExtensionText($extension, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -176,7 +201,6 @@ class CheckPermission extends BaseInstall
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Translated text about the directory state
|
* Get Translated text about the directory state
|
||||||
*
|
*
|
||||||
@@ -198,8 +222,7 @@ class CheckPermission extends BaseInstall
|
|||||||
$sentence,
|
$sentence,
|
||||||
array(
|
array(
|
||||||
'%directory%' => $directory
|
'%directory%' => $directory
|
||||||
),
|
)
|
||||||
'install-wizard'
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$translatedText = sprintf('Your directory %s needs to be writable', $directory);
|
$translatedText = sprintf('Your directory %s needs to be writable', $directory);
|
||||||
@@ -208,6 +231,19 @@ class CheckPermission extends BaseInstall
|
|||||||
return $translatedText;
|
return $translatedText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getI18nExtensionText($extension, $isValid)
|
||||||
|
{
|
||||||
|
if ($isValid) {
|
||||||
|
$sentence = '%extension% php extension is loaded';
|
||||||
|
} else {
|
||||||
|
$sentence = '%extension% php extension is not loaded';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->translator->trans($sentence, array(
|
||||||
|
'%extension%' => $extension
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Translated hint about the directory state
|
* Get Translated hint about the directory state
|
||||||
*
|
*
|
||||||
@@ -266,6 +302,11 @@ class CheckPermission extends BaseInstall
|
|||||||
return $translatedText;
|
return $translatedText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getI18nExtensionHint()
|
||||||
|
{
|
||||||
|
return $this->translator->trans('This extension must be installed and loaded');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Translated hint about the config requirement issue
|
* Get Translated hint about the config requirement issue
|
||||||
*
|
*
|
||||||
@@ -275,9 +316,7 @@ class CheckPermission extends BaseInstall
|
|||||||
{
|
{
|
||||||
$sentence = 'Modifying this value on your server php.ini file with admin rights could help';
|
$sentence = 'Modifying this value on your server php.ini file with admin rights could help';
|
||||||
$translatedText = $this->translator->trans(
|
$translatedText = $this->translator->trans(
|
||||||
$sentence,
|
$sentence
|
||||||
array(),
|
|
||||||
'install-wizard'
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return $translatedText;
|
return $translatedText;
|
||||||
@@ -306,8 +345,7 @@ class CheckPermission extends BaseInstall
|
|||||||
array(
|
array(
|
||||||
'%expectedValue%' => $expectedValue,
|
'%expectedValue%' => $expectedValue,
|
||||||
'%currentValue%' => $currentValue,
|
'%currentValue%' => $currentValue,
|
||||||
),
|
)
|
||||||
'install-wizard'
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$translatedText = sprintf('Thelia needs at least PHP %s (%s currently)', $expectedValue, $currentValue);
|
$translatedText = sprintf('Thelia needs at least PHP %s (%s currently)', $expectedValue, $currentValue);
|
||||||
@@ -326,8 +364,7 @@ class CheckPermission extends BaseInstall
|
|||||||
$sentence = 'Upgrading your version of PHP with admin rights could help';
|
$sentence = 'Upgrading your version of PHP with admin rights could help';
|
||||||
$translatedText = $this->translator->trans(
|
$translatedText = $this->translator->trans(
|
||||||
$sentence,
|
$sentence,
|
||||||
array(),
|
array()
|
||||||
'install-wizard'
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return $translatedText;
|
return $translatedText;
|
||||||
|
|||||||
1
local/modules/Colissimo/templates/admin.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Hello World
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<phpdoc>
|
|
||||||
<title><![CDATA[<b>Thelia</b> e-commerce Project]]></title>
|
|
||||||
<parser>
|
|
||||||
<target>documentation/api</target>
|
|
||||||
</parser>
|
|
||||||
<transformer>
|
|
||||||
<target>documentation/api</target>
|
|
||||||
</transformer>
|
|
||||||
<files>
|
|
||||||
<ignore>core/lib/Thelia/Tests/*</ignore>
|
|
||||||
<directory>core/lib/Thelia</directory>
|
|
||||||
|
|
||||||
</files>
|
|
||||||
</phpdoc>
|
|
||||||
|
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 62 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 509 B After Width: | Height: | Size: 509 B |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.8 KiB |
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |