Integration of Assetic in SmartyParser, extended it to Admin (we can now
use loops !), added the Thelia ControllerResolver and fixed config and routing accordingly.²:wq
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
@@ -17,7 +17,7 @@
|
||||
/* 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/>. */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
namespace Thelia\Admin\Controller;
|
||||
@@ -25,6 +25,9 @@ namespace Thelia\Admin\Controller;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Thelia\Admin\Templating\Template;
|
||||
use Thelia\Core\Template\SmartyParser;
|
||||
use Symfony\Component\Routing\RequestContext;
|
||||
use Symfony\Component\DependencyInjection\ContainerAware;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -34,24 +37,23 @@ use Thelia\Admin\Templating\Template;
|
||||
* @author Franck Allimant <franck@cqfdev.fr>
|
||||
*/
|
||||
|
||||
class BaseAdminController
|
||||
class BaseAdminController extends ContainerAware
|
||||
{
|
||||
protected function render($templateName, $args = array()) {
|
||||
|
||||
$tpl = new Template();
|
||||
$parser = $this->container->get('thelia.admin.parser');
|
||||
|
||||
$data = $tpl->render($templateName, $args);
|
||||
$args = array('lang' => 'fr');
|
||||
|
||||
return $data;
|
||||
return $parser->render($templateName, $args);
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
$rep = new Response();
|
||||
$resp = new Response();
|
||||
|
||||
$rep->setContent($this->render('login'));
|
||||
$resp->setContent($this->render('login.html'));
|
||||
|
||||
return $rep;
|
||||
return $resp;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
||||
46
core/lib/Thelia/Admin/Template/AdminSmartyParser.php
Normal file
46
core/lib/Thelia/Admin/Template/AdminSmartyParser.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?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\Admin\Template;
|
||||
|
||||
use Thelia\Core\Template\SmartyParser;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
// smarty configuration
|
||||
class AdminSmartyParser extends SmartyParser
|
||||
{
|
||||
public function __construct(ContainerInterface $container, $template = false)
|
||||
{
|
||||
$this->template = $template == false ? 'admin/default' : $template;
|
||||
|
||||
parent::__construct($container, $template);
|
||||
}
|
||||
|
||||
public function render($realTemplateName, $parameters) {
|
||||
|
||||
$this->assign($parameters);
|
||||
|
||||
return $this->fetch($realTemplateName);
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user