Ejemplo n.º 1
0
 /**
  * @ignore 
  */
 protected function crear_objeto_js()
 {
     $id = toba_js::arreglo($this->_id, false);
     $identado = toba_js::instancia()->identado();
     $ajax = toba_js::bool($this->_navegacion_ajax);
     //Crea le objeto CI
     echo $identado . "window.{$this->objeto_js} = new ci({$id}, '{$this->objeto_js}', '{$this->_nombre_formulario}', '{$this->_submit}', '{$this->_id_en_controlador}', {$ajax});\n";
     //Agrega la lista de pantallas con las que trabaja el ci
     toba_js::instancia()->identar(1);
     if ($this->_info_ci['tipo_navegacion'] == self::NAVEGACION_TAB_HORIZONTAL || $this->_info_ci['tipo_navegacion'] == self::NAVEGACION_TAB_VERTICAL) {
         $pantallas_activas = array();
         foreach ($this->_lista_tabs as $id => $tab) {
             $pantallas_activas[$id] = $tab->esta_activado();
         }
         echo $identado . "window.{$this->objeto_js}.agregar_pantallas(" . toba_js::arreglo($pantallas_activas, true) . "); \n";
     }
     //Crea los objetos hijos
     $objetos = array();
     foreach ($this->_dependencias as $id => $dep) {
         $objetos[$id] = $dep->generar_js();
     }
     $identado = toba_js::instancia()->identar(-1);
     //Agrega a los objetos hijos
     //ATENCION: Esto no permite tener el mismo formulario instanciado dos veces
     echo "\n";
     foreach ($objetos as $id => $objeto) {
         echo $identado . "window.{$this->objeto_js}.agregar_objeto({$objeto}, '{$id}');\n";
     }
 }
Ejemplo n.º 2
0
 function crear_objeto_js()
 {
     $mantiene_estado_js = toba_js::bool($this->mantiene_estado_cascada);
     return "new ef_combo({$this->parametros_js()}, {$mantiene_estado_js})";
 }
Ejemplo n.º 3
0
 function crear_objeto_js()
 {
     $mantiene_estado_js = toba_js::bool($this->mantiene_estado_cascada);
     if (!$this->es_solo_lectura()) {
         return "new ef_combo_editable({$this->parametros_js()}, {$mantiene_estado_js})";
     } else {
         //--En el caso que sea solo-lectura en el server, se comporta como un combo normal en js
         $parametros = parent::parametros_js();
         return "new ef_combo({$parametros}, {$mantiene_estado_js})";
     }
 }
Ejemplo n.º 4
0
 /**
  * Genera la invocación JS necesaria para incluir en un onclick por ejemplo
  */
 function get_invocacion_js($objeto_js = null, $id_componente = null)
 {
     if (!isset($objeto_js)) {
         $objeto_js = $this->contenedor->get_id_objeto_js();
     }
     if (!isset($id_componente)) {
         $id_componente = $this->contenedor->get_id();
     }
     if ($this->posee_accion_imprimir()) {
         // ---*** IMPRIMIR HTML ***---
         $opciones['servicio'] = 'vista_toba_impr_html';
         $opciones['objetos_destino'] = array($id_componente);
         //$opciones['celda_memoria'] = 'popup';
         $url = toba::vinculador()->get_url(null, null, array(), $opciones);
         if ($this->datos['accion_imphtml_debug'] == 1) {
             $js = "imprimir_html('{$url}',true);";
         } else {
             $js = "imprimir_html('{$url}');";
         }
     } elseif ($this->posee_accion_vista_pdf()) {
         // ---*** VISTA PDF ***---
         $opciones['servicio'] = 'vista_pdf';
         $opciones['objetos_destino'] = array($id_componente);
         $url = toba::vinculador()->get_url(null, null, array(), $opciones);
         $js = "document.location.href='{$url}';";
     } elseif ($this->posee_accion_vista_excel()) {
         // ---*** VISTA EXCEL ***---
         $opciones['servicio'] = 'vista_excel';
         $opciones['objetos_destino'] = array($id_componente);
         $url = toba::vinculador()->get_url(null, null, array(), $opciones);
         $js = "document.location.href='{$url}';";
     } elseif ($this->posee_accion_vista_xslfo()) {
         // ---*** VISTA XSLFo ***---
         $opciones['servicio'] = 'vista_xslfo';
         $opciones['objetos_destino'] = array($id_componente);
         $url = toba::vinculador()->get_url(null, null, array(), $opciones);
         $js = "document.location.href='{$url}';";
     } elseif ($this->posee_accion_vista_jasperreports()) {
         // ---*** VISTA JASPERREPORTS ***---
         $opciones['servicio'] = 'vista_jasperreports';
         $opciones['objetos_destino'] = array($id_componente);
         $url = toba::vinculador()->get_url(null, null, array(), $opciones);
         $js = "document.location.href='{$url}';";
     } elseif ($this->posee_accion_vista_xml()) {
         // ---*** VISTA XML ***---
         $opciones['servicio'] = 'vista_xml';
         $opciones['objetos_destino'] = array($id_componente);
         $url = toba::vinculador()->get_url(null, null, array(), $opciones);
         $js = "document.location.href='{$url}';";
     } elseif ($this->posee_accion_vincular()) {
         // ---*** VINCULO ***---
         if (isset($this->datos['accion_vinculo_servicio']) && !is_null($this->datos['accion_vinculo_servicio'])) {
             $this->vinculo()->set_servicio($this->datos['accion_vinculo_servicio']);
         }
         // Registro el vinculo en el vinculador
         $id_vinculo = toba::vinculador()->registrar_vinculo($this->vinculo());
         if (!isset($id_vinculo)) {
             //Si no tiene permisos no devuelve un identificador
             return null;
         }
         $es_boton_visible = ($this->esta_en_botonera() || $this->esta_sobre_fila()) && $this->esta_activado();
         // Escribo la sentencia que invocaria el vinculo
         if ($this->posee_confirmacion() && $es_boton_visible) {
             $conf_msg = $this->get_msg_confirmacion();
             $js = "{$objeto_js}.invocar_vinculo_confirmado('" . $this->get_id() . "', '{$id_vinculo}', '{$conf_msg}');";
         } else {
             $js = "{$objeto_js}.invocar_vinculo('" . $this->get_id() . "', '{$id_vinculo}');";
         }
     } elseif ($this->posee_accion_respuesta_popup()) {
         //--- En una respuesta a un ef_popup
         $param = addslashes(str_replace('"', "'", $this->parametros));
         $js = "iniciar_respuesta_popup(this, '{$param}');";
     } else {
         // Manejo estandar de eventos
         $submit = toba_js::bool(!($this->es_seleccion_multiple() || $this->posee_accionar_diferido()));
         $js = "{$objeto_js}.set_evento(" . $this->get_evt_javascript() . ", {$submit}, this);";
     }
     return $js;
 }
