<?php require_once('Connections/conn.php'); ?>
<?php
session_start();
$cedula_usuario=$_SESSION['CEDULA_USUARIO'];

mysql_select_db($database_conn, $conn);
// Cargo los datos de los Alumnos.

mysql_select_db($database_conn, $conn);
 mysql_query ("SET NAMES 'utf8'");
$query_rstAlumnos = "SELECT id_alumno,cedula,apellidos,nombres FROM alumnos ORDER BY apellidos,nombres";
$rstAlumnos = mysql_query($query_rstAlumnos, $conn) or die(mysql_error());
$totalRows_rstAlumnos = mysql_num_rows($rstAlumnos);

if($totalRows_rstAlumnos >0)
{
    $array_id = array();
	$array_alumno = array();
	$code=0;
	while($alumno = mysql_fetch_assoc($rstAlumnos))
		{
			$array_id[$code] = $alumno["id_alumno"];		
			$array_alumno[$code]=  $alumno["apellidos"].', '.$alumno["nombres"];	
			$code += 1;
		}
}
			
// Datos de las Carreras.

 session_start();
  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_alumno").change(function(){
		$.post("carga_carreras_alumno.php",{ id:$(this).val() },function(data){$("#id_carrera").html(data);})
	});
})
</script>
<body>
<table class="bd" width="100%" align="center"><tr><td class="hr"><h2 align="left">Imprimir de Carnet</h2></td></tr></table>
<form name="carnet" method="post" action="">
  <table width="40%" border="0" align="center" id="carga" cellpadding="1" cellspacing="10" style="border:1px solid #ccc;">
    
    <tr>
      <td>Participante:</td>
      <td colspan="5"><label>
        <select name="id_alumno" id="id_alumno" style="width:580px">
		<option value="0">Seleccione...</option>
         <?php
 			for($i=0;$i<count($array_alumno);$i++) {
  			echo "<option value=".$array_id[$i].">".$array_alumno[$i]."</option>" ;
			} 
		  ?> 
		 </select>
      </label></td>
    </tr>
    <tr>
      <td width="59"><div align="right">Carrera:</div></td>
      <td width="548" colspan="5"><label>
        <select name="id_carrera" id="id_carrera" style="width:580px">
		  <option value="0">Seleccione...</option>
        </select>
      </label></td>
    </tr>
    
    <tr>
      <td height="34" colspan="6"><div align="center">
        <label>
        <input name="Enviar" type="button" id="Enviar" value="Consultar" onClick="imprimir_carnet()" >
        </label>
      </div></td>
    </tr>
  </table>
    <div align="center"></div>
  <div align="center"></div>
</form>
<p>&nbsp;</p>
<?php
?>
</body>
</html>

<script type="text/javascript">
 function imprimir_carnet()
 {  
 	url="modelo/class_pdf/carnet.php?carrera="+document.carnet.id_carrera.value+"&cedula="+document.carnet.id_alumno.value;
	window.open(url);
	//window.location=url;
 }
</script>
