<?
include ("clases/enlace.class.php"); $objb = new enlace();
 $idpersona=$_REQUEST['idpersona'];
 
 $ide = $_REQUEST['idenlace'];
 if($objb->BuscarPorCodigo($ide))
 {
   $titulo = $objb->getTitulo();
   $url = $objb->getUrl();
   $visible = $objb->getVisible();
   $valor = "M";
   $boton = "Modificar";
 }else{
 		$valor = "R";
		$boton = "Guardar";
      }
?>
<html>
<head>
<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 src="editor/ckeditor/ckeditor.js" type=text/javascript></script>

<script>
function guardar(f)
{
   if(f.titulo.value==""){
      alert("Debe ingresar un titulo");
	  f.titulo.focus();
	  return false;
   }
   if(f.url.value==""){
      alert("No ha ingresado ninguna URL");
	  f.url.focus();
	  return false;
   }
  /* if(f.visible.value==""){
      alert("Seleccione el estado de la entrada");
	  f.visible.focus();
	  return false;
   }*/
   f.action="controladores/procesaenlace.php";
   f.submit();
   return true;
}
</script>
</head>

<body>
<div class="container">
<form name="form1" method="post" action="">
 <div class="panel-heading">
    <h4>      Registrar de Enlace:       
      <input type="hidden" name="idpersona" value="<?php echo $idpersona;?>">
    <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>
  </div> 
  
  <div class="form-group">
  Ingrese Titulo
  </div>
  <div class="form-group">
  <input name="titulo" type="text" class="form-control" value="<?=$titulo;?>">
  </div>
  
  <div class="form-group">
  <input name="url" type="text" value="<?php echo $url;?>" placeholder="URL" class="form-control">
  </div>
  <div class="form-group">
   <table width="100%" border="0">
  <tr>
    <td scope="col" align="right"><input name="" type="button" value="<?=$boton;?>" class="btn btn-success" onClick="guardar(this.form);"></td>
  </tr>
</table>
   <select name="visible" class="form-control-static" style="visibility:hidden">
    <option value="<?php if($visible!=""){echo $visible;}else{echo "";}?>"><?php if($visible!=""){echo $visible;}else{echo "Seleccione";}?></option>
	<option value="PUBLICO">PUBLICO</option>
	<option value="PRIVADO">PRIVADO</option>
   </select>
   <input type="hidden" name="idenlace" value="<?=$ide;?>">
   <input type="hidden" name="text" value="<?=$valor;?>">
  </div>
   
</form>
</div>
</body>
</html>
