<?php   include 'conector.php';
session_start();

if(isset($_SESSION["user"])){

  $class1="class=\"active\"";
  $class2="";
  $act2="";
  $act1=" active ";
if(isset($_POST['val1'])&&!empty($_POST['val1'])){

 if($_POST['val1']==1){
	
	$actualiza_pensum="update pensum set
	nombre='".$_POST['nombre1']."',
	class_id='".$_POST['curso1']."',
	teacher_id='".$_POST['docente1']."',
	asignatura_id='".$_POST['asignatura1']."',
	intensidad='".$_POST['horas1']."',
	estado='".$_POST['estado1']."'
	where subject_id=".$_POST['ide1']."
	";
	
//	echo $actualiza_pensum."<br>";
mysql_query($actualiza_pensum)or die(mysql_error());
	$men="<div class=\"alert alert-success\">
                    <button type=\"button\" class=\"close\" data-dismiss=\"alert\">X</button>
                    Pensum Actualizado
			</div>";	
	
	

 }
}
 $select_asignatura="select 

			 pensum.nombre,
			 (select codigo from curso where curso_id=pensum.class_id),
			 (select CONCAT(teacher_id,' ',nombre) as profe from docente where docente.teacher_id=pensum.teacher_id),
			 (select nombre from asignatura where pensum.asignatura_id=asignatura.subject_id),
			 pensum.intensidad,
			 pensum.estado,
			 pensum.subject_id,
			 pensum.class_id,
			 pensum.teacher_id,
			 pensum.asignatura_id			 
 from pensum where pensum.estado in ('A','I') order by nombre";
 $res_select_asignatura=mysql_query($select_asignatura);
				
					$tbody="<tbody>";
					while($r_sag=mysql_fetch_array($res_select_asignatura)){
					$c1='';$c2='';
					if($r_sag[5]=='A'){$est='Activo';$lab='success ';$c1=' selected ';}else{$est='Inactivo';$lab='danger ';$c2=' selected ';}
					$tbody.="<tr role='row'><td>".$r_sag[0]."</td><td class='curso'>".$r_sag[1]."</td><td>".$r_sag[3]."</td><td>".$r_sag[4]."</td><td class='nombre'>".$r_sag[2]."</td>
					<td><span class='label label-".$lab."'>".$est."</span></td>
					<td>
					<a class='btn btn-info btn-xs'  data-toggle='modal' data-target='#mimodala".$r_sag[6]."' onclick=''>
                			<i class='glyphicon glyphicon-edit icon-white'></i>  
			                Editar               
				        </a>
				        </td>
					</tr>";
					
					
					$tbody.="<div name='mimodala".$r_sag[6]."' id='mimodala".$r_sag[6]."' class='modal fade bs-example-modal-sm' tabindex='-1' role='dialog' aria-labelledby='mySmallModalLabel' aria-hidden='true'>
						  <div class='modal-dialog modal-md'>
						    <div class='modal-content'>
						      <div class='modal-header'>
							      <button type='button' class='close' data-dismiss='modal' aria-hidden='true'>x</button>
						      		<h4 class='modal-title' id='myLargeModalLabel'>Consultar Pensum</h4>
	      					      </div>
	      					      <div class='modal-body'>";
						$tbody.="
								 
						 <div class='input' style='float:left;width: 120px;padding-top: 5px;padding-left: 10px;text-align: left;height:20px;font-size:12px;' >
						Nombre &nbsp;  </div>
						<div class='input' ><input    value='".$r_sag[0]."' id='nombre_".$r_sag[6]."' name='nombre_".$r_sag[6]."' type='text' class='form-control2' style='width:50%;margin-bottom: 10px' >
						 </div>		 
					 <div class='input' style='float:left;width: 120px;padding-top: 5px;padding-left: 10px;text-align: left;height:20px;font-size:12px;' >
						Curso &nbsp;  </div>
						<div class='input' >
						<select id='curso_".$r_sag[6]."' name='curso_".$r_sag[6]."' class='form-control2' style='width:50%;margin-bottom: 10px'>";
				
			
				
							$select_curso2='select curso_id,nombre,codigo
					from curso where estado="A" order by orden';
					$res_select_curso2=mysql_query($select_curso2);
					$tbody.="<option value='XX' >Seleccione Curso</option>";
					while($r_sc2=mysql_fetch_array($res_select_curso2)){
					$sel3='  ';
					if($r_sag[7]==$r_sc2[0]){$sel3=' selected ';}
					//echo "hola";
							$tbody.='<option value="'.$r_sc2[0].'"  '.$sel3.'>'.$r_sc2[2].' - '.$r_sc2[1].' </option>';
					}		
							
							
					$tbody.="</select>
						 </div>		 



					 <div class='input' style='float:left;width: 120px;padding-top: 5px;padding-left: 10px;text-align: left;height:20px;font-size:12px;' >
						Docente &nbsp;  </div>
						<div class='input' >
						<select id='docente_".$r_sag[6]."' name='docente_".$r_sag[6]."' class='form-control2' style='width:50%;margin-bottom: 10px'>";
				
			
				
							$select_doc2='select teacher_id,nombre
							from docente where estado="A" order by nombre';
							$res_select_doc2=mysql_query($select_doc2);
							$tbody.="<option value='XX' >Seleccione Docente</option>";
							while($r_sd2=mysql_fetch_array($res_select_doc2)){
							$sel2=' ';
							if($r_sag[8]==$r_sd2[0]){$sel2=' selected ';}
									$tbody.='<option value="'.$r_sd2[0].'"  '.$sel2.'>'.$r_sd2[0].' - '.$r_sd2[1].' </option>';
							}
							
					$tbody.="</select>
						 </div>	

					 <div class='input' style='float:left;width: 120px;padding-top: 5px;padding-left: 10px;text-align: left;height:20px;font-size:12px;' >
						Asignatura &nbsp;  </div>
						<div class='input' >
						<select id='asignatura_".$r_sag[6]."' name='asignatura_".$r_sag[6]."' class='form-control2' style='width:50%;margin-bottom: 10px'>";
				
			
				
							$select_asig2='select subject_id,codigo,nombre,sigla
										from asignatura 
										where estado="A"
										order by nombre';
							$res_select_asig2=mysql_query($select_asig2);
							$tbody.="<option value='XX' >Seleccione Asignatura</option>";
							while($r_asi2=mysql_fetch_array($res_select_asig2)){
							$sel4=' ';
							if($r_sag[9]==$r_asi2[0]){$sel4=' selected ';}

							$tbody.='<option value="'.$r_asi2[0].'"  '.$sel4.'>'.$r_asi2[2].' </option>';
									
							}
							
					$tbody.="</select>
						 </div>								 	 
					 <div class='input' style='float:left;width: 120px;padding-top: 5px;padding-left: 10px;text-align: left;height:20px;font-size:12px;' >
						Int. Horaria &nbsp;  </div>
						<div class='input' ><input    value='".$r_sag[4]."' id='horas_".$r_sag[6]."' name='horas_".$r_sag[6]."' type='text' class='form-control2' style='width:50%;margin-bottom: 10px' >
						 </div>					
				
				 	 <div class='input' style='float:left;width: 120px;padding-top: 5px;padding-left: 10px;text-align: left;height:20px;font-size:12px;' >
								Estado&nbsp;  </div>
					 <div class='input' >
								 <select id='estadoa".$r_sag[6]."' name='estadoa".$r_sag[6]."' class='form-control2' style='width:50%;margin-bottom: 10px'>
								 	<option value='A' $c1 >Activo</option>
								 	<option value='I' $c2 >Inactivo</option>
								 </select>
					 </div>
								 ";

						 $tbody.="<div>
						 <button type=\"button\" class=\"btn btn-primary btn-xs\" onclick='actualizar_pensum(".$r_sag[6].")' >Actualizar</button>
							<button type=\"button\" class=\"btn btn-info btn-xs\" data-dismiss='modal' >Cerrar</button>
							</div>";	
					
					
					}
					$tbody.="</tbody>";




if(isset($_POST['val2'])&&!empty($_POST['val2'])){

 if($_POST['val2']==1){
  $class1="";
  $class2="class=\"active\"";
  $act1="";
  $act2=" active ";


	$insertar_asignatura='insert into pensum (nombre,class_id,teacher_id,asignatura_id,intensidad,estado)
	values("'.$_POST['nombre_registro2'].'","'.$_POST['l_curso22'].'","'.$_POST['docente2'].'","'.$_POST['asignatura2'].'","'.$_POST['intensidad_asignatura2'].'","A"
	)';
	mysql_query($insertar_asignatura)or die(mysql_error());
	$men="<div class=\"alert alert-success\">
                    <button type=\"button\" class=\"close\" data-dismiss=\"alert\">X</button>
                    Registro: ".$_POST['nombre_registro2']." Insertado
			</div>";


	
	



 }
}



echo "
<!DOCTYPE html>
<html lang=\"en\">
  <head>
    <meta charset=\"utf-8\">
    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">
    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">
    <meta name=\"description\" content=\"\">
    <meta name=\"author\" content=\"\">
    <link rel=\"shortcut icon\" href=\"assets/ico/favicon.ico\">
	<style>
	</style>
    <title>Pensum</title>

    <!-- Bootstrap core CSS -->
    <link href=\"dist/css/bootstrap.min.css\" rel=\"stylesheet\">

    <!-- Custom styles for this template -->
    <link href=\"offcanvas.css\" rel=\"stylesheet\">

    <!-- Just for debugging purposes. Don't actually copy this line! -->
    <!--[if lt IE 9]><script src=\"assets/js/ie8-responsive-file-warning.js\"></script><![endif]-->

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src=\"https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js\"></script>
      <script src=\"https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js\"></script>
    <![endif]-->
    <script>
 function actualizar_pensum(ide){
 
 if(document.getElementById('nombre_'+ide).value==''){alert('Debe digitar el nombre de la Asignatura');return false;}
	else{document.getElementById('nombre1').value=document.getElementById('nombre_'+ide).value}
 if(document.getElementById('curso_'+ide).value==''){alert('Debe Seleccionar Docente');return false;}
	else{document.getElementById('curso1').value=document.getElementById('curso_'+ide).value}
 if(document.getElementById('docente_'+ide).value==''){alert('Debe Seleccionar Docente');return false;}
	else{document.getElementById('docente1').value=document.getElementById('docente_'+ide).value}
 if(document.getElementById('asignatura_'+ide).value==''){alert('Debe Seleccionar Docente');return false;}
	else{document.getElementById('asignatura1').value=document.getElementById('asignatura_'+ide).value}
 if(document.getElementById('horas_'+ide).value==''){alert('Debe Seleccionar Docente');return false;}
	else{document.getElementById('horas1').value=document.getElementById('horas_'+ide).value}
	document.getElementById('estado1').value=document.getElementById('estadoa'+ide).value;
	document.getElementById('ide1').value=ide;	
	document.getElementById('val1').value=1;
	document.forms['listar_pensum'].submit();			

	
 }  

function crea_registro(){

if(document.getElementById('nombre_registro').value==''){alert('Debe digitar el nombre del Registro');return false;}
	else{document.getElementById('nombre_registro2').value=document.getElementById('nombre_registro').value}
	
if(document.getElementById('l_curso2').value=='XX'){alert('Debe seleccionar el Curso');return false;}
	else{document.getElementById('l_curso22').value=document.getElementById('l_curso2').value}

if(document.getElementById('docente').value=='XX'){alert('Debe seleccionar el Docente');return false;}
	else{document.getElementById('docente2').value=document.getElementById('docente').value}

if(document.getElementById('asignatura').value=='XX'){alert('Debe seleccionar Asignatura');return false;}
	else{document.getElementById('asignatura2').value=document.getElementById('asignatura').value}

if(document.getElementById('intensidad_asignatura').value==''){alert('Debe digitar Intensidad (Horas) de la Asignatura');return false;}
	else{document.getElementById('intensidad_asignatura2').value=document.getElementById('intensidad_asignatura').value}

	document.getElementById('val2').value=1;
	document.forms['crear_pensum'].submit();			
}


</script>
  
    
    
    
  </head>

  <body>
    <div class=\"navbar navbar-fixed-top navbar-inverse\" role=\"navigation\">
      <div class=\"container\">

         
         <a class=\"\" href=\"general.php\"><img src='img/logo1.png' style='margin-top:5px'></a>

        
        <a href=\"index.php\"><img src='img/salir.png' style='float:right;margin-top:15px'>
       </a><span style='float:right;margin-right:10px; margin-top:15px' class='label label-success'><span class='glyphicon glyphicon-user'></span> ".$_SESSION["user"]."</span>
      </div><!-- /.container -->
    </div><!-- /.navbar -->


    <div class=\"container\">

      <div class=\"row row-offcanvas row-offcanvas-left\">

       <div class=\"col-xs-6 col-sm-3 sidebar-offcanvas\" id=\"sidebar\" role=\"navigation\">
          <div class=\"list-group\">
            <a href=\"general.php\" class=\"list-group-item \" data-rel='popover' data-content='Dashboard' data-original-title><span class=\"glyphicon glyphicon-home\"></span> General</a>
            <a href=\"estudiantes.php\" class=\"list-group-item \"><span class=\"glyphicon glyphicon-th\"></span> Estudiantes</a>
            <a href=\"docentes.php\" class=\"list-group-item\"><span class=\"glyphicon glyphicon-user\"></span> Docentes</a>
            <a href=\"acudiente.php\" class=\"list-group-item \"><span class=\"glyphicon glyphicon-user\"></span> Acudiente</a>            
            <a href=\"asignaturas.php\" class=\"list-group-item \"><span class=\"glyphicon glyphicon-book\"></span> Asignaturas</a>
            <a href=\"cursos.php\" class=\"list-group-item\"><span class=\"glyphicon glyphicon-list\"></span> Cursos</a>
            <a href=\"pensum.php\" class=\"list-group-item active\"><span class=\"glyphicon glyphicon-edit\"></span> Pensum</a>            
            <a href=\"logros.php\" class=\"list-group-item \"><span class=\"glyphicon glyphicon-edit\"></span> Logros</a>                        
            <a href=\"observaciones.php\" class=\"list-group-item \"><span class=\"glyphicon glyphicon-edit\"></span> Indicadores Comportamiento</a>
            <a href=\"horario.php\" class=\"list-group-item \"><span class=\"glyphicon glyphicon-edit\"></span> Horario</a>
<a href=\"horario_atencion.php\" class=\"list-group-item \"><span class=\"glyphicon glyphicon-edit\"></span> Horario Atenci&oacute;n</a>            
<a href=\"planilla_asistencia.php\" class=\"list-group-item \"><span class=\"glyphicon glyphicon-file\"></span> Asistencia</a>            
<a href=\"planilla.php\" class=\"list-group-item \"><span class=\"glyphicon glyphicon-file\"></span> Planilla Notas</a>            
            <a href=\"planilla_obs.php\" class=\"list-group-item \"><span class=\"glyphicon glyphicon-file\"></span> Reportes Escolares</a>                        
            <a href=\"pagos.php\" class=\"list-group-item \"><span class=\"glyphicon glyphicon-list\"></span> Pagos</a>           
            <a href=\"reportes.php\" class=\"list-group-item \"><span class=\"glyphicon glyphicon-file\"></span> Informes</a><a href=\"eventos.php\" class=\"list-group-item \"><span class=\"glyphicon glyphicon-edit\"></span> Anuncios</a>            
            <a href=\"config.php\" class=\"list-group-item\"><span class=\"glyphicon glyphicon-wrench\"></span> Configuraci&oacute;n</a>
          </div>
        </div><!--/span-->

        <div class=\"col-xs-12 col-sm-9\">
          <p class=\"pull-left visible-xs\">
            <button type=\"button\" class=\"btn btn-primary btn-xs\" data-toggle=\"offcanvas\">menu</button>
          </p>
    
	<div class=\"panel panel-default\">
	<br>";
echo $men;	
echo	      "
	      <!-- Nav tabs -->
	<ul class=\"nav nav-tabs\">
		<li >&nbsp;</li>
	  <li $class1 ><a href=\"#home\" data-toggle=\"tab\">Gestion Registros</a></li>
	  <li $class2 ><a href=\"#profile\" data-toggle=\"tab\">Crear Registro</a></li>
	</ul>
	
	<!-- Tab panes -->

	<div class=\"tab-content\">
	<div class=\"tab-pane fade in $act2 \" id=\"profile\">
		<form name='crear_pensum' id='crear_pensum' method='post' action='pensum.php#profile' target='' >
		<input type='hidden' name='val2' id='val2' value='".$val2."'>	
		<input type='hidden' name='nombre_registro2' id='nombre_registro2' value='".$nombre_registro2."'>	
		<input type='hidden' name='l_curso22' id='l_curso22' value='".$l_curso22."'>
		<input type='hidden' name='docente2' id='docente2' value='".$docente2."'>		
		<input type='hidden' name='asignatura2' id='asignatura2' value='".$asignatura2."'>				
		<input type='hidden' name='intensidad_asignatura2' id='intensidad_asignatura2' value='".$intensidad_asignatura2."'>						

		
		<div class=\"page\">
			<fieldset>
				<legend>
					<br><span class=\"glyphicon glyphicon-plus\"></span> Crear Nuevo Registro          
				</legend>			
			</fieldset>
		
		
		 <div class='input' style='float:left;width: 140px;padding-top: 5px;text-align: right;' >
			Nombre&nbsp;
		  </div>
		 <div class='input' >
		    <input id='nombre_registro' name='nombre_registro' type='text' class='form-control' placeholder='' style='width:48%;margin-bottom: 10px'>
		 </div>

		<div class='input' style='float:left;width: 140px;padding-top: 5px;text-align: right;' >
			Curso&nbsp;
		  </div>
		 <div class='input' >
					<select id='l_curso2' name='l_curso2' class='form-control' style='width:48%;margin-bottom: 10px'>";
				
			
				
					$select_curso='select curso_id,nombre,codigo
					from curso order by orden';
					$res_select_curso=mysql_query($select_curso);
					echo "<option value='XX' >Seleccione Curso</option>";
					while($r_sc=mysql_fetch_array($res_select_curso)){
					$sel1='  ';
					//if($_POST['area']==$r_ar[0]){$sel1=' selected ';}
					//echo "hola";
							echo '<option value="'.$r_sc[0].'"  '.$sel1.'>'.$r_sc[2].' - '.$r_sc[1].' </option>';
					}
					
echo					"</select>
		 </div>

		<div class='input' style='float:left;width: 140px;padding-top: 5px;text-align: right;' >
			Docente&nbsp;
		  </div>
		 <div class='input' >
					<select id='docente' name='docente' class='form-control' style='width:48%;margin-bottom: 10px'>";
				
			
				
					$select_doc='select teacher_id,nombre
					from docente order by nombre';
					$res_select_doc=mysql_query($select_doc);
					echo "<option value='XX' >Seleccione Docente</option>";
					while($r_sd=mysql_fetch_array($res_select_doc)){
					$sel1='  ';
					//if($_POST['area']==$r_ar[0]){$sel1=' selected ';}
					//echo "hola";
							echo '<option value="'.$r_sd[0].'"  '.$sel1.'>'.$r_sd[0].' - '.$r_sd[1].' </option>';
					}
					
echo					"</select>
		 </div>
		<div class='input' style='float:left;width: 140px;padding-top: 5px;text-align: right;' >
			Asignatura&nbsp;
		  </div>
		 <div class='input' >
					<select id='asignatura' name='asignatura' class='form-control' style='width:48%;margin-bottom: 10px'>";
				
			
				
					$select_doc="select subject_id,codigo,nombre,sigla
					from asignatura 
					where estado='A'
					order by nombre";
					$res_select_doc=mysql_query($select_doc);
					echo "<option value='XX' >Seleccione Asignatura</option>";
					while($r_sd=mysql_fetch_array($res_select_doc)){
					$sel1='  ';
					//if($_POST['area']==$r_ar[0]){$sel1=' selected ';}
					//echo "hola";
							echo '<option value="'.$r_sd[0].'"  '.$sel1.'>'.$r_sd[2].' </option>';
					}
					
echo					"</select>
		 </div>
		 <div class='input' style='float:left;width: 140px;padding-top: 5px;text-align: right;' >
			Intensidad Horaria&nbsp;
		  </div>
		 <div class='input' >
		    <input id='intensidad_asignatura' name='intensidad_asignatura' type='text' class='form-control' placeholder='' style='width:48%;margin-bottom: 10px'>
		 </div>
		<fieldset>
		<legend>
					<br>
					
		</legend>	
			<button type='button' class='btn btn-info' onclick='crea_registro()'> Crear Registro</button>     
			<input type='reset' class='btn' value='Borrar'>
						
		</fieldset>
			
			<br>
		</div>
	</form>
</div>

<div class=\"tab-pane fade in $act1 \" id=\"home\">
	<form name='listar_pensum' id='listar_pensum' method='post' action='pensum.php' target=''>
	<div class=\"page\">
	

	<input type='hidden' name='val1' id='val1' value='".$val1."'>	
	<input type='hidden' name='cur1' id='cur1' value='".$cur1."'>	
	<input type='hidden' name='nombre1' id='nombre1' value='".$nombre1."'>
	<input type='hidden' name='curso1' id='curso1' value='".$curso1."'>
	<input type='hidden' name='docente1' id='docente1' value='".$docente1."'>
	<input type='hidden' name='asignatura1' id='asignatura1' value='".$asignatura1."'>
	<input type='hidden' name='horas1' id='horas1' value='".$horas1."'>
	<input type='hidden' name='estado1' id='estado1' value='".$estado1."'>						
	<input type='hidden' name='ide1' id='ide1' value='".$ide1."'>							
	

	
		<fieldset>
			<legend><br><span class=\"glyphicon glyphicon-th-list\"></span> 
				Pensum          
			</legend>			
		</fieldset>
	</div>
	
	<fieldset>
	<div class='table-responsive'>

	<p><input type='text'  style='font-size:12px;width:30%' id='search_string' name='search_string' value='Digite Nombre Docente...' onclick='this.value=\"\"'  size='20'/>
     <select id='search_string2'  style='font-size:12px;width:10%'>
        <option value=''>Sel. Curso...</option>";
$select_curs="select codigo from curso where estado='A' order by orden";     
$res_select_curs=mysql_query($select_curs);
while($rsc=mysql_fetch_array($res_select_curs)){
echo        "<option value='$rsc[0]'>$rsc[0]</option>";

}


echo "</select>  
    </p>

	<table id='pensums' class='table  table-striped table-bordered  '>
		<thead>
			<tr role='row'>
				<th>Nombre</th>
				<th>Curso</th>				
				<th>Asignatura</th>								
				<th>Horas</th>				
				<th>Docente</th>				
				<th>Estado</th>
				<th></th>				
			</tr>
		</thead>";
		
echo $tbody;
echo	"
	</div>
	</table>
	</fieldset>
	
	
	
	</form>

</div>
 
         
        </div><!--/span-->

       
      </div><!--/row-->


</div><!--/row--></div><!--/row--><hr><footer><p>Todos los derechos reservados - Copyright &copy; 2017</p></footer>

    </div><!--/.container-->

    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src=\"https://code.jquery.com/jquery-1.10.2.min.js\"></script>
    <script src=\"dist/js/bootstrap.min.js\"></script>
    <script src=\"offcanvas.js\"></script>
    <script src='js/tablesort.min.js'></script>
    <script>
      new Tablesort(document.getElementById('pensums'));
    </script>
    <script>
      // Con estas 3 l�neas sobreescribimos el Constains para que no sea case sensitive pues por default en jquery  viene con case sensitive. Si no lo pones, queda como Case sensitive
    $.expr[':'].Contains = function(x, y, z){
        return jQuery(x).text().toLowerCase().indexOf(z[3].toLowerCase())>=0;
       
    };

    // cada que escribamos, vamos a revisar lo que hay escrito 
    $('#search_string').keyup(function() 
    {
        //tomamos el valor que tiene el input
        var search = $('#search_string').val();
        //mostramos todos los valores, para despues ir ocultando los que no coinciden
        $('#pensums tr').show();
        
        //esto es para revisar si tenemos algo que buscar, sino, que no lo haga.
        if(search.length>0)
        {
        // con la clase .nombre le decimos en cual de las celdas buscar y si no coincide, ocultamos el tr que contiene a esa celda. 
        $('#pensums tr td.nombre').not(':Contains('+search+')').parent().hide();
        }

});

    // cada que escribamos, vamos a revisar lo que hay escrito 
    $('#search_string2').change(function() 
    {
        //tomamos el valor que tiene el input
        var search = $('#search_string2').val();
        //mostramos todos los valores, para despues ir ocultando los que no coinciden
        $('#pensums tr').show();
        
        //esto es para revisar si tenemos algo que buscar, sino, que no lo haga.
        if(search.length>0)
        {
        // con la clase .curso le decimos en cual de las celdas buscar y si no coincide, ocultamos el tr que contiene a esa celda. 
        $('#pensums tr td.curso').not(':Contains('+search+')').parent().hide();
        }

});

    
    </script>
    
  </body>
</html>
";
}else{
echo "<div align='center'>Debe registrase para usar la aplicaci&oacute;n <a href='index.php' > Registrar</a></div>";
}  ?>