Created
May 6, 2015 13:41
-
-
Save xombra/1570ed6e9dc65ba7c219 to your computer and use it in GitHub Desktop.
Creacion de iCalendar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* ------------------------------------------------------- | |
Script bajo los términos y Licencia | |
GNU GENERAL PUBLIC LICENSE | |
Ver Terminos en: | |
http://www.gnu.org/copyleft/gpl.html | |
Autor:Hector A. Mantellini (Xombra) | |
Creacion de iCalendar | |
Basado en las especificaciones: | |
https://tools.ietf.org/html/rfc5545 | |
Más info de iCalendar: | |
https://en.wikipedia.org/wiki/ICalendar | |
--------------------------------------------------------*/ | |
# Preparacion de encabezados | |
$tiempo= $_SERVER['REQUEST_TIME']; | |
$ExpStr='Expires:'.gmdate("D,d M Y H:i:s",$tiempo)." GMT"; | |
header("Etag:$etag"); | |
header('Content-type: text/calendar; charset=utf-8'); | |
header("Content-Transfer-Encoding:gzip;q=1.0,identity;q=0.5,*;q=0"); | |
header('Content-Disposition: inline; filename=invitacion.ics'); | |
# variables | |
# $email_usuario -> eMail del usuario invitado | |
# nombre_sitio -> Nombre del sitio o persona organizador | |
# $correo_sitio -> eMail de contacto del sitio o persona organizador | |
# $titulo_evento -> Titulo del evento | |
# $intro_evento -> Breve Introduccion sobre el evento | |
# $descripcion_evento -> Breve Descripcion acerca del evento | |
# $enlace_evento -> Enlace hacia el evento o registro evento | |
# $fecha_evento -> Fecha del Evento | |
# $fecha_evento_inicio -> Fecha con hora incluida exacta inicia en formato unix | |
# $fecha_evento_fin -> Fecha con hora incluida exacta culmina en formato unix | |
# Creando los valores que conforman el iCalendar | |
$iCal = "BEGIN:VCALENDAR \r\n | |
VERSION:2.0 \r\n | |
CALSCALE:GREGORIAN \r\n | |
PRODID:-//hacksw/handcal//NONSGML v1.0//EN \r\n | |
METHOD:PUBLISH \r\n | |
BEGIN:VEVENT \r\n | |
CATEGORIES:Project Report, Weekly, Meeting, Personal, Bussines \r\n | |
STATUS:Confirmed \r\n | |
CLASS:PRIVATE \r\n | |
TRANSP:Opaque \r\n | |
SEQUENCE:0 \r\n | |
ATTENDEE;CN=$email_usuario;ROLE=REQ-PARTICIPANT;CUTYPE=INDIVIDUAL;PAR | |
TSTAT=ACCEPTED:mailto:$email_usuario \r\n | |
ORGANIZER;CN=$nombre_sitio:mailto:$correo_sitio \r\n | |
DESCRIPTION:$titulo_evento \r\n $intro_evento\r\n $descripcion_evento \r\n | |
SUMMARY:$titulo_evento \r\n $intro_evento \r\n | |
UID:".md5(uniqid(mt_rand(), true))." \r\n | |
URL:$enlace_evento \r\n | |
DTSTAMP:".gmdate("Ymd",$fecha_evento)."T".gmdate("His",$fecha_evento_inicio) ."Z \r\n | |
DTSTART:".gmdate("Ymd",$fecha_evento)."T".gmdate("His",$fecha_evento_inicio) ."Z \r\n | |
DTEND:"gmdate("Ymd",$fecha_evento)."T".gmdate("His",$fecha_evento_fin) ."Z \r\n | |
END:VEVENT \r\n | |
END:VCALENDAR"; | |
echo $iCal; | |
exit; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment