mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge branch 'event_bundle_sf4' into 'master'
Event bundle sf4 See merge request Chill-Projet/chill-bundles!439
This commit is contained in:
commit
b4b67c6f0d
@ -12,6 +12,7 @@ declare(strict_types=1);
|
|||||||
namespace Chill\EventBundle\Controller;
|
namespace Chill\EventBundle\Controller;
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class AdminController
|
* Class AdminController
|
||||||
@ -20,18 +21,12 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|||||||
class AdminController extends AbstractController
|
class AdminController extends AbstractController
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
* Event admin.
|
||||||
|
*
|
||||||
|
* @Route("/{_locale}/admin/event", name="chill_event_admin_index")
|
||||||
*/
|
*/
|
||||||
public function indexAction()
|
public function indexAdminAction()
|
||||||
{
|
{
|
||||||
return $this->render('ChillEventBundle:Admin:layout.html.twig');
|
return $this->render('ChillEventBundle:Admin:index.html.twig');
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return \Symfony\Component\HttpFoundation\RedirectResponse
|
|
||||||
*/
|
|
||||||
public function redirectToAdminIndexAction()
|
|
||||||
{
|
|
||||||
return $this->redirectToRoute('chill_main_admin_central');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -273,7 +273,7 @@ class EventController extends AbstractController
|
|||||||
/**
|
/**
|
||||||
* @var Center $centers
|
* @var Center $centers
|
||||||
*/
|
*/
|
||||||
$centers = $this->authorizationHelper->getReachableCenters($this->getUser(), $role);
|
$centers = $this->authorizationHelper->getReachableCenters($this->getUser(), (string) $role);
|
||||||
|
|
||||||
if (count($centers) === 1) {
|
if (count($centers) === 1) {
|
||||||
return $this->redirectToRoute('chill_event__event_new', [
|
return $this->redirectToRoute('chill_event__event_new', [
|
||||||
|
@ -151,7 +151,7 @@ class PickEventType extends AbstractType
|
|||||||
} else {
|
} else {
|
||||||
$centers = $this->authorizationHelper->getReachableCenters(
|
$centers = $this->authorizationHelper->getReachableCenters(
|
||||||
$this->user,
|
$this->user,
|
||||||
$options['role']
|
(string) $options['role']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
61
src/Bundle/ChillEventBundle/Menu/AdminMenuBuilder.php
Normal file
61
src/Bundle/ChillEventBundle/Menu/AdminMenuBuilder.php
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
<?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\EventBundle\Menu;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||||
|
use Knp\Menu\MenuItem;
|
||||||
|
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
||||||
|
|
||||||
|
class AdminMenuBuilder 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('Events', [
|
||||||
|
'route' => 'chill_event_admin_index',
|
||||||
|
])
|
||||||
|
->setAttribute('class', 'list-group-item-header')
|
||||||
|
->setExtras([
|
||||||
|
'order' => 6500
|
||||||
|
]);
|
||||||
|
|
||||||
|
$menu->addChild('Event type', [
|
||||||
|
'route' => 'chill_eventtype_admin',
|
||||||
|
])->setExtras(['order' => 6510]);
|
||||||
|
|
||||||
|
$menu->addChild('Event status', [
|
||||||
|
'route' => 'chill_event_admin_status',
|
||||||
|
])->setExtras(['order' => 6520]);
|
||||||
|
|
||||||
|
$menu->addChild('Role', [
|
||||||
|
'route' => 'chill_event_admin_role',
|
||||||
|
])->setExtras(['order' => 6530]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getMenuIds(): array
|
||||||
|
{
|
||||||
|
return ['admin_section', 'admin_event'];
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
{% extends "@ChillMain/Admin/layoutWithVerticalMenu.html.twig" %}
|
||||||
|
|
||||||
|
{% block vertical_menu_content %}
|
||||||
|
{{ chill_menu('admin_event', {
|
||||||
|
'layout': '@ChillMain/Admin/menu_admin_section.html.twig',
|
||||||
|
}) }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block layout_wvm_content %}
|
||||||
|
{% block admin_content %}<!-- block content empty -->
|
||||||
|
<h1>{{ 'Events configuration' |trans }}</h1>
|
||||||
|
{% endblock %}
|
||||||
|
{% endblock %}
|
@ -1,31 +0,0 @@
|
|||||||
{#
|
|
||||||
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
|
|
||||||
<info@champs-libres.coop> / <http://www.champs-libres.coop>
|
|
||||||
*
|
|
||||||
* 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/>.
|
|
||||||
#}
|
|
||||||
|
|
||||||
{% extends "@ChillMain/Admin/layoutWithVerticalMenu.html.twig" %}
|
|
||||||
|
|
||||||
{% block vertical_menu_content %}
|
|
||||||
{{ chill_menu('admin_events', {
|
|
||||||
'layout': '@ChillEvent/Admin/menu.html.twig',
|
|
||||||
}) }}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block layout_wvm_content %}
|
|
||||||
{% block admin_content %}<!-- block content empty -->
|
|
||||||
<h1>{{ 'Events configuration' |trans }}</h1>
|
|
||||||
{% endblock %}
|
|
||||||
{% endblock %}
|
|
@ -1,21 +1,3 @@
|
|||||||
{#
|
|
||||||
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
|
|
||||||
<info@champs-libres.coop> / <http://www.champs-libres.coop>
|
|
||||||
*
|
|
||||||
* 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/>.
|
|
||||||
#}
|
|
||||||
|
|
||||||
{% extends "@ChillMain/Menu/verticalMenu.html.twig" %}
|
{% extends "@ChillMain/Menu/verticalMenu.html.twig" %}
|
||||||
{% block v_menu_title %}{{ 'Events configuration menu'|trans }}{% endblock %}
|
{% block v_menu_title %}{{ 'Events configuration menu'|trans }}{% endblock %}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{% extends "ChillEventBundle:Admin:layout.html.twig" %}
|
{% extends "ChillEventBundle:Admin:index.html.twig" %}
|
||||||
|
|
||||||
{% block admin_content -%}
|
{% block admin_content -%}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{% extends "ChillEventBundle:Admin:layout.html.twig" %}
|
{% extends "ChillEventBundle:Admin:index.html.twig" %}
|
||||||
|
|
||||||
{% block admin_content -%}
|
{% block admin_content -%}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{% extends "ChillEventBundle:Admin:layout.html.twig" %}
|
{% extends "ChillEventBundle:Admin:index.html.twig" %}
|
||||||
|
|
||||||
{% block admin_content -%}
|
{% block admin_content -%}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{% extends "ChillEventBundle:Admin:layout.html.twig" %}
|
{% extends "ChillEventBundle:Admin:index.html.twig" %}
|
||||||
|
|
||||||
{% block admin_content -%}
|
{% block admin_content -%}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{% extends "ChillEventBundle:Admin:layout.html.twig" %}
|
{% extends "ChillEventBundle:Admin:index.html.twig" %}
|
||||||
|
|
||||||
{% block admin_content -%}
|
{% block admin_content -%}
|
||||||
<h1>{{ 'Role edit'|trans }}</h1>
|
<h1>{{ 'Role edit'|trans }}</h1>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{% extends "ChillEventBundle:Admin:layout.html.twig" %}
|
{% extends "ChillEventBundle:Admin:index.html.twig" %}
|
||||||
|
|
||||||
{% block admin_content -%}
|
{% block admin_content -%}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{% extends "ChillEventBundle:Admin:layout.html.twig" %}
|
{% extends "ChillEventBundle:Admin:index.html.twig" %}
|
||||||
|
|
||||||
{% block admin_content -%}
|
{% block admin_content -%}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{% extends "ChillEventBundle:Admin:layout.html.twig" %}
|
{% extends "ChillEventBundle:Admin:index.html.twig" %}
|
||||||
|
|
||||||
{% block admin_content -%}
|
{% block admin_content -%}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{% extends "ChillEventBundle:Admin:layout.html.twig" %}
|
{% extends "ChillEventBundle:Admin:index.html.twig" %}
|
||||||
|
|
||||||
{% block admin_content -%}
|
{% block admin_content -%}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{% extends "ChillEventBundle:Admin:layout.html.twig" %}
|
{% extends "ChillEventBundle:Admin:index.html.twig" %}
|
||||||
|
|
||||||
{% block admin_content -%}
|
{% block admin_content -%}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{% extends "ChillEventBundle:Admin:layout.html.twig" %}
|
{% extends "ChillEventBundle:Admin:index.html.twig" %}
|
||||||
|
|
||||||
{% block admin_content -%}
|
{% block admin_content -%}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{% extends "ChillEventBundle:Admin:layout.html.twig" %}
|
{% extends "ChillEventBundle:Admin:index.html.twig" %}
|
||||||
|
|
||||||
{% block admin_content -%}
|
{% block admin_content -%}
|
||||||
|
|
||||||
|
@ -9,24 +9,24 @@ chill_event_participation:
|
|||||||
|
|
||||||
## ADMIN
|
## ADMIN
|
||||||
|
|
||||||
chill_event_admin:
|
chill_event_admin_index:
|
||||||
path: /{_locale}/admin/event
|
path: /{_locale}/admin/event
|
||||||
controller: Chill\EventBundle\Controller\AdminController::indexAction
|
controller: Chill\EventBundle\Controller\AdminController::indexAdminAction
|
||||||
options:
|
# options:
|
||||||
menus:
|
# menus:
|
||||||
admin_section:
|
# admin_section:
|
||||||
order: 2100
|
# order: 2100
|
||||||
label: "Events"
|
# label: "Events"
|
||||||
icons: ['calendar']
|
# icons: ['calendar']
|
||||||
|
|
||||||
chill_event_admin_redirect_to_admin_index:
|
# chill_event_admin_redirect_to_admin_index:
|
||||||
path: /{_locale}/admin/event_redirect_to_main
|
# path: /{_locale}/admin/event_redirect_to_main
|
||||||
controller: Chill\EventBundle\Controller\AdminController::redirectToAdminIndexAction
|
# controller: Chill\EventBundle\Controller\AdminController::redirectToAdminIndexAction
|
||||||
options:
|
# options:
|
||||||
menus:
|
# menus:
|
||||||
admin_events:
|
# admin_events:
|
||||||
order: 0
|
# order: 0
|
||||||
label: Main admin menu
|
# label: Main admin menu
|
||||||
|
|
||||||
chill_event_admin_status:
|
chill_event_admin_status:
|
||||||
resource: "@ChillEventBundle/config/routes/status.yaml"
|
resource: "@ChillEventBundle/config/routes/status.yaml"
|
||||||
|
@ -1,2 +1,11 @@
|
|||||||
services:
|
services:
|
||||||
|
Chill\EventBundle\Controller\:
|
||||||
|
autowire: true
|
||||||
|
resource: '../Controller'
|
||||||
|
tags: ['controller.service_arguments']
|
||||||
|
|
||||||
|
Chill\EventBundle\Menu\:
|
||||||
|
autowire: true
|
||||||
|
autoconfigure: true
|
||||||
|
resource: '../Menu/'
|
||||||
|
tags: ['chill.menu_builder']
|
Loading…
x
Reference in New Issue
Block a user