tieneRol("6")){
header("Location: aplicacion.php?e=permiso");
echo "no puedes";
exit;
}
include_once("html/cabecera.php");
?>
"","action"=>"");
$solicitud=$_POST;
$solicitud=array_diff_key($solicitud,$quitar);
switch ($_POST['action']) {
case "pedir":
$ultimo_dia = verifica_long_mes($mes_hoy,$ano_hoy);
// Recorremos todos los valores de los d�as
$dias=array();
foreach($solicitud as $key => $valor){
if($valor=="on"){
$dia=substr($key,1,strpos($key,"-")-1);
$mes=substr($key,strpos($key,"-")+1,strlen($key));
// Compruebo que sea solicitable
$vacaciones=new Vacaciones($usuario,$usuario->getValor("oid"),$mes,$ano_hoy,$locale);
$dias[$mes][]=$dia;
}
}
try{
$tipo="ok";
$msg="";
foreach($dias as $mensual => $diasSolicitar){
$vacaciones=new Vacaciones($usuario,$usuario->getValor("oid"),$mensual,$ano_hoy,$locale);
$vacaciones->solicitar($diasSolicitar);
foreach($diasSolicitar as $diaShow){
$msg.=$diaShow." de ".nombre_mes($mensual)."
";
}
}
$msg=$locale['290']."
".$msg;
} catch (Exception $e){
$tipo="error";
$msg=$e->getMessage();
}
break;
case "anular":
$ultimo_dia = verifica_long_mes($mes_hoy,$ano_hoy);
// Recorremos todos los valores de los d�as
$dias=array();
foreach($solicitud as $key => $valor){
if($valor=="on"){
$dia=substr($key,1,strpos($key,"-")-1);
$mes=substr($key,strpos($key,"-")+1,strlen($key));
// Compruebo que sea solicitable
$vacaciones=new Vacaciones($usuario,$usuario->getValor("oid"),$mes,$ano_hoy,$locale);
$dias[$mes][]=$dia;
}
}
try{
$tipo="ok";
$msg="";
foreach($dias as $mensual => $diasSolicitar){
$vacaciones=new Vacaciones($usuario,$usuario->getValor("oid"),$mensual,$ano_hoy,$locale);
$vacaciones->solicitarAnulacion($diasSolicitar);
foreach($diasSolicitar as $diaShow){
$msg.=$diaShow." de ".nombre_mes($mensual)."
";
}
}
$msg=$locale['464']."
".$msg;
} catch (Exception $e){
$tipo="error";
$msg=$e->getMessage();
}
break;
break;
default:
break;
}
}
if($msg!=""){
echo "".$msg."
";
}
?>
";
}
}
?>