Example #1
0
 function evt__mostrar()
 {
     //-- Cual es el mensaje a mostrar?
     $mensaje = null;
     switch ($this->s__opciones['origen']) {
         case 'mensaje_manual':
             $mensaje = $this->s__opciones['texto'];
             $pepe = null;
             break;
         case 'mensaje_componente':
             //Mensaje propio del componente
             $mensaje = $this->get_mensaje('info_local', array('uno', 'dos', 'tres'));
             break;
         case 'mensaje_global':
             $mensaje = toba::mensajes()->get('info_global', array('primer', date('d/M/Y')));
             break;
     }
     switch ($this->s__opciones['componente']) {
         case 'modal':
             toba::notificacion()->agregar($mensaje, $this->s__opciones['nivel']);
             break;
         case 'pantalla':
             $this->pantalla()->agregar_notificacion($mensaje, $this->s__opciones['nivel']);
             break;
         case 'formulario':
             $this->dep('opciones')->agregar_notificacion($mensaje, $this->s__opciones['nivel']);
             break;
     }
 }
Example #2
0
 function evt__formulario__baja()
 {
     $this->dep('datos')->eliminar_todo();
     toba::notificacion()->agregar('Se ha eliminado a la persona', 'info');
     $this->s__mostrar = 0;
     $this->resetear();
 }
Example #3
0
 function evt__cuadro__anular($datos)
 {
     //print_r($this->s__datos_filtro);//uni_acad = 'FAIF' AND	nro_540 = '481'3,1
     $sele = array();
     foreach ($this->s__datos as $key => $value) {
         $sele[] = $value['id_designacion'];
     }
     $comma_separated = implode(',', $sele);
     toba::db()->abrir_transaccion();
     try {
         $sql = "update impresion_540 set estado='A' where id=" . $this->s__datos_filtro['nro_540']['valor'];
         toba::db('designa')->consultar($sql);
         $sql = "insert into designacionh select * from designacion where id_designacion in (" . $comma_separated . ") ";
         toba::db('designa')->consultar($sql);
         $sql = "select count(distinct id_designacion) as cant from designacion where id_designacion in (" . $comma_separated . ") ";
         $res = toba::db('designa')->consultar($sql);
         $mensaje = '';
         if (count($res[0]) > 0) {
             $mensaje = "Se anularon " . $res[0]['cant'] . " designaciones";
         }
         $sql = "update designacion set nro_540=null where id_designacion in (" . $comma_separated . ") ";
         toba::db('designa')->consultar($sql);
         toba::notificacion()->agregar(utf8_decode('La anulación se realizó con éxito.' . $mensaje), "info");
         toba::db()->cerrar_transaccion();
     } catch (toba_error_db $e) {
         toba::db()->abortar_transaccion();
         throw $e;
     }
 }
Example #4
0
 function evt__eliminar()
 {
     $this->dependencia('datos')->eliminar();
     $this->eliminado = true;
     toba::notificacion()->agregar('El usuario ha sido eliminado.', 'info');
     $this->evt__cancelar();
 }
Example #5
0
    /**
     * Seguridad programada completamente
     */
    function evt__form__enviar($datos)
    {
        $carpeta = dirname(__FILE__);
        //--1- Arma el mensaje	(incluyendo los headers)
        $this->s__echo = $datos;
        $clave = xml_encode($datos['clave']);
        $valor = xml_encode($datos['valor']);
        $payload = <<<XML
<ns1:test xmlns:ns1="http://siu.edu.ar/toba_referencia/serv_pruebas">
\t<texto>{$clave} {$valor}</texto>
</ns1:test>
XML;
        $mensaje = new toba_servicio_web_mensaje($payload);
        //--2- Arma el servicio indicando certificado del server y clave privada del cliente
        $cert_server = ws_get_cert_from_file($carpeta . '/servidor.crt');
        $clave_privada = ws_get_key_from_file($carpeta . "/cliente.pkey");
        $cert_cliente = ws_get_cert_from_file($carpeta . "/cliente.crt");
        $seguridad = array("sign" => true, "encrypt" => true, "algorithmSuite" => "Basic256Rsa15", "securityTokenReference" => "IssuerSerial");
        $policy = new WSPolicy(array("security" => $seguridad));
        $security_token = new WSSecurityToken(array("privateKey" => $clave_privada, "receiverCertificate" => $cert_server, "certificate" => $cert_cliente));
        $opciones = array('to' => 'http://localhost/' . toba_recurso::url_proyecto() . '/servicios.php/serv_seguro_codigo', 'action' => 'http://siu.edu.ar/toba_referencia/serv_pruebas/test', 'policy' => $policy, 'securityToken' => $security_token);
        $servicio = toba::servicio_web('cli_seguro', $opciones);
        //-- 3 - Muestra la respuesta
        $respuesta = $servicio->request($mensaje);
        toba::notificacion()->info($respuesta->get_payload());
    }
