neuwies-kalender-generator-.../month.php

154 lines
5.6 KiB
PHP
Raw Permalink Normal View History

2024-03-17 17:18:17 +00:00
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Shows all events of a month 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
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<img src="logo_small.png" >
<!-- <span style="font-family: Arial; font-size: 24pt;">K<font color=red>I</font>RCHE NEUWIES</span> -->
<span style="<? echo($titleStyleLarger); ?>" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Programm <? echo("$month $year"); ?> </span> <br>
<span style="<? echo($textStyleLarger); ?>" ><u style="padding:20px">www.kirche-neuwies.ch</u></span>
<br><br>
<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 &amp; 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=\"$textStyleLarger\"><b>Heute<b></span></td>");
// }
// else{
?>
<td><span style="<? echo($textStyleLarger); ?>" >
<?
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 numbe rof lines in Word as the next column
echo("<br>&nbsp;");
}
?>
</span></td>
<td><span style="<? echo($textStyleLarger); ?>" >
<?
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 numbe rof lines in Word as the next column
echo("<br>&nbsp;");
}
?>
</span></td>
<? //} ?>
<td><span style="<? echo($textStyleLarger); ?>" >
<?
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 numbe rof lines in Word as the next column
echo("<br>&nbsp;");
}
?>
</span></td>
<td><span style="<? echo($textStyleLarger); ?>" >
<?
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>