From 5dceedbbb7b775447994c7d2e321d6fdc77a0d5e Mon Sep 17 00:00:00 2001 From: humano Date: Sat, 3 Nov 2018 09:14:47 -0500 Subject: [PATCH] campo tabla --- funciones/funciones.php | 90 +++++++++++++++++++++++++++++++++++------ 1 file changed, 78 insertions(+), 12 deletions(-) diff --git a/funciones/funciones.php b/funciones/funciones.php index c427b48..3cf3443 100644 --- a/funciones/funciones.php +++ b/funciones/funciones.php @@ -15992,18 +15992,78 @@ $resultado = " return $resultado; } -function campo_tabla_fila($id_campo,$fila){ + + function build_table($array){ + // start table + $html = ''; + // header row + $html .= ''; + foreach($array[0] as $key=>$value){ + $html .= ''; + } + $html .= ''; + + // data rows + foreach( $array as $key=>$value){ + $html .= ''; + foreach($value as $key2=>$value2){ + $html .= ''; + } + $html .= ''; + } + + // finish table and return it + + $html .= '
' . htmlspecialchars($key) . '
' . htmlspecialchars($value2) . '
'; + return $html; +} + + +function campo_tabla_fila($id_campo,$fila,$valor){ + $campos_valores = remplacetas('form_campos_valores','id_form_campo',$id_campo,'campo_valor',"") ; + $titulos = explode(";",$campos_valores[0]); + if($valor !=""){ + + $json= json_encode($valor); + + $array =$valor[$id_campo][0]; + + foreach( $array as $key=>$value){ + $fila_edicion = ($key+1); + $html .= "$fila_edicion"; + foreach($value as $key2=>$value2){ + // $html .= '' . htmlspecialchars($value2) . ''; + $html .= ""; + } + $html .= ''; + } + + + return $html; + + + }else{ $json=""; + + + } $nueva_fila=($fila+1); - $campos_valores = remplacetas('form_campos_valores','id_form_campo',$id_campo,'campo_valor',"") ; - $titulos = explode(";",$campos_valores[0]); + - for($i=0;$i";// - $listado_campos ="$nueva_fila$listado_campos"; - + for($i=0;$i + "; + } + $listado_campos ="$nueva_fila $cantidad_filas$listado_campos"; +if($fila=='0'){ + $resultado="$listado_campos "; + return $resultado; + } $respuesta = new xajaxResponse('utf-8'); #$respuesta->addAssign($div,"innerHTML",$ingredientes); $boton="[+] Agregar fila"; @@ -16232,10 +16292,16 @@ elseif($campo_tipo_accion == 'email'){$render = " for($i=0;$i";// - $listado_campos ="$fila$listado_campos"; - //$select = radio_agrupado_linea($id_campo,$id_form,$value,$id_campo."[".$item."]",$control); + //for($i=0;$i";// + //$listado_campos ="$fila$listado_campos"; + $valores = stripcslashes($value); + $valores_array= json_decode($valores,true); + $listado_campos = campo_tabla_fila("$id_campo","0",$valores_array); + //$priti= print_r($valores_array,true); + if(is_array($valores_array)){ $fila = count($valores_array[$id_campo][0]); } + else{ $fila='1';} $render = " +
@@ -16247,7 +16313,7 @@ elseif($campo_tipo_accion == 'email'){$render = " $listado_campos
- +
"; @@ -16257,7 +16323,7 @@ elseif($campo_tipo_accion == 'email'){$render = " //radio_agrupado_linea($id_campo,$form_id,$valor,$name,$control) $campos_valores = remplacetas('form_campos_valores','id_form_campo',$id_campo,'campo_valor',"") ; $mensaje = remplacetas('form_campos','id',$id_campo,'campo_descripcion',"") ; - $campos = explode(":",$campos_valores[0]); + $campos = explode(":",$campos_valores[0]); $titulos = explode(";",$campos[0]); $campos_incluidos = explode(";",$campos[1]); for($i=0;$i" ; //$name= array(); while( $row = mysqli_fetch_array( $sql ) ) { - $existe = strpos($valor_actual, $row[campo_valor]); + $existe = strpos($valor_actual, $row['campo_valor']); if( $existe != ""){$selected="checked";} else{$selected ="";} $valor_limpio = trim($row['campo_valor']);