Example #6
0
 function evt__cuadro_producto__eliminar($datos)
 {
     if ($this->tablaProdutos()->eliminar_producto($datos['id_producto'])) {
         toba::notificacion()->info("Se ha eliminado el producto");
     } else {
         toba::notificacion()->agregar("Hubo un problema al eliminar el producto. Por favor, refresque la página e inténtelo nuevamente");
     }
 }
Example #7
0
 function evt__form_antispam__modificacion($datos)
 {
     if ($datos['ef_antispam']) {
         toba::notificacion()->info('El código ingresado es correcto. Felicitaciones, has superado la prueba!.');
     } else {
         toba::notificacion()->error('El código ingresado es incorrecto. Inténtalo de nuevo, vamos que no es tan difícil!.');
     }
 }
Example #8
0
 function evt__form__baja()
 {
     try {
         $this->dep('tabla')->eliminar_todo();
     } catch (toba_error $e) {
         toba::notificacion()->agregar('No es posible eliminar el registro.');
     }
     $this->dep('tabla')->resetear();
 }
Example #9
0
 function evt__eliminar()
 {
     $this->get_entidad()->eliminar();
     $this->elemento_eliminado = true;
     $zona = toba::solicitud()->zona();
     $zona->resetear();
     toba::notificacion()->agregar('El elemento ha sido eliminado.', 'info');
     admin_util::refrescar_editor_item();
 }
 function conf__cuadro(toba_ei_cuadro $cuadro)
 {
     if (isset($this->s__datos_filtro)) {
         if ($this->s__datos_filtro['idunidad_academica']['condicion'] == 'es_distinto_de') {
             toba::notificacion()->agregar(utf8_decode('Seleccione la condición: es igual a'), 'info');
         } else {
             $cuadro->set_datos($this->dep('datos')->tabla('departamento')->get_listado_completo($this->s__where));
         }
     }
 }
Example #11
0
 function evt__form__modificacion($datos)
 {
     if (isset($datos)) {
         try {
             toba::manejador_sesiones()->iniciar_sesion_proyecto($datos);
         } catch (toba_error_login $e) {
             toba::notificacion()->agregar($e->getMessage());
         }
     }
 }
