<?php

include '../conector.php';
session_start();

if(isset($_SESSION["user"]) && $_SESSION["tipo"]=='D'){


$cuenta="select usuarios.cuenta,docente.coordinador
	from usuarios,docente 
	where name='".$_SESSION["user"]."'
	and usuarios.cuenta=docente.email";
$res_cuenta=mysql_query($cuenta);
$rs_cta=mysql_fetch_array($res_cuenta);

  $class1="class=\"active\"";
  $class2="";
  $act2="";
  $act1=" active ";

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

//echo "archivo".$_POST['ide1']."<br>";
//$_FILES["archivo".$_POST['ide1']]

 if($_POST['val1']==1){
 
 	if(isset($_FILES["archivo".$_POST['ide1']])&&!empty($_FILES["archivo".$_POST['ide1']])){

		$tamano = $_FILES["archivo".$_POST['ide1']]['size'];
		$tipo = $_FILES["archivo".$_POST['ide1']]['type'];
		$archivo = $_FILES["archivo".$_POST['ide1']]['name'];
		$prefijo = substr(md5(uniqid(rand())),0,6);

		if ($archivo != "") {
		// guardamos el archivo a la carpeta files

		//$destino = "upload/".$prefijo."_".$archivo;
		$destino = "../img/foto/".$archivo;
		if (copy($_FILES['archivo'.$_POST['ide1']]['tmp_name'],$destino)) {
		$status = "Archivo subido: <b>".$archivo."</b>";
		} else {
		$status = "Error al subir el archivo";
		}
		} else {
		$status = "Error al subir archivo";
		}	
		
		$select_foto="select * from upload_doc where codigo='".$_POST['ide1']."' ";
		$res_select_foto=mysql_query($select_foto);
		$num_filas=mysql_num_rows($res_select_foto);
		
		
		
		
		if($num_filas>0){
		$query_act = "update upload_doc 
		set
		nombre_archivo='".$archivo."',
		tipo='".$tipo."',
		tamano=".$tamano.",
		clase='F' 
		where codigo='".$_POST['ide1']."' ";
		} 			
		if($num_filas==0){
		
		$query_act = "INSERT INTO upload_doc (codigo,nombre_archivo,tipo,tamano,clase) ".
		"VALUES ('".$_POST['ide1']."','$archivo', '$tipo', '$tamano','F')";
		} 			
		
		if(!empty($archivo)){
		mysql_query($query_act) or die('Error, query failed');
		}

		
	}
 

	$actualiza_docente="update docente set
	nombre='".$_POST['nombre1']."',
	fecha_nacimiento='".$_POST['fecha_nacimiento1']."',
	sexo='".$_POST['sexo1']."',
	grupo_sangre='".$_POST['grupo_sangre1']."',
	direccion='".$_POST['direccion1']."',
	telefono='".$_POST['telefono1']."',
	email='".$_POST['correo1']."',
	identi='".$_POST['identi1']."',
	eps='".$_POST['eps1']."',
	pension='".$_POST['pension1']."',
	escalafon='".$_POST['escalafon1']."',
	especialidad='".$_POST['especialidad1']."',
	obs='".$_POST['obs1']."',
	estado='".$_POST['estado1']."'
	where teacher_id=".$_POST['ide1']."  ";
	
	$actualiza_clave="update usuarios set 
	name='".$_POST['usuario1']."',
	password='".$_POST['pass1']."'
	where cuenta='".$_POST['correo1']."'
	";
	if(mysql_query($actualiza_docente)){
		       	mysql_query($actualiza_clave)or die(mysql_error());
		       	$men="<div class=\"alert alert-success\">
	                    <button type=\"button\" class=\"close\" data-dismiss=\"alert\">X</button>
	                    Docente Actualizado                 
				</div>";
		}else{
		//echo $actualiza_docente;
		
		       	$men="<div class=\"alert alert-danger\">
	                    <button type=\"button\" class=\"close\" data-dismiss=\"alert\">X</button>
	                    Error al Actualizar Docente
				</div>";
		
		}
	
	
	
	 
 }
}





