mzur / kirby-calendar-plugin Goto Github PK
View Code? Open in Web Editor NEWA plugin for the Kirby CMS to easily implement an event calendar.
License: MIT License
A plugin for the Kirby CMS to easily implement an event calendar.
License: MIT License
Hi there,
beginDate [beginTime] [-> endDate [endTime]]:
can you give me an example of a blueprint, which creates this entry? (And I don't mean text, without validation ;) )
Thx, Jan
Would it be possible to provide an example template for the Kirby langkit (as your plugin uses multilanguage features) which works out of the box with your snippets? I'm a noob and don't get what the calendar.php template file must exactly look like. I followed your installation instructions, but i get the error Undefined variable: calendar
when inserting <?php snippet('calendar-table'); ?>
in /templates/calender.php.
My langkit content folder:
1-projects
2-blog
3-about
4-contact
5-calendar
These two documents are in 5-calendar:
calendar.de.txt
calendar.en.txt
When i use this code in calendar.php i get the error Call to undefined function calendar()
:
<?php snippet('header');?>
<?php $calendar = calendar($page->calendar()->yaml());?>
<?php snippet('calendar-table');?>
<?php snippet('footer');?>
and when i use this code in calendar.php i get the error ErrorException (E_NOTICE) Undefined variable: calendar
:
<?php snippet('header');?>
<?php $calendar = $page->calendar()->yaml();?>
<?php snippet('calendar-table');?>
<?php snippet('footer');?>
I found this thread in the Kirby forum:
The following code for calendar.php by texnixe works, but how do i get your snippets to work?
<?php snippet('header');?>
<?php
$calendar = $page->calendar()->yaml();
foreach($calendar as $calendarEntry) {
echo $calendarEntry['description'];
}
?>
<?php snippet('footer');?>
Thanks!
Hey there,
is it possible to generate an ical file for every event as single file? I want to loop through all events and add a download link next to each event with its individual .ics
file.
Thanks, much appreciated plugin so far.
Use __DIR__
and DS
in file paths.
I'm having trouble installing this plugin. I'm not very experienced with Kirby, so maybe I missed things that are obvious for experienced Kirby devs.
I hope you can help.
In what directory should it be installed? I think its site/plugins/mzur/kirby-calendar is that correct? When downloading the source (MacOS) i get 'kirby-calendar-plugin-master' but in index.php it says 'mzur/kirby-calendar'
Under Panel, the instruction state: "Take a look at the blueprints directory of this repo to see a full example."
I could not find a blueprints directory in this repo or any examples.
I have tried several things with a structure but I couldn't get it to work. Where should i look for an example of this calendar in a blueprint for the Panel?
It would be nice to have a panel screenshot here. I had the idea of trying to add one if I had installed this, but installing is a problem for me.
Hope you can help, thanks,
René
Hello!
I put the "calendar-table" snippet in my template and I created a new event but the calendar returns "There currently are no events."
This is the snippet:
<?php $calendar = calendar($page->calendar()->yaml()); ?>
<?php
$tmpDate = getdate(0);
$currentDate = getdate();
?>
<table class="calendar">
<?php if (!$calendar->getAllEvents()): ?>
<tr><td><?php echo l::get('calendar-no-entry'); ?></td></tr>
<?php else: ?>
<thead>
<tr>
<th><?php echo l::get('date'); ?></th>
<?php foreach ($fields as $field): ?>
<th><?php echo $field; ?></th>
<?php endforeach; ?>
</tr>
</thead>
<tbody>
<?php foreach ($calendar->getAllEvents() as $event):
$date = $event->getBeginDate();
?>
<?php if ($tmpDate['mon'] < $date['mon'] || $tmpDate['year'] < $date['year']): ?>
<tr class="month<?php e($date['mon'] < $currentDate['mon'] or $date['year'] < $currentDate['year'], ' past'); ?>">
<td colspan="<?php echo count($fields)+1; ?>"><?php echo strftime(l::get('calendar-month-format'), $date[0]); ?></td>
</tr>
<?php endif; ?>
<tr class="event<?php e($event->isPast(), ' past'); ?>">
<td><?php
echo $event->getBeginHtml();
if ($event->hasEnd()) {
echo ' '.l::get('to').' '.$event->getEndHtml();
}
?></td>
<?php foreach ($fields as $key => $value): ?>
<td><?php echo $event->getField($key); ?></td>
<?php endforeach; ?>
</tr>
<?php $tmpDate = $date; ?>
<?php endforeach; ?>
</tbody>
<?php endif; ?>
</table>
and this is where the snippet is located:
<section class="events">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="big-intro">
Events
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
<div class="col-md-9">
<?php snippet('calendar-table') ?>
</div>
</div>
</section>
What did I do wrong? 🤔
Explore how recurring events could be implemented.
Ideas:
getEvents()
and getAllEvents()
get optional arguments to specify a termination date in the future. All recurring events only return the single events until this date (else there may be infinite events).expand()
or some such that returns the list of single events until the termination date.getEvents()
or getAllEvents()
is called, the list of events is created by a call to expand()
of all (future) events of the calendar. This list is then sorted and returned.Thanks for your great plugin, I've been using it for a while, but unfortunately since I updated from Kirby v2.1.2 to v2.2.2 I get the following error message:
Fatal error: Uncaught exception 'Exception' with message 'Too many keys: Opening at 2015-02-27. Open: Fri-Sa-Su 14.00-17.00' in
/path/to/site/kirby/toolkit/vendors/yaml/yaml.php:1057 Stack trace: #0
/path/to/site/kirby/toolkit/vendors/yaml/yaml.php(1096): Spyc->checkKeysInValue('Opening at 2015...') #1
/path/to/site/kirby/toolkit/vendors/yaml/yaml.php(588): Spyc->returnKeyValuePair('opening: Openin...') #2
/path/to/site/kirby/toolkit/vendors/yaml/yaml.php(525): Spyc->_parseLine('opening: Openin...') #3
/path/to/site/kirby/toolkit/vendors/yaml/yaml.php(474): Spyc->loadWithSource(Array) #4
/path/to/site/kirby/toolkit/vendors/yaml/yaml.php(152): Spyc->__load('-\n\n\t_begin_date...') #5
/path/to/site/kirby/toolkit/lib/yaml. in /path/to/site/kirby/toolkit/vendors/yaml/yaml.php on line 1057
Apparently something changed in Kirby v2.2.2, that the calendar plugin doesn't like… any help is welcome…
https://github.com/mzur/kirby-calendar-plugin/blob/master/calendar/lib/Event.php#L104
are you sure 'tomorrow' works as intended?
i had to patch it with this
//$this->endTimestamp = strtotime('tomorrow', $this->endTimestamp);
$e = $this->endTimestamp;
$this->endTimestamp = mktime(23,59,59, intval(date('n',$e)), intval(date('j',$e)), intval(date('Y',$e)));
Make use of the Kirby Toolkit language support similar to the contact form plugin.
Use it for date, time, etc. formatting as well!
Make events with undefined dates possible. Show them at the top or bottom of the calendar. Make it possible to set individual "undefined" text.
I have my lang option set to en_US, timezone set to America/Phoenix, and it still expects day before month in the YAML in my calendar events. If I switch them, it gets confused.
This is fine for me, but not when I have other people start editing.
This Kirby calendar seems very interesting.
I have tried to follow the guide, but the calendar does not return date and time.
Only title and description will echo out.
Apart from that, it works great so far.
This is templates/calendar.php:
<?php $calendar = calendar($page->calendar()->yaml()); ?>
<?php
snippet('calendar-table', array(
'calendar' => $calendar,
'fields' => array(
'summary' => l::get('title'),
'description' => l::get('description'),
'_begin_date' => l::get('_begin_date'),
'_begin_time' => l::get('_begin_time'),
'_end_date' => l::get('_end_date'),
'_end_time' => l::get('_end_time')
)
));
?>
Can you help me?
Sitch to camel case to better folllow conventions.
Use the new structure field rather than manually entered text as input (as suggested here).
Implemented correctly, this will enhance usability and get rid of #1 and #2.
Hey,
I did everything as described but when I export the ical file are not the events in the file there.
Language files should be loaded automatically by the plugin rather than be placed manually to the languages
directory (as suggested here).
Most of my events have _begin_time and _end_time.
Some of them last several days, but most of them start and end on the same day.
Right now, getEndStr() always displays the full end date and time.
If _end_date is empty (or equal to _start_date), I would like to print only the end time.
How can I achieve that? Could I just modify getEndStr() or do I have to change the whole event constructor?
Thanks
Klaas
Function strftime() is deprecated
\site\plugins\kirby-calendar-plugin-master\snippets\calendar-table.php:28
Kirby 4.0.0-rc.4
PHP 8.1.23
Make multiple events at exactly the same time possible. This has to be a workaround to the YAML parsing because the same array keys are overwritten during parsing.
Use an options array like this.
Hi, first I have to say it's a great plugin!
I include the calendar two times on the same template/page, the first utilising a custom ‘current‘ (and future) events template and the second a ‘past’ events template.
Now I would like to change the order of the ‘past’ events output. I would be nice to be able to pass an option via $options array to change order of events per calendar include.
Is this possible? How? Or can I get do something in the ‘past’ events template to get the same result?
Thanks
Hey, this plugin looks great already. Do you think it would be possible to add support for usage via composer? Thanks for considering this suggestion.
The Kirby Panel converts all field names to lower case by default, including custom structure field names. Because of this the following fixed field names of the Calendar Plugin are incompatible with the structure field:
The Calendar Plugin was specifically designed to work with the structure field so I decided to change these fixed field names to snake case (actually reverting ea8311a).
Hi,
exist a demo of the calendar plugin?
Kind regards,
jan
Additionally provide Kirby-like accessor functions for the event fields. For example $event->get_field('summary')
should be the same as $event->summary()
.
Hi there, would it be hard to extend this into google cal or outlook at all ?
Lieber Mzur
Ich habe vor längerer Zeit ein ähnliches Plugin geschrieben. Du findest es unter https://github.com/moritzz/Kirby-Calendar. Im Gegensatz(?) zu Dir, habe ich mich damals entschlossen eine bestehende Bibliothek zur Generierung von vCal-Feeds einzusetzen und damit sehr gute Erfahrungen gemacht.
Momentan läge mir vor allem am Herzen, dass das Plugin nicht nur vCal-Feeds darbieten, sondern auch solche von Google und Co. abonnieren, zusammenführen und wieder publizieren kann.
Was denkst Du?
Herzliche Grüsse und bis hoffentlich bald,
Moritz
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.