我目前正在玩核心日历,以查看各种想法。 创建,编辑或删除日历已完成,但事件处理似乎更加困难。我正在寻找一种以编程方式创建,编辑和删除事件的方法。 是否有文档,或者有人可以给我指出一个很好的例子吗?
到目前为止,我的脚本是
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);
if($calendar instanceof \Concrete\Core\Entity\Calendar\Calendar){
Calendar::delete($calendar);
}
}
public function editCalendar(){
$this->app = \Concrete\Core\Support\Facade\Application::getFacadeApplication();
$site = $this->app->make('site')->getActiveSiteForEditing();
$cID = 47;
$calendar = Calendar::getByID($cID);
$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);
}
谢谢,祝你有美好的一天
马库斯