$select_doc="select teacher_id,nombre,fecha_nacimiento,sexo,grupo_sangre,direccion,telefono,email,estado,
(select nombre_archivo from upload_doc where upload_doc.codigo=docente.teacher_id and clase='F'),
identi,eps,pension,escalafon,especialidad,obs,(select usuarios.name from usuarios where usuarios.cuenta=docente.email ),
(select usuarios.password from usuarios where usuarios.cuenta=docente.email )
from docente where docente.estado in ('A','I')  order by nombre";

 $res_select_doc=mysql_query($select_doc);
			
					$tbody="<tbody>";
					while($r_sd=mysql_fetch_array($res_select_doc)){
					
					if(!empty($r_sd[9])&&isset($r_sd[9])){$foto="<div align=center><img style='
						border-radius: 50%;
						-moz-border-radius: 50%;
						-webkit-border-radius: 50%;
						-khtml-border-radius: 50%;
						border: 2px solid #cee6fb;
						 overflow: hidden;'  src='../img/foto/".$r_sd[9]."' width='50px' height='50px' ></div>";}
					else{$foto="<div align=center><img style='
						border-radius: 50%;
						-moz-border-radius: 50%;
						-webkit-border-radius: 50%;
						-khtml-border-radius: 50%;
						border: 2px solid #cee6fb;
						 overflow: hidden;'  src='../img/foto/anon.png' width='50px' height='50px' ></div>";}
					
					if($r_sd[8]=='A'){$est='Activo';$lab='success ';}else{$est='Inactivo';$lab='danger ';}
					$disabled=' disabled ';$tipo='password';

					
					
					$tbody.="<tr role='row'>
						<td  style='vertical-align: middle;'>".$r_sd[0]."</td>
						<td style='vertical-align: middle;'>$foto</td>
						<td style='vertical-align: middle;'>".$r_sd[1]."</td>
						<td style='vertical-align: middle;'><span class='label label-".$lab."'>".$est."</span></td>
						<td style='vertical-align: middle;'>
					<a class='btn btn-info btn-xs' name='".$r_sd[0]."' id='".$r_sd[0]."' data-toggle='modal' data-target='#mimodala".$r_sd[0]."'  >
                			<i class='glyphicon glyphicon-edit icon-white'></i>  
			                ver               
				            </a>
						</td>
						</tr>";
					
				
					
						$tbody_doc.="<div name='mimodala".$r_sd[0]."' id='mimodala".$r_sd[0]."' 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 Docente</h4>
	      					      </div>
	      					      <div class='modal-body'>";
						
						     //     $select_obs_doc="select * from observacion_docente where planilla=".$_POST['per1']." and estudiante=".$r_sce[0]."   ";
						       //   $res_select_obs_doc=mysql_query($select_obs_doc);
						        //  while($r_sodoc=mysql_fetch_array($res_select_obs_doc)){

								 $tbody_doc.="<div>

									".str_replace('50px','75px',$foto)."
									</div>
									<br>
									<div align=center>
									<b>$r_sd[1]</b>
									</div>
									<br>";
								$a1='';$a2='';
								if($r_sd[3]=='Masculino'){$a1=' selected ';}
								if($r_sd[3]=='Femenino'){$a2=' selected ';}								
								$b1='';$b2='';$b3='';$b4='';$b5='';$b6='';$b7='';$b8='';
								$c1='';$c2='';
								if($r_sd[4]=='AB+'){$b1=' selected ';}
								if($r_sd[4]=='AB-'){$b2=' selected ';}
								if($r_sd[4]=='B+'){$b3=' selected ';}
								if($r_sd[4]=='B-'){$b4=' selected ';}
								if($r_sd[4]=='A+'){$b5=' selected ';}
								if($r_sd[4]=='A-'){$b6=' selected ';}
								if($r_sd[4]=='O+'){$b7=' selected ';}
								if($r_sd[4]=='O-'){$b8=' selected ';}
								if($r_sd[8]=='A'){$c1=' selected ';}
								if($r_sd[8]=='I'){$c2=' selected ';}								
								
														
if($rs_cta[0]==$r_sd[7]){$disabled='';$tipo='text';									
								$tbody_doc.="
								 
								 <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  $disabled  value='".$r_sd[1]."' id='nombre".$r_sd[0]."' name='nombre".$r_sd[0]."' 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;' >
								C&eacute;dula &nbsp;  </div>
								 <div class='input' ><input  $disabled  value='".$r_sd[10]."' id='identi".$r_sd[0]."' name='identi".$r_sd[0]."' 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;' >
								Fecha Nacimiento&nbsp;  </div>
								 <div class='input' >
								 <input  $disabled  value='".$r_sd[2]."' id='fecha_nacimiento".$r_sd[0]."' name='fecha_nacimiento".$r_sd[0]."' type='date' 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;' >
									Foto &nbsp;
								  </div>
								<div class='input' >
									<input $disabled  id='archivo".$r_sd[0]."' name='archivo".$r_sd[0]."' type='file' class='fileUpload'  >
								  </div>	
								 
								 
							   	 
							   	 <div class='input' style='float:left;width: 120px;padding-top: 5px;padding-left: 10px;text-align: left;height:20px;font-size:12px;' >
								Sexo&nbsp;  </div>
								 <div class='input' >
								 <select $disabled id='sexo".$r_sd[0]."' name='sexo".$r_sd[0]."' class='form-control2' style='width:50%;margin-bottom: 10px'>
								 	<option value='XX' >Seleccione Sexo</option>
								 	<option value='Masculino' $a1 >Masculino</option>
								 	<option value='Femenino' $a2 >Femenino</option>
								 </select>
								 </div>
								 
								  <div class='input' style='float:left;width: 120px;padding-top: 5px;padding-left: 10px;text-align: left;height:20px;font-size:12px;' >
								Grupo de Sangre&nbsp;  </div>
								 <div class='input' >
								 <select $disabled id='grupo_sangre".$r_sd[0]."' name='grupo_sangre".$r_sd[0]."' class='form-control2' style='width:50%;margin-bottom: 10px'>
								 	<option value='XX' >Seleccione Grupo</option>
								 	<option value='AB+' $b1 >AB+</option>
								 	<option value='AB-' $b2 >AB-</option>
								 	<option value='B+' $b3 >B+</option>
								 	<option value='B-' $b4 >B-</option>
								 	<option value='A+' $b5 >A+</option>
								 	<option value='A-' $b6 >A-</option>
								 	<option value='O+' $b7 >O+</option>
								 	<option value='O-' $b8 >O-</option>
								 </select>
								 </div>
								 
								  <div class='input' style='float:left;width: 120px;padding-top: 5px;padding-left: 10px;text-align: left;height:20px;font-size:12px;' >
								EPS&nbsp;  </div>
								 <div class='input' ><input $disabled id='eps".$r_sd[0]."' name='eps".$r_sd[0]."'  value='".$r_sd[11]."' 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;' > 
								Pensi&oacute;n&nbsp;  </div>
								 <div class='input' ><input  $disabled id='pension".$r_sd[0]."' name='pension".$r_sd[0]."' value='".$r_sd[12]."' 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;' >								 
								Escalaf&oacute;n&nbsp;  </div>
								 <div class='input' ><input  $disabled  id='escalafon".$r_sd[0]."' name='escalafon".$r_sd[0]."' value='".$r_sd[13]."' 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;' >								 
								Especialidad&nbsp;  </div>
								 <div class='input' ><input $disabled id='especialidad".$r_sd[0]."' name='especialidad".$r_sd[0]."'  value='".$r_sd[14]."' 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;' >								 
							Direcci&oacute;n&nbsp;  </div>
								 <div class='input' ><input $disabled id='direccion".$r_sd[0]."' name='direccion".$r_sd[0]."'  value='".$r_sd[5]."' 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;' >								 
 							Tel&eacute;fono&nbsp;  </div>
								 <div class='input' ><input $disabled id='telefono".$r_sd[0]."' name='telefono".$r_sd[0]."'  value='".$r_sd[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;' >								 
							Correo&nbsp;  </div>
								 <div class='input' ><input $disabled  id='correo".$r_sd[0]."' name='correo".$r_sd[0]."' value='".$r_sd[7]."' 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;' >								 
							Usuario&nbsp;  </div>
								 <div class='input' ><input $disabled id='usuario".$r_sd[0]."' name='usuario".$r_sd[0]."'  value='".$r_sd[16]."' type='$tipo' 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;' >								 
							Clave&nbsp;  </div>
								 <div class='input' ><input $disabled id='pass".$r_sd[0]."' name='pass".$r_sd[0]."'  value='".$r_sd[17]."' type='$tipo' 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;' >								 
							Observaciones&nbsp;  </div>
								 <div class='input' ><input $disabled id='obs".$r_sd[0]."' name='obs".$r_sd[0]."'  value='".$r_sd[15]."' 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 $disabled id='estado".$r_sd[0]."' name='estado".$r_sd[0]."' class='form-control2' style='width:50%;margin-bottom: 10px'>
								 	<option value='A' $c1 >Activo</option>
								 	<option value='I' $c2 >Inactivo</option>
								 </select>
								 </div>
								";
}else{
$tbody_doc.=" <div class='input' align='center'><input $disabled  id='correo".$r_sd[0]."' name='correo".$r_sd[0]."' value='".$r_sd[7]."' type='text' class='form-control2' style='width:50%;margin-bottom: 10px' >";

}
/************************/								 
$select_docente="select distinct horario_at.docente,docente.nombre
				 from horario_at,docente  
				 where horario_at.estado='A' 
				  and docente.teacher_id=horario_at.docente
				  and docente.teacher_id=".$r_sd[0]."
				 order by horario_at.dia";
					$res_select_docente=mysql_query($select_docente);


 $select_horario="select 
			 docente,dia,hi,mi,hf,mf
			 from horario_at 
			 where horario_at.estado='A' order by dia";
			 $res_select_horario=mysql_query($select_horario);

					$tbody_doc.="
					<div align='center' style='margin-top:5px;font-size:12px;'>
					<h4>Horario de Atenci&oacute;n</h4>
					</div>
					<div align='center' >

					<div align='center' style='margin-top:5px;font-size:10px;font-WEIGHT:bold;float:right;'>
					<div  class='input' style='color:#ffffff;background-color:#4fad45;float:left;padding-left: 10px;width: 70px;'>Dir. Grupo</div>
					<div  class='input' style='color:#ffffff;background-color:#4fad45;float:left;padding-left: 5px;width: 90px;'>Asignaturas</div>
					<div  class='input' style='color:#ffffff;background-color:#4fad45;float:left;padding-left: 5px;width: 60px;'>Lunes</div>
					<div  class='input' style='color:#ffffff;background-color:#4fad45;float:left;padding-left: 5px;width: 60px;'>Martes</div>
					<div  class='input' style='color:#ffffff;background-color:#4fad45;float:left;padding-left: 5px;width: 65px;'>Miercoles</div>
					<div  class='input' style='color:#ffffff;background-color:#4fad45;float:left;padding-left: 5px;width: 60px;'>Jueves</div>
					<div  class='input' style='color:#ffffff;background-color:#4fad45;float:left;padding-left: 5px;width: 60px;'>Viernes</div>
					<div  class='input' style='color:#ffffff;background-color:#4fad45;float:right;padding-left: 5px;width: 60px;'></div>					
					
					
					<br>
					
					";
					while($doc=mysql_fetch_array($res_select_docente)){
					
					$tbody_doc.="
					
					<div align='left' style='margin-top:5px;font-WEIGHT:normal;font-size:9px;float:left;'>
						<div  class='input' style='float:left;padding-left: 10px;font-size:9px;width: 70px;'>
						";
					$select_curso="select curso_id,codigo,nombre,id_docente,estado
					from curso where id_docente='".$doc[0]."' and estado='A' ";
					$res_select_curso=mysql_query($select_curso);
					$num_curso=mysql_num_rows($res_select_curso);
					
					if($num_curso>0){
						while($cur=mysql_fetch_array($res_select_curso)){
						$tbody_doc.=" - ".$cur[2]."<br>";
						}
					}else{
					$tbody_doc.="  <br>";
					}

					$tbody_doc.="
						</div>
						<div  class='input' style='float:left;padding-left: 10px;font-WEIGHT:normal;font-size:9px;width: 90px;'>";
						
					$select_asig="select asignatura.nombre,(select curso.codigo from curso where pensum.class_id=curso.curso_id),asignatura.subject_id
					from pensum,asignatura,docente 
					where docente.teacher_id='".$doc[0]."' 
					and pensum.teacher_id=docente.teacher_id
					and pensum.asignatura_id=asignatura.subject_id
					and pensum.estado='A' 
					
					";
					$res_select_asig=mysql_query($select_asig);
					$num_asig=mysql_num_rows($res_select_asig);
					
					if($num_asig>0){
						while($asi=mysql_fetch_array($res_select_asig)){
						$tbody_doc.=" - ".$asi[0]." ".$asi[1]."<br>";
						}
					}else{
					$tbody_doc.="  <br>";
					}
						
					$tbody_doc.="
						</div>
						<div  class='input' style='float:left;padding-left: 10px;font-WEIGHT:normal;font-size:9px;width: 60px;'>";	
						$sel_hora="select Id,dia,hi,mi,hf,mf 
						from horario_at
						where docente=".$doc[0]." 
						and dia=1";	
					$res_sel_hora=mysql_query($sel_hora);
					$num_hor=mysql_num_rows($res_sel_hora);
					if($num_hor>0){
						while($hor=mysql_fetch_array($res_sel_hora)){
						if($hor[3]==0){$hor[3]='00';}if($hor[3]==5){$hor[3]='05';}
						if($hor[5]==0){$hor[5]='00';}if($hor[5]==5){$hor[5]='05';}
						//$tbody_doc.="(".$hor[2].":".$hor[3]." - ".$hor[4].":".$hor[5].")";
						
						$tbody_doc.="<div class='btn-group'>
								  <button type='button' class='btn btn-warning btn-xs dropdown-toggle' data-toggle='dropdown' style='font-size:9px;margin-bottom:5px'>
								    ".$hor[2].":".$hor[3]." ".$hor[4].":".$hor[5]."
								  </button>
								
								</div>
								<br>";
						}
					}else{
					$tbody_doc.="  <br>";
					}
					$tbody_doc.="
						</div>
						<div  class='input' style='float:left;padding-left: 10px;font-size:9px;width: 60px;'>";	
						$sel_hora="select Id,dia,hi,mi,hf,mf 
						from horario_at
						where docente=".$doc[0]." 
						and dia=2";	
					$res_sel_hora=mysql_query($sel_hora);
					$num_hor=mysql_num_rows($res_sel_hora);
					if($num_hor>0){
						while($hor=mysql_fetch_array($res_sel_hora)){
						if($hor[3]==0){$hor[3]='00';}if($hor[3]==5){$hor[3]='05';}
						if($hor[5]==0){$hor[5]='00';}if($hor[5]==5){$hor[5]='05';}
						//$tbody_doc.="(".$hor[2].":".$hor[3]." - ".$hor[4].":".$hor[5].")";
						
						$tbody_doc.="<div class='btn-group'>
								  <button type='button' class='btn btn-warning btn-xs dropdown-toggle' data-toggle='dropdown' style='font-size:9px;margin-bottom:5px'>
								    ".$hor[2].":".$hor[3]." ".$hor[4].":".$hor[5]."
								  </button>
								
								</div>
								<br>";
						}
					}else{
					$tbody_doc.="  <br>";
					}

					$tbody_doc.="
						</div>
						<div  class='input' style='float:left;padding-left: 10px;font-size:9px;width: 65px;'>";	
						$sel_hora="select Id,dia,hi,mi,hf,mf 
						from horario_at
						where docente=".$doc[0]." 
						and dia=3";	
					$res_sel_hora=mysql_query($sel_hora);
					$num_hor=mysql_num_rows($res_sel_hora);
					if($num_hor>0){
						while($hor=mysql_fetch_array($res_sel_hora)){
						if($hor[3]==0){$hor[3]='00';}if($hor[3]==5){$hor[3]='05';}
						if($hor[5]==0){$hor[5]='00';}if($hor[5]==5){$hor[5]='05';}
						//$tbody_doc.="(".$hor[2].":".$hor[3]." - ".$hor[4].":".$hor[5].")";
						
						$tbody_doc.="<div class='btn-group'>
								  <button type='button' class='btn btn-warning btn-xs dropdown-toggle' data-toggle='dropdown' style='font-size:9px;margin-bottom:5px'>
								    ".$hor[2].":".$hor[3]." ".$hor[4].":".$hor[5]."
								  </button>
								
								</div>
								<br>";
						}
					}else{
					$tbody_doc.="  <br>";
					}
					$tbody_doc.="
						</div>
						<div  class='input' style='float:left;padding-left: 10px;font-size:9px;width: 60px;'>";	
						$sel_hora="select Id,dia,hi,mi,hf,mf 
						from horario_at
						where docente=".$doc[0]." 
						and dia=4";	
					$res_sel_hora=mysql_query($sel_hora);
					$num_hor=mysql_num_rows($res_sel_hora);
					if($num_hor>0){
						while($hor=mysql_fetch_array($res_sel_hora)){
						if($hor[3]==0){$hor[3]='00';}if($hor[3]==5){$hor[3]='05';}
						if($hor[5]==0){$hor[5]='00';}if($hor[5]==5){$hor[5]='05';}
						//$tbody_doc.="(".$hor[2].":".$hor[3]." - ".$hor[4].":".$hor[5].")";
						
						$tbody_doc.="<div class='btn-group'>
								  <button type='button' class='btn btn-warning btn-xs dropdown-toggle' data-toggle='dropdown' style='font-size:9px;margin-bottom:5px'>
								    ".$hor[2].":".$hor[3]." ".$hor[4].":".$hor[5]."
								  </button>
								
								</div>
								<br>";
						}
					}else{
					$tbody_doc.="  <br>";
					}
					
					$tbody_doc.="
						</div>
						<div  class='input' style='float:left;padding-left: 10px;font-size:9px;width: 60px;'>";	
						$sel_hora="select Id,dia,hi,mi,hf,mf 
						from horario_at
						where docente=".$doc[0]." 
						and dia=5";	
					$res_sel_hora=mysql_query($sel_hora);
					$num_hor=mysql_num_rows($res_sel_hora);
					if($num_hor>0){
						while($hor=mysql_fetch_array($res_sel_hora)){
						if($hor[3]==0){$hor[3]='00';}if($hor[3]==5){$hor[3]='05';}
						if($hor[5]==0){$hor[5]='00';}if($hor[5]==5){$hor[5]='05';}
						//$tbody_doc.="(".$hor[2].":".$hor[3]." - ".$hor[4].":".$hor[5].")";
						
						$tbody_doc.="<div class='btn-group'>
								  <button type='button' class='btn btn-warning btn-xs dropdown-toggle' data-toggle='dropdown' style='font-size:9px;margin-bottom:5px'>
								    ".$hor[2].":".$hor[3]." ".$hor[4].":".$hor[5]."
								  </button>
								
								</div>
								<br>";
						}
					}else{
					$tbody_doc.="  <br>";
					}


$tbody_doc.="						
					</div>
					</div>
					";
					
					}

					$tbody_doc.="</div> 
					</div>
					
					</div>
					<br>
					";
/********************/								 



$disabled=' disabled ';

						 $tbody_doc.="
						 <br>
						 	<div style='padding: 10px;font-size:9px;'>
							<button type=\"button\" class=\"btn btn-success btn-xs\" data-dismiss='modal' >Cerrar</button>
							</div>";								
								
						$tbody_doc.="
							</div>
						    </div>
						  </div>
						</div>	";	
					
					
					
					}
					$tbody.="</tbody>";




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>
	.fileUpload {
	position: relative;
	overflow: hidden;
	margin: 10px;
	}
	.fileUpload input.upload {
	position: absolute;
	top: 0;
	right: 0;
	margin: 10px;
	padding: 10px;
	font-size: 12px;
	cursor: pointer;
	opacity: 0;
	filter: alpha(opacity=0);
	}
	</style>
    <title>Docentes</title>

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

    <!-- Custom styles for this template -->
";
	 include 'fuente.php'; 
echo "
    <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_docente(ide){

if(document.getElementById('nombre'+ide).value==''){alert('Debe digitar el documento de identidad1');return false;}
	else{document.getElementById('nombre1').value=document.getElementById('nombre'+ide).value}


if(document.getElementById('identi'+ide).value==''){alert('Debe digitar el documento de identidad2');return false;}
	else{document.getElementById('identi1').value=document.getElementById('identi'+ide).value}
	
if(document.getElementById('fecha_nacimiento'+ide).value==''){alert('Debe digitar el fecha nacimiento3');return false;}
	else{document.getElementById('fecha_nacimiento1').value=document.getElementById('fecha_nacimiento'+ide).value}
if(document.getElementById('sexo'+ide).value=='XX'){alert('Debe seleccionar el sexo');return false;}
	else{document.getElementById('sexo1').value=document.getElementById('sexo'+ide).value}
if(document.getElementById('grupo_sangre'+ide).value=='XX'){alert('Debe seleccionar el grupo de sangre');return false;}
	else{document.getElementById('grupo_sangre1').value=document.getElementById('grupo_sangre'+ide).value}


if(document.getElementById('eps'+ide).value==''){alert('Debe digitar EPS docente');return false;}
	else{document.getElementById('eps1').value=document.getElementById('eps'+ide).value}
if(document.getElementById('pension'+ide).value==''){alert('Debe digitar el fonde de pension del docente');return false;}
	else{document.getElementById('pension1').value=document.getElementById('pension'+ide).value}
if(document.getElementById('escalafon'+ide).value==''){alert('Debe digitar el escalafon del docente');return false;}
	else{document.getElementById('escalafon1').value=document.getElementById('escalafon'+ide).value}
if(document.getElementById('especialidad'+ide).value==''){alert('Debe digitar la especialidad del docente');return false;}
	else{document.getElementById('especialidad1').value=document.getElementById('especialidad'+ide).value}

	
if(document.getElementById('direccion'+ide).value==''){alert('Debe digitar la direccion');return false;}
	else{document.getElementById('direccion1').value=document.getElementById('direccion'+ide).value}
if(document.getElementById('telefono'+ide).value==''){alert('Debe digitar el telefono');return false;}
	else{document.getElementById('telefono1').value=document.getElementById('telefono'+ide).value}
if(document.getElementById('correo'+ide).value==''){alert('Debe digitar el correo');return false;}
	else{document.getElementById('correo1').value=document.getElementById('correo'+ide).value}
if(document.getElementById('usuario'+ide).value==''){alert('Debe digitar el usuario');return false;}
	else{document.getElementById('usuario1').value=document.getElementById('usuario'+ide).value}
if(document.getElementById('pass'+ide).value==''){alert('Debe digitar el password');return false;}
	else{document.getElementById('pass1').value=document.getElementById('pass'+ide).value}
if(document.getElementById('obs'+ide).value==''){}
	else{document.getElementById('obs1').value=document.getElementById('obs'+ide).value}
	document.getElementById('ide1').value=ide;
	document.getElementById('estado1').value=document.getElementById('estado'+ide).value;
	
document.getElementById('val1').value=1;
	document.forms['gestion_doc'].submit();	

}


function validarEmail( email ) {
    expr = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    if ( !expr.test(email) && email!='no tiene')
        alert('Error: La direccion de correo - ' + email + ' - es incorrecta.');
}
</script>
  
    
    
    
  </head>

  <body>
    <div class=\"navbar navbar-fixed-top navbar-inverse\" role=\"navigation\">
     <div class=\"container\">
         <div class=\"navbar-header\">
          <button type=\"button\" class=\"navbar-toggle hidden-xs\" data-toggle=\"collapse\" data-target=\".navbar-collapse\">
            <span class=\"sr-only\">Toggle navigation</span>
         
          </button>
         
         
          
          <a  href=\"general.php\" class='hidden-xs' ><img src='../img/logo1.png'  style='margin-top:5px;'></a>
	         <div align='' class='visible-xs'>
		         <a  href=\"general.php\"  ><img src='../img/logo1.png' width='250px' style='margin-top:10px;margin-left:5px'></a>
		         <a href=\"../index.php\" ><img src='../img/salir2.png' style='float:right;margin-top:15px;margin-right:10px'></a>
	         </div>

        </div>
      	<a href=\"../index.php\" class='hidden-xs'><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 hidden-xs'><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 active\"><span class=\"glyphicon glyphicon-user\"></span> Docentes</a>
            <a href=\"horario.php\" class=\"list-group-item \"><span class=\"glyphicon glyphicon-edit\"></span> Horario</a>
            <a href=\"logros.php\" class=\"list-group-item\"><span class=\"glyphicon glyphicon-edit\"></span> Logros</a>            
            <a href=\"planilla.php\" class=\"list-group-item \"><span class=\"glyphicon glyphicon-file\"></span> Planilla Notas</a>   
            <a href=\"planilla_asistencia.php\" class=\"list-group-item \"><span class=\"glyphicon glyphicon-file\"></span> Asistencia</a>                              
            <a href=\"reportes.php\" class=\"list-group-item \"><span class=\"glyphicon glyphicon-file\"></span> Informes</a>
            <a href=\"planilla_obs.php\" class=\"list-group-item \"><span class=\"glyphicon glyphicon-file\"></span> Planilla Obs.</a>
<a href=\"eventos.php\" class=\"list-group-item \"><span class=\"glyphicon glyphicon-edit\"></span> Anuncios</a>
";                        
if($rs_cta[1]==1||$rs_cta[1]==0){
echo	   "<a href=\"obs_disciplinarias.php\" class=\"list-group-item \"><span class=\"glyphicon glyphicon-file\"></span> Registro Obs.</a>";
}
echo     "                        
          </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=\"#gestion_docente\" data-toggle=\"tab\">Gestion Docentes</a></li>
	</ul>
	
	<!-- Tab panes -->

	<div class=\"tab-content\">

<div class=\"tab-pane fade in $act1 \" id=\"gestion_docente\">
	<form name='gestion_doc' id='gestion_doc' method='post' action='docentes.php' target='' enctype='multipart/form-data'>
	<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='ide1' id='ide1' value='".$ide1."'>
	<input type='hidden' name='estado1' id='estado1' value='".$estado1."'>	
	<input type='hidden' name='nombre1' id='nombre1' value='".$nombre1."'>					
	<input type='hidden' name='identi1' id='identi1' value='".$identi1."'>			
		<input type='hidden' name='eps1' id='eps1' value='".$eps1."'>
		<input type='hidden' name='pension1' id='pension1' value='".$pension1."'>			
		<input type='hidden' name='escalafon1' id='escalafon1' value='".$escalafon1."'>
		<input type='hidden' name='especialidad1' id='especialidad1' value='".$especialidad1."'>			
		<input type='hidden' name='obs1' id='obs1' value='".$obs1."'>
				
		<input type='hidden' name='nombre_docente1' id='nombre_docente1' value='".$nombre_docente1."'>	
		<input type='hidden' name='fecha_nacimiento1' id='fecha_nacimiento1' value='".$fecha_nacimiento1."'>
		<input type='hidden' name='sexo1' id='sexo1' value='".$sexo1."'>	
		<input type='hidden' name='grupo_sangre1' id='grupo_sangre1' value='".$grupo_sangre1."'>	


		<input type='hidden' name='direccion1' id='direccion1' value='".$direccion1."'>	
		<input type='hidden' name='telefono1' id='telefono1' value='".$telefono1."'>	
		<input type='hidden' name='correo1' id='correo1' value='".$correo1."'>
		<input type='hidden' name='usuario1' id='usuario1' value='".$usuario1."'>
		<input type='hidden' name='pass1' id='pass1' value='".$pass1."'>
		<input type='hidden' name='MAX_FILE_SIZE' value='2000000'>
	
	
		<fieldset>
			<legend>
			<br><span class=\"glyphicon glyphicon-th-list\"></span> Lista de Docentes          
			</legend>			
		</fieldset>
	</div>
	
	<fieldset>
	<div class='table-responsive'>
	<table class='table table-striped table-bordered '>
		<thead>
			<tr role='row'>
				<th>Codigo</th>
				<th>Foto</th>				
				<th>Nombre</th>				
				<th>Estado</th>								
				<th>&nbsp;</th>				
			</tr>
		</thead>";
		
echo $tbody;
echo	"</table>
	</div>
	</fieldset>";
	
echo $tbody_doc;	
	echo
	"</form>

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

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

</div><!--/row-->
     </div><!--/row--><hr><footer><p>Todos los derechos reservados - Copyright &copy; 2018</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>
  </body>
</html>
";
}else{
echo "<div align='center'>Debe registrase para usar la aplicaci&oacute;n <a href='../index.php' > Registrar</a></div>";
}
?>