<?php
include '../conector.php';
session_start();
date_default_timezone_set('America/Bogota');
$today = date('Y-m-d');
$val="";$tbody="";$tbody_obs="";$tbody_eve="";$r_cur=array();
$rs_cta = array(0, 0, 0);
if(isset($_SESSION["user"]) && ($_SESSION["tipo"]=='E'||$_SESSION["tipo"]=='P')){

//echo $_POST["est"]."<br>";
//echo $_POST["val"]."<br>";
if(isset($_POST["val"]) && $_POST["val"]==1){

$_SESSION["estudiante"]=$_POST["est"];

}

if($_SESSION["tipo"]=='E'){$cuenta="select estudiante.estudiante_id,estudiante.curso_id,estudiante.vernotas from estudiante where usuario='".$_SESSION["user"]."'	and estudiante.estado_est='A'";}
if($_SESSION["tipo"]=='P'){$cuenta="select estudiante.estudiante_id,estudiante.curso_id,estudiante.vernotas from estudiante where estudiante.estudiante_id=".$_SESSION["estudiante"]." ";}

$res_cuenta=mysql_query($cuenta);
$rs_cta=mysql_fetch_array($res_cuenta);

/******Pagos*******/
/*********Verificacion Pension**********/
$select_pagos="select count(*) 
from pagos 
where
estado='D' 
and titulo='P'
and estudiante='".$rs_cta[0]."' "; 

$res_select_pagos=mysql_query($select_pagos);
$rs_pagos=mysql_fetch_array($res_select_pagos);



if($rs_pagos[0]>0){

echo "<div align='center'><h3>VERIFIQUE SU ESTADO DE CUENTA.</h3></div>

<!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\">

    <title>SOFTWARE DE GESTION ACADEMICA EN LINEA</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]-->
  </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=\"collapse navbar-collapse\">
          <ul class=\"nav navbar-nav\">
           
          </ul>
        </div><!-- /.nav-collapse -->

 <div class=\"col-xs-12 col-sm-12 \" id=\"\" role=\"\">
          <div class=\"list-group\">
";
if($_SESSION["tipo"]=='P'){
echo            "            <a href=\"previo.php\" class=\"list-group-item \"><span class=\"glyphicon glyphicon-user\"></span> Selecciona Estudiante</a>
			<a href=\"pagos.php\" class=\"list-group-item \"><span class=\"glyphicon glyphicon-list\"></span> Consultar Pagos</a>                       ";
}
echo        "
                                
          </div>
        </div><!--/span-->
 </body>
</html>";
}else{


/*********fin verif pagos*********/

/*********Obs Disciplinarias******/


$select_curso_est="select 
 estudiante.estudiante_id,
 estudiante.nombre,
 (select nombre_archivo from upload where upload.codigo=estudiante.estudiante_id and clase='F') as foto,
 			 curso.codigo,
(select count(*) from observacion_docente where observacion_docente.estudiante=estudiante.estudiante_id and  observacion_docente.estado='A'),
curso.curso_id
			from estudiante,curso
			where  curso.curso_id=estudiante.curso_id
			and curso.curso_id=".$rs_cta[1]."
				and estudiante.estudiante_id=".$rs_cta[0]."  
			order by estudiante.nombre";




			//and pensum.teacher_id=".$_POST['doc1']." 
 
//echo $select_curso_est."<br>";
 

  $select_obs_gral="select * from observacion where estado='A' order by tipo ";

   $res_select_curso_est=mysql_query($select_curso_est); 
   $r_sce = array(0,0,0,0,0);
   if($res_select_curso_est && mysql_num_rows($res_select_curso_est)>0){
$r_sce=mysql_fetch_array($res_select_curso_est);
					
			
						
					
//echo $select_obs_dir."<br>";
// Calificar Periodo de Observaciones




			       $tbody_obs.="
					    
      					      <div class='panel-group' id='accordion'>";
      					      
						$res_select_obs_gral=mysql_query($select_obs_gral);
						$filas = mysql_num_rows($res_select_obs_gral);
						$count=0;





					if($r_sce[4]>0){
				       $tbody_obs.="
					    <div class='panel panel-default' style='font-size:0.75em'>
					    <div class='panel-heading'>
					      <h4 class='panel-title'>
					        <a data-toggle='collapse' data-parent='#accordion' href='#collapseTwo".(isset($r_cur[0])?$r_cur[0]:'0')."'>
					          <font size='2.5em'><img src='../img/eye-icon2.png' width='25px'><b>&nbsp;&nbsp;OBS. DISCIPLINARIAS</b></font>
					        </a>
					      </h4>
					    </div>
				      	<div id='collapseTwo".(isset($r_cur[0])?$r_cur[0]:'0')."' class='panel-collapse collapse in'>
					      <div class='panel-body'>
					    
					    
					    ";

					$select_obs_doc="select
					          Id,
						  estudiante,
						  problema,
						  correctivo,
						  fecha_ocurrencia,
						  asignatura,
						  ifnull((select docente.nombre from docente where docente.teacher_id=observacion_docente.docente),observacion_docente.user),
						  (select concat(planilla.anno,' - ',planilla.periodo) from planilla where planilla.id=observacion_docente.planilla),
						  observacion_docente.planilla,
						  pensum,
						  estado,
			                          docente
					          from observacion_docente
					          where 
					          observacion_docente.estudiante=".$r_sce[0]."  
					          and observacion_docente.estado='A' 
					          order by  observacion_docente.fecha_ocurrencia desc
					          ";
					          
					          $res_select_obs_doc=mysql_query($select_obs_doc);
					          while($r_sodoc=mysql_fetch_array($res_select_obs_doc)){
							$tbody_obs.="<div><b>Fecha: </b>".date("d-m-Y", strtotime(substr($r_sodoc[4],0,10)))."<br><b>Reporta: </b>".$r_sodoc[6]."<br><b>Situaci&oacute;n Problema: </b>".$r_sodoc[2]."<br><b>Correctivos y Compromisos: </b>".$r_sodoc[3]."<hr></div>";
					          }
					$tbody_obs.="
						</div>
					    </div>
					  </div>

					</div>	";	
					}
					

				$tbody_obs.=" ";

}




/*********HORARIO***********/
$select_curso="

(SELECT distinct curso.curso_id,curso.nombre,curso.codigo
					FROM pensum,curso 
					where 
		                         pensum.class_id='".$rs_cta[1]."'
					and pensum.class_id=curso.curso_id 
					order by curso.curso_id
)";
					$res_select_curso=mysql_query($select_curso);


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

$arreglo=array(
1=>'Lunes',
2=>'Martes',
3=>'Miercoles',
4=>'Jueves',
5=>'Viernes',
6=>'Sabado',
7=>'Domingo'
);
					
//					$tbody.="<tr role='row'><td>".$r_sag[0]."</td><td>".$r_sag[1]."</td><td>".$r_sag[2]."</td><td>".$r_sag[3]."</td><td>".$r_sag[4]."</td><td>&nbsp;</td></tr>
					
				$tbody.="<div class='panel-group' id='accordion2'>";
				while($r_cur=mysql_fetch_array($res_select_curso)){
				$tbody.="<div class='panel panel-default'>
					    <div class='panel-heading'>
					      <h4 class='panel-title'>
					        <a data-toggle='collapse' data-parent='#accordion2' href='#collapseOne".$r_cur[0]."'>
					          <font size='2.5em'  style='text-transform: uppercase;'>
					          <img src='../img/cal-icon.png' width='25px'>
					          <b>HORARIO - ".$r_cur[1]."</b></font>
					        </a>
					      </h4>
					    </div>
					    <div id='collapseOne".$r_cur[0]."' class='panel-collapse collapse'>
					      <div class='panel-body'>
					        <div class='table-responsive'>
					      	<table cellpadding='0' cellspacing='0' border='0' class='table table-striped table-bordered ' >
					      	 <tbody>	
					      ";
//table-normal
						//for dias   for($i=1;$i<8;$i++){  
							$tbody.="
							<tr>
								<td  align='center'><strong>Lunes</strong></td>
								<td  align='center'><strong>Martes</strong></td>								
								<td  align='center'><strong>Mi&eacute;rcoles</strong></td>
								<td  align='center'><strong>Jueves</strong></td>
								<td  align='center'><strong>Viernes</strong></td>
								<td  align='center'><strong>S&aacute;bado</strong></td>								
							<tr>	<td>";
// inicio ciclo						
						 $select_horario="
							 select * from 
							(
								(select  horario.curso, horario.asignatura, horario.dia, horario.hi, horario.mi, horario.hf, 
								horario.mf,horario.asignatura  as asig, horario.id, '' 
								from horario
								where horario.estado='A' 
								and horario.dia=1 
								and horario.curso=".$r_cur[0]." 
								and horario.asignatura in ('Descanso','Proyecto')
								)
								union
								(select  horario.curso, horario.asignatura, horario.dia, horario.hi, horario.mi, horario.hf, 
								horario.mf, asignatura.nombre  as asig, horario.id, docente.nombre 
								from horario,asignatura,docente 
								where horario.estado='A' 
								 and horario.dia=1
								 and horario.asignatura=asignatura.subject_id
								 and horario.curso=".$r_cur[0]."
								and docente.teacher_id=horario.docente 
								 )
								 ) a
								 order by a.dia,a.hi,a.mi
								 
							
							 ";
							 //echo $select_horario."<br>";
							 $res_select_horario=mysql_query($select_horario);
						
							if(mysql_query($select_horario)){
							$num_hor=mysql_num_rows($res_select_horario);
							}
						
						if(isset($num_hor)&&$num_hor>0)	{
							
							while($r_selhor=mysql_fetch_array($res_select_horario)){	
							
							if($r_selhor[4]==0){$r_selhor[4]='00';}if($r_selhor[6]==0){$r_selhor[6]='00';}
							if($r_selhor[4]==5){$r_selhor[4]='05';}if($r_selhor[6]==5){$r_selhor[6]='05';}							
							$tbody.="
								<div class='btn-group dropup'>
								  <button type='button' class='btn btn-info btn-xs dropdown-toggle' data-toggle='dropdown' style='font-size:8px;margin-bottom:5px'>
								    ".$r_selhor[7]."<br>( ".$r_selhor[3].":".$r_selhor[4]." - ".$r_selhor[5].":".$r_selhor[6]." )
								  </button>
								   <ul class='dropdown-menu' role='menu'>
								    <li><a data-toggle='modal' href='#' ><span class='glyphicon glyphicon-user'></span></i>&nbsp;$r_selhor[9]</a></li>
								   
								  </ul>
								</div><br>";

							 }
							} 
							$tbody.="</td><td>";
// fin ciclo	
// inicio ciclo						
						 $select_horario="
							 select * from 
							(
								(select  horario.curso, horario.asignatura, horario.dia, horario.hi, horario.mi, horario.hf, 
								horario.mf,horario.asignatura  as asig, horario.id, '' 
								from horario
								where horario.estado='A' 
								and horario.dia=2 
								and horario.curso=".$r_cur[0]." 
								and horario.asignatura in ('Descanso','Proyecto')
								)
								union
								(select  horario.curso, horario.asignatura, horario.dia, horario.hi, horario.mi, horario.hf, 
								horario.mf, asignatura.nombre  as asig, horario.id, docente.nombre 
								from horario,asignatura,docente 
								where horario.estado='A' 
								 and horario.dia=2
								 and horario.asignatura=asignatura.subject_id
								 and horario.curso=".$r_cur[0]."
								and docente.teacher_id=horario.docente 
								 )
								 ) a
								 order by a.dia,a.hi,a.mi
								 
							
							 ";
							 //echo $select_horario."<br>";
							 $res_select_horario=mysql_query($select_horario);
						
							if(mysql_query($select_horario)){
							$num_hor=mysql_num_rows($res_select_horario);
							}
						
						if(isset($num_hor)&&$num_hor>0)	{
							
							while($r_selhor=mysql_fetch_array($res_select_horario)){	
							
							if($r_selhor[4]==0){$r_selhor[4]='00';}if($r_selhor[6]==0){$r_selhor[6]='00';}
							if($r_selhor[4]==5){$r_selhor[4]='05';}if($r_selhor[6]==5){$r_selhor[6]='05';}							
							$tbody.="
								<div class='btn-group dropup'>
								  <button type='button' class='btn btn-info btn-xs dropdown-toggle' data-toggle='dropdown' style='font-size:8px;margin-bottom:5px'>
								    ".$r_selhor[7]."<br>( ".$r_selhor[3].":".$r_selhor[4]." - ".$r_selhor[5].":".$r_selhor[6]." )
								  </button>
								   <ul class='dropdown-menu' role='menu'>
								    <li><a data-toggle='modal' href='#' ><span class='glyphicon glyphicon-user'></span></i>&nbsp;$r_selhor[9]</a></li>
								   
								  </ul>
								</div><br>";

							 }
							} 
							$tbody.="</td><td>";
// fin ciclo	
// inicio ciclo						
						 $select_horario="
							 select * from 
							(
								(select  horario.curso, horario.asignatura, horario.dia, horario.hi, horario.mi, horario.hf, 
								horario.mf,horario.asignatura  as asig, horario.id, '' 
								from horario
								where horario.estado='A' 
								and horario.dia=3 
								and horario.curso=".$r_cur[0]." 
								and horario.asignatura in ('Descanso','Proyecto')
								)
								union
								(select  horario.curso, horario.asignatura, horario.dia, horario.hi, horario.mi, horario.hf, 
								horario.mf, asignatura.nombre  as asig, horario.id, docente.nombre 
								from horario,asignatura,docente 
								where horario.estado='A' 
								 and horario.dia=3
								 and horario.asignatura=asignatura.subject_id
								 and horario.curso=".$r_cur[0]."
								and docente.teacher_id=horario.docente 
								 )
								 ) a
								 order by a.dia,a.hi,a.mi
								 
							
							 ";
							 //echo $select_horario."<br>";
							 $res_select_horario=mysql_query($select_horario);
						
							if(mysql_query($select_horario)){
							$num_hor=mysql_num_rows($res_select_horario);
							}
						
						if(isset($num_hor)&&$num_hor>0)	{
							
							while($r_selhor=mysql_fetch_array($res_select_horario)){	
							
							if($r_selhor[4]==0){$r_selhor[4]='00';}if($r_selhor[6]==0){$r_selhor[6]='00';}
							if($r_selhor[4]==5){$r_selhor[4]='05';}if($r_selhor[6]==5){$r_selhor[6]='05';}							
							$tbody.="
								<div class='btn-group dropup'>
								  <button type='button' class='btn btn-info btn-xs dropdown-toggle' data-toggle='dropdown' style='font-size:8px;margin-bottom:5px'>
								    ".$r_selhor[7]."<br>( ".$r_selhor[3].":".$r_selhor[4]." - ".$r_selhor[5].":".$r_selhor[6]." )
								  </button>
								   <ul class='dropdown-menu' role='menu'>
								    <li><a data-toggle='modal' href='#' ><span class='glyphicon glyphicon-user'></span></i>&nbsp;$r_selhor[9]</a></li>
								   
								  </ul>
								</div><br>";

							 }
							} 
							$tbody.="</td><td>";
// fin ciclo	
// inicio ciclo						
						 $select_horario="
							 select * from 
							(
								(select  horario.curso, horario.asignatura, horario.dia, horario.hi, horario.mi, horario.hf, 
								horario.mf,horario.asignatura  as asig, horario.id, '' 
								from horario
								where horario.estado='A' 
								and horario.dia=4 
								and horario.curso=".$r_cur[0]." 
								and horario.asignatura in ('Descanso','Proyecto')
								)
								union
								(select  horario.curso, horario.asignatura, horario.dia, horario.hi, horario.mi, horario.hf, 
								horario.mf, asignatura.nombre  as asig, horario.id, docente.nombre 
								from horario,asignatura,docente 
								where horario.estado='A' 
								 and horario.dia=4
								 and horario.asignatura=asignatura.subject_id
								 and horario.curso=".$r_cur[0]."
								and docente.teacher_id=horario.docente 
								 )
								 ) a
								 order by a.dia,a.hi,a.mi
								 
							
							 ";
							 //echo $select_horario."<br>";
							 $res_select_horario=mysql_query($select_horario);
						
							if(mysql_query($select_horario)){
							$num_hor=mysql_num_rows($res_select_horario);
							}
						
						if(isset($num_hor)&&$num_hor>0)	{
							
							while($r_selhor=mysql_fetch_array($res_select_horario)){	
							
							if($r_selhor[4]==0){$r_selhor[4]='00';}if($r_selhor[6]==0){$r_selhor[6]='00';}
							if($r_selhor[4]==5){$r_selhor[4]='05';}if($r_selhor[6]==5){$r_selhor[6]='05';}							
							$tbody.="
								<div class='btn-group dropup'>
								  <button type='button' class='btn btn-info btn-xs dropdown-toggle' data-toggle='dropdown' style='font-size:8px;margin-bottom:5px'>
								    ".$r_selhor[7]."<br>( ".$r_selhor[3].":".$r_selhor[4]." - ".$r_selhor[5].":".$r_selhor[6]." )
								  </button>
								   <ul class='dropdown-menu' role='menu'>
								    <li><a data-toggle='modal' href='#' ><span class='glyphicon glyphicon-user'></span></i>&nbsp;$r_selhor[9]</a></li>
								   
								  </ul>
								</div><br>";

							 }
							} 
							$tbody.="</td><td>";
// fin ciclo							
// inicio ciclo						
						 $select_horario="
							 select * from 
							(
								(select  horario.curso, horario.asignatura, horario.dia, horario.hi, horario.mi, horario.hf, 
								horario.mf,horario.asignatura  as asig, horario.id, '' 
								from horario
								where horario.estado='A' 
								and horario.dia=5 
								and horario.curso=".$r_cur[0]." 
								and horario.asignatura in ('Descanso','Proyecto')
								)
								union
								(select  horario.curso, horario.asignatura, horario.dia, horario.hi, horario.mi, horario.hf, 
								horario.mf, asignatura.nombre  as asig, horario.id, docente.nombre 
								from horario,asignatura,docente 
								where horario.estado='A' 
								 and horario.dia=5
								 and horario.asignatura=asignatura.subject_id
								 and horario.curso=".$r_cur[0]."
								and docente.teacher_id=horario.docente 
								 )
								 ) a
								 order by a.dia,a.hi,a.mi
								 
							
							 ";
							 //echo $select_horario."<br>";
							 $res_select_horario=mysql_query($select_horario);
						
							if(mysql_query($select_horario)){
							$num_hor=mysql_num_rows($res_select_horario);
							}
						
						if(isset($num_hor)&&$num_hor>0)	{
							
							while($r_selhor=mysql_fetch_array($res_select_horario)){	
							
							if($r_selhor[4]==0){$r_selhor[4]='00';}if($r_selhor[6]==0){$r_selhor[6]='00';}
							if($r_selhor[4]==5){$r_selhor[4]='05';}if($r_selhor[6]==5){$r_selhor[6]='05';}							
							$tbody.="
								<div class='btn-group dropup'>
								  <button type='button' class='btn btn-info btn-xs dropdown-toggle' data-toggle='dropdown' style='font-size:8px;margin-bottom:5px'>
								    ".$r_selhor[7]."<br>( ".$r_selhor[3].":".$r_selhor[4]." - ".$r_selhor[5].":".$r_selhor[6]." )
								  </button>
								   <ul class='dropdown-menu' role='menu'>
								    <li><a data-toggle='modal' href='#' ><span class='glyphicon glyphicon-user'></span></i>&nbsp;$r_selhor[9]</a></li>
								   
								  </ul>
								</div><br>";

							 }
							} 
							$tbody.="</td><td style='z-index: 1;'>";
// fin ciclo							
							 $select_horario="
							 select * from 
							(
								(select  horario.curso, horario.asignatura, horario.dia, horario.hi, horario.mi, horario.hf, 
								horario.mf,horario.asignatura  as asig, horario.id, '' 
								from horario
								where horario.estado='A' 
								and horario.dia=6 
								and horario.curso=".$r_cur[0]." 
								and horario.asignatura in ('Descanso','Proyecto')
								)
								union
								(select  horario.curso, horario.asignatura, horario.dia, horario.hi, horario.mi, horario.hf, 
								horario.mf, asignatura.nombre  as asig, horario.id, docente.nombre 
								from horario,asignatura,docente 
								where horario.estado='A' 
								 and horario.dia=6
								 and horario.asignatura=asignatura.subject_id
								 and horario.curso=".$r_cur[0]."
								and docente.teacher_id=horario.docente 
								 )
								 ) a
								 order by a.dia,a.hi,a.mi";
						 	$res_select_horario=mysql_query($select_horario);
							if(mysql_query($select_horario)){
							$num_hor=mysql_num_rows($res_select_horario);
							}
						if(isset($num_hor)&&$num_hor>0)	{
							while($r_selhor=mysql_fetch_array($res_select_horario)){	
							if($r_selhor[4]==0){$r_selhor[4]='00';}if($r_selhor[6]==0){$r_selhor[6]='00';}
							if($r_selhor[4]==5){$r_selhor[4]='05';}if($r_selhor[6]==5){$r_selhor[6]='05';}							
							$tbody.="
								<div class='btn-group dropup'>
								  <button type='button' class='btn btn-info btn-xs dropdown-toggle' data-toggle='dropdown' style='font-size:8px;margin-bottom:5px'>
								    ".$r_selhor[7]."<br>( ".$r_selhor[3].":".$r_selhor[4]." - ".$r_selhor[5].":".$r_selhor[6]." )
								  </button>
								   <ul class='dropdown-menu' role='menu'>
								    <li><a data-toggle='modal' href='#' ><span class='glyphicon glyphicon-user'></span></i>&nbsp;$r_selhor[9]</a></li>
								   
								  </ul>
								</div><br>";

								
				
							}	
						}
						$tbody.="						
								</td>								
							</tr>
							";	      
					//	      }  fin for arreglo dias
					      $tbody.="
					      	 </tbody>	
					      	</table>
					      	</div>
					      </div>
					    </div>
					  </div>";
				}
					$tbody.="</div>";
/*********Eventos******/					
$select_curso_eve="
select * from ((select mensaje,fecha_evento,docente,curso,user,fecha_pub, 
(select nombre from docente where teacher_id=evento.docente ) as nom
from evento where evento.curso='".$rs_cta[1]."' and fecha_evento>='".$today."'
and user=0
) 
union	
(select mensaje,fecha_evento,docente,curso,user,fecha_pub, 
(select name from usuarios where usuarios.id=evento.docente ) as nom
from evento where evento.curso='".$rs_cta[1]."' and fecha_evento>='".$today."'
and user=1
) ) a order by a.fecha_evento DESC

			";
$res_select_curso_eve=mysql_query($select_curso_eve); 

  $num_rows=mysql_num_rows($res_select_curso_eve);
  if($num_rows>0){
 
					
//$r_eve=mysql_fetch_array($res_select_curso_eve);			

			       $tbody_eve.="
					    
      					      <div class='panel-group' id='accordion3'>";
      					      
						$res_select_obs_gral=mysql_query($select_obs_gral);
						$filas = mysql_num_rows($res_select_obs_gral);
						$count=0;





					
				       $tbody_eve.="
					    <div class='panel panel-default' style='font-size:0.75em'>
					    <div class='panel-heading'>
					      <h4 class='panel-title'>
					        <a data-toggle='collapse' data-parent='#accordion3' href='#collapseTres".(isset($r_cur[0])?$r_cur[0]:'0')."'>
					          <font size='2.5em'><img src='../img/cal-icon.png' width='25px'><b>&nbsp;&nbsp;EVENTOS</b></font>
					        </a>
					      </h4>
					    </div>
				      	<div id='collapseTres".(isset($r_cur[0])?$r_cur[0]:'0')."' class='panel-collapse collapse in'>
					      <div class='panel-body'>
					    
					    
					    ";

					        
					          while($r_eve=mysql_fetch_array($res_select_curso_eve)){
							$tbody_eve.="<div><b>Fecha: ".date("d-m-Y", strtotime(substr($r_eve[1],0,10)))."</b><br><b>Creado por: </b>".$r_eve[6]."<br><b>Mensaje: </b>".$r_eve[0]."<br><hr></div>";
					          }
					$tbody_eve.="
						</div>
					    </div>
					  </div>

					</div>	";	

					

				$tbody_eve.=" ";

}



/**********************/					

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\">

    <title>SOFTWARE DE GESTION ACADEMICA EN LINEA</title>
	<link rel='stylesheet' href='calendar/css/calendar.css'>
    <!-- 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]-->
  </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='248px' style='margin-top:10px;margin-left:5px'></a>";

