Example #1
0
 protected function info_version()
 {
     $version = toba::proyecto()->get_parametro('version');
     if ($version && !(toba::proyecto()->get_id() == 'toba_editor')) {
         $info = '';
         $version_fecha = toba::proyecto()->get_parametro('version_fecha');
         if ($version_fecha) {
             $info .= "Lanzamiento: <strong>{$version_fecha}</strong> <br />";
         }
         $version_detalle = toba::proyecto()->get_parametro('version_detalle');
         if ($version_detalle) {
             $info .= "<hr />{$version_detalle}<br>";
         }
         $version_link = toba::proyecto()->get_parametro('version_link');
         if ($version_link) {
             $info .= "<hr /><a href=\\'http://{$version_link}\\' target=\"_bank\">Mas informacion</a><br>";
         }
         if ($info) {
             $info = "Version: <strong>{$version}</strong><br>" . $info;
             $info = toba_recurso::ayuda(null, $info, 'enc-version');
         } else {
             $info = "class='enc-version'";
         }
         echo "<div {$info} >";
         echo 'Version <strong>' . $version . '</strong>';
         echo '</div>';
     }
 }
 function __construct($info)
 {
     $this->info = $info;
     parent::__construct(toba::memoria()->get_item_solicitado(), toba::usuario()->get_id());
     $this->log = toba::logger_ws();
     toba::proyecto()->configurar_logger_ws();
 }
Example #3
0
 function conf__formulario(toba_ei_formulario $form)
 {
     if ($this->s__mostrar == 1) {
         // si presiono el boton alta entonces muestra el formulario para dar de alta un nuevo registro
         $this->dep('formulario')->descolapsar();
         $form->ef('nro_norma')->set_obligatorio('true');
         $form->ef('tipo_norma')->set_obligatorio('true');
         $form->ef('emite_norma')->set_obligatorio('true');
         $form->ef('fecha')->set_obligatorio('true');
     } else {
         $this->dep('formulario')->colapsar();
     }
     if ($this->dep('datos')->esta_cargada()) {
         $datos = $this->dep('datos')->tabla('norma')->get();
         $fp_imagen = $this->dep('datos')->tabla('norma')->get_blob('pdf');
         if (isset($fp_imagen)) {
             $temp_nombre = md5(uniqid(time())) . '.pdf';
             $temp_archivo = toba::proyecto()->get_www_temp($temp_nombre);
             $temp_fp = fopen($temp_archivo['path'], 'w');
             stream_copy_to_stream($fp_imagen, $temp_fp);
             fclose($temp_fp);
             $tamano = round(filesize($temp_archivo['path']) / 1024);
             $datos['imagen_vista_previa'] = "<a target='_blank' href='{$temp_archivo['url']}' >norma</a>";
             $datos['pdf'] = 'tamano: ' . $tamano . ' KB';
         } else {
             $datos['pdf'] = null;
         }
         return $datos;
     }
 }
Example #4
0
 /**
  * Retorna una fuente de datos
  *
  * @param string $id Id. de la fuente
  * @param string $proyecto Proyecto al que pertenece la fuente
  * @return toba_fuente_datos
  */
 function get_fuente($id, $proyecto = null)
 {
     if (!isset($proyecto)) {
         $proyecto = toba::proyecto()->get_id();
     }
     if (!isset($id)) {
         $id = $this->get_fuente_predeterminada(true, $proyecto);
     }
     if (!isset($this->fuentes[$id])) {
         $parametros = toba::proyecto()->get_info_fuente_datos($id, $proyecto);
         $clase = isset($parametros['subclase_nombre']) ? $parametros['subclase_nombre'] : 'toba_fuente_datos';
         if (isset($parametros['subclase_archivo'])) {
             $pm = $parametros['punto_montaje'];
             if (toba::proyecto()->get_id() != $proyecto) {
                 //Si la fuente esta extendida, puede necesitar otros archivos del proyecto, agregar el include path
                 $path_proyecto = toba::instancia()->get_path_proyecto($proyecto) . '/php';
                 agregar_dir_include_path($path_proyecto);
             }
             $archivo = $parametros['subclase_archivo'];
             toba_cargador::cargar_clase_archivo($pm, $archivo, $proyecto);
         }
         $this->fuentes[$id] = new $clase($parametros);
     }
     return $this->fuentes[$id];
 }
