Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions GoogleCalendarHelper/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# GoogleCalendar Helper for CometVisu

This is a simple helper for displaying Google Calendar events in CometVisu.
This is a simple helper for displaying generic iCal and Google Calendar events in CometVisu.
It's composed of two parts:
- an iCal reader php class to parse an ics file
- a php script (that also holds the private calendar URL) fetching iCal calendar from Google, calling the parser class and nicely format the content CometVisu-friendly
- a php script (that also holds the private calendar URL) fetching iCal calendar, calling the parser class and nicely format the content CometVisu-friendly

## Requirements

Expand All @@ -13,9 +13,13 @@ The assumption is that you already have a working CometVisu, served by a web ser
Copy the php files into a web-browsable and php-executable directory on this web server. If you use any subdirectories you will have to specify it in the URL later.

## Configuration
Google Calendar:
1. Fetch your private Google Calendar URL: ![alt text](https://raw.githubusercontent.com/OpenAutomationProject/OpenAutomation/master/GoogleCalendarHelper/image_46687.jpg "copy link")
2. Adjust configuration in googlecalendar_ical_parser.php header (use link(s) fetched in step 1)

Generic iCal feed:
1. Just put the link to the ics file as first parameter. Second parameter stays empty, third (days in advance to display) and fourth (color formatting) can be used exactly like described for Google Calendar

## Usage

Use the following syntax in your CometVisu configuration xml:
Expand Down
11 changes: 7 additions & 4 deletions GoogleCalendarHelper/googlecalendar_ical_parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
ReadCalendar('xxxxxxxxxxxxxxxxxxxxxxxxxx@group.calendar.google.com', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 7, '1'); # Blau - xxxx ersetzen
ReadCalendar('yyyyyyyyyyyyyyyyyyyyyyyyyy@group.calendar.google.com', 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy', 7, '3'); # Rot - yyyy ersetzen
ReadCalendar('rr7mkkascn405ksj67ttoh524aioaijm@import.calendar.google.com', '', 7, '5'); # Feiertage Sachsen
// Beispiel fuer frei verfuergbaren iCal Kalender ausserhalb von Google:
// ReadCalendar('http://i.cal.to/ical/661/aktionstagegedenktage/umstellung-sommer-winterzeit/a0ea7dbe.88ed4c6b-5d78d8f4.ics', '', 14, '5'); # Zeitumstellung

//Hier die Farbe für die ShortCuts angeben
$SC_Farbe[1] = "#6E6E6E"; # grau
Expand Down Expand Up @@ -63,8 +65,9 @@ function DateCompare($a, $b) {
function ReadCalendar($userid, $magicCookie, $maxDays, $shortCut) {
global $calcData;

if ($magicCookie != '') {$feedURL = "https://www.google.com/calendar/ical/$userid/private-$magicCookie/basic.ics";}
else $feedURL = "https://www.google.com/calendar/ical/$userid/public/basic.ics";
if (substr($userid, 0, 4) === "http") $feedURL = $userid;
elseif ($magicCookie != '') {$feedURL = "https://www.google.com/calendar/ical/$userid/private-$magicCookie/basic.ics";}
else $feedURL = "https://www.google.com/calendar/ical/$userid/public/basic.ics";

$date = "";

Expand Down Expand Up @@ -166,11 +169,11 @@ function SetEintrag($thisData)
if($thisData['DatumTxt'] == date("d.m.Y"))

{
return "<span style='font-weight:normal;font-size:".$StyleText[5].";text-decoration:".$deco.";;color:".$SC_Farbe[$thisData['shortCut']]."'>".$thisData['Bezeichnung']."&nbsp;&nbsp;".$thisData['ZeitTxt']."</span>";
return "<span style='font-weight:normal;font-size:".$StyleText[5].";text-decoration:".$deco.";;color:".$SC_Farbe[$thisData['shortCut']]."'>".str_replace("\\", "", $thisData['Bezeichnung'])."&nbsp;&nbsp;".$thisData['ZeitTxt']."</span>";
}
else
{
return "<span style='font-weight:normal;font-size:".$StyleText[5].";color:".$SC_Farbe[$thisData['shortCut']]."'>".$thisData['Bezeichnung']."&nbsp;&nbsp;".$thisData['ZeitTxt']."</span>";
return "<span style='font-weight:normal;font-size:".$StyleText[5].";color:".$SC_Farbe[$thisData['shortCut']]."'>".str_replace("\\", "", $thisData['Bezeichnung'])."&nbsp;&nbsp;".$thisData['ZeitTxt']."</span>";
}

}
Expand Down