1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Stfalcon\Bundle\EventBundle\Admin; |
4
|
|
|
|
5
|
|
|
use Sonata\AdminBundle\Form\FormMapper; |
6
|
|
|
use Sonata\AdminBundle\Datagrid\ListMapper; |
7
|
|
|
use Stfalcon\Bundle\EventBundle\Admin\AbstractClass\AbstractTranslateAdmin; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Class SpeakerAdmin. |
11
|
|
|
*/ |
12
|
|
|
class SpeakerAdmin extends AbstractTranslateAdmin |
13
|
|
|
{ |
14
|
|
|
/** |
15
|
|
|
* {@inheritdoc} |
16
|
|
|
*/ |
17
|
|
|
protected function configureListFields(ListMapper $listMapper) |
18
|
|
|
{ |
19
|
|
|
$listMapper |
20
|
|
|
->addIdentifier('slug') |
21
|
|
|
->add('name', null, ['label' => 'Имя']) |
22
|
|
|
; |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* {@inheritdoc} |
27
|
|
|
*/ |
28
|
|
|
protected function configureFormFields(FormMapper $formMapper) |
29
|
|
|
{ |
30
|
|
|
$localsRequiredService = $this->getConfigurationPool()->getContainer()->get('application_default.sonata.locales.required'); |
31
|
|
|
$localOptions = $localsRequiredService->getLocalsRequiredArray(); |
32
|
|
|
$formMapper |
33
|
|
|
->with('Переводы') |
34
|
|
|
->add('translations', 'a2lix_translations_gedmo', [ |
35
|
|
|
'translatable_class' => $this->getClass(), |
36
|
|
|
'fields' => [ |
37
|
|
|
'name' => [ |
38
|
|
|
'label' => 'Имя', |
39
|
|
|
'locale_options' => $localOptions, |
40
|
|
|
], |
41
|
|
|
'about' => [ |
42
|
|
|
'label' => 'Описание', |
43
|
|
|
'locale_options' => $localOptions, |
44
|
|
|
], |
45
|
|
|
], |
46
|
|
|
]) |
47
|
|
|
->end() |
48
|
|
|
->with('Общие') |
49
|
|
|
->add('slug') |
50
|
|
|
->add('email') |
51
|
|
|
->add('company', null, ['label' => 'Место работы']) |
52
|
|
|
->add('sortOrder', null, ['label' => 'Номер сортировки']) |
53
|
|
|
// @todo rm array options https://github.com/dustin10/VichUploaderBundle/issues/27 and https://github.com/symfony/symfony/pull/5028 |
54
|
|
|
->add('file', 'file', [ |
55
|
|
|
'required' => false, |
56
|
|
|
'data_class' => 'Symfony\Component\HttpFoundation\File\File', |
57
|
|
|
'property_path' => 'file', |
58
|
|
|
'label' => 'Фото', |
59
|
|
|
]) |
60
|
|
|
->end() |
61
|
|
|
->with('Участвует в событиях', ['class' => 'col-md-4']) |
62
|
|
|
->add('events', 'entity', [ |
63
|
|
|
'class' => 'Stfalcon\Bundle\EventBundle\Entity\Event', |
64
|
|
|
'query_builder' => function (\Doctrine\ORM\EntityRepository $repository) { |
65
|
|
|
$qb = $repository->createQueryBuilder('e'); |
66
|
|
|
$repository = $qb->orderBy('e.id', 'DESC'); |
67
|
|
|
|
68
|
|
|
return $repository; |
69
|
|
|
}, |
70
|
|
|
'multiple' => true, |
71
|
|
|
'expanded' => true, |
72
|
|
|
'label' => 'События', |
73
|
|
|
]) |
74
|
|
|
->end() |
75
|
|
|
->with('Кандидат на события', ['class' => 'col-md-4']) |
76
|
|
|
->add('candidateEvents', 'entity', [ |
77
|
|
|
'class' => 'Stfalcon\Bundle\EventBundle\Entity\Event', |
78
|
|
|
'query_builder' => function (\Doctrine\ORM\EntityRepository $repository) { |
79
|
|
|
$qb = $repository->createQueryBuilder('e'); |
80
|
|
|
$repository = $qb->orderBy('e.id', 'DESC'); |
81
|
|
|
|
82
|
|
|
return $repository; |
83
|
|
|
}, |
84
|
|
|
'multiple' => true, |
85
|
|
|
'expanded' => true, |
86
|
|
|
'label' => 'События', |
87
|
|
|
]) |
88
|
|
|
->end() |
89
|
|
|
->with('Программный комитет', ['class' => 'col-md-4']) |
90
|
|
|
->add('committeeEvents', 'entity', [ |
91
|
|
|
'class' => 'Stfalcon\Bundle\EventBundle\Entity\Event', |
92
|
|
|
'query_builder' => function (\Doctrine\ORM\EntityRepository $repository) { |
93
|
|
|
$qb = $repository->createQueryBuilder('e'); |
94
|
|
|
$repository = $qb->orderBy('e.id', 'DESC'); |
95
|
|
|
|
96
|
|
|
return $repository; |
97
|
|
|
}, |
98
|
|
|
'multiple' => true, |
99
|
|
|
'expanded' => true, |
100
|
|
|
'label' => 'События', |
101
|
|
|
]) |
102
|
|
|
->end() |
103
|
|
|
; |
104
|
|
|
} |
105
|
|
|
} |
106
|
|
|
|