Exemple #1
0
 /**
  * @return toba_js
  */
 static function instancia()
 {
     if (!isset(self::$instancia)) {
         self::$instancia = new toba_js();
     }
     return self::$instancia;
 }
Exemple #2
0
 /**
  * @ignore
  */
 protected function crear_objeto_js()
 {
     $identado = toba_js::instancia()->identado();
     $id = toba_js::arreglo($this->_id, false);
     $dim = toba_js::arreglo($this->get_dimensiones(), false);
     echo $identado . "window.{$this->objeto_js} = new ei_codigo({$id}, {$dim}, '{$this->_submit}', '{$this->_id_post_codigo}');\n";
 }
Exemple #3
0
 /**
  * @ignore 
  */
 function generar_js()
 {
     $identado = toba_js::instancia()->identado();
     echo "\n{$identado}//---------------- CREANDO OBJETO {$this->objeto_js} --------------  \n";
     $this->crear_objeto_js();
     $this->controlador->extender_objeto_js();
     $this->extender_objeto_js();
     echo "\n";
     $this->iniciar_objeto_js();
     echo "{$identado}//-----------------------------------------------------------------  \n";
     return $this->objeto_js;
 }
Exemple #4
0
 /**
  * @ignore 
  */
 protected function crear_objeto_js()
 {
     $identado = toba_js::instancia()->identado();
     $rango_tabs = "new Array({$this->_rango_tabs[0]}, {$this->_rango_tabs[1]})";
     $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({$id}, '{$this->objeto_js}', {$rango_tabs}, '{$this->_submit}', {$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) {
         if (!in_array($ef, $this->_efs_generados)) {
             throw new toba_error_def($this->get_txt() . " Error en la redefinición del layout: Falta salida ef '{$ef}'");
         }
         echo $identado . "{$this->objeto_js}.agregar_ef({$this->_elemento_formulario[$ef]->crear_objeto_js()}, '{$ef}');\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";
             }
         }
     }
 }
Exemple #5
0
 /**
  * @ignore
  */
 protected function crear_objeto_js()
 {
     $identado = toba_js::instancia()->identado();
     $id = toba_js::arreglo($this->_id, false);
     //Si hay seleccion multiple, envia los ids de las filas
     $id_evt_multiple = $this->get_ids_evento_aplicacion_multiple();
     $hay_multiple = !empty($id_evt_multiple);
     $id_evt_multiple = ', ' . toba_js::arreglo($id_evt_multiple);
     $filas = ',[]';
     if ($hay_multiple) {
         $datos = isset($this->datos) && is_array($this->datos) ? $this->datos : array();
         $filas = ',' . toba_js::arreglo(array_keys($datos));
     }
     echo $identado . "window.{$this->objeto_js} = new ei_cuadro({$id}, '{$this->objeto_js}', '{$this->_submit}'{$filas} {$id_evt_multiple});\n";
 }
Exemple #6
0
 /**
  * @ignore
  */
 protected function crear_objeto_js()
 {
     $identado = toba_js::instancia()->identado();
     $opciones['servicio'] = 'ejecutar';
     $opciones['objetos_destino'] = array($this->_id);
     $autovinculo = toba::vinculador()->get_url(null, null, '', $opciones);
     echo $identado . "window.{$this->objeto_js} = new ei_arbol('{$this->objeto_js}',\n\t\t'{$this->_submit}', '{$autovinculo}');\n";
 }
Exemple #7
0
 /**
  * Genera el codigo para inicializar el objeto JS
  * @ignore
  */
 protected function iniciar_objeto_js()
 {
     $url = $this->get_url_mapa();
     $identado = toba_js::instancia()->identado();
     //Obtengo el Full Extent del mapa, los zooms intermedios los maneja el cliente
     $extent_full = "'{$this->_extent->minx}' ,' {$this->_extent->maxx}', '{$this->_extent->miny}', '{$this->_extent->maxy}'";
     //Porcion actualmente visible, si no hay valores tomo el extent full como referencia
     if (isset($this->_extent_activo)) {
         $extent = "'" . $this->_extent_activo['xmin'] . "' ,'" . $this->_extent_activo['xmax'] . "', '" . $this->_extent_activo['ymin'] . "', '" . $this->_extent_activo['ymax'] . "'";
     } else {
         $extent = $extent_full;
     }
     //Obtengo la lista de Layers original del mapa
     $layers = implode(' ', $this->get_nombre_layers());
     //Genero los eventos en JS
     $this->generar_botones_eventos_js();
     //Se agrega al objeto al singleton toba
     echo $identado . "toba.agregar_objeto(window.{$this->objeto_js});\n";
     //Envio todas las variables necesarias en el cliente
     echo $identado . "{$this->objeto_js}.set_url('{$url}');\n";
     echo $identado . "{$this->objeto_js}.set_full_extent({$extent_full}); \n";
     echo $identado . "{$this->objeto_js}.set_extent({$extent});\n";
     echo $identado . "{$this->objeto_js}.set_layers('{$layers}');\n";
     echo $identado . "{$this->objeto_js}.set_layers_activos(" . toba_js::arreglo(array_fill_keys($this->_layers_activos, 1), true) . "); \n";
     echo $identado . "{$this->objeto_js}.iniciar();\n";
     echo $identado . "{$this->objeto_js}.render();\n";
     //-- EVENTO implicito --
     /*		if (isset($this->_evento_implicito) && is_object($this->_evento_implicito)){
     			$evento_js = $this->_evento_implicito->get_evt_javascript();
     			echo toba_js::instancia()->identado()."{$this->objeto_js}.set_evento_implicito($evento_js);\n";
     		}*/
     if ($this->_colapsado) {
         echo $identado . "window.{$this->objeto_js}.colapsar();\n";
     }
 }
