Use core calendar in custom package
Permalink 1 user found helpful
Hi!
I currently play with the core calendar to check out for various ideas.
Create, edit or delete a calendar is done, but the event handling seems more harder.
Is there a documentation, or can anyone point me to a good example?
My script so far:
Thanks and have a nice weekend
Marcus
I currently play with the core calendar to check out for various ideas.
Create, edit or delete a calendar is done, but the event handling seems more harder.
Is there a documentation, or can anyone point me to a good example?
My script so far:
public function createCalendar(){ $this->app = \Concrete\Core\Support\Facade\Application::getFacadeApplication(); $site = $this->app->make('site')->getActiveSiteForEditing(); $calendar = new CalendarEntity(); $calendar->setSite($site); $calendar->setEventPageAssociatedID(0); $calendar->setEnableMoreDetails(null); $calendar->setEventPageParentID(0); $calendar->setEventPageTypeID(0); $calendar->setEventPageAttributeKeyHandle(null); $calendar->setName('mycalendar'); $calendar = Calendar::save($calendar); } public function deleteCalendar(){ $calendar = Calendar::getByID(47);
Viewing 15 lines of 33 lines. View entire code block.
Thanks and have a nice weekend
Marcus
Hi Myq
I'm searching for a way to create, edit and delete events programmatically.
It seems that the appropriate place for create events is this file "concrete\controllers\dialog\event\edit.php" on line 77. But if i copy this script in my package controller for testing, there ist no request object to use respectively most of the required object relations. I fail to integrate the corresponding objects. Or maybe it's the wrong place to search for.
Greets
Marcus
I'm searching for a way to create, edit and delete events programmatically.
It seems that the appropriate place for create events is this file "concrete\controllers\dialog\event\edit.php" on line 77. But if i copy this script in my package controller for testing, there ist no request object to use respectively most of the required object relations. I fail to integrate the corresponding objects. Or maybe it's the wrong place to search for.
Greets
Marcus
Someone tried to do a similar thing recently. Here's what they found:https://concrete5.slack.com/archives/C024FJS50/p1537490851000100...
Mark Boohaker [13:48]
Anyone have any luck creating calendar events progmatically in 7+?
korvinszanto [14:42]
@Mark Boohaker what are you trying?
Mark Boohaker [16:17]
`/concrete/elements/event/form.php` I think the methods are in there @korvinszanto Starting here first. didn't want to reinvent any wheel tho if there' s some sort of method like this
for calendar events
korvinszanto [16:19]
There's no service or factory for that from what I can tell. See \Concrete\Controller\Dialog\Event\Edit::addEvent for how those are built in the core
Mark Boohaker [17:47]
many thanks for the lead @korvinszanto poking around i found this little gem `concrete\controllers\single_page\dashboard\system\calendar\import.php` which looks to be an import script for migrating old calendar entries. This will be exactly what I need for this scope! Thanks again
Mark Boohaker [13:48]
Anyone have any luck creating calendar events progmatically in 7+?
korvinszanto [14:42]
@Mark Boohaker what are you trying?
Mark Boohaker [16:17]
`/concrete/elements/event/form.php` I think the methods are in there @korvinszanto Starting here first. didn't want to reinvent any wheel tho if there' s some sort of method like this
$user = \UserInfo::add(['uName' => 'andrew', 'uEmail' => 'andrew@concrete5.org', 'uPassword' => 'kittens']);
for calendar events
korvinszanto [16:19]
There's no service or factory for that from what I can tell. See \Concrete\Controller\Dialog\Event\Edit::addEvent for how those are built in the core
Mark Boohaker [17:47]
many thanks for the lead @korvinszanto poking around i found this little gem `concrete\controllers\single_page\dashboard\system\calendar\import.php` which looks to be an import script for migrating old calendar entries. This will be exactly what I need for this scope! Thanks again
In the meantime, there's some documentation of classes and methods here:https://fossies.org/dox/concrete5-8.4.2/namespaceConcrete_1_1Core_1_...