public function __construct() { parent::__construct(); sessionValidation(); $this->load->model("noticia_model", "_noticia_model"); $this->load->model("noticia_vista_model", "_noticia_vista_model"); }
/** * */ public function __construct() { parent::__construct(); sessionValidation(); $this->load->helper(array("modulo/alarma/alarma_form")); $this->load->model("hospital_model", "_hospital_model"); }
/** * Constructor */ public function __construct() { parent::__construct(); $this->load->model("emergencia_model", "emergencia_model"); $this->load->model("emergencia_estado_model", "emergencia_estado_model"); $this->load->library(array("evento/evento_historial")); sessionValidation(); }
/** * */ public function __construct() { parent::__construct(); sessionValidation(); $this->load->model("marea_roja_model", "_marea_roja_model"); $this->load->model("region_model", "_region_model"); $this->load->model("modulo_model", "_modulo_model"); $this->load->helper(array("modulo/usuario/usuario_form", "modulo/comuna/form")); }
/** * Constructor */ public function __construct() { parent::__construct(); $this->load->model("alarma_model", "AlarmaModel"); $this->load->model("alarma_estado_model", "AlarmaEstadoModel"); $this->load->model("emergencia_model", "EmergenciaModel"); $this->load->model("emergencia_estado_model", "EmergenciaEstadoModel"); $this->load->model("tipo_emergencia_model", "EmergenciaTipoModel"); sessionValidation(); $this->load->helper("modulo/evento/permiso"); }
public function obtenerJsonDtTipos() { $this->load->helper("session"); sessionValidation(); $this->load->model("tipo_instalacion_model", "TipoInstalacion"); $tipos = $this->TipoInstalacion->obtenerTodos(); $retorno = array(); foreach ($tipos as $t) { $retorno[] = array("DT_RowId" => "DTRow_TipIns_" . $t["aux_ia_id"], "aux_ia_id" => $t["aux_ia_id"], "aux_c_nombre" => $t["aux_c_nombre"], "amb_c_nombre" => $t["amb_c_nombre"]); } echo json_encode(array("data" => $retorno)); }
/** * */ public function __construct() { parent::__construct(); $this->load->library(array("usuario", "evento/evento_historial")); $this->load->helper("modulo/evento/permiso"); $this->usuario->setModulo("alarma"); $this->load->model('emergencia_model', '_emergencia_model'); $this->load->model("emergencia_comuna_model", "_emergencia_comuna_model"); $this->load->model("emergencia_estado_model", "_emergencia_estado_model"); $this->load->model("tipo_emergencia_model", "_emergencia_tipo_model"); sessionValidation(); }
/** * Constructor */ public function __construct() { parent::__construct(); sessionValidation(); $this->load->model("marea_roja_desembarco_model", "_marea_roja_desembarco_model"); $this->load->model("region_model", "_region_model"); $this->load->model("modulo_model", "_modulo_model"); $this->load->model("laboratorio_model", "_laboratorio_model"); $this->_id_region = Region_Model::LOS_LAGOS; $this->load->helper(array("modulo/usuario/usuario_form", "modulo/comuna/form", "modulo/marea_roja/permiso", "modulo/marea_roja/form", "modulo/marea_roja_desembarco/grilla", "modulo/direccion/region", "modulo/direccion/comuna", "modulo/comuna/default", "modulo/laboratorio/form", "modulo/laboratorio/default")); $this->load->library(array("module/marea_roja_desembarco/marea_roja_desembarco_datos", "module/usuario/usuario_configuracion")); }
public function subir_CapaTemp() { $this->load->library("capa/capageojson"); $error = false; $this->load->helper(array("session", "debug")); $this->load->driver('cache', array('adapter' => 'apc', 'backup' => 'file')); sessionValidation(); if (!isset($_FILES)) { show_error("No se han detectado archivos", 500, "Error interno"); } $properties = array(); $arr_filename = array(); $tmp_prop_array = array(); $tipo_geometria = array(); $error = false; $error_mensaje = ''; /* validar archivos */ if (isset($_FILES['input-capa-geojson'])) { $nombre = explode(".", $_FILES['input-capa-geojson']['name']); $ext = end($nombre); if ($ext != 'geojson') { $error = true; $error_mensaje = 'Extensión no válida para archivo GeoJSON'; } } elseif (isset($_FILES['input-capa-shape'])) { $nombres = $_FILES['input-capa-shape']['name']; for ($i = 0; $i < sizeof($nombres); $i++) { $nombre = explode(".", $nombres[$i]); $ext = end($nombre); if ($ext != 'shp' and $ext != 'dbf') { $error = true; $error_mensaje = 'Extensión no válida para archivo Shape'; } } } if ($error === false) { $prefijo = uniqid(); if (isset($_FILES['input-capa-geojson'])) { $tipo = 'geojson'; $tmp_name = $_FILES['input-capa-geojson']['tmp_name']; $nombres = $_FILES['input-capa-geojson']['name']; $size = $_FILES['input-capa-geojson']['size']; $type = $_FILES['input-capa-geojson']['type']; $nombre_geojson = 'media/tmp/capa_' . $prefijo . '_' . $nombres; $tmp_geojson = 'media/tmp/tmp_' . $prefijo . '_' . $nombres; $geojson = fopen($nombre_geojson, 'w'); fwrite($geojson, file_get_contents($tmp_name)); fclose($geojson); $mapsharper = shell_exec('node --expose-gc /usr/bin/mapshaper -i ' . $nombre_geojson . ' -simplify 35% -o format=geojson ' . $tmp_geojson); unlink($nombre_geojson); } else { $tipo = 'shape'; $tmp_name = $_FILES['input-capa-shape']['tmp_name']; $nombres = $_FILES['input-capa-shape']['name']; $size = $_FILES['input-capa-shape']['size']; $type = $_FILES['input-capa-shape']['type']; for ($i = 0; $i < sizeof($tmp_name); $i++) { $extension = explode('.', $nombres[$i]); $ext = end($extension); if ($ext == 'shp') { $nombre_capa = 'media/tmp/capa_' . $prefijo . '_' . $nombres[$i]; $ext_geojson = str_replace('.shp', '.geojson', $nombres[$i]); $tmp_geojson = 'media/tmp/tmp_' . $prefijo . '_' . $ext_geojson; $geojson = fopen($nombre_capa, 'w'); fwrite($geojson, file_get_contents($tmp_name[$i])); fclose($geojson); } else { $nombre_dbf = 'media/tmp/capa_' . $prefijo . '_' . $nombres[$i]; $geojson = fopen($nombre_dbf, 'w'); fwrite($geojson, file_get_contents($tmp_name[$i])); fclose($geojson); } } $log = array(); $mapsharper = exec('node --expose-gc /usr/bin/mapshaper -i ' . $nombre_capa . ' -simplify 35% -o format=geojson ' . $tmp_geojson, $log, $retorno); fb($log); fb($retorno); fb($tmp_geojson); unlink($nombre_capa); unlink($nombre_dbf); } $arr_error_filenames = array(); $poligono = null; $icono = null; if (is_file($tmp_geojson)) { $fp = file_get_contents($tmp_geojson, 'r'); $nombre_archivo = end(explode("/", $tmp_geojson)); $size = filesize($tmp_geojson); $type = mime_content_type($tmp_geojson); } else { $fp = file_get_contents($tmp_name, 'r'); $nombre_archivo = $nombres; } $error = false; /*$fp = file_get_contents($tmp_geojson, 'r');*/ $arr_properties = json_decode(utf8_encode($fp), true); // var_dump($arr_properties['features'][0]['properties']);die; if (!isset($arr_properties['features'][0]['properties'])) { $error = true; $arr_error_filenames[] = $nombres[$i]; } else { $nombre_cache_id = 'file_temp_' . uniqid(); $arr_cache = array('filename' => $nombre_archivo, 'nombre_cache_id' => $nombre_cache_id, 'content' => $fp, 'size' => $size, 'type' => $type); /*$this->cache->save($nombre_cache_id, $arr_cache, 28800);*/ $file = fopen('media/tmp/' . $nombre_cache_id, 'w+b'); fwrite($file, serialize($arr_cache)); fclose($file); /* ejecutar script para reducir geojson */ foreach ($arr_properties['features'][0]['properties'] as $k => $v) { if (in_array($k, $tmp_prop_array)) { // reviso que no se me repitan las propiedades continue; } $k_name = str_replace(" ", "_", $k); $properties['data'][] = array("<input class='propiedades' id='prop_{$k_name}' name='prop_{$k_name}' type='checkbox' checked=checked />", $k); $tmp_prop_array[] = $k_name; } $arr_filename['data'][] = array($nombres[$i], "<select name=iComunas_" . ($i + 1) . " id=iComunas_" . ($i + 1) . " class='form-control iComunas required' placeholder='Comuna de la capa' ></select> <input name=tmp_file_" . ($i + 1) . " id=tmp_file_" . ($i + 1) . " value='{$nombre_cache_id}' type=hidden />"); $this->capageojson->setGeojson($arr_properties); $geometrias = $this->capageojson->listGeometry(); if (in_array("Polygon", $geometrias) or in_array("MultiPolygon", $geometrias) or in_array("MultiLineString", $geometrias)) { $poligono = array("Poligonos", "<input name=\"color_poligono\" id=\"color_poligono\" placeholder=\"Color del poligono o linea\" type='text' class=\"colorpicker required\" value=\"\"/>"); } if (in_array("Point", $geometrias)) { $icono = array("Icono", "<select name=\"icono_color\" id=\"icono_color\" style=\"width: 300px\" placeholder=\"Icono de los marcadores\" class=\" select2-images required\">" . "<option value=\"\"></option>" . "<option value=\"" . base_url("assets/img/markers/spotlight-poi.png") . "\">Rojo</option>" . "<option value=\"" . base_url("assets/img/markers/spotlight-poi-yellow.png") . "\">Amarillo</option>" . "<option value=\"" . base_url("assets/img/markers/spotlight-poi-blue.png") . "\">Azul</option>" . "<option value=\"" . base_url("assets/img/markers/spotlight-poi-green.png") . "\">Verde</option>" . "<option value=\"" . base_url("assets/img/markers/spotlight-poi-pink.png") . "\">Rosado</option>" . "<option value=\"" . base_url("assets/img/markers/spotlight-poi-black.png") . "\">Negro</option>" . "</select>"); } } if (!is_null($poligono)) { $tipo_geometria['data'][] = $poligono; } if (!is_null($icono)) { $tipo_geometria['data'][] = $icono; } } echo $error ? json_encode(array("uploaded" => 0, "error_filenames" => $arr_error_filenames, "error_mensaje" => $error_mensaje, 'properties' => $properties, 'filenames' => $arr_filename, 'geometry' => $tipo_geometria)) : json_encode(array("uploaded" => 1, 'nombre_cache_id' => $nombre_cache_id, 'error_mensaje' => $error_mensaje, 'properties' => $properties, 'filenames' => $arr_filename, 'geometry' => $tipo_geometria)); }
/** * */ public function subir_acta() { $params = $this->uri->uri_to_assoc(); $id = $params['id']; $error = false; $this->load->helper(array("session", "debug")); $this->load->library("cache"); sessionValidation(); if (!isset($_FILES)) { show_error("No se han detectado archivos", 500, "Error interno"); } $tmp_name = $_FILES['acta']['tmp_name']; $total = count($tmp_name); $nombres = $_FILES['acta']['name']; $size = $_FILES['acta']['size']; $type = $_FILES['acta']['type']; $binary_path = 'media/doc/marea_roja/muestra/' . $id; if (!is_dir($binary_path)) { @mkdir($binary_path, 0777, true); } $this->load->model('marea_roja_actas_model', 'MareaRojaActasModel'); $json = array(); $valido = 0; for ($i = 0; $i < $total; $i++) { $fp = file_get_contents($tmp_name[$i], 'r'); $nombre = str_replace(' ', '_', $nombres[$i]); $sha = sha1($nombre); $mime = $type[$i]; $ruta_archivo = $binary_path . '/' . $nombre; $ftmp = fopen($ruta_archivo, 'w'); fwrite($ftmp, $fp); fclose($ftmp); if (is_file($ruta_archivo) and is_readable($ruta_archivo)) { $this->MareaRojaActasModel->deleteByMarea($id); $data = array('id_marea' => $id, 'id_usuario' => $this->session->userdata('session_idUsuario'), 'fc_fecha_acta' => date('Y-m-d H:i:s'), 'gl_nombre_acta' => $nombre, 'gl_ruta_acta' => $ruta_archivo, 'gl_mime_acta' => $mime, 'gl_sha_acta' => $sha); if ($this->MareaRojaActasModel->insert($data)) { $valido++; } } } if ($total == $valido) { $json['estado'] = true; $json['mensaje'] = 'Archivo(s) subido(s) correctamente'; } elseif ($valido > 0 and $total > $valido) { $json['estado'] = true; $json['mensaje'] = 'Hubieron algunos archivos que no se subieron'; } elseif ($valido == 0) { $json['estado'] = false; $json['mensaje'] = 'Errores al subir archivos'; } echo json_encode($json); }
/** * */ public function __construct() { parent::__construct(); sessionValidation(); $this->load->model("rabia_vacunacion_model", "_rabia_vacunacion_model"); }
/** * Index */ public function __construct() { parent::__construct(); sessionValidation(); $this->load->library(array("core/sistema/sistema_base")); }
function download_file() { $this->load->helper(array("session", "debug")); sessionValidation(); $params = $this->uri->uri_to_assoc(); fb($params); $this->load->model("archivo_model", "ArchivoModel"); $this->ArchivoModel->descargar($params['hash']); }
/** * */ protected function _validarSession() { sessionValidation(); }
/** * Index */ public function __construct() { parent::__construct(); sessionValidation(); }
/** * */ public function __construct() { parent::__construct(); sessionValidation(); $this->load->model("embarazos_model", "_embarazos_model"); }
/** * */ public function __construct() { parent::__construct(); sessionValidation(); $this->load->model("intoxicacion_model", "_intoxicacion_model"); }