Example #5
0
 /**
  * Devuelve el vinculo asociado al evento
  * @param boolean $forzar_instancia Por defecto solo se crea una instancia de un vinculo asociada al evento,
  * 		con este parámetro fuerza a crear un nuevo objeto vinculo
  * @return toba_vinculo
  */
 function vinculo($forzar_instancia = false)
 {
     if ($this->posee_accion_vincular()) {
         if (!isset($this->vinculo) || $forzar_instancia) {
             $item = $this->datos['accion_vinculo_item'];
             if ($this->es_autovinculo()) {
                 $aux_it = toba::memoria()->get_item_solicitado();
                 $item = $aux_it[1];
             }
             $this->vinculo = new toba_vinculo(toba::proyecto()->get_id(), $item, $this->datos['accion_vinculo_popup'], $this->datos['accion_vinculo_popup_param']);
             if (isset($this->datos['accion_vinculo_celda']) && !is_null($this->datos['accion_vinculo_celda'])) {
                 $this->vinculo->set_opciones(array('celda_memoria' => $this->datos['accion_vinculo_celda']));
             }
             if (isset($this->datos['accion_vinculo_target']) && !is_null($this->datos['accion_vinculo_target'])) {
                 $this->vinculo->set_target($this->datos['accion_vinculo_target']);
             }
             $this->vinculo->set_propagar_zona();
             if (!$this->es_autovinculo()) {
                 $this->vinculo->agregar_opcion('menu', 1);
             }
             if (isset($this->datos['accion_vinculo_servicio']) && !is_null($this->datos['accion_vinculo_servicio'])) {
                 $this->vinculo->set_servicio($this->datos['accion_vinculo_servicio']);
             }
         }
         return $this->vinculo;
     } else {
         throw new toba_error_def('El evento "' . $this->get_id() . '" no posee un VINCULO ASOCIADO.');
     }
 }
Example #6
0
 function vista_pdf(toba_vista_pdf $salida)
 {
     //Cambio lo márgenes accediendo directamente a la libreríaa PDF
     $pdf = $salida->get_pdf();
     $pdf->ezSetMargins(80, 50, 30, 30);
     //top, bottom, left, right
     //Pie de página
     $formato = 'Página {PAGENUM} de {TOTALPAGENUM}';
     $pdf->ezStartPageNumbers(300, 20, 8, 'left', $formato, 1);
     //x, y, size, pos, texto, pagina inicio
     //Invoco la salida pdf original del cuadro
     toba_ei_cuadro::vista_pdf($salida);
     //Encabezado
     foreach ($pdf->ezPages as $pageNum => $id) {
         $pdf->reopenObject($id);
         $imagen = toba::proyecto()->get_path() . '/www/img/logo-defe.jpg';
         $pdf->addJpegFromFile($imagen, 50, 780, 58, 48);
         //ruta+archivo imagen, x, y, ancho, alto
         $pdf->addText(150, 810, 12, '<b>Centro de Asistencia a la VĂ­ctima y al Testigo del Delito</b>', 0, 'center');
         //$this->addText($xPos, $yPos, $fsize, $text,,align );
         $pdf->addText(165, 790, 12, '<b>DefensorĂ­a del Pueblo de la Provincia de Santa Fe</b>', 0, 'center');
         //$this->addText($xPos, $yPos, $fsize, $text,,align );
         $pdf->addText(250, 770, 14, '<b>HOJA DE RUTA</b>', 0, 'center');
         //$this->addText($xPos, $yPos, $fsize, $text,,align );
         $pdf->closeObject();
     }
 }
Example #7
0
 function pre_contenido()
 {
     echo "<div class='login-titulo'>" . toba_recurso::imagen_proyecto("logo.gif", true);
     echo "<div>versiĂłn " . toba::proyecto()->get_version() . "</div>";
     echo "</div>";
     echo "\n<div align='center' class='cuerpo'>\n";
 }
Example #8
0
 function servicio__descargar()
 {
     $encontre = false;
     $seleccionado = toba::memoria()->get_parametro('fila');
     $obj_data = null;
     $index = 0;
     while (!$encontre && $index < count($this->s__datos)) {
         if ($this->s__datos[$index]['x_dbr_clave'] == $seleccionado) {
             $obj_data = $this->s__datos[$index]['adjunto'];
             $encontre = true;
         }
         $index++;
     }
     if (!is_null($obj_data)) {
         $archivo = toba::proyecto()->get_www_temp($obj_data['name']);
         header("Content-type:{$obj_data['type']}");
         header("Content-Disposition: attachment; filename=\"{$obj_data['name']}\"");
         $handler = fopen($archivo['path'], 'r');
         if ($handler !== false) {
             fpassthru($handler);
         }
     } else {
         echo 'No funciono como debia, REVISAME!';
     }
 }
