1
0
Fork 0

mejoras en vista aplicacion

This commit is contained in:
humano 2018-11-03 17:18:47 -05:00
parent 491d3f3d52
commit 3b1712c67e
1 changed files with 304 additions and 11 deletions

View File

@ -5,6 +5,139 @@ date_default_timezone_set('America/Bogota');
use Firebase\JWT\JWT;
function vista_aplicacion($form){
$plantilla="carousel";
/// a=Aplicacion
$geo = buscar_campo_tipo($form,"14");
$empresa = remplacetas('form_id','id',$form,'id_empresa',"") ;
$razon_social_portal = remplacetas('empresa','id',"1",'razon_social','') ;
$id_empresa = $empresa[0];
$titulo = remplacetas('form_id','id',$form,'nombre',"") ;
$descripcion = remplacetas('form_id','id',$form,'descripcion',"") ;
// $registros = aplicacion_carrusel("$form",'10','','embebido','',"carousel");
//$registros="<div id='mostrar_carrusel'>$registros</div>";
// $formulario = formulario_embebido($form,$opciones);
$titulo = remplacetas('form_id','id',$form,'nombre',"") ;
$razon_social = remplacetas('empresa','id',"$id_empresa",'razon_social','') ;
$slogan = remplacetas('empresa','id',"$id_empresa",'slogan','') ;
$web = remplacetas('empresa','id',"$id_empresa",'web','');
$logo = remplacetas('empresa','id',"$id_empresa",'imagen','') ;
$campo_imagen = buscar_campo_tipo($form,"15");
$titulos = formulario_imprimir_linea("$form","","titulos")."";
$id_campo = $campo_imagen[0];
if($id_campo[0] =="") {
$galeria="";
}else{
$galeria= "
<section id='galeria' class='' >
<div class='container-fluid'>
<div style='overflow-y: scroll; overflow-x: hidden; max-height: calc(100vh - 50px); min-height: calc(100vh - 50px); '>
<br>
<table class='table table-bordered table-striped exportable'>
<thead></thead>
<tbody style=' ' id='scroll-galeria' >
</tbody>
</table>
</div>
</div>
</section>
";
}
if($geo[0] != "") {
$mapa = "
<a name='mapa'></a>
<embed class='' src='mapero.php?id=$form' width='100%' style='height: calc(100vh - 150px);' webkitAllowFullScreen mozallowfullscreen allowFullScreen ></embed>
";
}else {$mapa = "";}
$estadisticas = portal_listado_campos("$form");
$acciones= formulario_acciones("$form","aplicacion");
$footer="
<nav class='navbar navbar-default navbar-fixed-bottom'>
<div class='container-fluid'>
<!-- Brand/logo -->
<div class='navbar-header'>
<button type='button' class='navbar-toggle collapsed' data-toggle='collapse' data-target='#example-1' aria-expanded='false'>
<span class='sr-only'>Toggle navigation</span>
<span class='icon-bar'></span>
<span class='icon-bar'></span>
<span class='icon-bar'></span>
</button>
<a class='navbar-brand' href='#'></a>
</div>
<!-- Collapsible Navbar -->
<div class='collapse navbar-collapse' id='example-1'>
<ul class='nav navbar-nav'>
$acciones
</ul>
</div>
</div>
</nav>";
$onload="
<div class='reveal' style='bottom: 50px !important; '>
<div class='slides' >
<section id='inicio' class='text-center scrollable' >
<img style='width: 20%;
display: block;
margin-left: auto;
margin-right: auto;' src='milfs/images/secure/?file=600/$logo[0]' alt='' class='img img-responsive center-block'>
<h1>$titulo[0]</h1>
<h2>$descripcion[0]</h2>
<hr>
<h2>$razon_social[0]</h2>
<h3>$slogan[0]</h3>
<hr>
<a href='https://tupale.co'>Tupale.co</a>
</section>
$galeria
<section id='estadisticas' class='scrollable' >
$estadisticas
</section>
<section id='mapa'>
$mapa
</section>
<section id='listado' class='' >
<div class='container-fluid'>
<div style='overflow-y: scroll; overflow-x: hidden; max-height: calc(100vh - 100px); min-height: calc(100vh - 150px); ' >
<br>
<div class=''>
<table class='table table-bordered table-striped exportable'>
<thead>$titulos</thead>
<tbody style=' ' id='scroll-content' >
</tbody>
</table>
</div>
</div>
</div>
</section>
</div>
</div>
$footer ";
//$onload = "$footer $aplicacion ";
return $onload;
}
function array_linea($datos,$tipo,$id){
$output="";
@ -7331,6 +7464,15 @@ foreach($listado_campos as $campo=>$valor){
$json = html_entity_decode($contenido[0]);
$valor_actual = json_render(html_entity_decode($contenido[0]),"html","$row[control]");
@$listado_campos .= "<td title='' >$valor_actual</td>";
}
elseif( $tipo_campo[0] =="34" ) {
$contenido_limpio = stripslashes($contenido[0]);
$contenido_array = json_decode($contenido_limpio,true);
$array =$contenido_array[$id_campo][0];
$valor_actual= campo_tabla($array,$control,$tipo);
@$listado_campos .= "<td title='' >$valor_actual</td>";
}
elseif($tipo_campo[0] =="31") {
@ -7528,14 +7670,15 @@ while($row = mysqli_fetch_array( $sql ))
$contenido_multiple = formulario_valor_campo("$row[form_id]","$id_campo[0]","","$identificador",'',"$row[timestamp]");
$contenido[0] = $contenido_multiple[9];}
else{ $contenido = remplacetas_orden('form_datos','id_campo',$row["id_campo"],'contenido'," control = '$identificador'"," ORDER BY timestamp DESC ") ;}
$contenido[0] =stripslashes($contenido[0]);
$contenido[0] =stripslashes($contenido[0]);
//$contenido[0] =stripslashes($contenido[0]);
//$contenido[0] =stripslashes($contenido[0]);
$contenido[0] =stripslashes($contenido[0]);
$is_json = isJson($contenido[0]);
if($is_json == '1'){
/*if($is_json == '1'){
$cadena='{"a":1,"b":2,"c":3,"d":4,"e":5}';
$contenido[0] = json_decode($contenido[0]);
$contenido[0] = json_decode($contenido[0],true);
}else{}
* */
//$contenido[0] = "$contenido[0] $is_json ";
//$contenido[0] = json_encode($contenido,true,512);
$nombre_campo = remplacetas('form_campos','id',$id_campo[0],'campo_nombre',"") ;
@ -7551,6 +7694,14 @@ while($row = mysqli_fetch_array( $sql ))
$link_url = "$_SESSION[site]milfs/archivos/?archivo=$contenido[0]";
$contenido[0] = $link_url;
}
if($campo_tipo[0] =='34') {
//$link_url = "$_SESSION[site]milfs/archivos/?archivo=$contenido[0]";
//$json = stripslashes($contenido[0]);
$array_json = json_decode($contenido[0],true);
$contenido[0] = $array_json[$row['id_campo']][0];
//$contenido[0] = $array_json;
}
// if($campo_tipo[0] =='32') {
if($nombre_campo[0] =='Inicio') {
@ -7584,7 +7735,12 @@ while($row = mysqli_fetch_array( $sql ))
$privado = @$privado[1];
/// PRIVACIDAD
if($privado !='1') {
$array[$nombre_campo[0]] = @html_entity_decode($contenido[0]);
//
if(!is_array($contenido[0])){
$array[$nombre_campo[0]] = @html_entity_decode($contenido[0]);
}else{
$array[$nombre_campo[0]] = $contenido[0];
}
//$array['consulta'] = "$contenido[2]";
$uri = "$_SESSION[site]I$identificador";
$array['url'] = "$uri";
@ -13253,10 +13409,19 @@ if (mysqli_num_rows($sql)!='0'){
$contenido = "<a id='link_$row[id_campo]_$row[orden]_formulario_imprimir' href='$link_url' target='_blank' >$contenido</a>";
}
elseif($campo_tipo=="24"){
elseif($campo_tipo=="24" ){
$contenido_full = json_render("$contenido","csv","$control");
$valor_actual = json_render("$contenido","html","$control");
$contenido = "$valor_actual";}
elseif($campo_tipo=="34") {
$contenido = stripslashes($contenido);
$contenido_array = json_decode($contenido,true);
$array =$contenido_array[$row['id_campo']][0];
$contenido = campo_tabla($array,$control,$tipo);
//$contenido_full = json_render("$contenido","csv","$control");
// $valor_actual = json_render("$contenido","html","$control");
//$contenido = "$valor_actual";
}
elseif($campo_tipo=='5' AND $contenido !=""){
if($tipo =="") {
@ -14794,6 +14959,10 @@ elseif($tipo =='17'){
</div>";
}
elseif($tipo =='34'){
$resultado ="<textarea class='form-control' id='opciones' name='opciones' title='Nombres de las columnas separados por punto y coma.' placeholder='col_1;col_2;col_3'>$valores</textarea> ";
}
else{
$resultado = " <textarea class='form-control' id='opciones' name='opciones' title='Predefinido' placeholder='Valores predefinidos'>$valores</textarea>";
}
@ -15989,6 +16158,94 @@ $resultado = "
return $resultado;
}
function campo_tabla($array,$control,$tipo){
//return print_r($valor);
// start table
$html = "<table class='table table-bordered table-condensed tabla_campo_tabla'>";
// header row
$html .= '<thead><tr>';
foreach($array[0] as $key=>$value){
$html .= '<th>' . htmlspecialchars($key) . '</th>';
}
$html .= '</tr></thead>';
// data rows
foreach( $array as $key=>$value){
$html .= '<tr>';
foreach($value as $key2=>$value2){
$html .= '<td>' . htmlspecialchars($value2) . '</td>';
}
$html .= '</tr>';
}
// finish table and return it
$html .= '</table>';
$resultado ="<div class='table-responsive'>$html</div>";
return $resultado;
}
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 .= "<tr id=' fila_".$id_campo."_$fila_edicion'><td>$fila_edicion</td>";
foreach($value as $key2=>$value2){
// $html .= '<td>' . htmlspecialchars($value2) . '</td>';
$html .= "<td><textarea name='$id_campo"."[0][$key][$key2]' id='$id_campo"."[0][$key][$key2]' type='text' class='form-control'>$value2</textarea></td>";
}
$html .= '</tr>';
}
return $html;
}else{ $json="";
}
$nueva_fila=($fila+1);
for($i=0;$i<count($titulos);$i++) {
$listado_campos .= "
<td>
<textarea name='$id_campo"."[0][$fila][$titulos[$i]]' id='$id_campo"."[0][$fila][$titulos[$i]]' type='text' class='form-control'></textarea>
</td>";
}
$listado_campos ="<td>$nueva_fila $cantidad_filas</td>$listado_campos";
if($fila=='0'){
$resultado="<tr id=' fila_".$id_campo."_$nueva_fila'>$listado_campos </tr>";
return $resultado;
}
$respuesta = new xajaxResponse('utf-8');
#$respuesta->addAssign($div,"innerHTML",$ingredientes);
$boton="<a onclick=\"xajax_campo_tabla_fila('$id_campo','$nueva_fila'); \" class='btn btn-link pull-right'>[+] Agregar fila</a>";
$respuesta->addAssign("nueva_fila_$id_campo","innerHTML","$boton");
$respuesta->addcreate("tabla_$id_campo","tr","fila_".$id_campo."_$nueva_fila");
//"<tr id='fila_".$id_campo."_$nueva_fila' >";
$respuesta->addAssign("fila_".$id_campo."_$nueva_fila","innerHTML","$listado_campos");
return $respuesta;
}
$xajax->registerFunction("campo_tabla_fila");
function formulario_campos_render($id_campo,$id_form,$control,$item,$id_dato,$ubicacion){
$cols ="";
$style="";
@ -16194,11 +16451,47 @@ elseif($campo_tipo_accion == 'email'){$render = "
$render = "$select <small>$campo_descripcion</small> ";
$cols='6';
}
elseif($campo_tipo_accion == 'table'){
//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',"") ;
$titulos = explode(";",$campos_valores[0]);
for($i=0;$i<count($titulos);$i++) $listado_titulos .= "<th class='text-center'>$titulos[$i]</th>";
$fila="1";
//for($i=0;$i<count($titulos);$i++) $listado_campos .= "<td><textarea name='$id_campo"."[0][$titulos[$i]][$fila]' id='$id_campo"."[0][$titulos[$i]][$fila]' type='text' class='form-control'></textarea></td>";//
//$listado_campos ="<tr id='fila_".$id_campo."_$fila' ><td>$fila</td>$listado_campos</tr>";
$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 = "
<div style='width:100%; overflow-x:scroll '>
<div class='table-responsive' >
<table class='table table-condensed table-bordered' id='tabla_$id_campo'>
<legend>$mensaje[0]</legend>
<thead>
<tr><td>#</td>$listado_titulos</tr>
</thead>
$listado_campos
</table>
<div id='nueva_fila_$id_campo'><a onclick=\"xajax_campo_tabla_fila('$id_campo','$fila',''); \" class='btn btn-link pull-right'>[+] Agregar fila</a></div>
</div>
</div>";
$cols='12';
}
elseif($campo_tipo_accion == 'radio_agrupado_campos'){
//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<count($titulos);$i++) $listado_titulos .= "<th>$titulos[$i]</th>";
@ -16207,7 +16500,7 @@ elseif($campo_tipo_accion == 'email'){$render = "
$render = "
<div style='width:100%; overflow-x:scroll '>
<div class='table-responsive' >
<table class='table table-striped table-hover table-condensed' >
<table class='table ' >
<legend>$mensaje[0]</legend>
<tr><td></td> $listado_titulos </tr>
$listado_campos
@ -16646,7 +16939,7 @@ if (is_array($v) ){
$campo_tipo = remplacetas("form_campos","id",$c,"campo_tipo","");
$campo_nombre = remplacetas("form_campos","id",$c,"campo_nombre","");
if(@$campo_tipo[0] =="30" OR @$campo_tipo[0] =="24") {
if(@$campo_tipo[0] =="30" OR @$campo_tipo[0] =="24" OR @$campo_tipo[0]=="34") {
$V=array();
$V[$c]=$v;
@ -16785,7 +17078,7 @@ if(($V !='' ) && (is_numeric($c)) AND $repetido !=1 ) {
$campo_tipo = remplacetas("form_campos","id",$c,"campo_tipo","");
$campo_nombre = remplacetas("form_campos","id",$c,"campo_nombre","");
if(@$campo_tipo[0] =="30" OR @$campo_tipo[0] =="24") { $V=$V;}else{$V = htmlentities($V);}
if(@$campo_tipo[0] =="30" OR @$campo_tipo[0] =="24" OR @$campo_tipo[0] =="34") { $V=$V;}else{$V = htmlentities($V);}
///si el campo es tipo password
@ -17575,7 +17868,7 @@ $valor_actual = json_render("$valor","csv","$control");
// $resultado=" <SELECT class='form-control' NAME='$name"."[]"."' id='$name"."[]"."' multiple >" ;
//$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']);