forked from qwerty/tupali
84 lines
2.9 KiB
PHP
84 lines
2.9 KiB
PHP
<?php
|
|
function brigadiastas_grabar_imagen($data,$identificador) {
|
|
$respuesta = new xajaxResponse('utf-8');
|
|
$control = md5("$identificador");
|
|
//$form_id = $fomulario["formulario_id"];
|
|
|
|
$imagen= grabar_imagen($data,$control);
|
|
$preview = "<img src='$_SESSION[url]/images/secure/?file=150/$imagen'>";
|
|
$respuesta->addScript("javascript: document.getElementById('imagen').value= '$imagen' ;");
|
|
$respuesta->addAssign("aviso","innerHTML","$preview");
|
|
return $respuesta;
|
|
|
|
}
|
|
$xajax->registerFunction("brigadistas_grabar_imagen");
|
|
|
|
function brigadistas_grabar($formulario) {
|
|
|
|
$identificador = $formulario['identificador'];
|
|
$control = md5("$identificador");
|
|
$data = $formulario['debugConsole'];
|
|
$imagen= grabar_imagen($data,$control);
|
|
$texto_url = urlencode("#BrigadaDigital");
|
|
$uri = urlencode("$_SESSION[url]/images/secure/?file=600/$imagen");
|
|
$url ="https://twitter.com/share?url=$uri&text=$texto_url";
|
|
//$respuesta->addScript("window.location.href ='$url';");
|
|
$preview = "
|
|
<div class='row'>
|
|
<div class='center-block'>
|
|
<div class='thumbnail'>
|
|
<img src='$_SESSION[url]/images/secure/?file=300/$imagen'>
|
|
<a download='brigadistas.png' href='$_SESSION[url]images/secure/?file=600/$imagen' >
|
|
<span class='btn btn-default'><i class='fa fa-download'></i> </span>
|
|
</a>
|
|
<span class='btn btn-default'>
|
|
<a onclick =\"javascript:window.location.href ='$url'; \" ><i class='fa fa-twitter'></i> </a>
|
|
</span>
|
|
<a href='?set=$formulario[formulario_id]&embebido'>
|
|
<span class='btn btn-default'><i class='fa fa-eye'></i> </span>
|
|
</a>
|
|
<a href='#' onclick = \"javascript:location.reload(); \">
|
|
<span class='btn btn-default'><i class='fa fa-refresh'></i> </span>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
";
|
|
|
|
$respuesta = new xajaxResponse('utf-8');
|
|
//$identificador = $formulario['identificador'];
|
|
$id_formulario = $formulario['formulario_id'];
|
|
$campo_imagen = buscar_campo_tipo("$id_formulario","15");
|
|
$formulario[$campo_imagen[0]][0] = $imagen;
|
|
$empresa = remplacetas('form_id','id',"$id_formulario",'id_empresa',"") ;
|
|
$id_empresa = $empresa[0];
|
|
|
|
include_once("librerias/conex.php");
|
|
$link=Conectarse();
|
|
mysqli_query("SET NAMES 'utf8'");
|
|
|
|
foreach($formulario as $campo=>$valor){
|
|
if(is_array($valor)) {
|
|
foreach($valor as $c=>$v){
|
|
$consulta = "INSERT INTO form_datos ( timestamp,id_usuario,id_empresa,form_id,ip,control,id_campo,contenido) VALUES
|
|
( UNIX_TIMESTAMP(),'$_SESSION[id]','$id_empresa','$id_formulario','$ip' ,'$control', '$campo' , '$v')
|
|
";
|
|
$sql=mysqli_query($consulta,$link);
|
|
// $campos .= " $campo // $valor // $c -> $v $consulta <br>";
|
|
}
|
|
}
|
|
}
|
|
|
|
$resultado = "$preview ";
|
|
|
|
$respuesta->addAssign("aviso","innerHTML","$preview");
|
|
//$respuesta->addAlert("$resultado");
|
|
//$respuesta->addScript("javascript:location.reload(true);");
|
|
return $respuesta;
|
|
}
|
|
$xajax->registerFunction("brigadistas_grabar");
|
|
|
|
|
|
|
|
?>
|