diff --git a/core/lib/Thelia/Admin/Controller/AdminController.php b/core/lib/Thelia/Admin/Controller/AdminController.php new file mode 100644 index 000000000..27d0ef707 --- /dev/null +++ b/core/lib/Thelia/Admin/Controller/AdminController.php @@ -0,0 +1,19 @@ +render("login.html"); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Admin/Controller/BaseAdminController.php b/core/lib/Thelia/Admin/Controller/BaseAdminController.php index eaee6ee39..7b9e2a79f 100644 --- a/core/lib/Thelia/Admin/Controller/BaseAdminController.php +++ b/core/lib/Thelia/Admin/Controller/BaseAdminController.php @@ -35,33 +35,50 @@ use Symfony\Component\DependencyInjection\ContainerAware; * user is not yet logged in, or back-office home page if the user is logged in. * * @author Franck Allimant + * @author Manuel Raynaud */ -class BaseAdminController +class BaseAdminController extends ContainerAware { - protected $parser; - - public function __construct($parser) { - - $this->parser = $parser; - - // FIXME: should be read from config - $this->parser->setTemplate('admin/default'); - } - - protected function render($templateName, $args = array()) { + /** + * @param $templateName + * @param array $args + * @return \Symfony\Component\HttpFoundation\Response + */ + public function render($templateName, $args = array()) + { $args = array('lang' => 'fr'); - return $this->parser->render($templateName, $args); + $response = new Response(); + + return $response->setContent($this->renderRaw($templateName, $args)); } - public function indexAction() + public function renderRaw($templateName, $args = array()) { - $resp = new Response(); + $args = array('lang' => 'fr'); + + return $this->getParser()->render($templateName, $args); + } + + /** + * @return \Symfony\Component\HttpFoundation\Request + */ + public function getRequest() + { + return $this->container->get('request'); + } + + public function getParser() + { + $parser = $this->container->get("thelia.parser"); + + // FIXME: should be read from config + $parser->setTemplate('admin/default'); + + return $parser; + } - $resp->setContent($this->render('login.html')); - return $resp; - } } \ No newline at end of file diff --git a/core/lib/Thelia/Config/Resources/routing/admin.xml b/core/lib/Thelia/Config/Resources/routing/admin.xml index 9df36a90a..68510a84c 100644 --- a/core/lib/Thelia/Config/Resources/routing/admin.xml +++ b/core/lib/Thelia/Config/Resources/routing/admin.xml @@ -5,6 +5,6 @@ xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - thelia.admin.base_controller:indexAction + Thelia\Admin\Controller\AdminController::indexAction \ No newline at end of file diff --git a/templates/admin/default/login.html b/templates/admin/default/login.html index 76be69464..b059bb222 100644 --- a/templates/admin/default/login.html +++ b/templates/admin/default/login.html @@ -8,8 +8,9 @@
- + {* {thelia_module action='index_top'} + *}

{intl l='Thelia Back Office'}

@@ -45,8 +46,9 @@
- + {* {thelia_module action='index_bottom'} + *} {include file='includes/footer.inc.html'} \ No newline at end of file