if($_SESSION["tipo"]=='P'){
			
echo	"<a href='previo.php' ><span style='float:right;margin-right:10px; margin-top:15px' class='label label-success '> <span class='glyphicon  glyphicon-zoom-in'></span> </span></a>";
					}
echo
		         "<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>

       ";          
if($_SESSION["tipo"]=='P'){
			
 echo	"<a href='previo.php' class='hidden-xs'><span style='float:right;margin-right:10px; margin-top:15px' class='label label-success hidden-xs'>Seleccionar <span class='glyphicon  glyphicon-zoom-in'></span> </span></a>";
					}
echo			"
       <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=\"collapse navbar-collapse\">
          <ul class=\"nav navbar-nav\">
           
          </ul>
        </div><!-- /.nav-collapse -->

 <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 active\"><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=\"horario.php\" class=\"list-group-item \"><span class=\"glyphicon glyphicon-edit\"></span> Horario</a>
            <a href=\"planilla.php\" class=\"list-group-item \"><span class=\"glyphicon glyphicon-file\"></span> Calificaciones</a>";            
if($rs_cta[2]=='1'){echo "<a href=\"reportes.php\" class=\"list-group-item \"><span class=\"glyphicon glyphicon-file\"></span> Informes</a>";}
echo            "<a href=\"planilla_obs.php\" class=\"list-group-item \"><span class=\"glyphicon glyphicon-file\"></span> Control Disciplina</a>    ";
if($_SESSION["tipo"]=='P'){
echo            "<a href=\"pagos.php\" class=\"list-group-item \"><span class=\"glyphicon glyphicon-list\"></span> Pagos</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=\"row\">
<div class=\"col-12 col-sm-12 col-lg-12\">          	
				<div>
					<div class='pull-right form-inline'>
					<div class='btn-group'>
						<button class='btn btn-info btn-sm' data-calendar-nav='prev'><< Ant.</button>
						<button class='btn btn-sm' data-calendar-nav='today'>Hoy</button>
						<button class='btn btn-info btn-sm' data-calendar-nav='next'>Sig. >></button>
					</div>
					<div class='btn-group'>
						<button class='btn btn-success btn-sm' data-calendar-view='year'>A&ntilde;o</button>
						<button class='btn btn-success btn-sm active' data-calendar-view='month'>Mes</button>
						<button class='btn btn-success btn-sm' data-calendar-view='week'>Semana</button>
					</div>
					</div>
				</div>
				<div class='span9'>
					<h3></h3>
					<div id='calendar'></div>
				</div>
				<div class='span3'>
					<div class='row-fluid'>
						
						<label class='checkbox'>
		
						</label>
					</div>
		
					<h4></h4>
					<small></small>
					<ul id='eventlist' class='nav nav-list'></ul>
				</div>

	          
	          	<div class='modal fade' id='events-modal'>
			    <div class='modal-dialog'>
			        <div class='modal-content' >
			            <div align='center' class='modal-header' style='background:#4fad45;border-radius:6px 6px 0px 0px;color:white;background-clip: padding-box;border: 1px solid rgba(0,0,0,.2)'>
			                <button type='button' class='close' data-dismiss='modal' aria-hidden='true'>&times;</button>
			                <h3>Anuncio</h3>
			            </div>
			            <div class='modal-body' style='height: 200px'>
			            <h4></h4>
			            </div>
			            <div class='modal-footer'>
			                <a href='#' data-dismiss='modal' class='btn'>Cerrar</a>
			            </div>
			        </div>
			    </div>
			</div>
          	</div><!--/span-->
     	 <div class=\"col-6 col-sm-6 col-lg-4\">
          	<a href=\"estudiantes.php\" class=\"thumbnail\"><div style='background:#eeeeee;height: 120px;' align='center' > <img src=\"../img/alumnos.png\" class=\"imag\" style=\"height: 51px; width: 51px;\"><br>Estudiantes</div></a></div><!--/span-->
	<div class=\"col-6 col-sm-6 col-lg-4\">
          	<a href=\"docentes.php\" class=\"thumbnail\"><div style='background:#eeeeee;height: 120px;' align='center' > <img src=\"../img/docentes.png\" class=\"imag\" style=\"height: 51px; width: 51px; \"><br>Docentes</div></a></div><!--/span-->
            <div class=\"col-6 col-sm-6 col-lg-4\">
          	<a href=\"planilla.php\" class=\"thumbnail\"><div style='background:#eeeeee;height: 120px;' align='center' > <img src=\"../img/checklist.png\" class=\"imag\" style=\"height: 51px; width: 51px; \"><br>Calificaciones</div></a></div><!--/span-->
      	    <div class=\"col-12 col-sm-12 col-lg-12\">
          	$tbody
          	</div><!--/span-->
      	    <div class=\"col-6 col-sm-6 col-lg-6\">
          	$tbody_eve
          	</div><!--/span-->
          <div class=\"col-6 col-sm-6 col-lg-6\">
          	$tbody_obs
          	</div><!--/span-->	
          	
          </div><!--/row-->
        </div><!--/span-->

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

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

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

	<script type='text/javascript' src='calendar/components/jquery/jquery.min.js'></script>
	<script type='text/javascript' src='calendar/components/underscore/underscore-min.js'></script>
	<script type='text/javascript' src='calendar/components/bootstrap2/js/bootstrap.min.js'></script>
	<script type='text/javascript' src='calendar/components/jstimezonedetect/jstz.min.js'></script>
	<script type='text/javascript' src='calendar/js/language/es-CO.js'></script>
	<script type='text/javascript' src='calendar/js/calendar.js'></script>
	<script type='text/javascript' src='calendar/js/app.js'></script>


    <!-- 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>
";
 }//estado de cuenta
}else{
echo "
<div class=\"alert alert-danger\" >
		                    <button type=\"button\" class=\"close\" data-dismiss=\"alert\">X</button>
					Debe registrase para usar la aplicaci&oacute;n <a href='../index.php' > Ingresar</a>
				</div>";
}

?>