<?php require_once('Connections/conn.php'); ?>
<?php
session_start();

mysql_select_db($database_conn, $conn);
mysql_query ("SET NAMES 'utf8'");

// Datos del alumno
$sql = "SELECT id_docente,cedula,apellidos, nombres FROM docentes order by apellidos,nombres";
$rs = mysql_query($sql, $conn) or die(mysql_error());
$row = mysql_fetch_assoc($rs);

// Datos del Periodo
$sql1 = "SELECT id_periodo,codigo, tipo FROM periodos where status='CERRADO' AND id_periodo>=70 order by id_periodo asc";
$rs1 = mysql_query($sql1, $conn) or die(mysql_error());
$row1 = mysql_fetch_assoc($rs1);

// Datos del Periodo
$sql2 = "SELECT codigo, nombre_sede FROM sedes order by nombre_sede";
$rs2 = mysql_query($sql2, $conn) or die(mysql_error());
$row2 = mysql_fetch_assoc($rs2);

  if (isset($_GET["order"])) $order = @$_GET["order"];
  if (isset($_GET["type"])) $ordtype = @$_GET["type"];

  if (isset($_POST["filter"])) $filter = @$_POST["filter"];
  if (isset($_POST["filter_field"])) $filterfield = @$_POST["filter_field"];
  $wholeonly = false;
  if (isset($_POST["wholeonly"])) $wholeonly = @$_POST["wholeonly"];

  if (!isset($order) && isset($_SESSION["order"])) $order = $_SESSION["order"];
  if (!isset($ordtype) && isset($_SESSION["type"])) $ordtype = $_SESSION["type"];
  if (!isset($filter) && isset($_SESSION["filter"])) $filter = $_SESSION["filter"];
  if (!isset($filterfield) && isset($_SESSION["filter_field"])) $filterfield = $_SESSION["filter_field"];

?>

<html>
<head>
<title>sadce -- carga de calificaciones</title>
<meta name="generator" http-equiv="content-type" content="text/html">
<style type="text/css">
  body {
    background-color: #FFFFFF;
    color: #004080;
    font-family: Arial;
    font-size: 12px;
  }
  .bd {
    background-color: #FFFFFF;
    color: #004080;
    font-family: Arial;
    font-size: 12px;
  }
  .tbl {
    background-color: #FFFFFF;
  }
  a:link { 
    color: #FF0000;
    font-family: Arial;
    font-size: 12px;
  }
  a:active { 
    color: #0000FF;
    font-family: Arial;
    font-size: 12px;
  }
  a:visited { 
    color: #800080;
    font-family: Arial;
    font-size: 12px;
  }
  .hr {
    background-color: #336699;
    color: #FFFFFF;
    font-family: Arial;
    font-size: 12px;
  }
  a.hr:link {
    color: #FFFFFF;
    font-family: Arial;
    font-size: 12px;
  }
  a.hr:active {
    color: #FFFFFF;
    font-family: Arial;
    font-size: 12px;
  }
  a.hr:visited {
    color: #FFFFFF;
    font-family: Arial;
    font-size: 12px;
  }
  .dr {
    background-color: #FFFFFF;
    color: #000000;
    font-family: Arial;
    font-size: 12px;
  }
  .sr {
    background-color: #FFFFCF;
    color: #000000;
    font-family: Arial;
    font-size: 12px;
  }
</style>
<script src="jquery.min.js" type="text/javascript"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

</head>
<script>
$(document).ready(function(){
	$("#id_carrera").change(function(){
		$.post("carga_materias.php",{ id:$(this).val() },function(data){$("#materia").html(data);})
	});
})
</script>
<body>

<table class="bd" width="100%" align="center"><tr><td class="hr"><h2 align="left">Carga Acad&eacute;mica (Hist&oacute;rico)</h2></td></tr></table>
<form name="form1" method="post" action="">
  <table width="38%" border="0" align="center" id="carga" cellpadding="1" cellspacing="10" style="border:1px solid #ccc;">
    <tr>
      <td><div align="right">Docente:</div></td>
      <td><select name="id_docente" id="id_docente">
	   <option value="0">TODOS...</option>
          <?php
do {  
?>
          <option value="<?php echo $row['id_docente']?>"><?php echo $row['apellidos'].' '.$row['nombres']?></option>
          <?php
} while ($row = mysql_fetch_assoc($rs));
?>
        </select>      </td>
    </tr>
    <tr>
      <td><div align="right">Sede:</div></td>
      <td><select name="sede" id="sede">
	      <option value="0">TODAS...</option>
          <?php
do {  
?>
          <option value="<?php echo $row2['codigo']?>"><?php echo $row2['nombre_sede']?></option>
          <?php
} while ($row2 = mysql_fetch_assoc($rs2));
?>
      </select>      </td>
    </tr>
    <tr>
      <td width="98"><div align="right">Lapso:</div></td>
      <td width="298">
	  <select name="id_periodo" id="id_periodo">
          <?php
do {  
?>
          <option value="<?php echo $row1['id_periodo']?>"><?php echo $row1['codigo']?>&nbsp;(<?php echo $row1['tipo']?>)</option>
          <?php
} while ($row1 = mysql_fetch_assoc($rs1));
?>
      </select>      </td>
    </tr>
    

    

    <tr>
      <td height="34" colspan="6"><div align="center">
        <label>
        <input name="Enviar" type="button" id="Enviar" value="Imprimir " onClick="imprimir()" >
        </label>
      </div></td>
    </tr>
  </table>
    <div align="center"></div>
  <div align="center"></div>
</form>
<p>&nbsp;</p>
</body>

 <script type="text/javascript">
	var nav4 = window.Event ? true : false;
	function soloNum(evt)
	{	
	// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57, ','= 44, '.'= 46
		var key = nav4 ? evt.which : evt.keyCode;	
		//var str=obj.value;
	
		return (key == 8 || key == 13 || (key >= 48 && key <= 57));
	}
	
	function validar_datos()
	{
		if(document.form1.id_periodo.value==0){
			alert("El campo <<Período>> es obligatorio");
			document.form1.id_periodo.focus();
			return false;
			}
			return true;
	}
	
	
</script>
 <?php
mysql_free_result($rs);
?>

<script type="text/javascript">
 function imprimir()
 {
    if(document.form1.id_docente.value!=0){
 	   url="modelo/class_pdf/carga_docente_seleccionado.php?id_docente="+document.form1.id_docente.value+"&sede="+document.form1.sede.value+"&id_periodo="+document.form1.id_periodo.value;
       window.open(url);
	  }
	  else{
	    url="modelo/class_pdf/carga_docente_todos.php?id_docente="+document.form1.id_docente.value+"&sede="+document.form1.sede.value+"&id_periodo="+document.form1.id_periodo.value;
       window.open(url);
	}  
 }
</script>
