Add basic template and hooks in Admin

This commit is contained in:
Benoît Burnichon
2015-08-27 17:16:07 +02:00
parent 68aab17157
commit c01f3f238f
8 changed files with 221 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2015 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Controller\Admin;
use Alchemy\Phrasea\Application;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\StreamedResponse;
class PluginsController
{
/** @var Application */
private $app;
public function __construct(Application $app)
{
$this->app = $app;
}
public function indexAction()
{
return $this->render('admin/plugins/index.html.twig', [
'plugins' => $this->app['plugins'],
]);
}
/**
* @param string $view
* @param array $parameters
* @param Response|null $response
* @return Response
*/
public function render($view, array $parameters = array(), Response $response = null)
{
/** @var \Twig_Environment $twig */
$twig = $this->app['twig'];
if ($response instanceof StreamedResponse) {
$response->setCallback(function () use ($twig, $view, $parameters) {
$twig->display($view, $parameters);
});
} else {
if (null === $response) {
$response = new Response();
}
$response->setContent($twig->render($view, $parameters));
}
return $response;
}
}