8.4.2: using concrete5 calendar programmatically
Permalink
Does anyone know and have examples how to use the concrete5 calendar programmatically?
What exactly are you trying to do?
I want to make and show a calendar with scheduled tasks which I can add/edit/update/delete programmatically. For example, a hotel room booking calendar.
We have done this a little bit, I'm not sure if this code will be helpful to you, but this is how we create an event
I can't really assist in the other parts, unfortunately this is not documented well at all, I just read through the core code and figured it out
use Concrete\Core\Calendar\Calendar; use Concrete\Core\Calendar\Event\EventRepetition; use Concrete\Core\Calendar\Event\EditResponse; use Concrete\Core\Calendar\Event\EventOccurrenceList; use Concrete\Core\Calendar\Event\EventService; use Concrete\Core\Entity\Calendar\CalendarEvent; use Concrete\Core\Entity\Calendar\CalendarEventVersionRepetition; use Concrete\Core\Entity\Calendar\CalendarEventRepetition; use Concrete\Core\User\User; use Concrete\Core\Workflow\Request\ApproveCalendarEventRequest; $app = \Concrete\Core\Support\Facade\Application::getFacadeApplication(); $calendar = Calendar::getByName($calendarName); $eventService = $app->make(EventService::class); $u = User::getByUserID(1); $timezone = $calendar->getSite()->getConfigRepository()->get('timezone');
Viewing 15 lines of 39 lines. View entire code block.
I can't really assist in the other parts, unfortunately this is not documented well at all, I just read through the core code and figured it out
Did you ever find any documentation on this? I'm also looking to interact with calendars programmatically. Ideally I'd be able to associate a calendar with an Express entity ...
Well, if it's not documented, it's just too hard... you have to dig into the core code and figure it all out yourself.
No, I haven't looked into this any further. I guess I'll have to some time in the future.
No, I haven't looked into this any further. I guess I'll have to some time in the future.
Ha ha. ya that's what I'm doing. Still easier than building it all from scratch!