<?
include ("clases/enlace.class.php"); $objb = new enlace();
include ("clases/alumno.class.php"); $obja = new alumno();
 $idpersona=$_REQUEST['idpersona'];
 
 $idenlace = $_REQUEST['idenlace'];
 if($objb->BuscarPorCodigo($idenlace))
 {
   $idpersona = $objb->getIdpersona();
   if($obja->BuscarPorCodigo($idpersona))
   {
      $nombres=$obja->getNombres();
	  $apellidos = $obja->getApellidos();
	  $foto = $obja->getFoto();
   }
   $titulo = $objb->getTitulo();
   $url = $objb->getUrl();
   $visible = $objb->getVisible();
   $valor = "C";
		$boton = "Guardar";
 }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
<meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="Shortcut Icon" type="image/x-icon" href="assets/icons/book.ico" />
    <script src="js/sweet-alert.min.js"></script>
    <link rel="stylesheet" href="css/sweet-alert.css">
    <link rel="stylesheet" href="css/material-design-iconic-font.min.css">
    <link rel="stylesheet" href="css/normalize.css">
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="css/jquery.mCustomScrollbar.css">
    <link rel="stylesheet" href="css/timeline.css">
    <link rel="stylesheet" href="css/style.css">
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
    <script>window.jQuery || document.write('<script src="js/jquery-1.11.2.min.js"><\/script>')</script>
    <script src="js/modernizr.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/jquery.mCustomScrollbar.concat.min.js"></script>
    <script src="js/main.js"></script>


<script type="text/javascript" src="jquery-1.2.1.pack.js"></script>
   <script type="text/javascript">
	function lookup(inputString) {
		if(inputString.length == 0) {
			// Hide the suggestion box.
			$('#suggestions').hide();
		} else {
			$.post("autocompletar.php", {queryString: ""+inputString+""}, function(data){
				if(data.length >0) {
					$('#suggestions').show();
					$('#autoSuggestionsList').html(data);
				}
			});
		}
	} // lookup
	
	function fill(thisValue,name) {
		$('#inputString2').val(thisValue);
		$('#inputString').val(name);
		setTimeout("$('#suggestions').hide();", 200);
	}
</script>  
<script>
function guardar(f)
{
   if(f.idpersona.value==""){
      alert("Debe seleccionar una persona");
	  f.txtbuscar.focus();
	  return false;
   }
  
   f.action="controladores/procesaenlace.php";
   f.submit();
   return true;
}
</script>

<style type="text/css">

	.suggestionsBox {
		position:relative;
		left: -20px;
		top: -15px;
		margin: 10px 0px 0px 0px;
		width: 300px;
		background-color: #ffffff;
		-moz-border-radius: 7px;
		-webkit-border-radius: 7px;
		border: 2px solid #ccc;	
		color: #000;
	}
	
	.suggestionList {
		margin: 0px;
		padding: 0px;
	}
	
	.suggestionList li {
		
		margin: 0px 0px 3px 0px;
		padding: 3px;
		cursor: pointer;		
	}
	
	.suggestionList li:hover {
		background-color:#F2F2F2;		
	}

#Layer1 {
	position:absolute;
	left:17px;
	top:199px;
	width:265px;
	height:29px;
	z-index:1;
}
</style>

</head>

<body>
<div class="container">
    
	  <h4> Formulario para Compartir Enlace
	  <a href="listaenlace.php?id=<?php echo $idpersona;?>" class="close" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-share" aria-hidden="true"></span></a>
	  </h4>
    
<form name="form1" method="post" action="">
<div class="form-group">
  <strong>Titulo:</strong> 
  <?=$titulo;?><input name="titulo" type="hidden" value="<?=$titulo;?>" class="form-control"/>
  <input name="idpersona" type="hidden" value="<?php echo $idpersona;?>" />
</div>
<div class="form-group">
<?php echo $url;?><input name="url" type="hidden" value="<?php echo $url;?>" class="form-control" /> 
</div>
<div class="form-group">
<strong>Seleccione compa&ntilde;ero:</strong> 

  <input name="txtbuscar" type="text" class="form-control"  id="inputString" onkeyup="lookup(this.value);" onblur="fill();" />
  <div class="suggestionsBox" id="suggestions" style="display:none; float:left">				
				<div class="suggestionList" id="autoSuggestionsList">
&nbsp;			</div>
  </div>

<input name="idpersonacom" type="hidden" size="11" class="Texto2" id="inputString2">
</div>
<div class="form-group">
   <table width="100%" border="0">
  <tr>
    <td scope="col" align="right"><input type="hidden" name="text" value="<?=$valor;?>" />
    <input name="" type="button" value="<?=$boton;?>" class="btn btn-success" onClick="guardar(this.form);"></td>
  </tr>
</table>
</div>
</form>
</div>

</body>
</html>
