Viewing file: cal.php (5.25 KB) -rw-rw-rw- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?Php
function select_mes($mes){
?>
<select name="mes" class="select" onchange="go_month()">
<?
for($i=1;$i<=12;$i++){
if($i == 1){$nmes = "Enero";}
if($i == 2){$nmes = "Febrero";}
if($i == 3){$nmes = "Marzo";}
if($i == 4){$nmes = "Abril";}
if($i == 5){$nmes = "Mayo";}
if($i == 6){$nmes = "Junio";}
if($i == 7){$nmes = "Julio";}
if($i == 8){$nmes = "Agosto";}
if($i == 9){$nmes = "Setiembre";}
if($i == 10){$nmes = "Octubre";}
if($i == 11){$nmes = "Noviembre";}
if($i == 12){$nmes = "Diciembre";}
?>
<option value="<?=$i?>" <?if($i == $mes){echo "selected";}?>><?=$nmes?></option>
<?
}
?>
</select>
<?
}
$ids = 2;
if($mes == ""){
$mes = date('m');
}
if($mes == 1){$nmes = "Enero";}
if($mes == 2){$nmes = "Febrero";}
if($mes == 3){$nmes = "Marzo";}
if($mes == 4){$nmes = "Abril";}
if($mes == 5){$nmes = "Mayo";}
if($mes == 6){$nmes = "Junio";}
if($mes == 7){$nmes = "Julio";}
if($mes == 8){$nmes = "Agosto";}
if($mes == 9){$nmes = "Setiembre";}
if($mes == 10){$nmes = "Octubre";}
if($mes == 11){$nmes = "Noviembre";}
if($mes == 12){$nmes = "Diciembre";}
$ld = strftime("%d", mktime (0,0,0,$mes+1,0,date('Y')));
$fd = date("w", mktime(0,0,0,$mes,1,date('Y')));
if($fd == 0){
$fd = 7;
}
if($fd == 1){
$x = 1;
for($i=1;$i<=5;$i++){
for($j=1;$j<=7;$j++){
$dia[$i][$j] = $x;
$x++;
if($x > $ld){
break;
}
}
}
}if($fd != 1){
$x = 1;
for($j=$fd;$j<=7;$j++){
$dia[1][$j] = $x;
$x++;
}
for($i=2;$i<=5;$i++){
for($j=1;$j<=7;$j++){
$dia[$i][$j] = $x;
$x++;
if($x > $ld){
break;
}
}
}
if($dia[5][7] < $ld){
$res = $ld - $dia[5][7];
if($res == 1 and $ld == 30){
$dia[1][1] = 30;
}if($res == 1 and $ld == 31){
$dia[1][1] = 31;
}if($res == 2){
$dia[1][1] = 30;
$dia[1][2] = 31;
}
}
}
?>
<html>
<head>
<title>Calendario</title>
</head>
<body>
<script language="JavaScript">
function go_month(){
window.location = '<?=$PHP_SELF?>?mes='+this.mes.value;
}
</script>
<table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="80" align="center"><b>
<?
if($mes > 1){
?>
<a href="<?=$PHP_SELF?>?mes=<?=$mes-1?>"><b> <<< </a>
<?
}else{
?>
<a href="<?=$PHP_SELF?>?mes=12"><b> <<< </a>
<?
}
?>
</b></td>
<td align="center" colspan="5" width="427"><font face=arial size=2><b>
<!--<?=$nmes." ".date('Y')?>-->
<?
select_mes($mes);
?>
</td>
<td width="80" align="center"><b>
<?
if($mes < 12){
?>
<a href="<?=$PHP_SELF?>?mes=<?=$mes+1?>"><b> >>> </a>
<?
}else{
?>
<a href="<?=$PHP_SELF?>?mes=1"><b> >>> </a>
<?
}
?>
</b></td>
</tr>
</table>
<br>
<table border="1" cellspacing="0" cellpadding="0" align="center" bgcolor="#ffffff" width="580">
<tr>
<td width="80" align="center"><font face=verdana size=1 color="#123456"><b>Lunes</td>
<td width="80" align="center"><font face=verdana size=1 color="#123456"><b>Martes</td>
<td width="80" align="center"><font face=verdana size=1 color="#123456"><b>Miércoles</td>
<td width="80" align="center"><font face=verdana size=1 color="#123456"><b>Jueves</td>
<td width="80" align="center"><font face=verdana size=1 color="#123456"><b>Viernes</td>
<td width="80" align="center"><font face=verdana size=1 color="#123456"><b>Sábado</td>
<td width="80" align="center"><font face=verdana size=1 color="#123456"><b>Domingo</td>
</tr>
<?
for($i=1;$i<=5;$i++){
?>
<tr>
<?
for($j=1;$j<=7;$j++){
if($dia[$i][$j]==""){
$td_color = "#d8d8d8";
}else{
$td_color = "#ffffff";
}
?>
<td bgcolor="<?=$td_color?>">
<table cellpadding="0" cellspacing="0" width="100%" align="center">
<tr>
<td align="left">
<?
if($dia[$i][$j]!=""){
?>
<font face=verdana size=1><b>
<?=$dia[$i][$j];?>
</b></font>
<?
}
?>
</td>
<td align="right">
<!--zzz-->
</td>
</tr>
<tr>
<td colspan="2">
<?
if($dia[$i][$j]!=""){
?>
<br>
<?
}
?>
</td>
</tr>
</table>
</td>
<?
}
?>
</tr>
<?
}
?>
</table>
</body>
</html>
|