152 lines
5.4 KiB
PHP
152 lines
5.4 KiB
PHP
|
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||
|
Shows all events of one or multiple weeks in a nice overview,
|
||
|
ready to be copied to an office program
|
||
|
Copyright 2017 by George Ruinelli <george@ruinelli.ch>
|
||
|
Licence: GPL
|
||
|
Last Change: 13.10.2017
|
||
|
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||
|
|
||
|
<!-- <span style="<? echo($titleStyle); ?>" ><? echo("Programm vom $startDMY bis $endDMY"); ?> </span> -->
|
||
|
<span style="<? echo($titleStyle); ?>" ><? echo("Programm vom $formatedDateSpan"); ?> </span>
|
||
|
|
||
|
<table>
|
||
|
<?
|
||
|
|
||
|
// exit();
|
||
|
|
||
|
// $events = $ical->eventsFromInterval('2 week');
|
||
|
// $events = $ical->eventsFromRange("23.04.2017 00:00 T", "30.04.2017 23:59 T");
|
||
|
$events = $ical->eventsFromRange($startDateIcs, $endDateIcs);
|
||
|
|
||
|
|
||
|
$prev_dtstart = new \DateTime('@' . (int) $ical->iCalDateToUnixTimestamp(0));
|
||
|
$printdate = false;
|
||
|
foreach ($events as $event){
|
||
|
$dtstart = new \DateTime('@' . (int) $ical->iCalDateToUnixTimestamp($event->dtstart_tz));
|
||
|
|
||
|
$description = $event->description;
|
||
|
|
||
|
if($description != ""){
|
||
|
$description = str_replace("Kalender:Extern & Info", "", $description);
|
||
|
$description = str_replace("Kalender:Hauptveranstaltungen - ", "", $description);
|
||
|
$description = str_replace("Kalender:Hauptveranstaltungen", "", $description);
|
||
|
$description = str_replace("Kalender:Weitere Veranstaltung", "", $description);
|
||
|
|
||
|
$description = preg_replace('/^ - /', '', $description); //Remove " - " if at beginning of line
|
||
|
$description = preg_replace('/^- /', '', $description); //Remove " - " if at beginning of line
|
||
|
}
|
||
|
|
||
|
if(trim($description) == trim($event->summary)){
|
||
|
//Ignore description as it is identically to summary
|
||
|
$description = "";
|
||
|
}
|
||
|
|
||
|
if($dtstart->format('N') == 7){ //sunday => bold, gray
|
||
|
$isSunday = true;
|
||
|
}
|
||
|
else{
|
||
|
$isSunday = false;
|
||
|
}
|
||
|
|
||
|
if($dtstart->format('d.m') != $prev_dtstart->format('d.m')){ //new date => show weekday
|
||
|
$isNewDay = true;
|
||
|
}
|
||
|
else{
|
||
|
$isNewDay = false;
|
||
|
}
|
||
|
|
||
|
if($dtstart->format('H:i') == "00:00"){ //full day event
|
||
|
$isFullDayEvent = true;
|
||
|
}
|
||
|
else{
|
||
|
$isFullDayEvent = false;
|
||
|
}
|
||
|
|
||
|
?>
|
||
|
<tr <? if($isNewDay){ echo("class=\"spaceOver\" "); } if($isSunday){ echo("bgcolor=\"#C0C0C0\""); } ?> >
|
||
|
<?
|
||
|
// $a1 = trim($startDMY);
|
||
|
// $a2 = trim($dtstart->format('d.m.Y'));
|
||
|
// if(strcmp($a1, $a2) == 0){ // its the printing date, show a "heute" instead of the date
|
||
|
if($printdate == false){ // its the printing date, show a "heute" instead of the date
|
||
|
$printdate = true;
|
||
|
// echo("<td colspan=2 align=right><b>Heute<b></td>");
|
||
|
echo("<td colspan=2 align=center><span style=\"$textStyle\"><b>Heute<b></span></td>");
|
||
|
}
|
||
|
else{
|
||
|
?>
|
||
|
<td><span style="<? echo($textStyle); ?>" >
|
||
|
<?
|
||
|
if($isSunday){ //Sunday => bold
|
||
|
echo("<b>");
|
||
|
}
|
||
|
if($isNewDay){ //new date => show weekday
|
||
|
echo($weekdays[$dtstart->format('N') - 1]);
|
||
|
}
|
||
|
if($isSunday){ //Sunday => bold
|
||
|
echo("</b>");
|
||
|
}
|
||
|
if($description != ""){ //make sure the column has the same number of lines in Word as the next column
|
||
|
echo("<br> ");
|
||
|
}
|
||
|
?>
|
||
|
</span></td>
|
||
|
<td><span style="<? echo($textStyle); ?>" >
|
||
|
<?
|
||
|
if($isSunday){ //Sunday => bold
|
||
|
echo("<b>");
|
||
|
}
|
||
|
if($isNewDay){ //new date => show date
|
||
|
echo($dtstart->format('d.m.'));
|
||
|
}
|
||
|
if($isSunday){ //Sunday => bold
|
||
|
echo("</b>");
|
||
|
}
|
||
|
if($description != ""){ //make sure the column has the same number of lines in Word as the next column
|
||
|
echo("<br> ");
|
||
|
}
|
||
|
?>
|
||
|
</span></td>
|
||
|
<? } ?>
|
||
|
<td><span style="<? echo($textStyle); ?>" >
|
||
|
<?
|
||
|
if($isSunday){ //Sunday => bold
|
||
|
echo("<b>");
|
||
|
}
|
||
|
if(!$isFullDayEvent){ //not full day event => show time
|
||
|
echo($dtstart->format('H:i'));
|
||
|
}
|
||
|
if($isSunday){ //Sunday => bold
|
||
|
echo("</b>");
|
||
|
}
|
||
|
if($description != ""){ //make sure the column has the same number of lines in Word as the next column
|
||
|
echo("<br> ");
|
||
|
}
|
||
|
?>
|
||
|
</span></td>
|
||
|
<td><span style="<? echo($textStyle); ?>" >
|
||
|
<?
|
||
|
if($isSunday){ //Sunday => bold
|
||
|
echo("<b>");
|
||
|
}
|
||
|
echo($event->summary);
|
||
|
if($isSunday){ //Sunday => bold
|
||
|
echo("</b>");
|
||
|
}
|
||
|
if($description != ""){
|
||
|
echo("<br><i>");
|
||
|
echo($description);
|
||
|
echo("</i>");
|
||
|
}
|
||
|
?>
|
||
|
</span></td>
|
||
|
</tr>
|
||
|
<?
|
||
|
|
||
|
$prev_dtstart = $dtstart;
|
||
|
}
|
||
|
|
||
|
?>
|
||
|
|
||
|
</table>
|