<?
 include ("clases/doc_curso.class.php");
include ("clases/curso.class.php");
include ("clases/autor.class.php");
$objc = new curso();
$obja = new autor();
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <!-- This file has been downloaded from Bootsnipp.com. Enjoy! -->
    <title>Asignacion Curso - Docente</title>
	<link rel="stylesheet" href="media/css/bootstrap.css">
	<link rel="stylesheet" href="media/css/bootstrap.min.css">
	<link rel="stylesheet" href="media/css/bootstrap-theme.css">
	<link rel="stylesheet" href="media/css/bootstrap-theme.min.css">
	<link rel="stylesheet" href="media/css/dataTables.bootstrap.min.css">
	<link rel="stylesheet" href="media/css/fixedHeader.bootstrap.min.css">
	<link rel="stylesheet" href="media/css/responsive.bootstrap.min.css">
	 <script src="media/js/jquery-1.10.2.js"></script>
	<script src="media/js/jquery.dataTables.min.js"></script>
	<script src="media/js/dataTables.bootstrap.min.js"></script>
	<script src="media/js/dataTables.fixedHeader.min.js"></script>
	<script src="media/js/dataTables.responsive.min.js"></script>
	<script src="media/js/responsive.bootstrap.min.js"></script>
	
	<script src="media/js/jquery.min.js"></script>
    <script src="media/js/bootstrap.min.js"></script>
	<script>
		$(document).ready(function() {
		var table = $('#example').DataTable( {
			responsive: true
		} ); 
			new $.fn.dataTable.FixedHeader( table );
		 });
   </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("autocompletardoc.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>   
    <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>


<script>
function guardar(f)
{   if(f.curso.value==""){
		 f.txtbuscar.focus();
		 return false;
	}
	if(f.docente.value==""){
		 f.docente.focus();
		 return false;
	}
	
		   f.action='controladores/procesadoc_curso.php';
		   f.submit();
		   return true;
		 
}



$(document).ready(function() {
  $('a[data-toggle=modal], button[data-toggle=modal]').click(function () {
    var data_id = '';
	var data_des= '';
    if (typeof $(this).data('id') !== 'undefined') {
      data_id = $(this).data('id');	   
    }
    $('#idcurso').val(data_id);
  })
});
</script>
 
		  
<div class="container">
	<div class="row">	
        <div class="col-md-12">
        <h4>Lista de Asignacion Curso - Docente
          <button class="btn btn-success btn-xs" data-title="AGREGAR" data-toggle="modal" data-target="#nuevo" ><span class="glyphicon glyphicon-plus"></span> Agregar</button><a href="contenido.php" class="close" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></a></h4>
        <div class="table-responsive">

            
              <table width="100%" class="table table-striped table-bordered nowrap" id="example">
                   
                   <thead>
                   <tr>
				   <th width="3%">ID</th>
                    <th width="9%">Docente</th>
                     <th width="10%">Curso</th>
                     <th width="3%">Del</th> 
					</tr> 
                   </thead>
    <tbody>
    
    <tr><? 
	       $obj = new doc_curso();
		   $lista = $obj->Listar();
		   //////////////////////////////////////////////////77		 
			
			//////////////////////////////////////////////////////////77
		   for($i=0;$i<count($lista); $i++){	    
			
		?>
    <td><?=$lista[$i]["iddoc_curso"];?></td>
    <td><?= $lista[$i]["nombres"]." ".$lista[$i]["apellidos"];?></td>
    <td><?=$lista[$i]["curso"];?></td>
    <td><a href="controladores/procesadoc_curso.php?id=<?=$lista[$i]["iddoc_curso"];?>&text=e"><span class="glyphicon glyphicon-trash"></span></a></td>
    </tr>
    <?
		  }
		?>
     <tfoot>
    <tr>
      <td>ID</td>
      <td>Docente</td>
      <td>Curso</td>
      <td>Del</td>
	 </tr>    
    </tbody>
</table>

<div class="clearfix">

</div>

                
          </div>
            
        </div>
	</div>
</div>

<form name="form1" action="" method="post">

<div class="modal fade" id="nuevo" tabindex="-1" role="dialog" aria-labelledby="nuevo" aria-hidden="true">
      <div class="modal-dialog">
    <div class="modal-content">
          <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></button>
        <h4 class="modal-title custom_align" id="Heading">Registro de Asignacion Curso-Docente</h4>
      </div>
          <div class="modal-body">
          <div class="form-group">
        	<select name="docente" class="form-control">
			   <option value="">Seleccione Docente</option>
				<? $listadoc = $obja->ListaTotal();
				  for($i=0;$i<count($listadoc);$i++){
				 ?>  
				  <option value="<?=$listadoc[$i]["iddoc"];?>"><?=$listadoc[$i]["nombres"]." ".$listadoc[$i]["apellidos"];?></option>
				<?
				  }		
	  			?>
	  </select>  
          </div>
		  <div class="form-group">
		  <input name="txtbuscar" type="text" class="form-control"  id="inputString" onkeyup="lookup(this.value);" onblur="fill();" placeholder="Seleccione Curso" />
  				<div class="suggestionsBox" id="suggestions" style="display:none; float:left">				
							<div class="suggestionList" id="autoSuggestionsList">
&nbsp;						</div>
  				</div>
				<input name="curso" type="hidden"  id="inputString2">
				<input name="text" type="hidden" value="R" id="text">
		   </div>     
      </div>
          <div class="modal-footer ">
        <button type="button" class="btn btn-warning btn-lg" style="width: 100%;" onClick="guardar(this.form);"><span class="glyphicon glyphicon-ok-sign"></span> Guardar</button>
		
      </div>
        </div>
    <!-- /.modal-content --> 
  </div>
      <!-- /.modal-dialog --> 
    </div>
 </form>   
    
 <form name="form2" id="form2" action="" method="post">
 
<div class="modal fade" id="edit" tabindex="-1" role="dialog" aria-labelledby="edit" aria-hidden="true">
      <div class="modal-dialog">
    <div class="modal-content">
          <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></button>
        <h4 class="modal-title custom_align" id="Heading">Actualizacion de Mesa</h4>
      </div>
          <div class="modal-body">
          <div class="form-group">
		 
		  <input name="idcurso" id="idcurso" type="hidden">		   
		 
        <input class="form-control " type="text" name="curso" id="curso" placeholder="Curso">
		<input name="text" type="hidden" value="M" id="text">
		
        </div>       
      </div>
          <div class="modal-footer ">
        <button type="button" class="btn btn-warning btn-lg" style="width: 100%;" onClick="editar(this.form);"><span class="glyphicon glyphicon-ok-sign"></span> Actualizar</button>
		
      </div>
        </div>
    <!-- /.modal-content --> 
  </div>
      <!-- /.modal-dialog --> 
    </div>	
	
 </form>      
  
  
<script type="text/javascript">
$(document).ready(function(){
$("#mytable #checkall").click(function () {
        if ($("#mytable #checkall").is(':checked')) {
            $("#mytable input[type=checkbox]").each(function () {
                $(this).prop("checked", true);
            });

        } else {
            $("#mytable input[type=checkbox]").each(function () {
                $(this).prop("checked", false);
            });
        }
    });
    
    $("[data-toggle=tooltip]").tooltip();
});

</script>
</body>
</htm