Example #9
0
 /**
  * Instancia el cliente RDI
  * @return \RDICliente
  * @throws toba_error
  * @ignore
  */
 protected function instanciar_cliente()
 {
     $id_proyecto = $this->proyecto->get_id();
     $ini = new toba_ini($this->instalacion->get_path_carpeta_instalacion() . self::nombre_archivo);
     if (!$ini->existe_entrada($id_proyecto)) {
         throw new toba_error('Falta el archivo de configuraciĂłn rdi.ini');
     }
     $parametros = $ini->get($id_proyecto);
     $nombre = $this->instalacion->get_nombre();
     if (trim($nombre) == '' && !isset($parametros['instalacion'])) {
         throw new toba_error('Falta especificar el nombre de la instalacion en el archivo instalacion.ini');
     }
     $nombre_inst = trim($nombre) != '' ? $nombre : $parametros['instalacion'];
     $rdi = new RDICliente($parametros['conector'], $parametros['repositorio'], $parametros['usuario'], $parametros['clave'], $id_proyecto, $nombre_inst);
     //Agrego un log para desarrollo
     if (!$this->instalacion->es_produccion()) {
         $log = new toba_logger_rdi($id_proyecto);
         $rdi->asociarLog($log);
     }
     //Reviso si existen servicios redefinidos y los asigno
     $serv_personalizados = toba::proyecto()->get_parametro('servicios_rdi', null, false);
     if (!is_null($serv_personalizados)) {
         foreach ($serv_personalizados as $servicio => $clase) {
             $rdi->mapeoServicios()->redefinir($servicio, $clase);
         }
     }
     return $rdi;
 }
 function __construct($proyecto = null)
 {
     if (!isset($proyecto)) {
         $proyecto = toba::proyecto()->get_id();
     }
     $this->proyecto = $proyecto;
 }
Example #11
0
 function vista_pdf(toba_vista_pdf $salida)
 {
     //Cambio lo márgenes accediendo directamente a la librería PDF
     $pdf = $salida->get_pdf();
     $pdf->ezSetMargins(80, 50, 30, 30);
     //top, bottom, left, right
     //Pie de página
     $formato = 'Página {PAGENUM} de {TOTALPAGENUM}';
     $pdf->ezStartPageNumbers(300, 20, 8, 'left', $formato, 1);
     //x, y, size, pos, texto, pagina inicio
     //Inserto los componentes usando la API de toba_vista_pdf
     $salida->titulo($this->get_nombre());
     $salida->mensaje('Nota: Este es el Principal');
     $this->dependencia('filtro')->vista_pdf($salida);
     $this->dependencia('cuadro')->vista_pdf($salida);
     $this->dependencia('formulario')->vista_pdf($salida);
     $salida->salto_pagina();
     $salida->mensaje('Nota: Esta es una copia');
     $this->dependencia('filtro')->vista_pdf($salida);
     $this->dependencia('cuadro')->vista_pdf($salida);
     $this->dependencia('formulario')->vista_pdf($salida);
     $salida->salto_pagina();
     $salida->mensaje('Este es un formulario ML que esta en otra pagina');
     $salida->separacion();
     $this->dependencia('ml')->vista_pdf($salida);
     //Encabezado
     $pdf = $salida->get_pdf();
     foreach ($pdf->ezPages as $pageNum => $id) {
         $pdf->reopenObject($id);
         $imagen = toba::proyecto()->get_path() . '/www/img/logo_toba_siu.jpg';
         $pdf->addJpegFromFile($imagen, 50, 780, 141, 45);
         //imagen, x, y, ancho, alto
         $pdf->closeObject();
     }
 }
