<?
if(1==2){
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<link href="../estilo1.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>

<body>
<?
}


if(!$mes){
  $mes=date("m");
}

if(!$year){
  $year=date("Y");
}

if($mes<1 or $mes >12){
 alert("Error, parámetros incorrectos","javascript:history.go(-1)");
}

$primer_dia=date("w",mktime(0,0,0,$mes,1,$year));
$dias_mes=date("t",mktime(0,0,0,$mes,1,$year));

$n_mesactual=mes_letras(date("m"));
$link_hoy="index3.php?op=calendario&mes=".date("m")."&year=".date("Y");

if($mes==12){
 $nyear=$year+1;
 $link_smes="index3.php?op=calendario&mes=1&year=".$nyear;
}else{
 $nmes=$mes+1;
 $link_smes="index3.php?op=calendario&mes=".$nmes."&year=".$year;
}

if($mes==1){
 $lyear=$year-1;
 $link_ames="index3.php?op=calendario&mes=12&year=".$lyear;
}else{
 $lmes=$mes-1;
 $link_ames="index3.php?op=calendario&mes=".$lmes."&year=".$year;
}  
?>
<table width="900" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="49"><img src="../images/contenedores/padres/ic_calendario.gif" width="49" height="35" /></td>
    <td width="177" valign="bottom" background="../images/contenedores/pestana_centro.gif" class="lbl_campo"><div align="left" class="titulo_pagina">Calendario de actividades<a name="tareash" id="tareas5"></a></div></td>
    <td width="430" background="../images/contenedores/pestana_bg.gif"><div align="left"><img src="../images/contenedores/pestana_derecha.gif" width="16" height="35" /></div></td>
    <td width="244" background="../images/contenedores/pestana_bg.gif"><div align="right"><img src="../images/contenedores/pestana_curva.gif" width="13" height="35" /></div></td>
  </tr>
  <tr>
    <td colspan="4"><table width="900" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="10" background="../images/contenedores/pestana_cont_izq.gif">&nbsp;</td>
        <td width="880" bgcolor="#FFFFFF"><br />
          <table width="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#333333">
            <tr>
              <td align="left" valign="top" bgcolor="#FFFFFF"><div align="left" class="parrafo">
                <table width="99%"  border="0" align="center" cellpadding="1" cellspacing="0" bgcolor="#336699">
                  <tr bgcolor="#336699">
                    <td width="33%" bgcolor="#CFDFEF"><div align="left"><a href="<?=$link_hoy;?>" class="link_parrafo">Regresar a <strong>
                      <?="$n_mesactual $year";?>
                      </strong></a></div></td>
                    <td width="2%" bgcolor="#CFDFEF"><div align="right"><a href="<?=$link_ames;?>" class="link_parrafo"><strong><img src="../images/back_f2.png" width="32" height="32" border="0" /></strong></a></div></td>
                    <td width="30%" bgcolor="#CFDFEF"><div align="center" class="titulo_seccion"><?php echo mes_letras($mes); ?>
                      <?=$year;?>
                      </div></td>
                    <td width="2%" bgcolor="#CFDFEF"><div align="left"><a href="<?=$link_smes;?>" class="link_parrafo"><strong><img src="../images/next_f2.png" width="32" height="32" border="0" /></strong></a></div></td>
                    <td width="33%" bgcolor="#CFDFEF"><div align="right">
                      <select name="menu1" class="textbox" onchange="MM_jumpMenu('self',this,0)">
                        <?
                      for($tmpy=date("Y");$tmpy<=date("Y");$tmpy++){
                      ?>
                        <option value="frm_calendario.php?mes=1&amp;year=<?=$tmpy;?>">
                          <?=$tmpy;?>
                          </option>
                        <?
                      }
                      ?>
                        </select>
                      </div></td>
                    </tr>
                  </table>
                <table width="99%"  border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#666666">
                  <tr bgcolor="#CFDFEF" class="lbl_campo">
                    <td width="85"><div align="center">Domingo</div></td>
                    <td width="85"><div align="center">Lunes</div></td>
                    <td width="85"><div align="center">Martes</div></td>
                    <td width="85"><div align="center">Mi&eacute;rcoles</div></td>
                    <td width="85"><div align="center">Jueves</div></td>
                    <td width="85"><div align="center">Viernes</div></td>
                    <td width="85"><div align="center">S&aacute;bado</div></td>
                    </tr>
                  <?

                  $semana=1;
                  $sumar=false;
                  while($semana<=6){
                  ?>
                  <tr align="left" valign="top" bgcolor="#ECF2F9">
                    <?
                    for($i=0;$i<=6;$i++){
                    if($semana==1 and $i==$primer_dia){
                      $sumar=true;
                    }

                    if($dia>=$dias_mes){
                      $sumar=false;
                      $dia="";
                      $fecha_evento="";
                    }

                    if($sumar==true){
                      $dia++;
                      $fecha_evento="$year-$mes-$dia";
                    }


                    ?>
                    <td height="50" <?if($dia==""){echo "bgcolor='#D0D0D0'";}else{if($fecha=="$year-$mes-$dia"){echo "bgcolor='#CFDFEF'";}}?>><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td align="left" valign="top" class="lbl_campo"><?if($dia!=""){?>
                          <strong>
                            <?=$dia;?>
                            </strong>
                          <?}if($fecha=="$year-$mes-$dia"){echo " Hoy";}?></td>
                        </tr>
                      <tr>
                        <td height="20" align="left" valign="top"><?
                          if($dia!=""){
                          $qeventos=mysql_query("select * from calendario where fecha = '$fecha_evento' order by fecha, hora");
                          $hay_evento=false;
                          while($ievento=mysql_fetch_array($qeventos)){
                          $hay_evento=true;
                          ?>
                          <a href="#" onmouseover="return overlib('&lt;strong&gt;<?=$ievento[asunto];?>&lt;/strong&gt;');" onmouseout="return nd();"><img src="../images/cuad_rojo.gif" border="0" /></a>
                          <?
                          }// fin del ciclo

                          $mi_grado=ggradoalumno($uuser);
                          $qeventos=mysql_query("select evaluaciones.*, cursos.curso as ncurso
                                                 from evaluaciones inner join cursos on evaluaciones.curso = cursos.codigo
                                                 inner join cursos_grados on evaluaciones.curso = cursos_grados.curso
                                                 where fecha_inicio = '$fecha_evento' and evaluaciones.activa = 'S' and cursos_grados.grado = '$mi_grado'
                                                 and evaluaciones.seccion = '$useccion'
                                                 order by fecha_inicio");
                          while($ievento=mysql_fetch_array($qeventos)){
                          $ievento[tarea]=str_replace("\"","",$ievento[nombre]);
                          $ievento[tarea]=str_replace("'","",$ievento[nombre]);
                                    
                          $hay_evento=true;
                          ?>
                          <a href="#" onmouseover="return overlib('&lt;strong&gt;Evaluaci&oacute;n:&lt;/strong&gt; <?=$ievento[nombre];?>&lt;br&gt;Curso: <?=$ievento[ncurso];?>&lt;br&gt;Inicia el: <?=fechalarga($ievento[fecha_inicio]." ".$ievento[hora_inicio]);?>&lt;br&gt;Caduca el: <?=fechalarga($ievento[fecha_fin]." ".$ievento[hora_fin]);?>');" onmouseout="return nd();"><img src="../images/cuad_naranja.gif" border="0" /></a>
                          <?
                          }// fin del ciclo

                          $qeventos=mysql_query("select tareas.*, cursos.curso as ncurso
                                                 from tareas inner join cursos on tareas.curso = cursos.codigo
                                                 inner join cursos_grados on tareas.curso = cursos_grados.curso
                                                 where fecha_limite = '$fecha_evento'
                                                 and tareas.activa = 'S'
                                                 and cursos_grados.grado = '$mi_grado'
                                                 and tareas.seccion = '$useccion'
                                                 order by fecha_limite");
                          echo mysql_error();
                          while($ievento=mysql_fetch_array($qeventos)){
                          $ievento[tarea]=str_replace("\"","",$ievento[tarea]);
                          $ievento[tarea]=str_replace("'","",$ievento[tarea]);
                                    
                          $hay_evento=true;
                          ?>
                          <a href="#" onmouseover="return overlib('&lt;strong&gt;Tarea:&lt;/strong&gt; <?=$ievento[tarea];?>&lt;br&gt;Curso: <?=$ievento[ncurso];?>&lt;br&gt;Fecha m&aacute;xima de entrega:&lt;br&gt;<?=fecha($ievento[fecha_limite])." ".substr($ievento[hora_limite],0,5);?> Hrs.');" onmouseout="return nd();"><img src="../images/cuad_celeste.gif"  border="0" /></a>
                          <?
                          }// fin del ciclo

                          } // fin si el dia no existe
                          ?></td>
                        </tr>
                      <tr>
                        <td height="10"><div align="right">
                          <?if($dia!="" and $hay_evento==true){?>
                          <a href="index3.php?op=calendario_eventos&<?="txtdia=$dia&txtmes=$mes&txtyear=$year&txtconsulta=1";?>" class="link_parrafo" title="Ver todos los eventos con sus detalles...">Ver eventos<img src="../images/flecha_3.jpg" width="9" height="9" border="0" /></a></div>
                          <?}?></td>
                        </tr>
                      </table></td>
                    <?
                    }  // fin del ciclo de dias
                    ?>
                    </tr>
                  <tr>
                    <?
                  $semana++;
                  } // fin del ciclo de semanas
                  ?>
                    </tr>
                  </table>
                <table width="99%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#666666">
                  <tr>
                    <td bgcolor="#ECF2F9">&nbsp;[<img src="../images/cuad_celeste.gif" width="6" height="6" /> Tareas] &nbsp;[<img src="../images/cuad_naranja.gif" width="6" height="6" /> Evaluaciones] &nbsp;[<img src="../images/cuad_rojo.gif" width="6" height="6" /> Eventos agregados por la administraci&oacute;n] </td>
                    </tr>
                  </table>
                </div></td>
            </tr>
          </table>
          <br /></td>
        <td width="10" background="../images/contenedores/pestana_cont_der.gif">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td><img src="../images/contenedores/pestana_bott_izq.gif" width="49" height="26" /></td>
    <td background="../images/contenedores/pestana_bott_centro.gif">&nbsp;</td>
    <td background="../images/contenedores/pestana_bott_centro.gif">&nbsp;</td>
    <td background="../images/contenedores/pestana_bott_centro.gif"><div align="right"><img src="../images/contenedores/pestana_bott_der.gif" width="13" height="26" /></div></td>
  </tr>
</table>
<?
if(1==2){
?>
</body>
</html>
<?}?>