Exemple #8
0
 /**
  * @ignore
  */
 protected function crear_objeto_js()
 {
     $identado = toba_js::instancia()->identado();
     $id = toba_js::arreglo($this->_id, false);
     echo $identado . "window.{$this->objeto_js} = new ei_firma({$id}, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'{$this->_submit}', \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t" . ($this->_multiple ? 'true' : 'false') . ");\n";
     echo "\n\t\t\tfunction appletLoaded() {\n\t\t\t\t{$this->objeto_js}.applet_cargado();\n\t\t\t}\n\t\t\tfunction firmaOk() {\n\t\t\t\t{$this->objeto_js}.firma_ok();\n\t\t\t}\n\t\t\tif (! {$this->objeto_js}._multiple) {\n\t\t\t\twindow.onload = function () {\n\t\t\t\t\t{$this->objeto_js}.ver_pdf_inline('{$this->_url_pdf_embebido}');\n\t\t\t\t};\n\t\t\t}\t\t\t\n\t\t";
 }
Exemple #9
0
 /**
  * Termina la construcción del objeto javascript asociado al componente
  * @ignore 
  */
 protected function iniciar_objeto_js()
 {
     $identado = toba_js::instancia()->identado();
     //-- EVENTO implicito --
     if (isset($this->_evento_implicito) && is_object($this->_evento_implicito)) {
         $evento_js = $this->_evento_implicito->get_evt_javascript();
         echo toba_js::instancia()->identado() . "{$this->objeto_js}.set_evento_implicito({$evento_js});\n";
     }
     if ($this->_colapsado) {
         echo $identado . "window.{$this->objeto_js}.colapsar();\n";
     }
     //Se agrega al objeto al singleton toba
     echo $identado . "toba.agregar_objeto(window.{$this->objeto_js});\n";
 }
Exemple #10
0
 function ini()
 {
     toba_js::instancia()->cargar_consumos_globales(array('utilidades/colorselector'));
 }
Exemple #11
0
 /**
  * @ignore 
  */
 protected function crear_objeto_js()
 {
     $identado = toba_js::instancia()->identado();
     $path = addslashes($this->get_path_relativo());
     echo $identado . "window.{$this->objeto_js} = new ei_archivos('{$this->objeto_js}', '{$this->_submit}', '{$path}');\n";
 }
 /**
  * @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";
             }
         }
     }
 }
Exemple #13
0
 /**
  * @ignore 
  */
 protected function crear_objeto_js()
 {
     $efs_esclavos = $this->_carga_opciones_ef->get_cascadas_esclavos();
     $identado = toba_js::instancia()->identado();
     $id = toba_js::arreglo($this->_id, false);
     $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);
     echo $identado . "window.{$this->objeto_js} = new ei_filtro({$id}, '{$this->objeto_js}', '{$this->_submit}', {$maestros}, {$esclavos});\n";
     foreach ($this->_columnas as $columna) {
         $visible = $columna->es_visible() ? 'true' : 'false';
         $compuesto = $columna->es_compuesto() ? 'true' : 'false';
         echo $identado . "{$this->objeto_js}.agregar_ef({$columna->crear_objeto_js()}, '{$columna->get_nombre()}', {$visible}, {$compuesto});\n";
     }
     //Ciclo por los eventos para definir el comportamiento que lance el predeterminado
     foreach (array_keys($this->_eventos_usuario_utilizados) as $id_evento) {
         if ($this->evento($id_evento)->es_predeterminado()) {
             $excluidos = array();
             foreach ($this->_columnas as $columna) {
                 //Aca tengo que ciclar por las columnas
                 if ($columna->es_solo_lectura()) {
                     $excluidos[] = $columna->get_ef()->get_id();
                 }
             }
             $excluidos = toba_js::arreglo($excluidos);
             echo $identado . "{$this->objeto_js}.set_procesar_cambios(true, '{$id_evento}', {$excluidos});\n";
         }
     }
 }
Exemple #14
0
 /**
  * @ignore 
  */
 protected function crear_objeto_js()
 {
     $identado = toba_js::instancia()->identado();
     echo $identado . "window.{$this->objeto_js} = new ei_calendario('{$this->objeto_js}', '{$this->_submit}');\n";
 }