sf4, repair errors and make basic and admin chill pages works

This commit is contained in:
Tchama 2020-07-30 17:34:45 +02:00
parent 7d9de642ff
commit 91edb14fb2
17 changed files with 126 additions and 77 deletions

View File

@ -34,12 +34,12 @@ class AdminController extends Controller {
public function indexAction($menu = 'admin', public function indexAction($menu = 'admin',
$header_title = 'views.Main.admin.index.header_title', $header_title = 'views.Main.admin.index.header_title',
$page_title = 'views.Main.admin.index.page_title') { $page_title = 'views.Main.admin.index.page_title') {
return $this->render('ChillMainBundle:Admin:layout.html.twig'); return $this->render('@ChillMain/Admin/layout.html.twig');
} }
public function indexPermissionsAction() public function indexPermissionsAction()
{ {
return $this->render('ChillMainBundle:Admin:layout_permissions.html.twig'); return $this->render('@ChillMain/Admin/layout_permissions.html.twig');
} }
public function configurationWarningsAction() public function configurationWarningsAction()

View File

@ -27,7 +27,7 @@ class CenterController extends Controller
$entities = $em->getRepository('ChillMainBundle:Center')->findAll(); $entities = $em->getRepository('ChillMainBundle:Center')->findAll();
return $this->render('ChillMainBundle:Center:index.html.twig', array( return $this->render('@ChillMain/Center/index.html.twig', array(
'entities' => $entities, 'entities' => $entities,
)); ));
} }
@ -49,7 +49,7 @@ class CenterController extends Controller
return $this->redirect($this->generateUrl('admin_center_show', array('id' => $center->getId()))); return $this->redirect($this->generateUrl('admin_center_show', array('id' => $center->getId())));
} }
return $this->render('ChillMainBundle:Center:new.html.twig', array( return $this->render('@ChillMain/Center/new.html.twig', array(
'entity' => $center, 'entity' => $center,
'form' => $form->createView(), 'form' => $form->createView(),
)); ));
@ -83,7 +83,7 @@ class CenterController extends Controller
$center = new Center(); $center = new Center();
$form = $this->createCreateForm($center); $form = $this->createCreateForm($center);
return $this->render('ChillMainBundle:Center:new.html.twig', array( return $this->render('@ChillMain/Center/new.html.twig', array(
'entity' => $center, 'entity' => $center,
'form' => $form->createView(), 'form' => $form->createView(),
)); ));
@ -103,7 +103,7 @@ class CenterController extends Controller
throw $this->createNotFoundException('Unable to find Center entity.'); throw $this->createNotFoundException('Unable to find Center entity.');
} }
return $this->render('ChillMainBundle:Center:show.html.twig', array( return $this->render('@ChillMain/Center/show.html.twig', array(
'entity' => $center 'entity' => $center
)); ));
} }
@ -123,7 +123,7 @@ class CenterController extends Controller
} }
$editForm = $this->createEditForm($center); $editForm = $this->createEditForm($center);
return $this->render('ChillMainBundle:Center:edit.html.twig', array( return $this->render('@ChillMain/Center/edit.html.twig', array(
'entity' => $center, 'entity' => $center,
'edit_form' => $editForm->createView() 'edit_form' => $editForm->createView()
)); ));
@ -170,7 +170,7 @@ class CenterController extends Controller
return $this->redirect($this->generateUrl('admin_center_edit', array('id' => $id))); return $this->redirect($this->generateUrl('admin_center_edit', array('id' => $id)));
} }
return $this->render('ChillMainBundle:Center:edit.html.twig', array( return $this->render('@ChillMain/Center/edit.html.twig', array(
'entity' => $center, 'entity' => $center,
'edit_form' => $editForm->createView() 'edit_form' => $editForm->createView()
)); ));

View File

