1 | <?php |
||
7 | class GrigliaParametriUtils |
||
8 | { |
||
9 | |||
10 | 4 | public static function getAliasTestataPerGriglia($paricevuti) |
|
11 | { |
||
12 | 4 | $alias = isset($paricevuti['dettaglij']) ? $paricevuti['dettaglij'] : array(); |
|
13 | |||
14 | 4 | if (is_object($alias)) { |
|
15 | $alias = get_object_vars($alias); |
||
16 | } |
||
17 | |||
18 | 4 | return $alias; |
|
19 | } |
||
20 | |||
21 | 4 | public static function getOrdineColonneTestataPerGriglia($paricevuti) |
|
22 | { |
||
23 | 4 | $ordinecolonne = isset($paricevuti['ordinecolonne']) ? $paricevuti['ordinecolonne'] : null; |
|
24 | 4 | if (!isset($ordinecolonne)) { |
|
25 | 4 | $ordinecolonne = GrigliaUtils::ordinecolonne($paricevuti); |
|
26 | } |
||
27 | |||
28 | 4 | return $ordinecolonne; |
|
29 | } |
||
30 | |||
31 | 4 | public static function getCampiEsclusiTestataPerGriglia($paricevuti) |
|
35 | |||
36 | 4 | public static function getParametriCampiExtraTestataPerGriglia($paricevuti) |
|
40 | |||
41 | 4 | public static function getDoctrineByEm($parametri) |
|
42 | { |
||
43 | 4 | if (isset($parametri['em'])) { |
|
44 | $doctrine = $parametri['container']->get('doctrine')->getManager($parametri['em']); |
||
45 | } else { |
||
46 | 4 | $doctrine = $parametri['container']->get('doctrine')->getManager(); |
|
47 | } |
||
48 | |||
49 | 4 | return $doctrine; |
|
50 | } |
||
51 | |||
52 | 4 | public static function getDoctrineFiCoreByEm($parametri, $doctrine) |
|
53 | { |
||
54 | 4 | if (isset($parametri['emficore'])) { |
|
55 | $doctrineficore = $parametri['container']->get('doctrine')->getManager($parametri['emficore']); |
||
56 | } else { |
||
57 | 4 | $doctrineficore = &$doctrine; |
|
58 | } |
||
59 | |||
60 | 4 | return $doctrineficore; |
|
61 | } |
||
62 | |||
63 | 4 | public static function getOuputType($parametri) |
|
64 | { |
||
65 | 4 | if ((isset($parametri['output'])) && ($parametri['output'] == 'stampa')) { |
|
66 | $output = 'stampa'; |
||
67 | } else { |
||
68 | 4 | $output = 'index'; |
|
69 | } |
||
70 | |||
71 | 4 | return $output; |
|
72 | } |
||
73 | |||
74 | 1 | public static function getDatiEscludereDaTabella($parametri) |
|
75 | { |
||
76 | 1 | if (!isset($parametri["nometabella"])) { |
|
77 | return false; |
||
78 | } |
||
79 | |||
80 | 1 | if ((isset($parametri["output"])) && ($parametri["output"] == "stampa")) { |
|
81 | $output = "stampa"; |
||
82 | } else { |
||
83 | 1 | $output = "index"; |
|
84 | } |
||
85 | |||
86 | 1 | $nometabella = $parametri["nometabella"]; |
|
87 | |||
88 | 1 | $container = $parametri['container']; |
|
89 | 1 | $doctrine = $container->get('doctrine'); |
|
90 | |||
91 | //$bundle = $parametri["nomebundle"]; |
||
|
|||
92 | //Fisso il CoreBundle perchè si passa sempre da questo bundle per le esclusioni |
||
93 | 1 | $bundle = "FiCoreBundle"; |
|
94 | 1 | $gestionepermessi = $container->get("ficorebundle.gestionepermessi"); |
|
95 | 1 | $operatorecorrente = $gestionepermessi->utentecorrente(); |
|
96 | |||
97 | 1 | $escludi = array(); |
|
98 | |||
99 | 1 | $q = $doctrine->getRepository($bundle . ":tabelle")->findBy(array("operatori_id" => $operatorecorrente["id"], "nometabella" => $nometabella)); |
|
100 | |||
101 | 1 | if (!$q) { |
|
102 | 1 | unset($q); |
|
103 | 1 | $q = $doctrine->getRepository($bundle . ":tabelle")->findBy(array("operatori_id" => null, "nometabella" => $nometabella)); |
|
104 | } |
||
105 | |||
106 | 1 | if ($q) { |
|
107 | 1 | foreach ($q as $riga) { |
|
108 | 1 | $escludi[] = GrigliaUtils::getCampiEsclusi($riga, $output); |
|
109 | } |
||
110 | } |
||
111 | |||
112 | 1 | return $escludi; |
|
113 | } |
||
114 | |||
115 | 1 | public static function getDatiEscludere($parametri) |
|
119 | } |
||
120 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.