<? include ("clases/clases.class.php");
include ("clases/doc_curso.class.php");
include ("clases/curso.class.php");
include ("clases/autor.class.php");
$objdc = new doc_curso(); $objc = new curso(); $objd = new autor();
$cod=$_REQUEST['id'];
if($objdc->BuscarPorCodigo($cod)){
     $idcurso =  $objdc->getIdcurso();
	 if($objc->BuscarPorCodigo($idcurso)){
	   $curso = $objc->getCurso();
	 }
	 $iddoc =  $objdc->getIddoc();
	 if($objd->BuscarPorCodigo($iddoc)){$nom = $objd->getNombres()." ".$objd->getApellidos();}
   }
///////////////////////////////   
$obja=new clases();    
?>
<html>
	<head><title>mi web</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="editor/ckeditor/ckeditor.js" type=text/javascript></script>
    <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>
		</head>
	
	<script language="javascript">
	function consultar(f){
	f.action = 'mandocente.php';
	f.submit();return true;
	}	
	</script>
	<script>
function confirmar()
{
	if(confirm('Estas seguro de Eliminar el Registro?'))
		return true;
	else
		return false;
}

function guardar(f)
{
  if(f.clase.value=="")
   {
      f.clase.focus();
	  return false;
   }
   if(f.file.value=="")
   {
      alert("Debe seleccionar un archivo");
      f.file.focus();
	  return false;
   }
   
   f.action='controladores/procesaclases.php';
   f.submit();
   return true;
}

$(function () {
  $('[data-toggle="tooltip"]').tooltip()
})
</script>
	<style>
	.text_docentes{ font-size:12px; font-family:Arial, Helvetica, sans-serif;}
	</style>
	<body>
	<form action="controladores/procesaclases.php" method="post" enctype="multipart/form-data" name="f">
	  <div id="container">
	        <div class="panel-heading">
		            <h4>Registro de Clases del curso de: <?=$curso;?>
					<a href="#" data-id="" data-title="Editar" data-toggle="modal" data-target="#nuevo" class="btn btn-default"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></a>
					<a href="datoscargalectiva.php?dc=<?=$cod;?>" class="close" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-share" aria-hidden="true"></span></a></h4>					
		    </div>
			<div class="form-group">
  <table width="90%" border="0" align="center">
			    
			    <tr>
			      <td width="517" >
                    <table width="100%"  border="0"  class="table table-responsive">
                      <tr class="text_docentes active">
                        <td colspan="2"  >Titulo de clase </td>
                        <td  >Estado</td>
                        <td colspan="3"  align="center">&nbsp;</td>
                      </tr>
                      <? 
			  
			  $lista=$obja->ListarPorDoccur($cod);			  
			  for($i = 0; $i<count($lista); $i++)
			  {
			  ?>
                      <tr onMouseOver="this.style.backgroundColor='#f5f5f5'" onMouseOut="this.style.backgroundColor='FFFFFF'" class="text_docentes">
                        <td width="3%" ><span class="glyphicon glyphicon-ok"></span></td>
                        <td width="34%" ><a href="temas/<?= $lista[$i]["archivo"];?>" data-toggle="tooltip" title="Descargar Clase"><?= $lista[$i]["clase"];?></a></td>
                        <td width="29%" ><? if($lista[$i]["estado"]=="V"){echo "Visible";}else{echo "No Visible";}?></td>
         <td width="3%" ><a href="frmtarea.php?iddoccur=<?=$lista[$i]['iddoc_curso']?>&idclases=<?=$lista[$i]["idclases"];?>" data-toggle="tooltip" title="Crear Tarea"><span class="glyphicon glyphicon-open-file"></span></a></td >
                        <td width="3%" ><a href="controladores/procesaclases.php?id=<?=$lista[$i]["idclases"];?>&text=A&iddoccur=<?=$lista[$i]['iddoc_curso'];?>&estado=<?= $lista[$i]["estado"];?>" data-toggle="tooltip" title="Cambiar estado"><span class="glyphicon glyphicon-refresh"></span></a></td >
                        <td width="6%" ><a href="controladores/procesaclases.php?id=<?=$lista[$i]['idclases'];?>&text=e&iddoccur=<?=$lista[$i]['iddoc_curso'];?>" onClick="return confirmar();" data-toggle="tooltip" title="Eliminar"><span class="glyphicon glyphicon-trash"></span></a></td >
                      </tr>
                      
                      <?
			  }
			  ?>
                    </table>		          </td>
      </tr>
		      </table>
	    </div>
	  </div>
	</form>

     <form name="form2" action="" method="post" enctype="multipart/form-data">
        <input type="hidden" name="iddoc_curso" value="<?=$cod;?>">
		<input type="hidden" name="text" value="R">
<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">Registrar Clase</h4>
      </div>
          <div class="modal-body">
          <div class="form-group">Titulo:
         <input name="clase" type="text" value="" size="35" class="form-control" >
		</div>
		<div class="form-group">Archivo:
		<input type="file" name="file" class="form-control">
		<input type="hidden" name="MAX_FILE_SIZE" value="4000000">	
		</div>	
		<div class="form-group">
				  <select name="estado" class="form-control">
                    <option value="V">Visible</option>
                    <option value="NV">No Visible</option>
                  </select>
				  </div>
       
      </div>
          <div class="modal-footer ">
        <button type="button" class="btn btn-success 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>   
	</body>	
</html>