Ratings | | Unique User Downloads | | Download Rankings |
Not enough user ratings | | Total: 195 | | All time: 8,533 This week: 78 |
|
Description | | Author |
This package can be used to create 'Add to my google calendar' link for a page.
It can take several parameters to configure the details of a given event, so it can generate HTML for a link on a page that when the user clicks on it will be added to his Google Calendar.
Currently it takes parameters to define event details like:
- Event name
- Event start date and time zone
- Event duration
- Event location
- Event description
- Event guest email addresses Innovation Award
December 2020
Winner
Prize: One official elePHPant Plush Mascott |
Google Calendar is a popular task scheduling application used by many people.
This package provides a simple way to add a scheduled task to Google Calendar by generating a link with all the parameters of the task.
So when the user clicks on that link, the browser goes to a page of Google Calendar to add the task to his calendar.
This way it becomes simple for a site to add tasks to other people calendars on Google Calendar.
Manuel Lemos |
| |
|
|
Innovation award
Nominee: 11x
Winner: 6x |
|
Example
<?php
require_once 'autoloader.php';
use SKien\GCalendar\GCalAddEventLink;
$oLink = new GCalAddEventLink();
$oLink->setSubject('Zoom meeting at christmas day');
$oLink->setStart('2020-12-24 13:00');
$oLink->setDuration('PT1H'); // 1 hour
$oLink->setTimezone('America/New_York');
$oLink->setDetails(
'We just want to meet us via zoom cause we are not allowed to ' . PHP_EOL .
'meet us at the christmas market :-(' . PHP_EOL . PHP_EOL .
'And this is just a check whether the usual problems caused by' . PHP_EOL .
'German umlauts are correctly intercepted: ä, ö, ü, Ä, Ö, Ü, ß ...'
);
$oLink->setLocation('Homeoffice');
$oLink->addGuest('guest1@example.com');
$oLink->addGuest('guest2@example.com');
echo '<h1>Example to add event to google calendar</h1>' . PHP_EOL;
echo '<a target="_blank" href="' . $oLink->getHREF() . '">Add to google calendar</a>' . PHP_EOL;
|
Details
Create 'Add to my google calendar' Link to your Homepage
Overview
This class can generate the HREF value to provide a Add to my google calendar
link to your
page.
Following Data for the event to create is supported:
- Subject
- `setSubject()`
-
Start Date/Time
- `setStart()`
-
End Date/Time or Duration(if not set, default duration of 30 min is used)
- `setEnd()` or `setDuration()`
-
Timezone (if not set, system settings used)
- `setTimezone()`
-
All day Event
- `setTimezone()`
-
Detailed Description (optional)
- `setDetails()`
-
Location
- `setLocation()`
-
Additional Guest(s)
- `addGuest()`
Usage
-
Create an instance of the GCalAddEventLink class
-
Set the required information for the event to be generated
-
Pass the generated HREF to an <a> element on your page
See AddEventExample.php
Logging
This package can use any PSR-3 compliant logger. The logger is initialized with a NullLogger-object
by default. The logger of your choice have to be passed to the constructor of the GCalAddEventLink class.
If you are not working with a PSR-3 compatible logger so far, this is a good opportunity
to deal with this recommendation and may work with it in the future.
There are several more or less extensive PSR-3 packages available on the Internet.
You can also take a look at the
'XLogger'
package and the associated blog
'PSR-3 logging in a PHP application'
as an introduction to this topic.
History
2020-12-15 Version 1.00
* initial Version
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.