Example #12
0
 function generar_layout()
 {
     //El archivo original esta en formato Windows CR/LF
     $nombre = toba::proyecto()->get_path_php() . '/varios/line_endings/archivo_windows.php';
     //Verifico que el archivo original tiene el CR
     assert(strrchr(file_get_contents($nombre), 13) !== false);
     $archivo = new toba_archivo_php($nombre);
     $archivo->edicion_inicio();
     $codigo_actual = $archivo->contenido();
     //Verifico que el codigo original no tiene CR al ser cargado en toba_archivo_php
     assert(strrchr($codigo_actual, 13) === false);
     $metodo = new toba_codigo_metodo_php('extender_objeto_js');
     $metodo->set_contenido("alert('soy un alert nuevo'); \n alert(4);");
     $nuevo_codigo = $archivo->codigo_agregar_metodo($codigo_actual, $metodo->get_codigo());
     $archivo->insertar($nuevo_codigo);
     $archivo->insertar_al_final("function cargo_algo(\$id) \n { echo 'Ingrese \$id'; \n}");
     //Verifico que el nuevo codigo que obtuve tampoco tiene CR antes de ser grabado
     assert(strrchr($archivo->contenido(), 13) === false);
     //Aca grabe el archivo
     $archivo->edicion_fin();
     assert(strrchr(file_get_contents($nombre), 13) === false);
     assert(strrchr(file_get_contents($nombre), PHP_EOL) !== false);
     echo 'El test parece que funco!, revirtiendo archivo....';
     $tsvn = new toba_svn();
     $tsvn->revert($nombre);
 }
Example #13
0
 function evt__formulario__modificacion($datos)
 {
     if (isset($datos['archivo'])) {
         $this->s__nombre_archivo = $datos['archivo']['name'];
         $img = toba::proyecto()->get_www_temp($this->s__nombre_archivo);
         // Mover los archivos subidos al servidor del directorio temporal PHP a uno propio.
         move_uploaded_file($datos['archivo']['tmp_name'], $img['path']);
     }
 }
 function __construct($opciones, $id_servicio, $proyecto = null)
 {
     if (!isset($proyecto)) {
         $proyecto = toba_editor::activado() ? toba_editor::get_proyecto_cargado() : toba::proyecto()->get_id();
     }
     $this->proyecto = $proyecto;
     $this->opciones = $opciones;
     $this->id_servicio = $id_servicio;
 }
Example #15
0
 protected function estilos_css()
 {
     if (toba::proyecto()->get_parametro('es_css3')) {
         echo "<link rel='stylesheet' href='" . toba_recurso::url_toba() . "/js/formalize/stylesheets/formalize.css' />";
     } else {
         echo "\n\t\t\t\t<style type='text/css'>\n\t            #overlay, #capa_espera {\n\t                background-image:url('" . toba_recurso::imagen_toba('nucleo/overlay.gif') . "');               \n\t            }\n\t            .barra-superior {\n\t                background: url('" . toba_recurso::imagen_skin('barra-sup.gif') . "') repeat-x top;\n\t            }\n\t            .ei-cuadro-col-tit, .ei-ml-columna, .ei-filtro-columna {\n\t                background: url('" . toba_recurso::imagen_skin('cuadro-col-titulo.gif') . "') repeat-x top;\n\t            }\n\t            .ei-barra-sup, .ci-botonera {\n\t                background: url('" . toba_recurso::imagen_skin('barra-sup.gif') . "') repeat-x top;\n\t            }\n\t            .ci-tabs-h-lista {\n\t            \tbackground: url('" . toba_recurso::imagen_skin('tabs/bg.gif') . "') repeat-x bottom;\n\t            }\n\t            .ci-tabs-h-solapa {\n\t\t\t\t\tbackground:url('" . toba_recurso::imagen_skin('tabs/left.gif') . "') no-repeat left top;\t            \n\t            }\n\t            .ci-tabs-h-solapa a {\t\t\t\t\n\t            \tbackground:url('" . toba_recurso::imagen_skin('tabs/right.gif') . "') no-repeat right top;\n\t            }\t            \n\t            .ci-tabs-h-solapa-sel {\n\t\t\t\t\tbackground:url('" . toba_recurso::imagen_skin('tabs/left_on.gif') . "') no-repeat left top;\t            \n\t            }\n\t            .ci-tabs-h-solapa-sel a {\t\t\t\t\n\t            \tbackground:url('" . toba_recurso::imagen_skin('tabs/right_on.gif') . "') no-repeat right top;\n\t            }\n\t\t\t\t</style>\n\t\t\t";
     }
     echo "\n\t\t<style type='text/css'>\n\t\t\t#overlay, #capa_espera {\n\t\t\t\tbackground-image:url('" . toba_recurso::imagen_toba('nucleo/overlay.gif') . "');     \t\t\t\n\t\t\t}\n\t\t\t#barra_superior {\n\t\t\t\tdisplay:none;\n\t\t\t}\n\t\t</style>\t\t\t\n\t\t";
 }
