Incam_Intranet/agenda.php

119 lines
3.4 KiB
PHP
Raw Permalink Normal View History

<?php
include("seguridad.php");
include("functions.php");
include_once("html/cabecera.php");
include_once("Objects/Agenda.php");
$dia_hoy=date("d");
if($_GET['dia']!="") $dia_hoy=$_GET['dia'];
if($_POST['dia']!="") $dia_hoy=$_POST['dia'];
$mes_hoy=date("m");
if($_GET['mes']!="") $mes_hoy=$_GET['mes'];
if($_POST['mes']!="") $mes_hoy=$_POST['mes'];
$ano_hoy=date("Y");
if($_GET['anio']!="") $ano_hoy=$_GET['anio'];
if($_POST['anio']!="") $ano_hoy=$_POST['anio'];
// Recuperamos informaci<63>n para el mini calendario
$dia_cal=$dia_hoy;
if($_GET['diaCal']!="") $dia_cal=$_GET['diaCal'];
if($_POST['diaCal']!="") $dia_cal=$_POST['diaCal'];
$mes_cal=$mes_hoy;
if($_GET['mesCal']!="") $mes_cal=$_GET['mesCal'];
if($_POST['mesCal']!="") $mes_cal=$_POST['mesCal'];
$ano_cal=$ano_hoy;
if($_GET['anioCal']!="") $ano_cal=$_GET['anioCal'];
if($_POST['anioCal']!="") $ano_cal=$_POST['anioCal'];
$hoy=mktime(0,0,0,$mes_hoy,$dia_hoy,$ano_hoy);
$manana=mktime(0,0,0,$mes_hoy,$dia_hoy+1,$ano_hoy);
$ayer=mktime(0,0,0,$mes_hoy,$dia_hoy-1,$ano_hoy);
$agenda=new Agenda($usuario,$hoy,$locale);
?>
<h2><?php echo $locale['716']; ?></h2>
<?php
if($_POST['action']){
switch ($_POST['action']) {
case "actualizar":
try{
for($i=0;$i<=23;$i++){
$agenda->setAgenda($i,$_POST['h'.$i]);
}
$tipo="ok";
$msg=$locale['717'];
}catch (Exception $e){
$tipo="error";
$msg=$e->getMessage();
}
break;
default:
break;
}
}
if($msg!=""){
echo "<div class=\"aviso ".$tipo."\">".$msg."</div>";
}
?>
<div id="ContTabul">
<p class="encabezado" align="center">
<a href="agenda.php?dia=<?php echo date("j",$ayer);?>&mes=<?php echo date("m",$ayer);?>&anio=<?php echo date("Y",$ayer);?>">
<img src='css/flecha_menos.gif'>
</a>
<span class="encabezado"><?php echo nombre_dia(date("N",$hoy));?> <?php echo ver_fecha_larga(date("Y-n-d",$hoy));?></span>
<a href="agenda.php?dia=<?php echo date("j",$manana);?>&mes=<?php echo date("m",$manana);?>&anio=<?php echo date("Y",$manana);?>">
<img src='css/flecha_mas.gif'>
</a>
</p>
<div style="float:left;">
<form action="agenda.php" method="post">
<input type="hidden" name="action" value="actualizar" />
<input type="hidden" name="mes" value="<?php echo date("m",$hoy); ?>" />
<input type="hidden" name="anio" value="<?php echo date("Y",$hoy); ?>" />
<input type="hidden" name="dia" value="<?php echo date("j",$hoy); ?>" />
<input type="hidden" name="mesCal" value="<?php echo $mes_cal; ?>" />
<input type="hidden" name="anioCal" value="<?php echo $ano_cal; ?>" />
<table cellpadding="0" cellspacing="1" width="400" class="agenda">
<tr class="encabezado">
<th width="50">Hora</th>
<th>Observacion</th>
</tr>
<?php
for($hora=0;$hora<=23;$hora++){
?>
<tr>
<td class="agendaTitDia"><?php echo $hora;?>:00</td>
<td><textarea name="h<?php echo $hora;?>"><?php echo $agenda->getObservacion($hora); ?></textarea></td>
</tr>
<?php
}
?>
</table
<br />
<input type="submit" value="<?php echo $locale['ac']." ".$locale['702']; ?>" class="button" />
</div>
<div style="float:left;padding-left:20px">
<?php
include_once("Objects/Calendario.php");
$calendario=new Calendario($usuario,$mes_cal,$ano_cal,"","agenda.php",$locale);
echo $calendario->getMiniAgenda($hoy);
?>
</div>
<div style="clear:both;"></div>
</div>
<?php
include_once("html/pie.php");
?>