Ejemplo n.º 5
0
 /**
  * @ignore 
  */
 protected function crear_objeto_js()
 {
     $identado = toba_js::instancia()->identado();
     //Creación de los objetos javascript de los objetos
     $rango_tabs = "new Array({$this->_rango_tabs[0]}, {$this->_rango_tabs[1]})";
     $filas = toba_js::arreglo($this->_filas_enviadas);
     $en_linea = toba_js::bool($this->_info_formulario['filas_agregar_online']);
     $seleccionada = isset($this->_clave_seleccionada) ? $this->_clave_seleccionada : "null";
     $esclavos = toba_js::arreglo($this->_carga_opciones_ef->get_cascadas_esclavos(), true, false);
     $maestros = toba_js::arreglo($this->_carga_opciones_ef->get_cascadas_maestros(), true, false);
     $id = toba_js::arreglo($this->_id, false);
     $invalidos = toba_js::arreglo($this->_efs_invalidos, true);
     echo $identado . "window.{$this->objeto_js} = new ei_formulario_ml";
     echo "({$id}, '{$this->objeto_js}', {$rango_tabs}, '{$this->_submit}', {$filas}, {$this->_siguiente_id_fila}, {$seleccionada}, {$en_linea}, {$maestros}, {$esclavos}, {$invalidos});\n";
     if ($this->_disparo_evento_condicionado_a_datos) {
         echo $identado . "{$this->objeto_js}.set_eventos_condicionados_por_datos(true);";
     }
     foreach ($this->_lista_ef_post as $ef) {
         echo $identado . "{$this->objeto_js}.agregar_ef({$this->_elemento_formulario[$ef]->crear_objeto_js()}, '{$ef}');\n";
     }
     //Agregado de callbacks para calculo de totales
     if (count($this->_lista_ef_totales) > 0) {
         foreach ($this->_lista_ef_post as $ef) {
             if (in_array($ef, $this->_lista_ef_totales)) {
                 echo $identado . "{$this->objeto_js}.agregar_total('{$ef}');\n";
             }
         }
     }
     if ($this->_hay_toggle) {
         foreach ($this->_lista_ef_post as $ef) {
             if ($this->_elemento_formulario[$ef]->get_toggle()) {
                 echo $identado . "{$this->objeto_js}.set_toggle('{$ef}');\n";
             }
         }
     }
     if (!$this->_mostrar_cabecera_sin_datos) {
         echo $identado . "{$this->objeto_js}.set_cabecera_visible_sin_datos(false);\n";
     }
     if ($this->_detectar_cambios) {
         foreach (array_keys($this->_eventos_usuario_utilizados) as $id_evento) {
             if ($this->evento($id_evento)->es_predeterminado()) {
                 $excluidos = array();
                 foreach ($this->_lista_ef_post as $ef) {
                     if ($this->ef($ef)->es_solo_lectura()) {
                         $excluidos[] = $ef;
                     }
                 }
                 $excluidos = toba_js::arreglo($excluidos);
                 echo $identado . "{$this->objeto_js}.set_procesar_cambios(true, '{$id_evento}', {$excluidos});\n";
             }
         }
     }
 }
Ejemplo n.º 6
0
 /**
  * Retorna el codigo necesario para crear un evento en js
  *
  * @param string $id Id. del evento
  * @param string $evento Datos del evento, en forma de arreglo
  */
 static function evento($id, $evento, $parametros = null, $es_implicito = false)
 {
     $js_confirm = isset($evento['confirmacion']) ? "'{$evento['confirmacion']}'" : "''";
     $js_validar = isset($evento['maneja_datos']) ? toba_js::bool($evento['maneja_datos']) : "true";
     if (is_array($parametros)) {
         $param = ", " . toba_js::arreglo($parametros, true);
     } else {
         $param = isset($parametros) ? ", '" . addslashes(str_replace('"', "'", $parametros)) . "'" : '';
     }
     $implicito = '';
     if ($es_implicito) {
         $implicito = $param == '' ? ",''" : '';
         $implicito .= ', ' . toba_js::bool(true);
     }
     return "new evento_ei('{$id}', {$js_validar}, {$js_confirm} {$param} {$implicito})";
 }