mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-27 17:15:02 +00:00
63 lines
1.6 KiB
PHP
63 lines
1.6 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/*
|
|
* 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\BudgetBundle\Menu;
|
|
|
|
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
|
use Knp\Menu\MenuItem;
|
|
use Symfony\Component\Security\Core\Security;
|
|
|
|
final class AdminMenuBuilder implements LocalMenuBuilderInterface
|
|
{
|
|
private Security $security;
|
|
|
|
public function __construct(Security $security)
|
|
{
|
|
$this->security = $security;
|
|
}
|
|
|
|
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
|
{
|
|
// all the entries below must have ROLE_ADMIN permissions
|
|
if (!$this->security->isGranted('ROLE_ADMIN')) {
|
|
return;
|
|
}
|
|
|
|
$menu->addChild('Budget', [
|
|
'route' => 'chill_admin_budget',
|
|
])
|
|
->setAttribute('class', 'list-group-item-header')
|
|
->setExtras([
|
|
'order' => 7050,
|
|
'explain' => 'Budget resource and charge type configuration',
|
|
]);
|
|
$menu
|
|
->addChild('admin.menu.Resource types', [
|
|
'route' => 'chill_crud_resource_kind_index',
|
|
])
|
|
->setExtras([
|
|
'order' => 7060,
|
|
]);
|
|
$menu
|
|
->addChild('admin.menu.Charge types', [
|
|
'route' => 'chill_crud_charge_kind_index',
|
|
])
|
|
->setExtras([
|
|
'order' => 7070,
|
|
]);
|
|
}
|
|
|
|
public static function getMenuIds(): array
|
|
{
|
|
return ['admin_section', 'admin_budget'];
|
|
}
|
|
}
|