-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanagement_builder
85 lines (68 loc) · 2.87 KB
/
management_builder
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
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
namespace GestbdtBundle\DataGrid;
use Doctrine\ORM\EntityManager;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Translation\TranslatorInterface;
use Thrace\DataGridBundle\DataGrid\DataGridFactoryInterface;
class VolontarioManagementBuilder
{
const IDENTIFIER = 'volontario_management';
protected $factory;
protected $translator;
protected $router;
protected $em;
public function __construct (DataGridFactoryInterface $factory, TranslatorInterface $translator, RouterInterface $router, EntityManager $em)
{
$this->factory = $factory;
$this->translator = $translator;
$this->router = $router;
$this->em = $em;
}
public function build ()
{
$dataGrid = $this->factory->createDataGrid(self::IDENTIFIER);
$dataGrid
->setCaption($this->translator->trans('volontario_management_datagrid.caption'))
->setColNames(array(
$this->translator->trans('column.idUtente'),
$this->translator->trans('column.idPrestazione'),
$this->translator->trans('column.oreOfferte'),
$this->translator->trans('column.descrizionePrestazione'),
))
->setColModel(array(
array(
'name' => 'idUtente', 'index' => 'u.idUtente', 'width' => 200,
'align' => 'left', 'sortable' => true, 'search' => true,
),
array(
'name' => 'idPrestazione', 'index' => 'u.idPrestazione', 'width' => 200,
'align' => 'left', 'sortable' => true, 'search' => true,
),
array(
'name' => 'oreOfferte', 'index' => 'oreOfferte', 'width' => 200, 'aggregated' => FALSE,
'align' => 'left', 'sortable' => true, 'search' => true,// 'formatter' => 'currency',
),
array(
'name' => 'descrizionePrestazione', 'index' => 'u.descrizionePrestazione', 'width' => 255,
'align' => 'left', 'sortable' => true, 'search' => true,
'formatter' => 'textarea', 'search' => true, // 'stype' => 'select',
//'searchoptions' => array(
// 'value' => array(
// 1 => 'enable',
// 0 => 'disabled',
// )
//)
),
))
->setQueryBuilder($this->getQueryBuilder())
->enableSearchButton(true)
;
return $dataGrid;
}
protected function getQueryBuilder()
{
$qb = $this->em->getRepository('idlGestbdtBundle:Offerte')->createQueryBuilder('u');
$qb->select('u.id, u.idUtente, u.idPrestazione, u.oreOfferte, u.descrizionePrestazione, u');
return $qb;
}
}