Example #16
0
 function recuperar_contenido()
 {
     $srv = toba::rdi()->servicio(RDITipos::FOTO);
     $attr = $srv->recuperarAtributos($this->s__id_recurso);
     $content = $srv->recuperarContenido($this->s__id_recurso);
     $nombre = toba::proyecto()->get_www_temp($attr['tipoIdentificacion'] . $attr['numeroIdentificacion']);
     file_put_contents($nombre['path'], $content);
     return $nombre;
 }
Example #17
0
 function ini()
 {
     $fuente = toba::proyecto()->get_parametro('fuente_datos');
     ei_arbol(toba::perfil_de_datos()->get_id(), 'get_id');
     ei_arbol(toba::perfil_de_datos()->posee_restricciones($fuente), 'posee_restricciones');
     ei_arbol(toba::perfil_de_datos()->get_restricciones($fuente), 'get_restricciones');
     ei_arbol(toba::perfil_de_datos()->get_lista_dimensiones_restringidas($fuente), 'get_lista_dimensiones_restringidas');
     ei_arbol(toba::perfil_de_datos()->get_gatillos_activos($fuente), 'get_gatillos_activos');
 }
Example #18
0
 function conf__inicial()
 {
     require_once 'php_referencia.php';
     //toba::menu()->set_abrir_nueva_ventana();
     toba::db()->set_parser_errores(new toba_parser_error_db_postgres7());
     toba::mensajes()->set_fuente_ini(toba::proyecto()->get_path() . '/mensajes.ini');
     //Autenticacion personalizada
     /*$autentificacion = new toba_autenticacion_ldap('ldap-test.siu.edu.ar', "dc=ldap,dc=siu,dc=edu,dc=ar");
     		toba::manejador_sesiones()->set_autenticacion($autentificacion);*/
 }
Example #19
0
 protected static function get_redefinicion_parametro_runtime($proyecto, $seccion, $parametro = null, $obligatorio = true)
 {
     $variable_instancia = self::get_instancia()->get_parametro_seccion_proyecto($proyecto, $parametro);
     $variable_proyecto = toba::proyecto()->get_parametro($seccion, $parametro, $obligatorio);
     //Uso el proyecto cargado actualmente, no pido ninguno en particular ya que esto sale del runtime
     if (!is_null($variable_instancia)) {
         $variable_proyecto = $variable_instancia;
     }
     return $variable_proyecto;
 }
Example #20
0
 protected function get_subclase_usuario_proyecto()
 {
     $subclase = 'toba_usuario';
     $archivo = toba::proyecto()->get_parametro('usuario_subclase_archivo');
     $pm = toba::proyecto()->get_parametro('pm_usuario');
     if (trim($archivo) != '') {
         toba_cargador::cargar_clase_archivo($pm, $archivo, toba::proyecto()->get_id());
         $subclase = toba::proyecto()->get_parametro('usuario_subclase');
     }
     return $subclase;
 }
Example #21
0
 public static function log($message)
 {
     if (self::ENABLE_LOGGING) {
         $dir_base = toba::instancia()->get_path_instalacion_proyecto(toba::proyecto()->get_id()) . '/logs/';
         if (self::$fh == null) {
             self::$fh = fopen($dir_base . self::LOGGING_FILENAME, 'a');
         }
         $args = func_get_args();
         $arg = call_user_func_array('sprintf', $args);
         fputs(self::$fh, sprintf("[%s] %s: %s\n", date('r'), self::getCaller(), $arg));
     }
 }
Example #22
0
 function __construct()
 {
     $this->xml = new toba_vista_xml();
     //$this->fop se debe obtener desde la variable en instalacion.ini
     $fop = toba::instalacion()->get_xslfo_fop();
     $this->fop = $fop ? $fop : (toba_manejador_archivos::es_windows() ? 'fop.bat' : 'fop');
     $this->fop = toba_manejador_archivos::path_a_plataforma($this->fop);
     $prxsl = toba::proyecto()->get_path() . '/exportaciones/pdf_proyecto.xsl';
     $toxsl = toba::nucleo()->toba_dir() . '/exportaciones/pdf.xsl';
     $this->xsl_proyecto = toba_manejador_archivos::existe_archivo_en_path($prxsl) ? $prxsl : $toxsl;
     $this->xsl_proyecto = toba_manejador_archivos::path_a_plataforma($this->xsl_proyecto);
     $this->xml_proyecto = toba_manejador_archivos::path_a_plataforma(tempnam(toba::nucleo()->toba_dir() . '/temp', 'xml'));
 }
