Initial commit
This commit is contained in:
92
outlook_ics.php
Normal file
92
outlook_ics.php
Normal file
@ -0,0 +1,92 @@
|
||||
<?php
|
||||
require("config/datenbankanbindung.php"); // fügt die Datenbankanbindung ein: Sys:\php\includes\kurs\datenbankanbindung.php
|
||||
require_once("func_rollenrechte.php");
|
||||
$user_admin=$_COOKIE["user_admin"];
|
||||
$typ = $_GET["typ"];
|
||||
|
||||
#################
|
||||
## TYP=2 Monatsexport
|
||||
#################
|
||||
|
||||
if ($typ == 2){
|
||||
if($mon < 10){
|
||||
$mon = "0".$mon; # 0 voranstellen
|
||||
}
|
||||
$datum = "$jahr-$mon";
|
||||
|
||||
$Filename = "LG-Online_Monat-$mon.vcs";
|
||||
|
||||
|
||||
class ICS {
|
||||
var $data;
|
||||
var $name;
|
||||
function ICS($start,$end,$name,$description,$location) {
|
||||
$this->name = $name;
|
||||
$this->data = "BEGIN:VCALENDAR\nVERSION:2.0\nMETHOD:PUBLISH\nBEGIN:VEVENT\nDTSTART:".date("Ymd\THis\Z",strtotime($start))."\nDTEND:".date("Ymd\THis\Z",strtotime($end))."\nLOCATION:".$location."\nTRANSP: OPAQUE\nSEQUENCE:0\nUID:\nDTSTAMP:".date("Ymd\THis\Z")."\nSUMMARY:".$name."\nDESCRIPTION:".$description."\nPRIORITY:1\nCLASS:PUBLIC\nBEGIN:VALARM\nTRIGGER:-PT10080M\nACTION:DISPLAY\nDESCRIPTION:Reminder\nEND:VALARM\nEND:VEVENT\nEND:VCALENDAR\n";
|
||||
}
|
||||
function save() {
|
||||
file_put_contents($this->name.".ics",$this->data);
|
||||
}
|
||||
function show() {
|
||||
header("Content-type:text/calendar");
|
||||
header('Content-Disposition: attachment; filename="'.$this->name.'.ics"');
|
||||
Header('Content-Length: '.strlen($this->data));
|
||||
Header('Connection: close');
|
||||
echo $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$db = dbconnect();
|
||||
$query2 = "SELECT lid, textstelle, ueberschrift, textwort, botschaft, inhalt, zusammenfassung, kontext, datum, DATE_Format(datum, '%d') tag, DATE_Format(datum, '%m') monat, DATE_Format(datum, '%Y') jahr, DATE_Format(datum, '%Y-%m-%d')AS datum_berechnung
|
||||
FROM quelle
|
||||
WHERE datum LIKE'$datum%'
|
||||
AND kid=1
|
||||
AND ( ukid=1 OR ukid=2 OR ukid=6 OR ukid=13 OR ukid=14 OR ukid=15 OR ukid=16 OR ukid=17 OR ukid=22 OR ukid=25 OR ukid=26 OR ukid=30 )
|
||||
ORDER BY datum ASC
|
||||
";
|
||||
$result = $db->query( $query2)
|
||||
or die ("Cannot execute query2");
|
||||
|
||||
$event = new ICS();
|
||||
|
||||
while ($row = $result->fetch_array()){
|
||||
|
||||
$wochentag = date("l", mktime(0,0,0,$row['monat'],$row['tag'],$row['jahr']));
|
||||
switch($wochentag)
|
||||
{
|
||||
case 'Sunday':
|
||||
$vCalStart = "$row[datum_berechnung] 09:30";
|
||||
$vCalEnd ="$row[datum_berechnung] 10:30";
|
||||
break;
|
||||
case 'Wednesday':
|
||||
$vCalStart = "$row[datum_berechnung] 20:00";
|
||||
$vCalEnd ="$row[datum_berechnung] 21:00";
|
||||
break;
|
||||
case 'Thursday':
|
||||
$vCalStart = "$row[datum_berechnung] 20:00";
|
||||
$vCalEnd ="$row[datum_berechnung] 21:00";
|
||||
break;
|
||||
}
|
||||
|
||||
$result_gd = $db->query("SELECT wgd FROM profil WHERE user = '$user_admin'");
|
||||
$row_gd = $result_gd->fetch_array();
|
||||
|
||||
$ueberschrift = strip_tags($row['ueberschrift'],'<br>');
|
||||
$ueberschrift = str_replace (array("<br>")
|
||||
, array("\n")
|
||||
, $ueberschrift
|
||||
);
|
||||
|
||||
$text = strip_tags($row['inhalt'],'<br>');
|
||||
$text = str_replace (array("<br>")
|
||||
, array("\n")
|
||||
, $text
|
||||
);
|
||||
#$event = -> ICS("$vCalStart","$vCalEnd","$ueberschrift","$text","");
|
||||
$event -> ICS("2009-11-06 09:00","2009-11-06 21:00","Test Event","This is an event made by Jamie Bicknell","GU1 1AA");
|
||||
}
|
||||
$event->show();
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user