mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-05 14:25:00 +00:00
cs: Fix code style (safe rules only).
This commit is contained in:
@@ -1,35 +1,21 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2018 Champs Libres Cooperative <info@champs-libres.coop>
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Routing\MenuBuilder;
|
||||
|
||||
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||
use Knp\Menu\MenuItem;
|
||||
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
||||
use Chill\MainBundle\Security\Authorization\ChillExportVoter;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
class AdminSectionMenuBuilder implements LocalMenuBuilderInterface
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var AuthorizationCheckerInterface
|
||||
*/
|
||||
protected $authorizationChecker;
|
||||
@@ -47,26 +33,26 @@ class AdminSectionMenuBuilder implements LocalMenuBuilderInterface
|
||||
}
|
||||
|
||||
$menu->addChild('Users and permissions', [
|
||||
'route' => 'chill_main_admin_permissions'
|
||||
])
|
||||
'route' => 'chill_main_admin_permissions',
|
||||
])
|
||||
->setExtras([
|
||||
'icons' => ['key'],
|
||||
'order' => 200,
|
||||
'explain' => "Configure permissions for users"
|
||||
'explain' => 'Configure permissions for users',
|
||||
]);
|
||||
|
||||
$menu->addChild('Location and location type', [
|
||||
'route' => 'chill_main_admin_locations'
|
||||
])
|
||||
'route' => 'chill_main_admin_locations',
|
||||
])
|
||||
->setExtras([
|
||||
'icons' => ['key'],
|
||||
'order' => 205,
|
||||
'explain' => "Configure location and location type"
|
||||
'explain' => 'Configure location and location type',
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getMenuIds(): array
|
||||
{
|
||||
return [ 'admin_section', 'admin_index' ];
|
||||
return ['admin_section', 'admin_index'];
|
||||
}
|
||||
}
|
||||
|
@@ -1,28 +1,31 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Routing\MenuBuilder;
|
||||
|
||||
use Knp\Menu\MenuItem;
|
||||
|
||||
class LocationMenuBuilder implements \Chill\MainBundle\Routing\LocalMenuBuilderInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getMenuIds(): array
|
||||
{
|
||||
return [ 'admin_location' ];
|
||||
}
|
||||
|
||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||
{
|
||||
$menu->addChild('Location type list', [
|
||||
'route' => 'chill_crud_main_location_type_index'
|
||||
'route' => 'chill_crud_main_location_type_index',
|
||||
])->setExtras(['order' => 205]);
|
||||
|
||||
$menu->addChild('Location list', [
|
||||
'route' => 'chill_crud_main_location_index'
|
||||
'route' => 'chill_crud_main_location_index',
|
||||
])->setExtras(['order' => 206]);
|
||||
}
|
||||
|
||||
public static function getMenuIds(): array
|
||||
{
|
||||
return ['admin_location'];
|
||||
}
|
||||
}
|
||||
|
@@ -1,43 +1,45 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Routing\MenuBuilder;
|
||||
|
||||
use Knp\Menu\MenuItem;
|
||||
|
||||
class PermissionMenuBuilder implements \Chill\MainBundle\Routing\LocalMenuBuilderInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getMenuIds(): array
|
||||
{
|
||||
return [ 'admin_permissions' ];
|
||||
}
|
||||
|
||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||
{
|
||||
$menu->addChild('Permissions group list', [
|
||||
'route' => 'admin_permissionsgroup'
|
||||
'route' => 'admin_permissionsgroup',
|
||||
])->setExtras([
|
||||
'order' => 300
|
||||
]);
|
||||
'order' => 300,
|
||||
]);
|
||||
|
||||
$menu->addChild('crud.admin_user.index.title', [
|
||||
'route' => 'chill_crud_admin_user_index'
|
||||
'route' => 'chill_crud_admin_user_index',
|
||||
])->setExtras(['order' => 400]);
|
||||
|
||||
$menu->addChild('List circles', [
|
||||
'route' => 'admin_scope'
|
||||
'route' => 'admin_scope',
|
||||
])->setExtras(['order' => 200]);
|
||||
|
||||
$menu->addChild('Center list', [
|
||||
'route' => 'admin_center'
|
||||
'route' => 'admin_center',
|
||||
])->setExtras(['order' => 100]);
|
||||
|
||||
$menu->addChild('User jobs', [
|
||||
'route' => 'chill_crud_admin_user_job_index'
|
||||
'route' => 'chill_crud_admin_user_job_index',
|
||||
])->setExtras(['order' => 150]);
|
||||
}
|
||||
|
||||
public static function getMenuIds(): array
|
||||
{
|
||||
return ['admin_permissions'];
|
||||
}
|
||||
}
|
||||
|
@@ -1,35 +1,22 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (C) 2018 Champs Libres Cooperative <info@champs-libres.coop>
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Routing\MenuBuilder;
|
||||
|
||||
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||
use Chill\MainBundle\Security\Authorization\ChillExportVoter;
|
||||
use Knp\Menu\MenuItem;
|
||||
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
||||
use Chill\MainBundle\Security\Authorization\ChillExportVoter;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
|
||||
/**
|
||||
* Class SectionMenuBuilder
|
||||
*
|
||||
* @package Chill\MainBundle\Routing\MenuBuilder
|
||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||
* Class SectionMenuBuilder.
|
||||
*/
|
||||
class SectionMenuBuilder implements LocalMenuBuilderInterface
|
||||
{
|
||||
@@ -37,62 +24,56 @@ class SectionMenuBuilder implements LocalMenuBuilderInterface
|
||||
* @var AuthorizationCheckerInterface
|
||||
*/
|
||||
protected $authorizationChecker;
|
||||
|
||||
|
||||
/**
|
||||
* @var TranslatorInterface
|
||||
*/
|
||||
protected $translator;
|
||||
|
||||
|
||||
/**
|
||||
* SectionMenuBuilder constructor.
|
||||
*
|
||||
* @param AuthorizationCheckerInterface $authorizationChecker
|
||||
*/
|
||||
public function __construct(AuthorizationCheckerInterface $authorizationChecker, TranslatorInterface $translator)
|
||||
{
|
||||
$this->authorizationChecker = $authorizationChecker;
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $menuId
|
||||
* @param MenuItem $menu
|
||||
* @param array $parameters
|
||||
*/
|
||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||
{
|
||||
$menu->addChild($this->translator->trans('Homepage'), [
|
||||
'route' => 'chill_main_homepage'
|
||||
])
|
||||
'route' => 'chill_main_homepage',
|
||||
])
|
||||
->setExtras([
|
||||
'icons' => ['home'],
|
||||
'order' => 0
|
||||
'order' => 0,
|
||||
]);
|
||||
|
||||
$menu->addChild($this->translator->trans('Global timeline'), [
|
||||
'route' => 'chill_center_timeline',
|
||||
])
|
||||
->setExtras([
|
||||
'order' => 10
|
||||
]
|
||||
);
|
||||
|
||||
->setExtras(
|
||||
[
|
||||
'order' => 10,
|
||||
]
|
||||
);
|
||||
|
||||
if ($this->authorizationChecker->isGranted(ChillExportVoter::EXPORT)) {
|
||||
$menu->addChild($this->translator->trans('Export Menu'), [
|
||||
'route' => 'chill_main_export_index'
|
||||
'route' => 'chill_main_export_index',
|
||||
])
|
||||
->setExtras([
|
||||
'icons' => ['upload'],
|
||||
'order' => 20
|
||||
]);
|
||||
->setExtras([
|
||||
'icons' => ['upload'],
|
||||
'order' => 20,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
|
||||
public static function getMenuIds(): array
|
||||
{
|
||||
return [ 'section' ];
|
||||
return ['section'];
|
||||
}
|
||||
}
|
||||
|
@@ -1,25 +1,16 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2018 Champs Libres Cooperative <info@champs-libres.coop>
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Routing\MenuBuilder;
|
||||
|
||||
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
|
||||
class UserMenuBuilder implements LocalMenuBuilderInterface
|
||||
@@ -36,7 +27,6 @@ class UserMenuBuilder implements LocalMenuBuilderInterface
|
||||
$user = $this->security->getUser();
|
||||
|
||||
if ($user instanceof User) {
|
||||
|
||||
if (null !== $user->getCurrentLocation()) {
|
||||
$locationTextMenu = $user->getCurrentLocation()->getName();
|
||||
} else {
|
||||
@@ -50,7 +40,7 @@ class UserMenuBuilder implements LocalMenuBuilderInterface
|
||||
)
|
||||
->setExtras([
|
||||
'order' => -9999999,
|
||||
'icon' => 'map-marker'
|
||||
'icon' => 'map-marker',
|
||||
]);
|
||||
$menu
|
||||
->addChild(
|
||||
@@ -58,7 +48,7 @@ class UserMenuBuilder implements LocalMenuBuilderInterface
|
||||
['route' => 'change_my_password']
|
||||
)
|
||||
->setExtras([
|
||||
'order' => 99999999998
|
||||
'order' => 99999999998,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -66,17 +56,17 @@ class UserMenuBuilder implements LocalMenuBuilderInterface
|
||||
->addChild(
|
||||
'Logout',
|
||||
[
|
||||
'route' => 'logout'
|
||||
'route' => 'logout',
|
||||
]
|
||||
)
|
||||
->setExtras([
|
||||
'order' => 99999999999,
|
||||
'icon' => 'power-off'
|
||||
'icon' => 'power-off',
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getMenuIds(): array
|
||||
{
|
||||
return [ 'user' ];
|
||||
return ['user'];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user