Example #23
0
 function conf__cuadro(toba_ei_cuadro $cuadro)
 {
     $path = toba::proyecto()->get_path() . '/exportaciones/jasper';
     $archivos = toba_manejador_archivos::get_archivos_directorio($path, '/.jasper$/', true);
     $datos = array();
     $i = 0;
     foreach ($archivos as $archivo) {
         $this->s__paths[$i] = $archivo;
         $datos[$i]['path'] = $i;
         $datos[$i]['reporte'] = ucwords(str_replace('_', ' ', basename($archivo, '.jasper')));
         $i++;
     }
     $cuadro->set_datos($datos);
 }
 function verificar_clave_vencida($id_usuario)
 {
     $parametros = array($id_usuario);
     $subclase = toba::proyecto()->get_parametro('usuario_subclase');
     $archivo = toba::proyecto()->get_parametro('usuario_subclase_archivo');
     if ($subclase && $archivo) {
         require_once $archivo;
         $clase = $subclase;
     } else {
         $clase = 'toba_usuario_basico';
     }
     $estado = call_user_func_array(array($clase, 'verificar_clave_vencida'), $parametros);
     return $estado;
 }
Example #25
0
 protected function generar_html_encabezado()
 {
     echo "<html><head>";
     $estilo = toba::proyecto()->get_parametro('estilo');
     echo toba_recurso::link_css("toba_impr", 'screen');
     echo toba_recurso::link_css("toba_impr", 'print');
     echo "<style type='text/css' media='print'>\n\t\t\t.barra-impresion {\n\t\t\t\tdisplay: none;\t\t\t\t\n\t\t\t}\n\t\t\t</style>\n";
     toba_js::cargar_consumos_basicos();
     echo "</head><body>\n";
     echo "<div class='barra-impresion'>";
     echo "<button onclick='window.print()'>" . toba_recurso::imagen_toba('impresora.gif', true, null, null) . "    Imprimir</button>";
     echo "</div>";
     echo $this->encabezado();
 }
Example #26
0
 /**
  * Retorna un mensaje asociado a un componente especĂ­fico
  * @param mixed $parametros Parámetros posicionales a ser reemplazados en el mensaje (puede ser uno solo o un array)
  */
 function get_componente($objeto, $indice, $parametros = null)
 {
     $datos = toba::proyecto()->get_mensaje_objeto($objeto, $indice);
     if (!is_array($datos)) {
         //Retorna null para que siga la busqueda al GLOBAL
         $mensaje = null;
     } else {
         if (trim($datos['m']) == "") {
             $mensaje = null;
         } else {
             $mensaje = self::parsear_parametros($datos['m'], $parametros);
         }
     }
     return $mensaje;
 }
Example #27
0
 static function get_proyecto_defecto()
 {
     $proyecto = toba::memoria()->get_dato_instancia('proyecto');
     if (isset($proyecto)) {
         return $proyecto;
     }
     $proyectos = toba::manejador_sesiones()->get_proyectos_activos();
     if (count($proyectos) > 1) {
         foreach ($proyectos as $proyecto) {
             if ($proyecto != toba::proyecto()->get_id()) {
                 return $proyecto;
             }
         }
     }
 }
Example #28
0
 /**
  * @ignore
  */
 protected function preparar_componente()
 {
     if (!isset($this->_info_mapa['mapfile_path'])) {
         toba::logger()->error('El componente ' . $this->_id[1] . ' no posee un archivo map definido.');
         throw new toba_error_def('Falta especificar un map file para el componente');
     }
     $ruta = toba::proyecto()->get_path_php() . '/' . $this->_info_mapa['mapfile_path'];
     try {
         $this->_mapa = new MapObj($ruta);
     } catch (Exception $e) {
         toba::logger()->error($e->getMessage());
         throw new toba_error('No se pudo crear el objeto Mapserver');
     }
     $this->analizar_layers();
     parent::preparar_componente();
 }
