From 19cdd5e2fde57d53f05570cd50f5ffd223182566 Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Sat, 30 Jun 2018 11:26:37 +0200 Subject: Renommage pour diff entre appli_3_alpha_old et beta_old1 --- beta_old1/app/include/ical.inc.php | 68 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 beta_old1/app/include/ical.inc.php (limited to 'beta_old1/app/include/ical.inc.php') diff --git a/beta_old1/app/include/ical.inc.php b/beta_old1/app/include/ical.inc.php new file mode 100644 index 0000000..e79570b --- /dev/null +++ b/beta_old1/app/include/ical.inc.php @@ -0,0 +1,68 @@ + NOW() '; + if ( ! $result = @mysql_query($query) ) + { + // Cas d'erreur + $errmsg =mysql_generate_errmsg(); + return ERR_ICAL_SQL_ERROR; + } + else + { + if (mysql_num_rows($result)<1) + { + return ERR_ICAL_NO_DATA; + } + else + { + $time = time(); + $iCal_name = "iCal_${idP}_${time}.ics"; + $iCal_content = "BEGIN:VCALENDAR\r\n" . "VERSION:2.0\r\n"; + while ( list($idR, $objetR, $courrielP, $dateDeb, $duree, $lieuR, $ordreJourR, $idL) = mysql_fetch_array($result) ) + { + // TODO : Il est probablement judicieux d'ajouter à l'UID un timestamp unix !!!!! + $iCal_content .= "BEGIN:VEVENT\r\n" . "UID:awor_${idP}.${idR}\r\n" . "SUMMARY:$objetR ($courrielP)\r\n"; + $iCal_content .= 'DTSTART:' . date('Ymd\THis', $dateDeb) . "\r\n"; + $iCal_content .= 'DTEND:' . date('Ymd\THis', $dateDeb+60*$duree) . "\r\n"; + $iCal_content .= "LOCATION:$lieuR\r\n"; + $iCal_content .= "DESCRIPTION:$ordreJourR\r\n"; + + $query = 'SELECT P.courrielP FROM Appartenir A,Personne P' . " WHERE A.idP=P.idP AND A.idL='$idL'"; + if ( ! $result = mysql_query($query) ) + { + // Cas d'erreur + $errmsg =mysql_generate_errmsg(); + $ret=ERR_ICAL_SQL_ERROR; + break; + } + else + { + while ( list($mail_autres) = mysql_fetch_array($result) ) + { + $iCal_content .= "ATTENDEE:mailto:$mail_autres\r\n"; + } + } + // TODO : vérifier la pertinance de la variable utilisée + $iCal_content .= 'URL:http://' . $_SERVER['HTTP_HOST'] . "\r\n"; + $iCal_content .= "END:VEVENT\r\n"; + } + $iCal_content .= "END:VCALENDAR\r\n"; + return 0; + } + } +} +?> \ No newline at end of file -- cgit v1.2.3