<?
include ("clases/blog.class.php"); $objb = new blog();
 $idpersona=$_REQUEST['idpersona'];
 
 $idblog = $_REQUEST['idblog'];
 if($objb->BuscarPorCodigo($idblog))
 {
   $titulo = $objb->getTitulo();
   $detalle = $objb->getDetalle();
   $estado = $objb->getEstado();
   $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 de entrada");
	  f.titulo.focus();
	  return false;
   }
   if(f.detalle.value==""){
      alert("No ha ingresado ningun contenido a la entrada");
	  f.detalle.focus();
	  return false;
   }
   if(f.estado.value==""){
      alert("Seleccione el estado de la entrada");
	  f.estado.focus();
	  return false;
   }
   f.action="controladores/procesablog.php";
   f.submit();
   return true;
}
</script>
</head>

<body>
<div class="container">
<form name="form1" method="post" action="">
 <div class="panel-heading">
    <h4>      Registrar de Entradas:
      <input type="hidden" name="idpersona" value="<?php echo $idpersona;?>">    
      <a href="listablog.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">
  <textarea name="detalle" id="toolbar-container"  class="form-control" placeholder="Detalle"  ><?=$detalle;?>
               
            </textarea><script>
                CKEDITOR.replace( 'detalle' );
            </script>
		 
  </div>
   <div class="form-group">
   <select name="estado" class="form-control-static">
    <option value="<?php if($estado!=""){echo $estado;}else{echo "";}?>"><?php if($estado!=""){echo $estado;}else{echo "Seleccione estado";}?></option>
	<option value="PUBLICO">PUBLICO</option>
	<option value="PRIVADO">PRIVADO</option>
   </select>
   </div>
   <div class="form-group">
   <table width="100%" border="0">
  <tr>
    <td scope="col" align="right"><input type="hidden" name="idblog" value="<?=$idblog;?>">
    <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>
