Viewing file: calendar.php (5.01 KB) -rw-rw-rw- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
//////////////////////// Extracción de la fecha
$accion = isset($acc);
if ($accion == true) {
if ($acc == "prev") {
$m = $m-1;
if ($m == 0) {
$m = 12;
$y = $y - 1;
}
$ma = mktime(0,0,0,$m,$d,$y);
$hora = getdate($ma);
}
if ($acc == "next") {
$m = $m+1;
if ($m == 13) {
$m = 1;
$y = $y + 1;
}
$ma = mktime(0,0,0,$m,$d,$y);
$hora = getdate($ma);
}
if ($acc == "this") {
$ma = mktime(0,0,0,$m,$d,$y);
$hora = getdate($ma);
}
}else{
$hora = getdate();
}
$yr = $hora["year"];
$mo = $hora["mon"];
$dy = $hora["mday"];
if ($mo == 1) {
$lb = "Enero";
$end = 31;
}
if ($mo == 2) {
$lb = "Febrero";
$end = 28;
}
if ($mo == 3) {
$lb = "Marzo";
$end = 31;
}
if ($mo == 4) {
$lb = "Abril";
$end = 30;
}
if ($mo == 5) {
$lb = "Mayo";
$end = 31;
}
if ($mo == 6) {
$lb = "Junio";
$end = 30;
}
if ($mo == 7) {
$lb = "Julio";
$end = 31;
}
if ($mo == 8) {
$lb = "Agosto";
$end = 31;
}
if ($mo == 9) {
$lb = "Septiembre";
$end = 30;
}
if ($mo == 10) {
$lb = "Octubre";
$end = 31;
}
if ($mo == 11) {
$lb = "Noviembre";
$end = 30;
}
if ($mo == 12) {
$lb = "Diciembre";
$end = 31;
}
$primero = mktime(0,0,0,$mo,1,$yr);
$hora_prim = getdate($primero);
$clk = $hora_prim["wday"];
//echo $clk;
//echo "<br>";
?>
<table width="188" border="1" cellpadding="2" cellspacing="0" bordercolor="#FFFFFF">
<tr>
<td colspan="7" background="imagenes/fondobot1.gif">
<div align="center"><a href="decide.php?d=<?php echo $dy; ?>&m=<?php echo $mo; ?>&y=<?php echo $yr; ?>&acc=prev&patron=<?php echo $patron; ?>"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><<</font></a>
<font size="1" face="Verdana, Arial, Helvetica, sans-serif"><?php echo $lb; ?>
<?php echo $yr; ?> <a href="decide.php?d=<?php echo $dy; ?>&m=<?php echo $mo; ?>&y=<?php echo $yr; ?>&acc=next&patron=<?php echo $patron; ?>">>></a></font></div></td>
</tr>
<tr>
<td width="20" background="imagenes/focal.gif">
<div align="center"><font color="#FFFFFF"><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">D</font></strong></font></div></td>
<td width="20" background="imagenes/focal.gif">
<div align="center"><font color="#FFFFFF"><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">L</font></strong></font></div></td>
<td width="20" background="imagenes/focal.gif">
<div align="center"><font color="#FFFFFF"><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">M</font></strong></font></div></td>
<td width="20" background="imagenes/focal.gif">
<div align="center"><font color="#FFFFFF"><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">M</font></strong></font></div></td>
<td width="20" background="imagenes/focal.gif">
<div align="center"><font color="#FFFFFF"><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">J</font></strong></font></div></td>
<td width="20" background="imagenes/focal.gif">
<div align="center"><font color="#FFFFFF"><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">V</font></strong></font></div></td>
<td width="20" background="imagenes/focal.gif">
<div align="center"><font color="#FFFFFF"><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">S</font></strong></font></div></td>
</tr>
<?php
$sec_r = 1;
$sec_a = 0;
$start = 0;
for ($i = 1; $i <= 42; $i++) {
if ($sec_a == 0 or $sec_a == 7 or $sec_a == 14 or $sec_a == 21 or $sec_a == 28 or $sec_a == 35) {
?>
<tr>
<?php } ?>
<?php
/////////// Función principal
if ($start != 0 and $sec_r <= $end)
{
if ($dy == $sec_r) {
echo "<td width=\"20\" background=\"imagenes/focal1.gif\">";
} else {
echo "<td width=\"20\" background=\"imagenes/fondobot2.gif\">";
}
echo "<div align=\"center\"><a href=\"decide.php?d=$sec_r&m=$mo&y=$yr&acc=this&patron=$patron\"><font size=\"1\" face=\"Verdana, Arial, Helvetica, sans-serif\">" . $sec_r . "</font></a><div>";
$sec_r++;
} else {
if ($sec_a != $clk) {
echo "<td width=\"20\">";
echo "<div align=\"center\"><font size=\"1\" face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"#FFFFFF\">" . "-" . "</font><div>";
}
}
if ($sec_a == $clk) {
echo "<td width=\"20\" background=\"imagenes/fondobot2.gif\">";
echo "<div align=\"center\"><a href=\"#\"><font size=\"1\" face=\"Verdana, Arial, Helvetica, sans-serif\">" . $sec_r . "</font></a><div>";
$start = 1;
$sec_r++;
}
?>
</td>
<?php
if ($sec_a == 6 or $sec_a == 13 or $sec_a == 20 or $sec_a == 27 or $sec_a == 34 or $sec_a == 41) {
?>
</tr>
<?php } ?>
<?php
$sec_a++;
}
?>
</table>
|