|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the Sonata Project package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Thomas Rabaix <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Sonata\NotificationBundle\Admin; |
|
13
|
|
|
|
|
14
|
|
|
use Sonata\AdminBundle\Admin\Admin; |
|
15
|
|
|
use Sonata\AdminBundle\Datagrid\DatagridMapper; |
|
16
|
|
|
use Sonata\AdminBundle\Datagrid\ListMapper; |
|
17
|
|
|
use Sonata\AdminBundle\Route\RouteCollection; |
|
18
|
|
|
use Sonata\AdminBundle\Show\ShowMapper; |
|
19
|
|
|
|
|
20
|
|
|
class MessageAdmin extends Admin |
|
|
|
|
|
|
21
|
|
|
{ |
|
22
|
|
|
/** |
|
23
|
|
|
* {@inheritdoc} |
|
24
|
|
|
*/ |
|
25
|
|
|
public function configureRoutes(RouteCollection $collection) |
|
26
|
|
|
{ |
|
27
|
|
|
$collection |
|
28
|
|
|
->remove('edit') |
|
29
|
|
|
->remove('create') |
|
30
|
|
|
->remove('history') |
|
31
|
|
|
; |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* {@inheritdoc} |
|
36
|
|
|
*/ |
|
37
|
|
|
public function getBatchActions() |
|
38
|
|
|
{ |
|
39
|
|
|
$actions = array(); |
|
40
|
|
|
$actions['publish'] = array( |
|
41
|
|
|
'label' => $this->trans($this->getLabelTranslatorStrategy()->getLabel('publish', 'batch', 'message')), |
|
42
|
|
|
'ask_confirmation' => false, |
|
43
|
|
|
); |
|
44
|
|
|
|
|
45
|
|
|
$actions['cancelled'] = array( |
|
46
|
|
|
'label' => $this->trans($this->getLabelTranslatorStrategy()->getLabel('cancelled', 'batch', 'message')), |
|
47
|
|
|
'ask_confirmation' => false, |
|
48
|
|
|
); |
|
49
|
|
|
|
|
50
|
|
|
return $actions; |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* {@inheritdoc} |
|
55
|
|
|
*/ |
|
56
|
|
|
protected function configureShowFields(ShowMapper $showMapper) |
|
57
|
|
|
{ |
|
58
|
|
|
$showMapper |
|
59
|
|
|
->add('id') |
|
60
|
|
|
->add('type') |
|
61
|
|
|
->add('createdAt') |
|
62
|
|
|
->add('startedAt') |
|
63
|
|
|
->add('completedAt') |
|
64
|
|
|
->add('getStateName') |
|
65
|
|
|
->add('body') |
|
66
|
|
|
->add('restartCount') |
|
67
|
|
|
; |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* {@inheritdoc} |
|
72
|
|
|
*/ |
|
73
|
|
|
protected function configureListFields(ListMapper $listMapper) |
|
74
|
|
|
{ |
|
75
|
|
|
$listMapper |
|
76
|
|
|
->addIdentifier('id', null, array('route' => array('name' => 'show'))) |
|
77
|
|
|
->add('type') |
|
78
|
|
|
->add('createdAt') |
|
79
|
|
|
->add('startedAt') |
|
80
|
|
|
->add('completedAt') |
|
81
|
|
|
->add('getStateName') |
|
82
|
|
|
->add('restartCount') |
|
83
|
|
|
; |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
/** |
|
87
|
|
|
* {@inheritdoc} |
|
88
|
|
|
*/ |
|
89
|
|
|
protected function configureDatagridFilters(DatagridMapper $datagridMapper) |
|
90
|
|
|
{ |
|
91
|
|
|
$class = $this->getClass(); |
|
92
|
|
|
|
|
93
|
|
|
$datagridMapper |
|
94
|
|
|
->add('type') |
|
95
|
|
|
->add('state', null, array(), 'choice', array('choices' => $class::getStateList())) |
|
96
|
|
|
; |
|
97
|
|
|
} |
|
98
|
|
|
} |
|
99
|
|
|
|
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.