1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Fi\CoreBundle\Controller; |
4
|
|
|
|
5
|
|
|
use Symfony\Component\HttpFoundation\Request; |
6
|
|
|
use Fi\CoreBundle\Entity\Permessi; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Permessi controller. |
10
|
|
|
*/ |
11
|
|
|
class PermessiController extends FiCoreController |
12
|
|
|
{ |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Lists all Ffprincipale entities. |
16
|
|
|
*/ |
17
|
1 |
|
public function indexAction(Request $request) |
18
|
|
|
{ |
19
|
1 |
|
$this->setup($request); |
20
|
1 |
|
$namespace = $this->getNamespace(); |
|
|
|
|
21
|
1 |
|
$bundle = $this->getBundle(); |
|
|
|
|
22
|
1 |
|
$controller = $this->getController(); |
23
|
1 |
|
$container = $this->container; |
|
|
|
|
24
|
|
|
|
25
|
1 |
|
$nomebundle = $namespace . $bundle . 'Bundle'; |
26
|
|
|
|
27
|
1 |
|
$em = $this->getDoctrine()->getManager(); |
|
|
|
|
28
|
1 |
|
$entities = $em->getRepository($nomebundle . ':' . $controller)->findAll(); |
29
|
|
|
|
30
|
|
|
$dettaglij = array( |
31
|
1 |
|
'operatori_id' => array( |
32
|
|
|
array('nomecampo' => 'operatori.username', |
33
|
|
|
'lunghezza' => '200', |
34
|
|
|
'descrizione' => 'Username', |
35
|
|
|
'tipo' => 'text',), |
36
|
|
|
array('nomecampo' => 'operatori.operatore', |
37
|
|
|
'lunghezza' => '200', |
38
|
|
|
'descrizione' => 'Operatore', |
39
|
|
|
'tipo' => 'text',), |
40
|
|
|
), |
41
|
|
|
'ruoli_id' => array( |
42
|
|
|
array('nomecampo' => 'ruoli.ruolo', |
43
|
|
|
'lunghezza' => '200', |
44
|
|
|
'descrizione' => 'Ruolo', |
45
|
|
|
'tipo' => 'text',), |
46
|
|
|
), |
47
|
|
|
); |
48
|
|
|
|
49
|
|
|
$paricevuti = array( |
50
|
1 |
|
'doctrine' => $em, |
51
|
1 |
|
'nomebundle' => $nomebundle, |
52
|
1 |
|
'nometabella' => $controller, |
53
|
1 |
|
'dettaglij' => $dettaglij, |
54
|
1 |
|
'container' => $container,); |
55
|
|
|
|
56
|
1 |
|
$griglia = $this->get("ficorebundle.griglia"); |
|
|
|
|
57
|
1 |
|
$testatagriglia = $griglia->testataPerGriglia($paricevuti); |
|
|
|
|
58
|
1 |
|
$testatagriglia['overlayopen'] = 1; |
59
|
|
|
|
60
|
1 |
|
$testata = json_encode($testatagriglia); |
|
|
|
|
61
|
|
|
$twigparms = array( |
62
|
1 |
|
'entities' => $entities, |
63
|
1 |
|
'nomecontroller' => $controller, |
64
|
1 |
|
'testata' => $testata, |
65
|
|
|
); |
66
|
|
|
|
67
|
1 |
|
return $this->render($nomebundle . ':' . $controller . ':index.html.twig', $twigparms); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
public function setParametriGriglia($prepar = array()) |
71
|
|
|
{ |
72
|
|
|
$this->setup($prepar['request']); |
73
|
|
|
$namespace = $this->getNamespace(); |
|
|
|
|
74
|
|
|
$bundle = $this->getBundle(); |
|
|
|
|
75
|
|
|
$controller = $this->getController(); |
76
|
|
|
|
77
|
|
|
$nomebundle = $namespace . $bundle . 'Bundle'; |
|
|
|
|
78
|
|
|
$escludi = array(); |
|
|
|
|
79
|
|
|
$tabellej = array(); |
|
|
|
|
80
|
|
|
$tabellej['operatori_id'] = array('tabella' => 'operatori', 'campi' => array('username', 'operatore')); |
81
|
|
|
$tabellej['ruoli_id'] = array('tabella' => 'ruoli', 'campi' => array('ruolo')); |
|
|
|
|
82
|
|
|
|
83
|
|
|
$paricevuti = array( |
84
|
|
|
'container' => $this->container, |
85
|
|
|
'nomebundle' => $nomebundle, |
86
|
|
|
'tabellej' => $tabellej, |
87
|
|
|
'nometabella' => $controller, |
88
|
|
|
'escludere' => $escludi, |
89
|
|
|
); |
90
|
|
|
|
91
|
|
|
if (! empty($prepar)) { |
92
|
|
|
$paricevuti = array_merge($paricevuti, $prepar); |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
self::$parametrigriglia = $paricevuti; |
96
|
|
|
} |
97
|
|
|
} |
98
|
|
|
|
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.