Total Complexity | 90 |
Total Lines | 566 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
Complex classes like edificaciones often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use edificaciones, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
24 | class edificaciones extends residentes_controller |
||
25 | { |
||
26 | public $edificaciones; |
||
27 | public $edificaciones_tipo; |
||
28 | public $edificaciones_mapa; |
||
29 | public $allow_delete; |
||
30 | public $nombre_edificacion; |
||
31 | public $residentes_setup; |
||
32 | public $mapa; |
||
33 | public $padre_interior; |
||
34 | public $padre_inmuebles; |
||
35 | public $lista_interior; |
||
36 | public $lista_inmuebles; |
||
37 | public function __construct() |
||
40 | } |
||
41 | |||
42 | protected function private_core() |
||
43 | { |
||
44 | parent::private_core(); |
||
45 | $this->shared_extensions(); |
||
46 | $this->init(); |
||
47 | |||
48 | $tipos = $this->edificaciones_tipo->all(); |
||
49 | $this->padre = $tipos[0]; |
||
|
|||
50 | $accion = $this->filter_request('accion'); |
||
51 | $this->verificar_accion($accion); |
||
52 | |||
53 | $tipo = \filter_input(INPUT_GET, 'type'); |
||
54 | if ($tipo === 'select-hijos') { |
||
55 | $this->obtener_hijos(); |
||
56 | } elseif ($tipo === 'select-iddireccion') { |
||
57 | $this->mostrar_direcciones_residente(\filter_input(INPUT_GET, 'codcliente')); |
||
58 | } |
||
59 | |||
60 | $this->fsvar = new fs_var(); |
||
61 | //Aqui almacenamos las variables del plugin |
||
62 | $this->residentes_setup = $this->fsvar->array_get( |
||
63 | array( |
||
64 | 'residentes_nombre_edificacion' => 'Inmueble', |
||
65 | ), |
||
66 | false |
||
67 | ); |
||
68 | |||
69 | $this->nombre_edificacion = $this->residentes_setup['residentes_nombre_edificacion']; |
||
70 | |||
71 | if (isset($_REQUEST['busqueda'])) { |
||
72 | if ($_REQUEST['busqueda'] === 'arbol_tipo_edificaciones') { |
||
73 | $this->buscar_tipo_edificaciones(); |
||
74 | } |
||
75 | } |
||
76 | $interior = \filter_input(INPUT_GET, 'interior'); |
||
77 | if ($interior) { |
||
78 | $this->padre_interior = $this->edificaciones_mapa->get($interior); |
||
79 | $this->lista_interior = $this->edificaciones_mapa->get_by_field('padre_id', $interior); |
||
80 | } |
||
81 | $inmuebles = \filter_input(INPUT_GET, 'inmuebles'); |
||
82 | if ($inmuebles) { |
||
83 | $this->padre_inmuebles = $this->edificaciones_mapa->get($inmuebles); |
||
84 | $this->lista_inmuebles = $this->edificaciones->get_by_field('id_edificacion', $inmuebles); |
||
85 | } |
||
86 | |||
87 | if (\filter_input(INPUT_GET, 'buscar_cliente')) { |
||
88 | $this->buscar_cliente(); |
||
89 | } |
||
90 | |||
91 | $this->mapa = $this->edificaciones_mapa->get_by_field('id_tipo', $this->padre->id); |
||
92 | } |
||
93 | |||
94 | public function init() |
||
95 | { |
||
96 | $this->allow_delete = ($this->user->admin)?TRUE:$this->user->allow_delete_on(__CLASS__); |
||
97 | $this->edificaciones_tipo = new residentes_edificaciones_tipo(); |
||
98 | $this->edificaciones_mapa = new residentes_edificaciones_mapa(); |
||
99 | $this->edificaciones = new residentes_edificaciones(); |
||
100 | } |
||
101 | |||
102 | public function verificar_accion($accion) |
||
103 | { |
||
104 | switch ($accion) { |
||
105 | case "agregar": |
||
106 | $this->tratar_edificaciones(); |
||
107 | break; |
||
108 | case "eliminar": |
||
109 | $this->eliminar(); |
||
110 | break; |
||
111 | case "desocupar": |
||
112 | $this->desocupar(); |
||
113 | break; |
||
114 | case "agregar_inmueble": |
||
115 | $this->agregar_inmueble(); |
||
116 | break; |
||
117 | case "agregar_residente": |
||
118 | $this->agregar_residente(); |
||
119 | break; |
||
120 | case "agregar_hijo": |
||
121 | $objeto = $this->edificaciones_tipo->get(\filter_input(INPUT_POST, 'id_hijo')); |
||
122 | $this->agregar($objeto); |
||
123 | break; |
||
124 | case "tratar_tipo": |
||
125 | $this->tratar_tipo_edificaciones(); |
||
126 | break; |
||
127 | case "cambiar_datos": |
||
128 | $nombre = filter_input(INPUT_POST, 'nombre_edificacion'); |
||
129 | $residentes_config = array('residentes_nombre_edificacion' => trim($nombre)); |
||
130 | $this->fsvar->array_save($residentes_config); |
||
131 | break; |
||
132 | default: |
||
133 | break; |
||
134 | } |
||
135 | } |
||
136 | |||
137 | public function url() |
||
138 | { |
||
139 | $interior = \filter_input(INPUT_GET, 'interior'); |
||
140 | $inmuebles = \filter_input(INPUT_GET, 'inmuebles'); |
||
141 | if ($interior) { |
||
142 | return 'index.php?page='.__CLASS__.'&interior='.$interior; |
||
143 | } elseif ($inmuebles) { |
||
144 | return 'index.php?page='.__CLASS__.'&inmuebles='.$inmuebles; |
||
145 | } else { |
||
146 | return 'index.php?page='.__CLASS__; |
||
147 | } |
||
148 | } |
||
149 | |||
150 | public function parent_url() |
||
151 | { |
||
152 | return 'index.php?page='.__CLASS__; |
||
153 | } |
||
154 | |||
155 | public function desocupar() |
||
156 | { |
||
157 | $id = \filter_input(INPUT_GET, 'id'); |
||
158 | $edificacion = $this->edificaciones->get($id); |
||
159 | if ($edificacion->ocupado) { |
||
160 | $edificacion->ocupado = false; |
||
161 | $edificacion->iddireccion = 0; |
||
162 | $edificacion->codcliente = ''; |
||
163 | $edificacion->fecha_disponibilidad = null; |
||
164 | $edificacion->fecha_ocupacion = null; |
||
165 | try{ |
||
166 | $edificacion->save(); |
||
167 | $this->new_message('Inmueble desocupado exitosamente.'); |
||
168 | } catch (Exception $ex) { |
||
169 | $this->new_error_msg('Ocurrio un error al intentar desocupar el inmueble, intentelo nuevamente.'); |
||
170 | $this->new_error_msg($ex->getTraceAsString()); |
||
171 | } |
||
172 | } |
||
173 | } |
||
174 | |||
175 | public function eliminar() |
||
176 | { |
||
177 | $id = \filter_input(INPUT_GET, 'id'); |
||
178 | $edificacion = $this->edificaciones->get($id); |
||
179 | if ($edificacion->ocupado) { |
||
180 | $this->new_error_msg('Esta edificacion tiene un residente, '. |
||
181 | 'primero debe quitar al residente para proceder '. |
||
182 | 'a eliminar esta edificacion.'); |
||
183 | } else { |
||
184 | try { |
||
185 | $edificacion->delete(); |
||
186 | $this->new_message('Edificación eliminada correctamente.'); |
||
187 | } catch (\Exception $ex) { |
||
188 | $this->new_error_msg('Ocurrió un error intentando eliminar la edificación'); |
||
189 | $this->new_error_msg($ex->getTraceAsString()); |
||
190 | } |
||
191 | } |
||
192 | } |
||
193 | |||
194 | private function buscar_cliente() |
||
195 | { |
||
196 | /// desactivamos la plantilla HTML |
||
197 | $this->template = false; |
||
198 | |||
199 | $cliente = new cliente(); |
||
200 | $json = array(); |
||
201 | foreach ($cliente->search(\filter_input(INPUT_GET, 'buscar_cliente')) as $cli) { |
||
202 | $json[] = array('value' => $cli->razonsocial, 'data' => $cli->codcliente); |
||
203 | } |
||
204 | |||
205 | header('Content-Type: application/json'); |
||
206 | echo \json_encode(array( |
||
207 | 'query' => \filter_input(INPUT_GET, 'buscar_cliente'), |
||
208 | 'suggestions' => $json), JSON_THROW_ON_ERROR); |
||
209 | } |
||
210 | |||
211 | public function buscar_padre($id, &$codigo, &$unir = false) |
||
212 | { |
||
213 | $dato = $this->edificaciones_mapa->get($id); |
||
214 | $codigo[] = ($unir)?'"'.$dato->id_tipo.'":"'.$dato->codigo_edificacion.'"':$dato->codigo_edificacion; |
||
215 | if ($dato->padre_id === 0) { |
||
216 | return $codigo; |
||
217 | } else { |
||
218 | $this->buscar_padre($dato->padre_id, $codigo, $unir); |
||
219 | } |
||
220 | } |
||
221 | |||
222 | public function crear_codigo($id,$unir = false) |
||
223 | { |
||
224 | $codigo = array(); |
||
225 | $this->buscar_padre($id, $codigo, $unir); |
||
226 | if ($unir) { |
||
227 | $lista = array(); |
||
228 | foreach ($codigo as $linea) { |
||
229 | array_unshift($lista, $linea); |
||
230 | } |
||
231 | $codigo = $lista; |
||
232 | } else { |
||
233 | rsort($codigo); |
||
234 | } |
||
235 | return $codigo; |
||
236 | } |
||
237 | |||
238 | public function agregar_inmueble() |
||
239 | { |
||
240 | $inicio = \filter_input(INPUT_POST, 'inicio'); |
||
241 | $final_p = \filter_input(INPUT_POST, 'final'); |
||
242 | $cantidad = \filter_input(INPUT_POST, 'cantidad'); |
||
243 | $incremento = \filter_input(INPUT_POST, 'incremento'); |
||
244 | $final=(!empty($final_p))?$final_p:$inicio; |
||
245 | $inmuebles = 0; |
||
246 | $error = 0; |
||
247 | $linea = 0; |
||
248 | if ($inicio === $final) { |
||
249 | $this->inmueble($inicio, $inmuebles, $error); |
||
250 | } else { |
||
251 | for ($i = $inicio; $i<=($final); $i++) { |
||
252 | if ($linea === $cantidad and $cantidad!=0) { |
||
253 | $i = ($i-$cantidad)+$incremento; |
||
254 | $linea = 0; |
||
255 | } |
||
256 | $this->inmueble($i, $inmuebles, $error); |
||
257 | $linea++; |
||
258 | } |
||
259 | } |
||
260 | if ($error) { |
||
261 | $this->new_error_msg('No puedieron guardarse la informacion de '.$error.' inmuebles, revise su listado.'); |
||
262 | } |
||
263 | |||
264 | if ($inmuebles) { |
||
265 | $this->new_message('Se guardaron correctamente '.$inmuebles.' inmuebles.'); |
||
266 | } |
||
267 | } |
||
268 | |||
269 | public function inmueble($inicio, &$inmuebles, &$error) |
||
270 | { |
||
271 | $codigo_mapa = $this->crear_codigo(\filter_input(INPUT_POST, 'id_edificacion')); |
||
272 | $codigo_interno = $this->crear_codigo(\filter_input(INPUT_POST, 'id_edificacion'), 1); |
||
273 | $codigo = implode("", $codigo_mapa); |
||
274 | $codigo_interno = "{".implode(",", $codigo_interno)."}"; |
||
275 | $ubicacion = ""; |
||
276 | $codcliente = ""; |
||
277 | $ocupado = false; |
||
278 | $item = (is_int($inicio))?str_pad($inicio, 3, "0", STR_PAD_LEFT):$inicio; |
||
279 | $edif0 = new residentes_edificaciones(); |
||
280 | $edif0->id = \filter_input(INPUT_POST, 'id'); |
||
281 | $edif0->id_edificacion = \filter_input(INPUT_POST, 'id_edificacion'); |
||
282 | $edif0->codigo = $codigo; |
||
283 | $edif0->codigo_interno = $codigo_interno; |
||
284 | $edif0->numero = $item; |
||
285 | $edif0->ubicacion = trim($ubicacion); |
||
286 | $edif0->codcliente = trim($codcliente); |
||
287 | $edif0->ocupado = (bool)$ocupado; |
||
288 | try { |
||
289 | $edif0->save(); |
||
290 | $inmuebles++; |
||
291 | } catch (Exception $exc) { |
||
292 | $this->new_error_msg($exc->getTraceAsString()); |
||
293 | $error++; |
||
294 | } |
||
295 | } |
||
296 | |||
297 | public function agregar_residente() |
||
298 | { |
||
299 | $id_edificacion = \filter_input(INPUT_POST, 'id_edificacion'); |
||
300 | $codcliente = \filter_input(INPUT_POST, 'codcliente'); |
||
301 | $iddireccion = \filter_input(INPUT_POST, 'iddireccion'); |
||
302 | $fecha_ocupacion = \filter_input(INPUT_POST, 'fecha_ocupacion'); |
||
303 | $fecha_disponibilidad = \filter_input(INPUT_POST, 'fecha_disponibilidad'); |
||
304 | $accion = \filter_input(INPUT_POST, 'accion'); |
||
305 | $inmueble = $this->edificaciones->get($id_edificacion); |
||
306 | if ($inmueble and $accion === 'agregar_residente') { |
||
307 | $inmueble->ocupado = true; |
||
308 | $inmueble->codcliente = $codcliente; |
||
309 | $descripcion_direccion = $inmueble->codigo_externo().' - Apartamento '.$inmueble->numero; |
||
310 | $inmueble->iddireccion = $this->actualizar_direccion_residente( |
||
311 | $codcliente, |
||
312 | $iddireccion, |
||
313 | $descripcion_direccion |
||
314 | ); |
||
315 | $inmueble->fecha_ocupacion = ($fecha_ocupacion)?\date('Y-m-d', strtotime($fecha_ocupacion)):null; |
||
316 | $inmueble->fecha_disponibilidad = ($fecha_disponibilidad) |
||
317 | ?\date('Y-m-d', strtotime($fecha_disponibilidad)) |
||
318 | :null; |
||
319 | if ($inmueble->save()) { |
||
320 | $this->new_message('Residente agregado exitosamente.'); |
||
321 | } else { |
||
322 | $this->new_error_msg('No se pudo agregar al residente confirme el '. |
||
323 | 'nombre del residente y las fechs de ocupación y disponibilidad'); |
||
324 | } |
||
325 | } elseif ($inmueble and $accion === 'quitar_residente') { |
||
326 | $inmueble->ocupado = false; |
||
327 | $inmueble->codcliente = ''; |
||
328 | $inmueble->iddireccion = null; |
||
329 | $inmueble->fecha_ocupacion = ''; |
||
330 | $inmueble->fecha_disponibilidad = ''; |
||
331 | if ($inmueble->save()) { |
||
332 | $this->new_message('Residente removido exitosamente.'); |
||
333 | } else { |
||
334 | $this->new_error_msg('No se pudo remover al residente'); |
||
335 | } |
||
336 | } |
||
337 | } |
||
338 | |||
339 | public function tratar_edificaciones() |
||
340 | { |
||
341 | $id = filter_input(INPUT_POST, 'id'); |
||
342 | $precodigo = ""; |
||
343 | $precodigo_interno = array(); |
||
344 | foreach ($this->edificaciones_tipo->all() as $i) { |
||
345 | $campo = "campo_".$i->id; |
||
346 | $linea = filter_input(INPUT_POST, $campo); |
||
347 | $precodigo .= $linea; |
||
348 | $precodigo_interno[$i->id]=$linea; |
||
349 | } |
||
350 | $codigo_p = filter_input(INPUT_POST, 'codigo'); |
||
351 | $codigo_interno_p = filter_input(INPUT_POST, 'codigo_interno'); |
||
352 | $codigo = ($codigo_p)?$codigo_p:$precodigo; |
||
353 | $codigo_interno = ($codigo_interno_p) |
||
354 | ?$codigo_interno_p |
||
355 | : \json_encode($precodigo_interno, JSON_THROW_ON_ERROR); |
||
356 | $numero = filter_input(INPUT_POST, 'numero_edificacion'); |
||
357 | $ubicacion = filter_input(INPUT_POST, 'ubicacion'); |
||
358 | $codcliente = filter_input(INPUT_POST, 'codcliente'); |
||
359 | $ocupado = filter_input(INPUT_POST, 'ocupado'); |
||
360 | $delete = filter_input(INPUT_POST, 'delete'); |
||
361 | if ($delete) { |
||
362 | $item = $this->edificaciones->get($id); |
||
363 | if (!$item->ocupado) { |
||
364 | try { |
||
365 | $item->delete(); |
||
366 | $this->new_message('Edificación eliminada con exito.'); |
||
367 | } catch (Exception $exc) { |
||
368 | $this->new_error_msg('Ocurrió un error al querer eliminar la Edificación. '. |
||
369 | $exc->getTraceAsString()); |
||
370 | } |
||
371 | } else { |
||
372 | $this->new_error_msg('¡No se puede eliminar una edificación que está ocupada!'); |
||
373 | } |
||
374 | } else { |
||
375 | $edif0 = new FacturaScripts\model\residentes_edificaciones(); |
||
376 | $edif0->id = $id; |
||
377 | $edif0->codigo = $codigo; |
||
378 | $edif0->codigo_interno = $codigo_interno; |
||
379 | $edif0->numero = trim($numero); |
||
380 | $edif0->ubicacion = trim($ubicacion); |
||
381 | $edif0->codcliente = trim($codcliente); |
||
382 | $edif0->ocupado = ($ocupado)?"TRUE":"FALSE"; |
||
383 | try { |
||
384 | $edif0->save(); |
||
385 | $this->new_message('¡Edificación guardada exitosamente!'); |
||
386 | } catch (Exception $exc) { |
||
387 | $this->new_error_msg('Ocurrió un error intentando guardar la información. '.$exc->getTraceAsString()); |
||
388 | } |
||
389 | } |
||
390 | $this->edificaciones = new residentes_edificaciones(); |
||
391 | } |
||
392 | |||
393 | public function tratar_tipo_edificaciones() |
||
394 | { |
||
395 | $id = filter_input(INPUT_POST, 'id'); |
||
396 | $descripcion = filter_input(INPUT_POST, 'descripcion'); |
||
397 | $padre = filter_input(INPUT_POST, 'padre'); |
||
398 | $delete = filter_input(INPUT_POST, 'delete'); |
||
399 | if ($delete) { |
||
400 | $item = $this->edificaciones_tipo->get($delete); |
||
401 | if (!$item->hijos()) { |
||
402 | try { |
||
403 | $item->delete(); |
||
404 | $this->new_message('Tipo de edificación eliminada con exito.'); |
||
405 | } catch (ErrorException $e) { |
||
406 | $this->new_error_msg('Ocurrió un error al querer eliminar el tipo de edificación. '. |
||
407 | $e->getTraceAsString()); |
||
408 | } |
||
409 | } else { |
||
410 | $this->new_error_msg('No se puede eliminar un Tipo de edificación que es padre de otros '. |
||
411 | 'tipos de edificación.'); |
||
412 | } |
||
413 | } else { |
||
414 | $tipo0 = new residentes_edificaciones_tipo(); |
||
415 | $tipo0->id = $id; |
||
416 | $tipo0->descripcion = ucfirst(strtolower(trim(htmlspecialchars($descripcion)))); |
||
417 | $tipo0->padre = $padre; |
||
418 | try { |
||
419 | $tipo0->save(); |
||
420 | $this->new_message('¡Tipo de edificación guardado exitosamente!'); |
||
421 | } catch (Exception $exc) { |
||
422 | $this->new_error_msg('Ocurrió un error intentando guardar la información. '.$exc->getTraceAsString()); |
||
423 | } |
||
424 | } |
||
425 | $this->edificaciones_tipo = new residentes_edificaciones_tipo(); |
||
426 | } |
||
427 | |||
428 | public function buscar_tipo_edificaciones() |
||
429 | { |
||
430 | $estructura = $this->edificaciones_tipo->jerarquia(); |
||
431 | $this->template = false; |
||
432 | header('Content-Type: application/json'); |
||
433 | echo json_encode($estructura, JSON_THROW_ON_ERROR); |
||
434 | } |
||
435 | |||
436 | public function obtener_hijos() |
||
437 | { |
||
438 | $this->template = false; |
||
439 | $id_tipo = \filter_input(INPUT_GET, 'id_tipo'); |
||
440 | $hijos = array(); |
||
441 | if ($id_tipo) { |
||
442 | $hijos = $this->edificaciones_tipo->get_by_field('padre', $id_tipo); |
||
443 | } |
||
444 | header('Content-Type: application/json'); |
||
445 | echo json_encode($hijos, JSON_THROW_ON_ERROR); |
||
446 | } |
||
447 | |||
448 | /** |
||
449 | * funcion para guardar los codigos de las edificaciones base Manzana, Zona, Grupo, Edificio, etc |
||
450 | */ |
||
451 | public function agregar($objeto) |
||
452 | { |
||
453 | $inicio = \filter_input(INPUT_POST, 'inicio'); |
||
454 | $final_p = \filter_input(INPUT_POST, 'final'); |
||
455 | $id = \filter_input(INPUT_POST, 'id'); |
||
456 | $codigo_padre = \filter_input(INPUT_POST, 'codigo_padre'); |
||
457 | $padre_id = \filter_input(INPUT_POST, 'padre_id'); |
||
458 | $final=(!empty($final_p))?$final_p:$inicio; |
||
459 | $inmuebles = 0; |
||
460 | $error = 0; |
||
461 | $linea = 0; |
||
462 | foreach (range($inicio, $final) as $item) { |
||
463 | $item = (is_int($item))?str_pad($item, 3, "0", STR_PAD_LEFT):$item; |
||
464 | $punto = new residentes_edificaciones_mapa(); |
||
465 | $punto->id = $id; |
||
466 | $punto->id_tipo = $objeto->id; |
||
467 | $punto->codigo_edificacion = $item; |
||
468 | $punto->codigo_padre = $codigo_padre; |
||
469 | $punto->padre_tipo = $objeto->padre; |
||
470 | $punto->padre_id = $padre_id; |
||
471 | $punto->numero = ''; |
||
472 | if ($punto->save()) { |
||
473 | $inmuebles++; |
||
474 | } else { |
||
475 | $error++; |
||
476 | } |
||
477 | $linea++; |
||
478 | } |
||
479 | if ($error) { |
||
480 | $this->new_error_msg('No puedieron guardarse la informacion de '.$error.' inmuebles, revise su listado.'); |
||
481 | } |
||
482 | $this->new_message('Se guardaron correctamente '.$inmuebles.' inmuebles.'); |
||
483 | } |
||
484 | |||
485 | private function mayusculas($string) |
||
486 | { |
||
487 | return strtoupper(trim(strip_tags(stripslashes($string)))); |
||
488 | } |
||
489 | |||
490 | private function minusculas($string) |
||
491 | { |
||
492 | return strtolower(trim(strip_tags(stripslashes($string)))); |
||
493 | } |
||
494 | |||
495 | public function shared_extensions() |
||
496 | { |
||
497 | $extensiones = array( |
||
498 | array( |
||
499 | 'name' => 'tipo_edificaciones', |
||
500 | 'page_from' => __CLASS__, |
||
501 | 'page_to' => __CLASS__, |
||
502 | 'type' => 'button', |
||
503 | 'text' => '<span class="fa fa-list-ol"></span> Tipo Edificaciones', |
||
504 | 'params' => '&tipo_edificaciones=TRUE' |
||
505 | ), |
||
506 | array( |
||
507 | 'name' => 'configurar_residentes_js', |
||
508 | 'page_from' => __CLASS__, |
||
509 | 'page_to' => __CLASS__, |
||
510 | 'type' => 'head', |
||
511 | 'text' => '<script src="'.FS_PATH. |
||
512 | 'plugins/residentes/view/js/2/residentes.js" type="text/javascript"></script>', |
||
513 | 'params' => '' |
||
514 | ), |
||
515 | array( |
||
516 | 'name' => 'treeview_edificaciones_js', |
||
517 | 'page_from' => __CLASS__, |
||
518 | 'page_to' => __CLASS__, |
||
519 | 'type' => 'head', |
||
520 | 'text' => '<script src="'.FS_PATH. |
||
521 | 'plugins/residentes/view/js/1/bootstrap-treeview.min.js" type="text/javascript"></script>', |
||
522 | 'params' => '' |
||
523 | ), |
||
524 | array( |
||
525 | 'name' => 'treeview_edificaciones_css', |
||
526 | 'page_from' => __CLASS__, |
||
527 | 'page_to' => __CLASS__, |
||
528 | 'type' => 'head', |
||
529 | 'text' => '<link rel="stylesheet" type="text/css" media="screen" href="'.FS_PATH. |
||
530 | 'plugins/residentes/view/css/bootstrap-treeview.min.css"/>', |
||
531 | 'params' => '' |
||
532 | ), |
||
533 | ); |
||
534 | |||
535 | foreach ($extensiones as $ext) { |
||
536 | $fsext0 = new fs_extension($ext); |
||
537 | if (!$fsext0->delete()) { |
||
538 | $this->new_error_msg('Imposible eliminar los datos de la extensión ' . $ext['name'] . '.'); |
||
539 | } |
||
540 | } |
||
541 | |||
542 | $extensiones2 = array( |
||
543 | array( |
||
544 | 'name' => '001_edificaciones_js', |
||
545 | 'page_from' => __CLASS__, |
||
546 | 'page_to' => __CLASS__, |
||
547 | 'type' => 'head', |
||
548 | 'text' => '<script src="'.FS_PATH. |
||
549 | 'plugins/residentes/view/js/1/bootstrap-treeview.min.js" type="text/javascript"></script>', |
||
550 | 'params' => '' |
||
551 | ), |
||
552 | array( |
||
553 | 'name' => '002_edificaciones_js', |
||
554 | 'page_from' => __CLASS__, |
||
555 | 'page_to' => __CLASS__, |
||
556 | 'type' => 'head', |
||
557 | 'text' => '<script src="'.FS_PATH. |
||
558 | 'plugins/residentes/view/js/2/residentes.js" type="text/javascript"></script>', |
||
559 | 'params' => '' |
||
560 | ), |
||
561 | array( |
||
562 | 'name' => '003_edificaciones_js', |
||
563 | 'page_from' => __CLASS__, |
||
564 | 'page_to' => __CLASS__, |
||
565 | 'type' => 'head', |
||
566 | 'text' => '<link rel="stylesheet" type="text/css" media="screen" href="'.FS_PATH. |
||
567 | 'plugins/residentes/view/css/bootstrap-treeview.min.css"/>', |
||
568 | 'params' => '' |
||
569 | ), |
||
570 | ); |
||
571 | |||
572 | foreach ($extensiones2 as $ext) { |
||
573 | $fsext0 = new fs_extension($ext); |
||
574 | if (!$fsext0->save()) { |
||
575 | $this->new_error_msg('Imposible guardar los datos de la extensión ' . $ext['name'] . '.'); |
||
576 | } |
||
577 | } |
||
578 | } |
||
579 | |||
580 | /** |
||
581 | * Función para devolver el valor de una variable pasada ya sea por POST o GET |
||
582 | * @param type string |
||
583 | * @return type string |
||
584 | */ |
||
585 | public function filter_request($nombre) |
||
590 | } |
||
591 | |||
592 | } |
||
593 |