mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 10:33:49 +00:00
admin sections for person bundle
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
<?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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Menu;
|
||||
|
||||
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||
use Knp\Menu\MenuItem;
|
||||
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
||||
|
||||
class AdminAccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
|
||||
{
|
||||
/**
|
||||
* @var AuthorizationCheckerInterface
|
||||
*/
|
||||
protected $authorizationChecker;
|
||||
|
||||
public function __construct(AuthorizationCheckerInterface $authorizationChecker)
|
||||
{
|
||||
$this->authorizationChecker = $authorizationChecker;
|
||||
}
|
||||
|
||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||
{
|
||||
if (!$this->authorizationChecker->isGranted('ROLE_ADMIN')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$menu->addChild('person_admin.accompanying_period', [
|
||||
'route' => 'chill_accompanying-course_admin_index',
|
||||
])
|
||||
->setAttribute('class', 'list-group-item-header')
|
||||
->setExtras(['order' => 2200, 'header' => true]);
|
||||
|
||||
$menu->addChild('person_admin.closing motives', [
|
||||
'route' => 'chill_crud_closing_motive_index',
|
||||
])->setExtras(['order' => 2210]);
|
||||
|
||||
$menu->addChild('person_admin.origin', [
|
||||
'route' => 'chill_crud_origin_index',
|
||||
])->setExtras(['order' => 2210]);
|
||||
|
||||
}
|
||||
|
||||
public static function getMenuIds(): array
|
||||
{
|
||||
return ['admin_section', 'admin_accompanying_course'];
|
||||
}
|
||||
}
|
@@ -0,0 +1,56 @@
|
||||
<?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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Menu;
|
||||
|
||||
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||
use Knp\Menu\MenuItem;
|
||||
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
||||
|
||||
class AdminHouseholdMenuBuilder implements LocalMenuBuilderInterface
|
||||
{
|
||||
/**
|
||||
* @var AuthorizationCheckerInterface
|
||||
*/
|
||||
protected $authorizationChecker;
|
||||
|
||||
public function __construct(AuthorizationCheckerInterface $authorizationChecker)
|
||||
{
|
||||
$this->authorizationChecker = $authorizationChecker;
|
||||
}
|
||||
|
||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||
{
|
||||
if (!$this->authorizationChecker->isGranted('ROLE_ADMIN')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$menu->addChild('Household', [
|
||||
'route' => 'chill_household_admin_index',
|
||||
])
|
||||
->setAttribute('class', 'list-group-item-header')
|
||||
->setExtras(['order' => 2100, 'header' => true]);
|
||||
|
||||
$menu->addChild('Position', [
|
||||
'route' => 'chill_crud_person_household_position_index',
|
||||
])->setExtras(['order' => 2110]);
|
||||
|
||||
$menu->addChild('person_admin.relation', [
|
||||
'route' => 'chill_crud_person_relation_index',
|
||||
])->setExtras(['order' => 2120]);
|
||||
|
||||
}
|
||||
|
||||
public static function getMenuIds(): array
|
||||
{
|
||||
return ['admin_section', 'admin_household'];
|
||||
}
|
||||
}
|
60
src/Bundle/ChillPersonBundle/Menu/AdminPersonMenuBuilder.php
Normal file
60
src/Bundle/ChillPersonBundle/Menu/AdminPersonMenuBuilder.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Menu;
|
||||
|
||||
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||
use Knp\Menu\MenuItem;
|
||||
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
||||
|
||||
class AdminPersonMenuBuilder implements LocalMenuBuilderInterface
|
||||
{
|
||||
/**
|
||||
* @var AuthorizationCheckerInterface
|
||||
*/
|
||||
protected $authorizationChecker;
|
||||
|
||||
public function __construct(AuthorizationCheckerInterface $authorizationChecker)
|
||||
{
|
||||
$this->authorizationChecker = $authorizationChecker;
|
||||
}
|
||||
|
||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||
{
|
||||
if (!$this->authorizationChecker->isGranted('ROLE_ADMIN')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$menu->addChild('Person', [
|
||||
'route' => 'chill_person_admin_index',
|
||||
])
|
||||
->setAttribute('class', 'list-group-item-header')
|
||||
->setExtras(['order' => 2000, 'header' => true]);
|
||||
|
||||
$menu->addChild('Civility', [
|
||||
'route' => 'chill_crud_main_civility_index',
|
||||
])->setExtras(['order' => 2010]);
|
||||
|
||||
$menu->addChild('Marital status', [
|
||||
'route' => 'chill_crud_person_marital-status_index',
|
||||
])->setExtras(['order' => 2020]);
|
||||
|
||||
$menu->addChild('person_admin.person_resource_kind', [
|
||||
'route' => 'chill_crud_person_resource-kind_index',
|
||||
])->setExtras(['order' => 2030]);
|
||||
|
||||
}
|
||||
|
||||
public static function getMenuIds(): array
|
||||
{
|
||||
return ['admin_section', 'admin_person'];
|
||||
}
|
||||
}
|
@@ -15,7 +15,7 @@ use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||
use Knp\Menu\MenuItem;
|
||||
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
||||
|
||||
class AdminMenuBuilder implements LocalMenuBuilderInterface
|
||||
class AdminSocialWorkMenuBuilder implements LocalMenuBuilderInterface
|
||||
{
|
||||
/**
|
||||
* @var AuthorizationCheckerInterface
|
||||
@@ -33,47 +33,9 @@ class AdminMenuBuilder implements LocalMenuBuilderInterface
|
||||
return;
|
||||
}
|
||||
|
||||
$menu->addChild('Person')
|
||||
->setAttribute('class', 'list-group-item-header')
|
||||
->setExtras(['order' => 2000, 'header' => true]);
|
||||
|
||||
$menu->addChild('Civility', [
|
||||
'route' => 'chill_crud_main_civility_index',
|
||||
])->setExtras(['order' => 2010]);
|
||||
|
||||
$menu->addChild('Marital status', [
|
||||
'route' => 'chill_crud_person_marital-status_index',
|
||||
])->setExtras(['order' => 2020]);
|
||||
|
||||
$menu->addChild('person_admin.person_resource_kind', [
|
||||
'route' => 'chill_crud_person_resource-kind_index',
|
||||
])->setExtras(['order' => 2030]);
|
||||
|
||||
$menu->addChild('Household')
|
||||
->setAttribute('class', 'list-group-item-header')
|
||||
->setExtras(['order' => 2100, 'header' => true]);
|
||||
|
||||
$menu->addChild('Position', [
|
||||
'route' => 'chill_crud_person_household_position_index',
|
||||
])->setExtras(['order' => 2110]);
|
||||
|
||||
$menu->addChild('person_admin.relation', [
|
||||
'route' => 'chill_crud_person_relation_index',
|
||||
])->setExtras(['order' => 2120]);
|
||||
|
||||
$menu->addChild('person_admin.accompanying_period')
|
||||
->setAttribute('class', 'list-group-item-header')
|
||||
->setExtras(['order' => 2200, 'header' => true]);
|
||||
|
||||
$menu->addChild('person_admin.closing motives', [
|
||||
'route' => 'chill_crud_closing_motive_index',
|
||||
])->setExtras(['order' => 2210]);
|
||||
|
||||
$menu->addChild('person_admin.origin', [
|
||||
'route' => 'chill_crud_origin_index',
|
||||
])->setExtras(['order' => 2210]);
|
||||
|
||||
$menu->addChild('person_admin.social_work')
|
||||
$menu->addChild('person_admin.social_work', [
|
||||
'route' => 'chill_social-work_admin_index',
|
||||
])
|
||||
->setAttribute('class', 'list-group-item-header')
|
||||
->setExtras(['order' => 2300, 'header' => true]);
|
||||
|
||||
@@ -100,6 +62,6 @@ class AdminMenuBuilder implements LocalMenuBuilderInterface
|
||||
|
||||
public static function getMenuIds(): array
|
||||
{
|
||||
return ['admin_section'];
|
||||
return ['admin_section', 'admin_social_work'];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user