Example #12
0
    function evt__procesar()
    {
        if (!$this->get_dbr_eventos()->hay_evento_maneja_datos()) {
            toba::notificacion()->agregar('El formulario no posee evento que <strong>maneje datos</strong>,
				esto implica que los datos no viajaran del cliente al servidor.<br><br>
				Para que este comportamiento funcione debe generar algún 
				[wiki:Referencia/Eventos#Modelos modelo de eventos] en la solapa
				de Eventos', 'info');
        }
        parent::evt__procesar();
    }
Example #13
0
 function evt__aceptar()
 {
     try {
         $r = $this->dep('relacion');
         $r->sincronizar();
         $r->resetear();
         $this->controlador->set_pantalla('pant_listado');
     } catch (toba_error $e) {
         toba::notificacion()->agregar('Error procesando');
         toba::logger()->error($e->getMessage());
     }
 }
Example #14
0
 function evt__eliminar()
 {
     $opciones = array();
     foreach ($this->lista_comp as $comp) {
         $opciones[$comp['componente']] = array('eliminar' => $comp['eliminar'], 'eliminar_archivo' => $comp['eliminar_archivo']);
     }
     $this->operacion->eliminar($this->eliminar_item, $opciones, true);
     toba::notificacion()->agregar('Los componentes seleccionados han sido eliminado', 'info');
     if ($this->eliminar_item) {
         toba::zona()->resetear();
     }
 }
Example #15
0
 function evt__formulario__baja()
 {
     $est = $this->dep('datos')->tabla('estimulo')->get();
     $res = $this->dep('datos')->tabla('tiene_estimulo')->existen_registros($est);
     if ($res == 1) {
         toba::notificacion()->agregar('No puede eliminarlo porque existen estimulos del proyecto que estan asociados', 'error');
     } else {
         $this->dep('datos')->tabla('estimulo')->eliminar_todo();
         $this->resetear();
         $this->s__mostrar = 0;
     }
 }
Example #16
0
 function evt__formulario__alta($datos)
 {
     $t = $this->get_tabla();
     $t->nueva_fila($datos);
     try {
         $t->sincronizar();
         $this->resetear();
     } catch (toba_error $e) {
         toba::notificacion()->agregar('Error insertando');
         toba::logger()->error($e->getMessage());
     }
 }
Example #17
0
 function post_eventos()
 {
     if (isset($this->s__datos['usuario'])) {
         if (!isset($this->s__datos['clave'])) {
             $this->s__datos['clave'] = null;
         }
         try {
             toba::manejador_sesiones()->login($this->s__datos['usuario'], $this->s__datos['clave']);
         } catch (toba_error_autenticacion $e) {
             toba::notificacion()->agregar($e->getMessage());
         }
     }
 }
Example #18
0
 /**
  * Seguridad configurada en la instalacion
  */
 function evt__form__enviar($datos)
 {
     //--1- Arma el mensaje	(incluyendo los headers)
     $this->s__echo = $datos;
     $opciones = array('action' => 'test');
     $mensaje = new toba_servicio_web_mensaje($this->s__echo, $opciones);
     //--2- Arma el servicio
     $opciones = array('to' => 'http://localhost/' . toba_recurso::url_proyecto() . '/servicios.php/serv_seguro_configuracion');
     $servicio = toba::servicio_web('cli_seguro_configuracion', $opciones);
     //-- 3 - Muestra la respuesta
     $respuesta = $servicio->request($mensaje);
     toba::notificacion()->info(print_r($respuesta->get_array(), true));
 }
 function evt__cuadro__seleccion($datos)
 {
     $band = $this->dep('datos')->tabla('impresion_540')->esta_anulado($datos['id']);
     if ($band) {
         //si esta anulado
         $this->s__mostrar = 0;
         $this->resetear();
         toba::notificacion()->agregar('NO SE PUEDE MODIFICAR UN TKD ANULADO', "error");
     } else {
         $this->dep('datos')->tabla('impresion_540')->cargar($datos);
         $this->s__mostrar = 1;
     }
 }
Example #20
0
 function post_eventos()
 {
     if (isset($this->temp_importar_eventos['modelo'])) {
         $eventos = $this->controlador->get_eventos_estandar($this->temp_importar_eventos['modelo']);
         foreach ($eventos as $evento) {
             try {
                 $this->get_tabla()->nueva_fila($evento);
             } catch (toba_error $e) {
                 toba::notificacion()->agregar("Error agregando el evento '{$evento['identificador']}'. " . $e->getMessage());
             }
         }
     }
 }
Example #21
0
 function evt__generar()
 {
     //Luego invocar los metodos que generan el certificado y la exportacion de clave publica.
     $proyecto = $this->get_modelo_proyecto();
     if ($this->verificar_existencia_private_key($proyecto) && !$this->pisa_archivo) {
         throw new toba_error_usuario('El archivo ya existe, no se permitira la generación a menos que se reemplace');
     }
     try {
         toba_modelo_servicio_web::generar_certificados($proyecto);
     } catch (toba_error_usuario $e) {
         toba::logger()->error($e->getMessage());
         toba::notificacion()->agregar('Se ha producido un error generando el certificado, verifique los logs', 'error');
     }
 }
 function evt__formulario__modificacion($datos)
 {
     //toma todas las designaciones que se filtraron y les agrega la norma
     if (isset($this->s__listado)) {
         //si la variable tiene valor
         $cont = 0;
         foreach ($this->s__listado as $desig) {
             //asocia la designacion a la norma
             $this->controlador()->dep('datos')->tabla('designacion')->modifica_norma($desig['id_designacion'], $datos['norma']);
             $cont++;
         }
         toba::notificacion()->agregar('Se han actualizado ' . $cont . ' designaciones.', 'info');
         $this->set_pantalla('pant_edicion');
     }
 }
Example #23
0
 /**
  * Recorre los metadatos de la tabla y actualiza la definicion:
  *   - Si hay alguna nueva columna la agrega
  */
 function actualizar_campos($schema = null)
 {
     $basicos = $this->tabla('base')->get();
     $id_fuente = $basicos['fuente_datos'];
     //-- Obtengo datos
     $reg = $this->tabla('prop_basicas')->get();
     $tabla = $reg['tabla'];
     $fuente = toba::db($id_fuente, toba_editor::get_proyecto_cargado());
     if (is_null($schema)) {
         $schema = $fuente->get_schema();
     }
     $columnas = $fuente->get_definicion_columnas($tabla, $schema);
     $tabla_ext = '';
     if ($reg['ap'] == toba_ap_tabla_db_mt::id_ap_mt) {
         // Si es un ap multitabla
         $tabla_ext = $reg['tabla_ext'];
         $columnas = array_merge($columnas, $fuente->get_definicion_columnas($tabla_ext));
     }
     foreach (array_keys($columnas) as $id) {
         $columnas[$id]['columna'] = $columnas[$id]['nombre'];
         $columnas[$id]['no_nulo_db'] = $columnas[$id]['not_null'];
         if ($columnas[$id]['tipo'] == 'C' && $columnas[$id]['longitud'] > 0) {
             $columnas[$id]['largo'] = $columnas[$id]['longitud'];
         }
     }
     $dbr = $this->tabla('columnas');
     $actuales = $dbr->get_filas(null, true);
     for ($a = 0; $a < count($columnas); $a++) {
         try {
             //--- Evita incluir dos veces el mismo nombre
             $nueva = true;
             foreach ($actuales as $id => $actual) {
                 if ($columnas[$a]['columna'] == $actual['columna']) {
                     $nueva = false;
                 }
             }
             if ($nueva) {
                 $dbr->nueva_fila($columnas[$a]);
             }
         } catch (toba_error $e) {
             if ($columnas[$a]['tabla'] == $tabla) {
                 toba::notificacion()->agregar("Error agregando la COLUMNA '{$columnas[$a]['columna']}' al datos_tabla de laa tabla {$tabla}. " . $e->getMessage());
             } else {
                 toba::notificacion()->agregar("Error agregando la COLUMNA '{$columnas[$a]['columna']}' al datos_tabla de laa tabla {$tabla_ext}. " . $e->getMessage());
             }
         }
     }
 }
 function evt__cuadro__seleccion($datos)
 {
     //cuando selecciona ese usuario tiene que agregar la novedad de tipo 2 LSGH, subtipo MATE
     //veo si la designacion seleccionada
     $sql2 = "select * from novedad t_n " . " where t_n.tipo_nov=2 " . " and t_n.nro_tab10=10 " . " and t_n.sub_tipo='MATE' " . " and t_n.id_designacion=" . $datos['id_designacion'] . " and t_n.desde='" . $datos['desde'] . "'";
     $res = toba::db('designa')->consultar($sql2);
     if (count($res) == 0) {
         //si la designacion no tiene la licencia cargada
         $sql3 = "insert into novedad (tipo_nov, desde, hasta, id_designacion, tipo_norma, \n                    tipo_emite, norma_legal, observaciones, nro_tab10, sub_tipo) values(2,'" . $datos['desde'] . "','" . $datos['hasta'] . "'," . $datos['id_designacion'] . ",'NOTA','DECA','MATE','maternidad',10,'MATE')";
         toba::db('designa')->consultar($sql3);
         toba::notificacion()->agregar('La licencia se ha importado exitosamente.', 'info');
         $sql4 = "update designacion set nro_540=null,check_presup=0 where id_designacion=" . $datos['id_designacion'];
         toba::db('designa')->consultar($sql4);
     } else {
         toba::notificacion()->agregar(utf8_decode('La designación ya tiene asociada esta licencia'), 'info');
     }
 }
 function chequear_sincro_svn()
 {
     $this->chequeado = true;
     $proy = toba_editor::get_modelo_proyecto();
     try {
         $proy->chequear_actualizacion_prematura();
     } catch (toba_error_def $e) {
         //Hubo update prematuro
         $msg = $e->getMessage();
         $msg = str_replace("\\", "\\\\", $msg);
         $msg = nl2br($msg);
         toba::notificacion()->agregar($msg, 'error');
         //Muestro msg de error si los hubiera
         $tags_js = toba::memoria()->get_servicio_solicitado() != 'html_parcial';
         toba::notificacion()->mostrar($tags_js);
     } catch (toba_error $e) {
     }
 }
Example #26
0
 function ejecutar($id_item, $retorno_opciones_generacion = null, $con_transaccion = true)
 {
     try {
         abrir_transaccion();
         foreach ($this->moldes as $molde) {
             $molde->generar();
         }
         $this->generar_archivos_consultas();
         $this->guardar_log_elementos_generados();
         cerrar_transaccion();
         toba::notificacion()->agregar('La generación se realizó exitosamente', 'info');
         return $this->log_elementos_creados;
     } catch (toba_error $e) {
         toba::logger()->error($e);
         toba::notificacion()->agregar("Fallo en la generación: " . $e->getMessage(), 'error');
         abortar_transaccion();
     }
 }
 function evt__cuadro__seleccion($datos)
 {
     $this->dep('datos')->tabla('designacion')->cargar($datos);
     $desig = $this->dep('datos')->tabla('designacion')->get();
     if ($desig['check_presup'] == 1) {
         //si esta chequedo lo deschequea
         $datos['check_presup'] = 0;
         $mensaje = utf8_decode('La designación ' . $datos['id_designacion'] . ' ha perdido el check');
     } else {
         //sino lo chequea
         $datos['check_presup'] = 1;
         $mensaje = utf8_decode('La designación ' . $datos['id_designacion'] . ' ha sido checkeada');
     }
     $this->dep('datos')->tabla('designacion')->set($datos);
     //modifica el check de presupuesto de esa designacion
     $this->dep('datos')->tabla('designacion')->sincronizar();
     $this->dep('datos')->tabla('designacion')->resetear();
     toba::notificacion()->agregar($mensaje, 'info');
 }
Example #28
0
 function conf__cuadro_dias(burgos_v2_ei_cuadro $cuadro)
 {
     //creo un objeto dia, por defecto se instancia al día de hoy
     //Despues le sumo dos días. si dentro de dos días es sabado o domingo sigo sumando
     $hoy = date_create();
     $manana = date_create()->add(new date_interval('P2D'));
     switch ($mañana->format('D')) {
         case 'Sun':
             $mañana->add(new date_in('P1D'));
             break;
         case 'Sut':
             $mañana->add(new date_in('P2D'));
             break;
     }
     toba::notificacion()->agregar($hoy->format('Y-m-d'));
     toba::notificacion()->agregar($manana->format('Y-m-d'));
     $datos = toba::db('burgos_v2')->consultar("SELECT * FROM eventos WHERE fecha BETWEEN {$hoy->format('Y-m-d')} AND {$manana->format('Y-m-d')}");
     ei_arbol($datos);
     $cuadro->set_datos($datos);
 }
Example #29
0
 function evt__guardar()
 {
     try {
         $datos = $this->dep('editor')->datos('basica')->get();
         // verifico que no existe el usuario en la creacion
         if (!$this->dep('datos')->esta_cargada() && isset($datos['usuario']) && consultas_instancia::get_existe_usuario($datos['usuario'])) {
             throw new toba_error('El usuario ya existe.');
         }
         $this->dep('datos')->sincronizar();
         $usuario_arai = $this->dep('editor')->get_usuario_arai();
         if (isset($usuario_arai)) {
             gestion_arai_usuarios::sincronizar_datos($datos['usuario'], $usuario_arai);
         }
         $this->dep('datos')->resetear();
         $this->set_pantalla('seleccionar');
     } catch (toba_error $e) {
         toba::notificacion()->agregar($e->getMessage());
         toba::logger()->error($e->getMessage());
     }
 }
Example #30
0
    function cargar_info($editable = null)
    {
        //Carga el EDITABLE que se va a manejar dentro de la ZONA
        $sql = '	SELECT	*
					FROM	apex_usuario_grupo_acc
					WHERE	proyecto = ' . quote($this->editable_id[0]) . '
					AND		usuario_grupo_acc = ' . quote($this->editable_id[1]) . ';';
        //echo $sql;
        $rs = toba::db()->consultar($sql);
        if (!$rs) {
            toba::notificacion()->agregar('ZONA - GRUPO ACCESO: El editable solicitado no existe', 'info');
            return false;
        } else {
            $this->editable_info = $rs[0];
            //ei_arbol($this->editable_info,"EDITABLE");
            $this->editable_id = array($this->editable_id[0], $this->editable_id[1]);
            $this->editable_cargado = true;
            return true;
        }
    }