Example #29
0
 /**
  * @ignore Metodo interno que llama la solicitud web para obtener las configuraciones del servicio 
  */
 public static function _get_opciones($id, $clase)
 {
     $seguro = false;
     self::cargar_ini($id);
     $directorio = toba_instancia::get_path_instalacion_proyecto(toba::proyecto()->get_id()) . "/servicios_serv/{$id}";
     if (isset(self::$ini)) {
         chdir($directorio);
         if (self::$ini->existe_entrada('conexion')) {
             self::$opciones = self::$ini->get_datos_entrada('conexion');
         }
         if (self::$ini->existe_entrada('certificado')) {
             $seguridad = array("sign" => true, "encrypt" => true, "algorithmSuite" => "Basic256Rsa15", "securityTokenReference" => "IssuerSerial");
             $policy = new WSPolicy(array("security" => $seguridad));
             //Agrego los certificados manualmente
             if (!file_exists(self::$ini->get("certificado", "clave_servidor"))) {
                 throw new toba_error("El archivo " . self::$ini->get("certificado", "clave_servidor") . " no existe");
             }
             $clave_privada = ws_get_cert_from_file(self::$ini->get("certificado", "clave_servidor"));
             if (!file_exists(self::$ini->get("certificado", "cert_servidor"))) {
                 throw new toba_error("El archivo " . self::$ini->get("certificado", "cert_servidor") . " no existe");
             }
             $certificado_servidor = ws_get_cert_from_file(self::$ini->get("certificado", "cert_servidor"));
             $certificados = array("privateKey" => $clave_privada, "certificate" => $certificado_servidor);
             $security = new WSSecurityToken($certificados);
             self::$opciones['policy'] = $policy;
             self::$opciones['securityToken'] = $security;
             $seguro = true;
         }
         //Averiguo los IDs de firmas definidos
         foreach (self::$ini->get_entradas() as $entrada => $valores) {
             if (strpos($entrada, '=')) {
                 if (file_exists($valores['archivo'])) {
                     $pares = array();
                     foreach (explode(",", $entrada) as $par) {
                         list($clave, $valor) = explode('=', trim($par));
                         $pares[$clave] = $valor;
                     }
                     self::agregar_mapeo_firmas(realpath($valores['archivo']), $pares, $valores['fingerprint']);
                 } else {
                     throw new toba_error("El archivo {$valores['archivo']} no existe");
                 }
             }
         }
     }
     self::$opciones = array_merge(self::$opciones, call_user_func(array($clase, 'get_opciones')));
     return self::$opciones;
 }
Example #30
0
 static function get_runtime_clase_y_datos($id, $tipo = null, $usar_cache = false)
 {
     // Controla la integridad de la clave
     self::control_clave_valida($id);
     if (!isset($tipo)) {
         $tipo = toba_cargador::get_tipo($id);
     }
     // Cargo los metadatos
     if (toba::nucleo()->utilizar_metadatos_compilados($id['proyecto'])) {
         $datos = self::get_metadatos_compilados($id, $tipo == 'toba_item');
     } else {
         $datos = toba_cargador::instancia()->get_metadatos_extendidos($id, $tipo);
     }
     //--- INSTANCIACION	---
     if ($tipo != 'toba_item') {
         //**** Creacion de OBJETOS
         $instancia_nro = 0;
         $clase = $tipo;
         if (!$usar_cache || !isset(self::$objetos_runtime_instanciados[$id['componente']])) {
             //Posee una subclase asociada?
             if ($datos['_info']['subclase']) {
                 if (isset($datos['_info']['subclase_archivo'])) {
                     //Puede estar en un autoload
                     self::cargar_clase($datos, $id['proyecto']);
                 }
                 $clase = $datos['_info']['subclase'];
             } else {
                 $clase = get_nombre_clase_extendida($clase, $id['proyecto'], toba::proyecto()->get_clases_extendidas());
             }
             //Averiguo cuantas instancias previas de este componente fueron creadas
             if (!isset(self::$objetos_runtime_instanciados[$id['componente']])) {
                 $instancia_nro = 0;
                 self::$objetos_runtime_instanciados[$id['componente']] = array();
             } else {
                 $instancia_nro = count(self::$objetos_runtime_instanciados[$id['componente']]);
             }
         }
         $datos['_const_instancia_numero'] = $instancia_nro;
     } else {
         //**** Creacion de ITEMS
         $clase = "toba_solicitud_" . $datos['basica']['item_solic_tipo'];
     }
     return array($tipo, $clase, $datos);
 }