add new feature to donwload a calendar

This commit is contained in:
2022-03-04 17:06:49 +01:00
parent 6c08d2462a
commit 508439e8cf
8 changed files with 45 additions and 28 deletions

View File

@@ -176,6 +176,7 @@ class EmbeddedCalendar extends ComponentBase {
$data += ['wkst' => 2];
}
// Calenders from config
$calendarList = $this->getCalendarsFromProperties();
$dataParams = http_build_query($data);
@@ -220,9 +221,9 @@ class EmbeddedCalendar extends ComponentBase {
$exp_key = explode($this->calPropSeparator, $key);
if($exp_key[0] == 'cal' && $this->property($key) == true){
$calendar = [];
$calendar['src'] = $exp_key[2];
$calendar['color'] = $exp_key[1];
$calendars[] = $calendar;
$calendar['src'] = $exp_key[2];
array_push($calendars, $calendar);
}
}
@@ -230,7 +231,6 @@ class EmbeddedCalendar extends ComponentBase {
}
private function calendarProperties() {
// ToDo: Add cache => https://octobercms.com/docs/services/cache
$service = new GoogleCalendarService();
$calendars = $service->calendarList();

View File

@@ -41,7 +41,7 @@ class Upcoming extends ComponentBase {
];
}
public function events() {
public function getEvents() {
$connector = new GoogleCalendarService();
$maxEvents = $this->property('maxEvents');
$calendarEvents = $connector->allEventList($maxEvents);

View File

@@ -1,4 +1,4 @@
{% set events = upcoming.events %}
{% set events = __SELF__.events %}
{% if not events.error and events is not empty %}
<table>