Skip to content

Commit

Permalink
bugfix2
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanfriedrich committed Sep 18, 2016
1 parent d0d7c7f commit 0e1ea74
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 22 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ Go to Settings > Plugins from your Craft control panel and enable the Date2Calen

## Usage

Simple usage if your entryfields for the event are named like this:
entry.start
entry.end
entry.title
entry.description
entry.location
Simple usage if your entryfields for the event are named like this:
entry.start
entry.end
entry.title
entry.description
entry.location

If so, use this:
```jinja
Expand All @@ -38,8 +38,8 @@ In return you'll get an url that creates an entry in Google Calendar when called

## Options

{{ entry | date2calendar }} => returns the link for google calendar
{{ entry | date2calendar('GC') }} => returns the link for google calendar
{{ entry | date2calendar('ICS') }} => downloads an ics-file for outlook, ical, whatever..
{{ entry | date2calendar('GC', +2) }} => returns the link for google calendar with the date plus 2 hours
{{ entry | date2calendar('ICS', -2) }} => returns the link for google calendar with the date minus 2 hours
{{ entry | date2calendar }} => returns the link for google calendar
{{ entry | date2calendar('GC') }} => returns the link for google calendar
{{ entry | date2calendar('ICS') }} => downloads an ics-file for outlook, ical, whatever..
{{ entry | date2calendar('GC', +2) }} => returns the link for google calendar with the date plus 2 hours
{{ entry | date2calendar('ICS', -2) }} => returns the link for google calendar with the date minus 2 hours
24 changes: 13 additions & 11 deletions date2calendar/twigextensions/Date2calendarTwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,23 @@ public function date2calendar( $arrEvent, $calType = 'GC', $extratime = 0 ) {
foreach ($entries as $entry)
{

$arrEvent["start"] = $entry->start->getTimestamp() ;
$arrEvent["end"] = $entry->end->getTimestamp();
$arrEvent["title"] = $entry->title;
$arrEvent["description"] = $entry->description;
$arrEvent["location"] = $entry->location;
$strStart = $entry->start->getTimestamp() + $extratime;
$strEnd = $entry->end->getTimestamp() + $extratime;
$eventTitle = $this->escapeString($entry->title);
$eventDescription = $this->escapeString($entry->description);
$eventLocation = $this->escapeString($entry->location);

}

}
} else {

$strStart = $arrEvent["start"] + $extratime;
$strEnd = $arrEvent["end"] + $extratime;
$eventTitle = $this->escapeString($arrEvent["title"]);
$eventDescription = $this->escapeString($arrEvent["description"]);
$eventLocation = $this->escapeString($arrEvent["location"]);

$strStart = $arrEvent["start"] + $extratime;
$strEnd = $arrEvent["end"] + $extratime;
$eventTitle = $this->escapeString($arrEvent["title"]);
$eventDescription = $this->escapeString($arrEvent["description"]);
$eventLocation = $this->escapeString($arrEvent["location"]);
}


// link to download ics-file
Expand Down

0 comments on commit 0e1ea74

Please sign in to comment.