<?
session_start();
if(!isset($_SESSION['usuario']))
{
 	echo "<script languaje='JavaScript'>";       
	echo "parent.location.href='index.php'; ";
	echo "</script>";
}
include ("clases/alumno.class.php");
include ("clases/curso.class.php"); $objc = new curso();
include ("clases/autor.class.php"); $objdoc = new autor(); $obja = new autor();
include ("clases/doc_curso.class.php"); $objdc = new doc_curso();
$objd = new alumno();
if($objd->BuscarPorNombre($_SESSION['usuario']))
	{
	  $nombre = $objd->getNombres();
	  $apellido = $objd->getApellidos();
	  $email = $objd->getEmail();
	  $foto = $objd->getFoto();
	  $dir = $objd->getDireccion();
	  $tel = $objd->getTelefono();
	  $f = $objd->getFechanaci();
	  $es = $objd->getEspecialidad();
	  $idalu = $objd->getIdalu();
	}
///////////////////////////////////////

?>
<!DOCTYPE html>
<html>
<head>
<title>Lista de Docentes</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 language="javascript">
function envia2(id)
	{ 
	  window.open("confirma.php?id="+id,"","fullscreen=no, height=470,width=620,left=150,top=100,resizable = yes,scrollbars=yes,toolbar = no,status = no");	
</script>
</head>

<body>
<div class="container">
<form id="form1" name="form1" method="post" action="">

              <div class="panel-heading"><h4>Cursos Disponibles<a href="listaentradas.php" class="close" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-share" aria-hidden="true"></span></a></h4></div>
  <table width="100%" border="0">
    
    <tr >
      <td width="26%"><select name="iddoc" class="form-control">
	    <option value="">Seleccione Docente</option>
		<? $listadoc = $objdoc->ListaTotal();
		   for($k=0;$k<count($listadoc);$k++)
		   {
		   ?>
		   	 <option value="<?=$listadoc[$k]["iddoc"];?>"><?=$listadoc[$k]["nombres"]." ".$listadoc[$k]["apellidos"];?></option>
		  <? }?>
		
      </select></td>
      <td width="13%">&nbsp;</td>
      <td width="61%"><input type="submit" name="Submit" value="Consultar" class="btn btn-primary"/></td>
    </tr>
    <tr >
      <td colspan="3">&nbsp;</td>
      </tr>
    <tr>
      <td colspan="3"><table width="100%" border="0" class="table table-condensed">
        <tr >
          <td colspan="2" ><strong>Docente</strong></td>
          <td width="47%" ><strong>Curso a cargo</strong> </td>
          <td width="4%" >&nbsp;</td>
        </tr>
        <? 
			  $obj = new doc_curso();
			  $c = $_REQUEST['iddoc'];
			  if($c==""){
			  $lista = $obj->ListaTotal();
			  }
			  else{
			  $lista=$obj->ListarPorDocente($c);
			  }
			  for($i = 0; $i<count($lista); $i++)
			  {
			    if($objc->BuscarPorCodigo($lista[$i]["idcurso"])){
				      $lista[$i]["curso"]=$objc->getCurso(); 
				 }
				 
				if($obja->BuscarPorCodigo($lista[$i]["iddoc"])){
				      $lista[$i]["nombres"]=$obja->getNombres();
					  $lista[$i]["apellidos"]=$obja->getApellidos();
					  $lista[$i]["foto"]=$obja->getFoto();
				 }
			  ?>
        <tr onMouseOver="this.style.backgroundColor='#f5f5f5'" onMouseOut="this.style.backgroundColor='#FFFFFF'" class="text-muted">
          <td width="11%" height="46" align="center"><a href="pagdocente.php?id=<?=$lista[$i]["iddoc"];?>" target="trabajos"><img src="fotos/<? if($lista[$i]["foto"]==""){echo "student.png";}else{echo $lista[$i]["foto"];}?>" width="61" height="64" border="0" class="img-thumbnail img-circle" /></a></td>
          <td width="38%" ><?= $lista[$i]["nombres"]." ".$lista[$i]["apellidos"];?></td>
          <td><?= $lista[$i]["curso"];?></td>
          <td align="center"><a href="confirma.php?id=<?=$lista[$i]["iddoc_curso"];?>" class="btn btn-success"><span class="glyphicon glyphicon-ok"></span> Inscribete</a></td>
        </tr>
        <?
			  }
			  ?>
      </table></td>
    </tr>
  </table>
  
</form>
</div>
</body>
</html>
