Sync multiple iCalendars (Airbnb, Flipkey, Google Calendar, etc)
I'm developing a website for apartments rental. I'm using a wordpress hotel theme that I tweaked so instead of "rooms" it uses "flats" and a booking plug-in. Each of this flats are also advertised in Airbnb and FlipKey.
What I need is to able to sync all the calendars so if, for instance, someone books the flat in Airbnb, that flat is automatically marked as "non available" in both the website and Flipkey. This is done using feeds .ics that are provided by both companies. There is an output feed and an input feed for both, so if I paste the output in the input of the other and vice versa, the thing works perfectly.
Now, what I need is a way of centralizing both calendar in one system and using that system to feed the inputs of Airbnb, Flipkey and my own booking plugin of wordpress. I've tried that with:
PHP iCalendar (it can, as google calendar, get the feeds, but it doesn't -as far as I know- provide an unified output). Services as http://www.accommodationcalendar.com only get the input, but no output either.
Maybe http://www.davical.org/ could be a good option, but as I'm using a shared hosting, I can't install it (as far as I know) -the reason being that the shared hosting only has MySql and not PostgreSQL.
Does anyone have an idea of how solve this?
THANK YOU!
After some research, I found this solution:
1) Use this library: http://kigkonsult.se/iCalcreator/
2) Get the ICS feeds and merge them and then create a new ICS (create both "import" and "export" folders and give them writing permissions).
require_once('../classes/iCalcreator/iCalcreator.class.php');
$config2 = array("unique_id" => "kigkonsult2.se",
"directory" => "import",
);
$vcalendar2 = new vcalendar($config2);
$vcalendar2->setConfig("url" , "https://someweb/cal.ics");
$vcalendar2->parse();
$vcalendar2->setConfig("url" , "https://anotherurl/cal2.ics");
$vcalendar2->parse();
$vcalendar2->setConfig("directory", "export");
$vcalendar2->setConfig("filename", "icalmerge3.ics");
$vcalendar2->saveCalendar();
echo "done";
3) Create a CRON scheduler to run this file recurrently. Point both Airbnb and Flipkey to the url where the feed is created. You can use as many input ICS files as you want.
iCalcreator
iCalcreator is the PHP class package managing rfc5545 iCal files, supporting (non-)calendar systems and applications to process and communicate calendarinformation like events, agendas, tasks, reports, totos and journaling information.
iCalcreator features create, parse, edit and select calendar and calendarcomponents.
Knowledge of calendar and rfc5545/rfc2445 is necessary! All functions calls are made as simple as possible BUT (, !!!,) read these rfc properly as well as the iCalcreator package user guide!
Click to get iCalcreator 2.26.8
from github - at packagist |
At github, you will also found the 2.28 release candidate (tag 2.27.16).
Howto summary
A short (v2.26.8) summary how to use iCalcreator: create, parse, edit, select and output, click on the to expand/minimize each section.
CREATE
namespace Kigkonsult\Icalcreator; use Kigkonsult\Icalcreator\Util\Util; use kigkonsult\iCalcreator\TimezoneHandler; // define time zone $tz = "Europe/Stockholm"; // set Your unique id, // required if any component UID is missing $config = [ Util::$UNIQUE_ID => "kigkonsult.se", // opt. set "calendar" timezone Util::$TZID => $tz ]; // create a new calendar object instance $calendar = new Vcalendar( $config ); // required of some calendar software $calendar->setProperty( Util::$METHOD, "PUBLISH" ); $calendar->setProperty( "x-wr-calname", "Calendar Sample" ); $calendar->setProperty( "X-WR-CALDESC", "Calendar Description" ); $calendar->setProperty( "X-WR-TIMEZONE", $tz ); // create an calendar event component $vevent = $calendar->newVevent(); // set event start $vevent->setProperty( Util::$DTSTART, new DateTime( '2017-04-01 19:00:00') ); // set event end $vevent->setProperty( Util::$DTEND, new DateTime( '2017-04-01 22:30:00') ); $vevent->setProperty( Util::$LOCATION, "Central Placa" ); $vevent->setProperty( Util::$SUMMARY, "PHP summit" ); $vevent->setProperty( Util::$DESCRIPTION, "This is a description" ); $vevent->setProperty( Util::$COMMENT, "This is a comment" ); $vevent->setProperty( Util::$ATTENDEE, "attendee1@icaldomain.net" ); // create an event alarm $valarm = $vevent->newValarm(); $valarm->setProperty( Util::$ACTION, "DISPLAY" ); // reuse the event description $valarm->setProperty( Util::$DESCRIPTION, $vevent->getProperty( Util::$DESCRIPTION ) ); // create alarm trigger (in UTC datetime) $valarm->setProperty( Util::$TRIGGER, new DateTime( '2017-04-01 08:00:00 UTC') ); // create another calendar event component $vevent = $calendar->newVevent(); // alt. date format, here for an all-day event $vevent->setProperty( Util::$DTSTART, "20170401", [ "VALUE" => "DATE" ] ); $vevent->setProperty( Util::$ORGANIZER, "boss@icaldomain.com" ); $vevent->setProperty( Util::$SUMMARY, "ALL-DAY event" ); $vevent->setProperty( Util::$DESCRIPTION, "An all-day event" ); $vevent->setProperty( Util::$RESOURCES, "Full attension" ); // weekly, four occasions $vevent->setProperty( Util::$RRULE, [ "FREQ" => "WEEKLY", "count" => 4 ] ); // supporting parse of strict rfc5545 formatted text $vevent->parse( "LOCATION:1CP Conference Room 4350" ); // all calendar components are described in rfc5545 // a complete iCalcreator function list (ex. setProperty) in // iCalcreator manual // create timezone component(-s) // based on all start dates in events (i.e. all dtstarts) // X-LIC-LOCATION required of some calendar software $xprops = [ "X-LIC-LOCATION" => $tz ]; TimezoneHandler::createTimezone( $v, $tz, $xprops );
PARSE
EDIT
SELECT
OUTPUT
iCalcreator used in.. .
AgenDAV | AgenDAV is an open source CalDAV web client |
albaven | un Sistema Informático Abierto de Gestión Unificada para Unidades Educacionales |
All-in-One Event Calendar | Calendar Software for Everybody, a WordPress plugin |
Bugscope | free interactive access to a scanning electron microscope (SEM) |
Date iCal | a Drupal plugin |
Dokeos | an elearning and course management web application |
event_connect | an iCal import/export tool in lorea |
ESS Feed | ESS: A XML Standard - ESS is The Events Feed |
Exponent CMS | a website content management system |
EQDKP Plus | The Gamer CMS & DKP system |
GCalendar | connects google calendars with your Joomla powered web site |
GLPI | an Information Resource-Manager |
Gumbo Millennium | Studentenvereniging Gumbo Millennium |
Hypecal | There is always something going on |
iCal | a Drupal suite of iCal integration modules |
iCalendar-to-Facebook-Event | create facebook events from an iCalendar (iCal/ics) file |
JCal Pro | an events calendar for Joomla |
kitEvent | Event manager and calendar for WebsiteBaker and LEPTON CMS |
MarkupiCalendar | a Processwire module |
One Big SYSTem | a Feng Office calendar module |
Open Atrium | a collaboration platform |
Repository based CMS | A CMS system based on the structure of the dokeos LCMS (2.0) code |
sfiCalCreatorPlugin | a Symfony plugin |
Telaen | a webmail interface |
terncal | the WordPress Event System |
twical | takes a web calendar or ics file and tweets it "from you" |
Virtual Loup-De-Mer | a web-based real-time Sailboat-routing simulation |
"Weather Forecast" | a UK ‘Weather Forecast’ PHP Calendar Service |
And many, many more.. ..look especially at Ohloh Code. |
Please use the contact page if you would like to
- report your site / application / module / plugin as a new entry in the list
- report a dead link
- tell us what iCalcreator is missing!!
Create/edit/show iCal files
You can test iCalcreator online and create iCal test files on-the-fly, using tiCalFile, example of how to employ iCalcreator in software development.
An example how to present and display iCal calendar file information, tinycal, using iCalcreator class in the server back end software.
Комментариев нет:
Отправить комментарий