@@ -2,10 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace Api\Controller; |
4 | 4 | |
5 | -use Zend\Db\Adapter\AdapterInterface; |
|
6 | 5 | use Zend\Mvc\Controller\AbstractRestfulController; |
7 | 6 | use Zend\View\Model\JsonModel; |
8 | -use Api\Helper\Utils; |
|
9 | 7 | use Api\Entity\Indicator; |
10 | 8 | use Api\Entity\IndicatorValue; |
11 | 9 |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | } |
27 | 27 | public function getIndicatorAction() |
28 | 28 | { |
29 | - $indicator = (int)$this->params()->fromRoute('indicator'); |
|
29 | + $indicator = (int) $this->params()->fromRoute('indicator'); |
|
30 | 30 | |
31 | 31 | $response = []; |
32 | 32 | |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $arrIndicador = $this->entityManager->getRepository(Indicator::class) |
35 | 35 | ->getIndicator($indicator); |
36 | 36 | |
37 | - foreach($arrIndicador as $indicador) { |
|
37 | + foreach ($arrIndicador as $indicador) { |
|
38 | 38 | $response['indicador'] = $indicador; |
39 | 39 | break; |
40 | 40 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $arrAnos = []; |
46 | 46 | $arrValor = []; |
47 | 47 | |
48 | - foreach($arrValores as $a) { |
|
48 | + foreach ($arrValores as $a) { |
|
49 | 49 | // SI EL NOMBRE TIENE UNA COMA LO TENGO QUE PONER ENTRE COMILLAS |
50 | 50 | $arrAnos[] = $a['year']; |
51 | 51 | $arrValor[] = $a['value']; |
@@ -133,25 +133,25 @@ |
||
133 | 133 | /** |
134 | 134 | * |
135 | 135 | */ |
136 | - public function getGasesDistributionAction() |
|
137 | - { |
|
138 | - $year = (int)$this->params()->fromRoute('year'); |
|
136 | + public function getGasesDistributionAction() |
|
137 | + { |
|
138 | + $year = (int)$this->params()->fromRoute('year'); |
|
139 | 139 | |
140 | - $response = []; |
|
140 | + $response = []; |
|
141 | 141 | |
142 | - $results = $this->entityManager->getRepository(Emission::class)->findGasesByYear($year); |
|
142 | + $results = $this->entityManager->getRepository(Emission::class)->findGasesByYear($year); |
|
143 | 143 | |
144 | - $response['gases'][] = 'x'; |
|
145 | - $response['valores'][] = 'Gases'; |
|
144 | + $response['gases'][] = 'x'; |
|
145 | + $response['valores'][] = 'Gases'; |
|
146 | 146 | |
147 | - foreach ($results as $result) { |
|
148 | - $response['gases'][] = (strpos($result['name'], ',')) ? '"'.$result['name'].'"' : $result['name']; |
|
149 | - $response['valores'][] = round($result['total']); |
|
150 | - $response['colores'][] = $result['color']; |
|
151 | - } |
|
147 | + foreach ($results as $result) { |
|
148 | + $response['gases'][] = (strpos($result['name'], ',')) ? '"'.$result['name'].'"' : $result['name']; |
|
149 | + $response['valores'][] = round($result['total']); |
|
150 | + $response['colores'][] = $result['color']; |
|
151 | + } |
|
152 | 152 | |
153 | - return new JsonModel($response); |
|
154 | - } |
|
153 | + return new JsonModel($response); |
|
154 | + } |
|
155 | 155 | |
156 | 156 | public function getSectoralGasesDistributionAction() |
157 | 157 | { |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function getWholeSectoralDistributionAction() |
30 | 30 | { |
31 | - $year = (int)$this->params()->fromRoute('year'); |
|
31 | + $year = (int) $this->params()->fromRoute('year'); |
|
32 | 32 | |
33 | 33 | $response = []; |
34 | 34 | |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function getSectoralDistributionAction() |
55 | 55 | { |
56 | - $year = (int)$this->params()->fromRoute('year'); |
|
57 | - $sector = (int)$this->params()->fromRoute('sector'); |
|
56 | + $year = (int) $this->params()->fromRoute('year'); |
|
57 | + $sector = (int) $this->params()->fromRoute('sector'); |
|
58 | 58 | |
59 | 59 | $response = []; |
60 | 60 | $arrGraphData = []; |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | */ |
136 | 136 | public function getGasesDistributionAction() |
137 | 137 | { |
138 | - $year = (int)$this->params()->fromRoute('year'); |
|
138 | + $year = (int) $this->params()->fromRoute('year'); |
|
139 | 139 | |
140 | 140 | $response = []; |
141 | 141 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | public function getSectoralGasesDistributionAction() |
157 | 157 | { |
158 | - $year = (int)$this->params()->fromRoute('year'); |
|
158 | + $year = (int) $this->params()->fromRoute('year'); |
|
159 | 159 | |
160 | 160 | $response = []; |
161 | 161 |
@@ -46,15 +46,15 @@ discard block |
||
46 | 46 | $arrValores = []; |
47 | 47 | $arrColores = []; |
48 | 48 | |
49 | - for ($i= self::START_YEAR; $i <= self::END_YEAR; $i++) { |
|
49 | + for ($i = self::START_YEAR; $i <= self::END_YEAR; $i++) { |
|
50 | 50 | $arrAnos[] = $i; |
51 | 51 | } |
52 | 52 | |
53 | 53 | $column = 2; |
54 | 54 | |
55 | - foreach($arrSectores as $sector) { |
|
55 | + foreach ($arrSectores as $sector) { |
|
56 | 56 | $response['column_'.$column][] = $sector['name']; |
57 | - $response['colores'][] = $sector['color']; |
|
57 | + $response['colores'][] = $sector['color']; |
|
58 | 58 | |
59 | 59 | foreach ($arrAnos as $ano) { |
60 | 60 | // ATENCION, CABECEADA |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | public function getSectoralEvolutionAction() |
85 | 85 | { |
86 | - $sector = (int)$this->params()->fromRoute('sector'); |
|
86 | + $sector = (int) $this->params()->fromRoute('sector'); |
|
87 | 87 | |
88 | 88 | $response = []; |
89 | 89 | |
@@ -102,15 +102,15 @@ discard block |
||
102 | 102 | $arrValores = []; |
103 | 103 | $arrColores = []; |
104 | 104 | |
105 | - for ($i = self::START_YEAR; $i <= self::END_YEAR ;$i++) { |
|
105 | + for ($i = self::START_YEAR; $i <= self::END_YEAR; $i++) { |
|
106 | 106 | $arrAnos[] = $i; |
107 | 107 | } |
108 | 108 | |
109 | 109 | $column = 2; |
110 | 110 | |
111 | - foreach($arrSectores as $sector) { |
|
111 | + foreach ($arrSectores as $sector) { |
|
112 | 112 | $response['column_'.$column][] = $sector['name']; |
113 | - $response['colores'][] = $sector['color']; |
|
113 | + $response['colores'][] = $sector['color']; |
|
114 | 114 | |
115 | 115 | foreach ($arrAnos as $ano) { |
116 | 116 | // ATENCION, CABECEADA |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | |
139 | 139 | public function getSectoralEvolutionSubactivityAction() |
140 | 140 | { |
141 | - $sector = (int)$this->params()->fromRoute('sector'); |
|
141 | + $sector = (int) $this->params()->fromRoute('sector'); |
|
142 | 142 | |
143 | 143 | $response = []; |
144 | 144 | |
@@ -162,11 +162,11 @@ discard block |
||
162 | 162 | |
163 | 163 | $column = 2; |
164 | 164 | |
165 | - foreach($arrSubactividades as $subactividad) { |
|
165 | + foreach ($arrSubactividades as $subactividad) { |
|
166 | 166 | $response['column_'.$column][] = $subactividad['name']; |
167 | 167 | $response['groups'][] = $subactividad['name']; |
168 | 168 | |
169 | - foreach($arrAnos as $ano) { |
|
169 | + foreach ($arrAnos as $ano) { |
|
170 | 170 | // ATENCION, CABECEADA |
171 | 171 | // ESTOY EJECUTANDO EL QUERY CADA VEZ QUE NECESITO LA LISTA DE VALORES |
172 | 172 | // ESTA PARTE DEBERIA AFUERA DEL LOOP Y SE DEBERIA REUTILIZAR $arrValoresCrudo |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | |
193 | 193 | public function getSectoralEvolutionSubactivityCategoryAction() |
194 | 194 | { |
195 | - $sector = (int)$this->params()->fromRoute('sector'); |
|
196 | - $subactivity = (int)$this->params()->fromRoute('subactivity'); |
|
195 | + $sector = (int) $this->params()->fromRoute('sector'); |
|
196 | + $subactivity = (int) $this->params()->fromRoute('subactivity'); |
|
197 | 197 | |
198 | 198 | $response = []; |
199 | 199 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | // // // pr($arrCategorias); |
225 | 225 | // // // pr($arr); |
226 | 226 | |
227 | - foreach($arrCategorias as $categoria) { |
|
227 | + foreach ($arrCategorias as $categoria) { |
|
228 | 228 | $response['column_'.$column][] = $categoria['name']; |
229 | 229 | $response['groups'][] = $categoria['name']; |
230 | 230 |
@@ -6,9 +6,9 @@ discard block |
||
6 | 6 | |
7 | 7 | class SubactivityRepository extends EntityRepository |
8 | 8 | { |
9 | - public function findActivitySectorBySector($sector) |
|
10 | - { |
|
11 | - $dql = 'SELECT sub.name |
|
9 | + public function findActivitySectorBySector($sector) |
|
10 | + { |
|
11 | + $dql = 'SELECT sub.name |
|
12 | 12 | FROM Api\Entity\Subactivity sub |
13 | 13 | INNER JOIN sub.activity a |
14 | 14 | INNER JOIN Api\Entity\Sector s WITH s.id = a.sector |
@@ -18,5 +18,5 @@ discard block |
||
18 | 18 | return $this->getEntityManager()->createQuery($dql) |
19 | 19 | ->setParameter('sector', $sector) |
20 | 20 | ->getResult(); |
21 | - } |
|
21 | + } |
|
22 | 22 | } |
@@ -114,7 +114,7 @@ |
||
114 | 114 | 'factories' => [ |
115 | 115 | Controller\DistributionReportController::class => Factory\DistributionReportControllerFactory::class, |
116 | 116 | Controller\EvolutionReportController::class => Factory\EvolutionReportControllerFactory::class, |
117 | - Controller\IndicatorsReportController::class => Factory\IndicatorsReportControllerFactory::class, |
|
117 | + Controller\IndicatorsReportController::class => Factory\IndicatorsReportControllerFactory::class, |
|
118 | 118 | ], |
119 | 119 | ], |
120 | 120 | 'view_manager' => [ |