1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
namespace App\Admin;
use Knp\Menu\ItemInterface;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Admin\AdminInterface;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Route\RouteCollection;
/**
* Administration des paramètres à Solidoume.
*
* KOHINOS : Outil de gestion de Monnaie Locale Complémentaire
*
* @author Julien Jorry <julien.jorry@gmail.com>
*/
class SolidoumeParamAdmin extends AbstractAdmin
{
protected $baseRouteName = 'solidoumeparam';
protected $baseRoutePattern = 'solidoumeparam';
protected $security;
public function getTemplate($name)
{
if ('list' == $name) {
return '@kohinos/admin/solidoumeparameter_list.html.twig';
}
return parent::getTemplate($name);
}
/**
* {@inheritdoc}
*/
protected function configureListFields(ListMapper $listMapper)
{
unset($this->listModes['mosaic']);
$listMapper
->addIdentifier('user', null, ['label' => 'Utilisateur'])
->addIdentifier('adherent', null, ['label' => 'Adhérent'])
->addIdentifier('amount', null, ['label' => 'Montant'])
->addIdentifier('paiementDate', null, ['label' => 'Date de prélèvement'])
->addIdentifier('enabled', null, ['label' => 'Activé', 'datatype' => 'App.SolidoumeItem', 'template' => '@kohinos/bundles/SonataAdminBundle/Boolean/editable_boolean.html.twig'])
->add('_action', null, [
'actions' => [
'edit' => [],
],
]);
}
protected function configureSideMenu(ItemInterface $menu, string $action, AdminInterface $childAdmin = null)
{
if (!$childAdmin && in_array($action, ['list'])) {
return;
}
}
protected function configureRoutes(RouteCollection $collection)
{
$collection->clearExcept(['list']);
$collection->add('redistribution');
}
public function getBatchActions()
{
$actions = parent::getBatchActions();
unset($actions['delete']);
return $actions;
}
}