@ -23,7 +23,7 @@ class DefaultController extends Controller
public function testAction() public function testAction()
{ {
return $this->render('ChillMainBundle:Tabs:index.html.twig', [ return $this->render('@ChillMain/Tabs/index.html.twig', [
'tabs' => [ 'tabs' => [
'test1' => [ 'test1' => [
[ [

View File

@ -109,7 +109,7 @@ class ExportController extends Controller
$exports = $exportManager->getExportsGrouped(true); $exports = $exportManager->getExportsGrouped(true);
return $this->render('ChillMainBundle:Export:layout.html.twig', array( return $this->render('@ChillMain/Export/layout.html.twig', array(
'grouped_exports' => $exports 'grouped_exports' => $exports
)); ));
} }
@ -201,7 +201,7 @@ class ExportController extends Controller
} }
} }
return $this->render('ChillMainBundle:Export:new_centers_step.html.twig', return $this->render('@ChillMain/Export/new_centers_step.html.twig',
array( array(
'form' => $form->createView(), 'form' => $form->createView(),
'export' => $export 'export' => $export
@ -262,7 +262,7 @@ class ExportController extends Controller
} }
} }
return $this->render('ChillMainBundle:Export:new.html.twig', array( return $this->render('@ChillMain/Export/new.html.twig', array(
'form' => $form->createView(), 'form' => $form->createView(),
'export_alias' => $alias, 'export_alias' => $alias,
'export' => $export 'export' => $export
@ -403,7 +403,7 @@ class ExportController extends Controller
} }
} }
return $this->render('ChillMainBundle:Export:new_formatter_step.html.twig', return $this->render('@ChillMain/Export/new_formatter_step.html.twig',
array( array(
'form' => $form->createView(), 'form' => $form->createView(),
'export' => $export 'export' => $export
@ -543,6 +543,6 @@ class ExportController extends Controller
$viewVariables['mime_type'] = 'text/csv'; $viewVariables['mime_type'] = 'text/csv';
} }
return $this->render("ChillMainBundle:Export:download.html.twig", $viewVariables); return $this->render("@ChillMain/Export/download.html.twig", $viewVariables);
} }
} }

View File

@ -116,7 +116,7 @@ class PasswordController extends Controller
} }
// render into a template // render into a template
return $this->render('ChillMainBundle:Password:password.html.twig', array( return $this->render('@ChillMain/Password/password.html.twig', array(
'form' => $form->createView() 'form' => $form->createView()
)); ));

View File

@ -2,6 +2,8 @@
namespace Chill\MainBundle\Controller; namespace Chill\MainBundle\Controller;
use Chill\MainBundle\Security\RoleProvider;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\SubmitType;
@ -9,9 +11,10 @@ use Chill\MainBundle\Entity\RoleScope;
use Chill\MainBundle\Entity\PermissionsGroup; use Chill\MainBundle\Entity\PermissionsGroup;
use Chill\MainBundle\Form\PermissionsGroupType; use Chill\MainBundle\Form\PermissionsGroupType;
use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\Security\Core\Role\RoleInterface; use Symfony\Component\Security\Core\Role\RoleHierarchy;
use Chill\MainBundle\Entity\Scope; use Chill\MainBundle\Entity\Scope;
use Chill\MainBundle\Form\Type\ComposedRoleScopeType; use Chill\MainBundle\Form\Type\ComposedRoleScopeType;
use Symfony\Contracts\Translation\TranslatorInterface;
/** /**
* PermissionsGroup controller. * PermissionsGroup controller.
@ -19,6 +22,46 @@ use Chill\MainBundle\Form\Type\ComposedRoleScopeType;
*/ */
class PermissionsGroupController extends Controller class PermissionsGroupController extends Controller
{ {
/**
* @var TranslatableStringHelper
*/
private $translatableStringHelper;
/**
* @var RoleProvider $roleProvider
*/
private $roleProvider;
/**
* @var RoleHierarchy $roleHierarchy
*/
private $roleHierarchy;
/**
* @var TranslatorInterface
*/
private $translator;
/**
* PermissionsGroupController constructor.
*
* @param TranslatableStringHelper $translatableStringHelper
* @param RoleProvider $roleProvider
* @param RoleHierarchy $roleHierarchy
* @param TranslatorInterface $translator
*/
public function __construct(
TranslatableStringHelper $translatableStringHelper,
RoleProvider $roleProvider,
RoleHierarchy $roleHierarchy,
TranslatorInterface $translator
)
{
$this->translatableStringHelper = $translatableStringHelper;
$this->roleProvider = $roleProvider;
$this->roleHierarchy = $roleHierarchy;
$this->translator = $translator;
}
/** /**
* Lists all PermissionsGroup entities. * Lists all PermissionsGroup entities.
@ -30,7 +73,7 @@ class PermissionsGroupController extends Controller
$entities = $em->getRepository('ChillMainBundle:PermissionsGroup')->findAll(); $entities = $em->getRepository('ChillMainBundle:PermissionsGroup')->findAll();
return $this->render('ChillMainBundle:PermissionsGroup:index.html.twig', array( return $this->render('@ChillMain/PermissionsGroup/index.html.twig', array(
'entities' => $entities, 'entities' => $entities,
)); ));
} }
@ -54,7 +97,7 @@ class PermissionsGroupController extends Controller
array('id' => $permissionsGroup->getId()))); array('id' => $permissionsGroup->getId())));
} }
return $this->render('ChillMainBundle:PermissionsGroup:new.html.twig', array( return $this->render('@ChillMain/PermissionsGroup/new.html.twig', array(
'entity' => $permissionsGroup, 'entity' => $permissionsGroup,
'form' => $form->createView(), 'form' => $form->createView(),
)); ));
@ -88,7 +131,7 @@ class PermissionsGroupController extends Controller
$permissionsGroup = new PermissionsGroup(); $permissionsGroup = new PermissionsGroup();
$form = $this->createCreateForm($permissionsGroup); $form = $this->createCreateForm($permissionsGroup);
return $this->render('ChillMainBundle:PermissionsGroup:new.html.twig', array( return $this->render('@ChillMain/PermissionsGroup/new.html.twig', array(
'entity' => $permissionsGroup, 'entity' => $permissionsGroup,
'form' => $form->createView(), 'form' => $form->createView(),
)); ));
@ -108,7 +151,7 @@ class PermissionsGroupController extends Controller
throw $this->createNotFoundException('Unable to find PermissionsGroup entity.'); throw $this->createNotFoundException('Unable to find PermissionsGroup entity.');
} }
$translatableStringHelper = $this->get('chill.main.helper.translatable_string'); $translatableStringHelper = $this->translatableStringHelper;
$roleScopes = $permissionsGroup->getRoleScopes()->toArray(); $roleScopes = $permissionsGroup->getRoleScopes()->toArray();
// sort $roleScopes by name // sort $roleScopes by name
@ -128,8 +171,7 @@ class PermissionsGroupController extends Controller
}); });
// sort role scope by title // sort role scope by title
/* @var $roleProvider \Chill\MainBundle\Security\RoleProvider */ $roleProvider = $this->roleProvider;
$roleProvider = $this->get('chill.main.role_provider');
$roleScopesSorted = array(); $roleScopesSorted = array();
foreach($roleScopes as $roleScope) { foreach($roleScopes as $roleScope) {
/* @var $roleScope RoleScope */ /* @var $roleScope RoleScope */
@ -138,7 +180,7 @@ class PermissionsGroupController extends Controller
} }
ksort($roleScopesSorted); ksort($roleScopesSorted);
return $this->render('ChillMainBundle:PermissionsGroup:show.html.twig', array( return $this->render('@ChillMain/PermissionsGroup/show.html.twig', array(
'entity' => $permissionsGroup, 'entity' => $permissionsGroup,
'role_scopes_sorted' => $roleScopesSorted, 'role_scopes_sorted' => $roleScopesSorted,
'expanded_roles' => $this->getExpandedRoles($roleScopes) 'expanded_roles' => $this->getExpandedRoles($roleScopes)
@ -158,11 +200,10 @@ class PermissionsGroupController extends Controller
if (!array_key_exists($roleScope->getRole(), $expandedRoles)) { if (!array_key_exists($roleScope->getRole(), $expandedRoles)) {
$expandedRoles[$roleScope->getRole()] = $expandedRoles[$roleScope->getRole()] =
array_map( array_map(
function(RoleInterface $role) { function(Role $role) {
return $role->getRole(); return $role->getRole();
}, },
$this->get('security.role_hierarchy') $this->roleHierarchy
->getReachableRoles( ->getReachableRoles(
array(new Role($roleScope->getRole())) array(new Role($roleScope->getRole()))
) )
@ -198,8 +239,7 @@ class PermissionsGroupController extends Controller
$addRoleScopesForm = $this->createAddRoleScopeForm($permissionsGroup); $addRoleScopesForm = $this->createAddRoleScopeForm($permissionsGroup);
// sort role scope by title // sort role scope by title
/* @var $roleProvider \Chill\MainBundle\Security\RoleProvider */ $roleProvider = $this->roleProvider;
$roleProvider = $this->get('chill.main.role_provider');
$roleScopesSorted = array(); $roleScopesSorted = array();
foreach($permissionsGroup->getRoleScopes()->toArray() as $roleScope) { foreach($permissionsGroup->getRoleScopes()->toArray() as $roleScope) {
/* @var $roleScope RoleScope */ /* @var $roleScope RoleScope */
@ -208,7 +248,7 @@ class PermissionsGroupController extends Controller
} }
ksort($roleScopesSorted); ksort($roleScopesSorted);
return $this->render('ChillMainBundle:PermissionsGroup:edit.html.twig', array( return $this->render('@ChillMain/PermissionsGroup/edit.html.twig', array(
'entity' => $permissionsGroup, 'entity' => $permissionsGroup,
'role_scopes_sorted' => $roleScopesSorted, 'role_scopes_sorted' => $roleScopesSorted,
'edit_form' => $editForm->createView(), 'edit_form' => $editForm->createView(),
@ -276,8 +316,7 @@ class PermissionsGroupController extends Controller
$addRoleScopesForm = $this->createAddRoleScopeForm($permissionsGroup); $addRoleScopesForm = $this->createAddRoleScopeForm($permissionsGroup);
// sort role scope by title // sort role scope by title
/* @var $roleProvider \Chill\MainBundle\Security\RoleProvider */ $roleProvider = $this->roleProvider;
$roleProvider = $this->get('chill.main.role_provider');
$roleScopesSorted = array(); $roleScopesSorted = array();
foreach($permissionsGroup->getRoleScopes()->toArray() as $roleScope) { foreach($permissionsGroup->getRoleScopes()->toArray() as $roleScope) {
/* @var $roleScope RoleScope */ /* @var $roleScope RoleScope */
@ -286,7 +325,7 @@ class PermissionsGroupController extends Controller
} }
ksort($roleScopesSorted); ksort($roleScopesSorted);
return $this->render('ChillMainBundle:PermissionsGroup:edit.html.twig', array( return $this->render('@ChillMain/PermissionsGroup/edit.html.twig', array(
'entity' => $permissionsGroup, 'entity' => $permissionsGroup,
'role_scopes_sorted' => $roleScopesSorted, 'role_scopes_sorted' => $roleScopesSorted,
'edit_form' => $editForm->createView(), 'edit_form' => $editForm->createView(),
@ -352,10 +391,10 @@ class PermissionsGroupController extends Controller
$permissionsGroup->removeRoleScope($roleScope); $permissionsGroup->removeRoleScope($roleScope);
} catch (\RuntimeException $ex) { } catch (\RuntimeException $ex) {
$this->addFlash('notice', $this->addFlash('notice',
$this->get('translator')->trans("The role '%role%' and circle " $this->translator->trans("The role '%role%' and circle "
. "'%scope%' is not associated with this permission group", array( . "'%scope%' is not associated with this permission group", array(
'%role%' => $this->get('translator')->trans($roleScope->getRole()), '%role%' => $this->translator->trans($roleScope->getRole()),
'%scope%' => $this->get('chill.main.helper.translatable_string') '%scope%' => $this->translatableStringHelper
->localize($roleScope->getScope()->getName()) ->localize($roleScope->getScope()->getName())
))); )));
@ -367,16 +406,16 @@ class PermissionsGroupController extends Controller
if ($roleScope->getScope() !== NULL ) { if ($roleScope->getScope() !== NULL ) {
$this->addFlash('notice', $this->addFlash('notice',
$this->get('translator')->trans("The role '%role%' on circle " $this->translator->trans("The role '%role%' on circle "
. "'%scope%' has been removed", array( . "'%scope%' has been removed", array(
'%role%' => $this->get('translator')->trans($roleScope->getRole()), '%role%' => $this->translator->trans($roleScope->getRole()),
'%scope%' => $this->get('chill.main.helper.translatable_string') '%scope%' => $this->translatableStringHelper
->localize($roleScope->getScope()->getName()) ->localize($roleScope->getScope()->getName())
))); )));
} else { } else {
$this->addFlash('notice', $this->addFlash('notice',
$this->get('translator')->trans("The role '%role%' has been removed", array( $this->translator->trans("The role '%role%' has been removed", array(
'%role%' => $this->get('translator')->trans($roleScope->getRole()) '%role%' => $this->translator->trans($roleScope->getRole())
))); )));
} }
@ -417,7 +456,7 @@ class PermissionsGroupController extends Controller
$em->flush(); $em->flush();
$this->addFlash('notice', $this->addFlash('notice',
$this->get('translator')->trans("The permissions have been added")); $this->translator->trans("The permissions have been added"));
return $this->redirect($this->generateUrl('admin_permissionsgroup_edit', return $this->redirect($this->generateUrl('admin_permissionsgroup_edit',
array('id' => $id))); array('id' => $id)));
@ -454,7 +493,7 @@ class PermissionsGroupController extends Controller
} }
ksort($roleScopesSorted); ksort($roleScopesSorted);
return $this->render('ChillMainBundle:PermissionsGroup:edit.html.twig', array( return $this->render('@ChillMain/PermissionsGroup/edit.html.twig', array(
'entity' => $permissionsGroup, 'entity' => $permissionsGroup,
'edit_form' => $editForm->createView(), 'edit_form' => $editForm->createView(),
'role_scopes_sorted' => $roleScopesSorted, 'role_scopes_sorted' => $roleScopesSorted,

View File

@ -27,7 +27,7 @@ class ScopeController extends Controller
$entities = $em->getRepository('ChillMainBundle:Scope')->findAll(); $entities = $em->getRepository('ChillMainBundle:Scope')->findAll();
return $this->render('ChillMainBundle:Scope:index.html.twig', array( return $this->render('@ChillMain/Scope/index.html.twig', array(
'entities' => $entities, 'entities' => $entities,
)); ));
} }
@ -49,7 +49,7 @@ class ScopeController extends Controller
return $this->redirect($this->generateUrl('admin_scope_show', array('id' => $scope->getId()))); return $this->redirect($this->generateUrl('admin_scope_show', array('id' => $scope->getId())));
} }
return $this->render('ChillMainBundle:Scope:new.html.twig', array( return $this->render('@ChillMain/Scope/new.html.twig', array(
'entity' => $scope, 'entity' => $scope,
'form' => $form->createView(), 'form' => $form->createView(),
)); ));
@ -83,7 +83,7 @@ class ScopeController extends Controller
$scope = new Scope(); $scope = new Scope();
$form = $this->createCreateForm($scope); $form = $this->createCreateForm($scope);
return $this->render('ChillMainBundle:Scope:new.html.twig', array( return $this->render('@ChillMain/Scope/new.html.twig', array(
'entity' => $scope, 'entity' => $scope,
'form' => $form->createView(), 'form' => $form->createView(),
)); ));
@ -103,7 +103,7 @@ class ScopeController extends Controller
throw $this->createNotFoundException('Unable to find Scope entity.'); throw $this->createNotFoundException('Unable to find Scope entity.');
} }
return $this->render('ChillMainBundle:Scope:show.html.twig', array( return $this->render('@ChillMain/Scope/show.html.twig', array(
'entity' => $scope 'entity' => $scope
)); ));
} }
@ -124,7 +124,7 @@ class ScopeController extends Controller
$editForm = $this->createEditForm($scope); $editForm = $this->createEditForm($scope);
return $this->render('ChillMainBundle:Scope:edit.html.twig', array( return $this->render('@ChillMain/Scope/edit.html.twig', array(
'entity' => $scope, 'entity' => $scope,
'edit_form' => $editForm->createView(), 'edit_form' => $editForm->createView(),
)); ));
@ -171,7 +171,7 @@ class ScopeController extends Controller
return $this->redirect($this->generateUrl('admin_scope_edit', array('id' => $id))); return $this->redirect($this->generateUrl('admin_scope_edit', array('id' => $id)));
} }
return $this->render('ChillMainBundle:Scope:edit.html.twig', array( return $this->render('@ChillMain/Scope/edit.html.twig', array(
'entity' => $scope, 'entity' => $scope,
'edit_form' => $editForm->createView() 'edit_form' => $editForm->createView()
)); ));

View File

@ -32,7 +32,7 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\FormType; use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Chill\MainBundle\Search\SearchProvider; use Chill\MainBundle\Search\SearchProvider;
use Symfony\Component\Translation\TranslatorInterface; use Symfony\Contracts\Translation\TranslatorInterface;
use Chill\MainBundle\Pagination\PaginatorFactory; use Chill\MainBundle\Pagination\PaginatorFactory;
/** /**
@ -77,7 +77,7 @@ class SearchController extends Controller
if ($pattern === ''){ if ($pattern === ''){
switch($_format) { switch($_format) {
case 'html': case 'html':
return $this->render('ChillMainBundle:Search:error.html.twig', return $this->render('@ChillMain/Search/error.html.twig',
array( array(
'message' => $this->translator->trans("Your search is empty. " 'message' => $this->translator->trans("Your search is empty. "
. "Please provide search terms."), . "Please provide search terms."),
@ -129,7 +129,7 @@ class SearchController extends Controller
} }
} }
} catch (UnknowSearchDomainException $ex) { } catch (UnknowSearchDomainException $ex) {
return $this->render('ChillMainBundle:Search:error.html.twig', return $this->render('@ChillMain/Search/error.html.twig',
array( array(
"message" => $this->get('translator')->trans("The domain %domain% " "message" => $this->get('translator')->trans("The domain %domain% "
. "is unknow. Please check your search.", array('%domain%' => $ex->getDomain())), . "is unknow. Please check your search.", array('%domain%' => $ex->getDomain())),
@ -138,7 +138,7 @@ class SearchController extends Controller
} catch (UnknowSearchNameException $ex) { } catch (UnknowSearchNameException $ex) {
throw $this->createNotFoundException("The name ".$ex->getName()." is not found"); throw $this->createNotFoundException("The name ".$ex->getName()." is not found");
} catch (ParsingException $ex) { } catch (ParsingException $ex) {
return $this->render('ChillMainBundle:Search:error.html.twig', return $this->render('@ChillMain/Search/error.html.twig',
array( array(
"message" => $this->translator->trans('Invalid terms'). "message" => $this->translator->trans('Invalid terms').
": ".$this->translator->trans($ex->getMessage()), ": ".$this->translator->trans($ex->getMessage()),
@ -147,7 +147,7 @@ class SearchController extends Controller
} }
return $this->render('ChillMainBundle:Search:list.html.twig', return $this->render('@ChillMain/Search/list.html.twig',
array('results' => $results, 'pattern' => $pattern) array('results' => $results, 'pattern' => $pattern)
); );
} }
@ -167,7 +167,7 @@ class SearchController extends Controller
]); ]);
} }
return $this->render('ChillMainBundle:Search:choose_list.html.twig'); return $this->render('@ChillMain/Search/choose_list.html.twig');
} }
public function advancedSearchAction($name, Request $request) public function advancedSearchAction($name, Request $request)
@ -205,7 +205,7 @@ class SearchController extends Controller
} }
} }
return $this->render('ChillMainBundle:Search:advanced_search.html.twig', return $this->render('@ChillMain/Search/advanced_search.html.twig',
[ [
'form' => $form->createView(), 'form' => $form->createView(),
'name' => $name, 'name' => $name,

View File

@ -32,7 +32,7 @@ class UIController extends Controller
) { ) {
$nb = $counter->getSumNotification($this->getUser()); $nb = $counter->getSumNotification($this->getUser());
return $this->render('ChillMainBundle:UI:notification_user_counter.html.twig', [ return $this->render('@ChillMain/UI/notification_user_counter.html.twig', [
'nb' => $nb 'nb' => $nb
]); ]);
} }

View File

@ -34,7 +34,7 @@ class UserController extends Controller
. 'ORDER BY u.username') . 'ORDER BY u.username')
->getResult(); ->getResult();
return $this->render('ChillMainBundle:User:index.html.twig', array( return $this->render('@ChillMain/User/index.html.twig', array(
'entities' => $entities, 'entities' => $entities,
)); ));
} }
@ -60,7 +60,7 @@ class UserController extends Controller
return $this->redirect($this->generateUrl('admin_user_show', array('id' => $user->getId()))); return $this->redirect($this->generateUrl('admin_user_show', array('id' => $user->getId())));
} }
return $this->render('ChillMainBundle:User:new.html.twig', array( return $this->render('@ChillMain/User/new.html.twig', array(
'entity' => $user, 'entity' => $user,
'form' => $form->createView(), 'form' => $form->createView(),
)); ));
@ -95,7 +95,7 @@ class UserController extends Controller
$user = new User(); $user = new User();
$form = $this->createCreateForm($user); $form = $this->createCreateForm($user);
return $this->render('ChillMainBundle:User:new.html.twig', array( return $this->render('@ChillMain/User/new.html.twig', array(
'entity' => $user, 'entity' => $user,
'form' => $form->createView(), 'form' => $form->createView(),
)); ));
@ -115,7 +115,7 @@ class UserController extends Controller
throw $this->createNotFoundException('Unable to find User entity.'); throw $this->createNotFoundException('Unable to find User entity.');
} }
return $this->render('ChillMainBundle:User:show.html.twig', array( return $this->render('@ChillMain/User/show.html.twig', array(
'entity' => $user, 'entity' => $user,
)); ));
} }
@ -136,7 +136,7 @@ class UserController extends Controller
$editForm = $this->createEditForm($user); $editForm = $this->createEditForm($user);
return $this->render('ChillMainBundle:User:edit.html.twig', array( return $this->render('@ChillMain/User/edit.html.twig', array(
'entity' => $user, 'entity' => $user,
'edit_form' => $editForm->createView(), 'edit_form' => $editForm->createView(),
'add_groupcenter_form' => $this->createAddLinkGroupCenterForm($user)->createView(), 'add_groupcenter_form' => $this->createAddLinkGroupCenterForm($user)->createView(),
@ -165,7 +165,7 @@ class UserController extends Controller
$editForm = $this->createEditPasswordForm($user); $editForm = $this->createEditPasswordForm($user);
return $this->render('ChillMainBundle:User:edit_password.html.twig', array( return $this->render('@ChillMain/User/edit_password.html.twig', array(
'entity' => $user, 'entity' => $user,
'edit_form' => $editForm->createView() 'edit_form' => $editForm->createView()
)); ));
@ -256,7 +256,7 @@ class UserController extends Controller
} }
} }
return $this->render('ChillMainBundle:User:edit.html.twig', array( return $this->render('@ChillMain/User/edit.html.twig', array(
'entity' => $user, 'entity' => $user,
'edit_form' => $this->createEditForm($user)->createView(), 'edit_form' => $this->createEditForm($user)->createView(),
'add_groupcenter_form' => $this->createAddLinkGroupCenterForm($user)->createView(), 'add_groupcenter_form' => $this->createAddLinkGroupCenterForm($user)->createView(),
@ -329,7 +329,7 @@ class UserController extends Controller
return $this->redirect($this->generateUrl('admin_user_edit', array('id' => $id))); return $this->redirect($this->generateUrl('admin_user_edit', array('id' => $id)));
} }
return $this->render('ChillMainBundle:User:edit.html.twig', array( return $this->render('@ChillMain/User/edit.html.twig', array(
'entity' => $user, 'entity' => $user,
'edit_form' => $editForm->createView(), 'edit_form' => $editForm->createView(),
'add_groupcenter_form' => $this->createAddLinkGroupCenterForm($user)->createView(), 'add_groupcenter_form' => $this->createAddLinkGroupCenterForm($user)->createView(),
@ -378,7 +378,7 @@ class UserController extends Controller
return $this->redirect($this->generateUrl('admin_user_edit', array('id' => $id))); return $this->redirect($this->generateUrl('admin_user_edit', array('id' => $id)));
} }
return $this->render('ChillMainBundle:User:edit_password.html.twig', array( return $this->render('@ChillMain/User/edit_password.html.twig', array(
'entity' => $user, 'entity' => $user,
'edit_form' => $editForm->createView(), 'edit_form' => $editForm->createView(),
)); ));

View File

@ -144,7 +144,7 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface,
'name' => $config['installation_name']), 'name' => $config['installation_name']),
'available_languages' => $config['available_languages'] 'available_languages' => $config['available_languages']
), ),
'form_themes' => array('ChillMainBundle:Form:fields.html.twig') 'form_themes' => array('@ChillMain/Form/fields.html.twig')
); );
$container->prependExtensionConfig('twig', $twigConfig); $container->prependExtensionConfig('twig', $twigConfig);

View File

@ -34,8 +34,8 @@ use Twig\TwigFunction;
*/ */
class ChillPaginationTwig extends AbstractExtension class ChillPaginationTwig extends AbstractExtension
{ {
const LONG_TEMPLATE = 'ChillMainBundle:Pagination:long.html.twig'; const LONG_TEMPLATE = '@ChillMain/Pagination/long.html.twig';
const SHORT_TEMPLATE = 'ChillMainBundle:Pagination:short.html.twig'; const SHORT_TEMPLATE = '@ChillMain/Pagination/short.html.twig';
public function getName() public function getName()
{ {
@ -59,7 +59,7 @@ class ChillPaginationTwig extends AbstractExtension
public function paginationRender( public function paginationRender(
Environment $env, Environment $env,
PaginatorInterface $paginator, PaginatorInterface $paginator,
$template = 'ChillMainBundle:Pagination:long.html.twig' $template = '@ChillMain/Pagination/long.html.twig'
) { ) {
switch ($template) { switch ($template) {
case 'long': case 'long':

View File

@ -14,6 +14,14 @@ services:
Chill\MainBundle\Controller\SearchController: Chill\MainBundle\Controller\SearchController:
arguments: arguments:
$searchProvider: '@chill_main.search_provider' $searchProvider: '@chill_main.search_provider'
$translator: '@Symfony\Component\Translation\TranslatorInterface' $translator: '@Symfony\Contracts\Translation\TranslatorInterface'
$paginatorFactory: '@Chill\MainBundle\Pagination\PaginatorFactory' $paginatorFactory: '@Chill\MainBundle\Pagination\PaginatorFactory'
tags: ['controller.service_arguments'] tags: ['controller.service_arguments']
Chill\MainBundle\Controller\PermissionsGroupController:
arguments:
$translatableStringHelper: '@Chill\MainBundle\Templating\TranslatableStringHelper'
$roleProvider: '@chill.main.role_provider'
$roleHierarchy: '@security.role_hierarchy'
$translator: '@Symfony\Contracts\Translation\TranslatorInterface'
tags: ['controller.service_arguments']

View File

@ -54,7 +54,7 @@ class MenuTwig extends AbstractExtension implements ContainerAwareInterface
* @var mixed[] * @var mixed[]
*/ */
private $defaultParams = array( private $defaultParams = array(
'layout' => 'ChillMainBundle:Menu:defaultMenu.html.twig', 'layout' => '@ChillMain/Menu/defaultMenu.html.twig',
'args' => array(), 'args' => array(),
'activeRouteKey' => null 'activeRouteKey' => null
); );

View File

@ -40,7 +40,9 @@ class RoleProvider
* *
* @var array|null * @var array|null
*/ */
private $rolesTitlesCache = null; private $rolesTitlesCache = [];
// sf4 check: mis [] au lieu de null
// pour éviter `Warning: array_key_exists() expects parameter 2 to be array, null given` L129
/** /**
* Add a role provider * Add a role provider

View File

@ -274,7 +274,7 @@ class TimelineBuilder implements ContainerAwareInterface
} }
return $this->container->get('templating') return $this->container->get('templating')
->render('ChillMainBundle:Timeline:index.html.twig', array( ->render('@ChillMain/Timeline/index.html.twig', array(
'results' => $timelineEntries 'results' => $timelineEntries
)); ));

View File

@ -26,11 +26,11 @@
{% block v_menu_title %}<!-- title of the verticalMenu is empty -->{% endblock %} {% block v_menu_title %}<!-- title of the verticalMenu is empty -->{% endblock %}
</li> </li>
{% for route in routes %} {% for route in routes %}
<li class="{% spaceless %} <li class="{% apply spaceless %}
{% if route.key == activeRouteKey %} {% if route.key == activeRouteKey %}
active active
{% endif %} {% endif %}
{% endspaceless %} "> {% endapply %} ">
<a href="{{ path(route.key, args ) }}" >{{ route.label|trans }}</a> <a href="{{ path(route.key, args ) }}" >{{ route.label|trans }}</a>
</li> </li>
{% endfor %} {% endfor %}