joshuag

Recurme – Processwire Recurring Dates Field & Custom Calendar Module.

Recommended Posts

5 minutes ago, adrian said:

Thanks @joshuag - just curious - did you also take a look at the rrule code icon idea I brought up?

I did not modify it. I didn't even think of it, but it's a good idea. I'll do a quick update on that. Thanks!

  • Like 1

Share this post


Link to post
Share on other sites

Thanks for the update @joshuag, great to see Recurme continue being updated. 

I haven't had opportunity to update my current installs yet, but have a new project Recurme would be ideal for.

  • Thanks 1

Share this post


Link to post
Share on other sites
On 19.12.2017 at 11:33 AM, snck said:

I could not find a way to get the value of the "all day" checkbox and found out that its state is hard-coded (checked) in InputfieldRecurme.module. I need to differentiate between "all day" and "normal" events and output them differently on a clients website. Could you please implement something like a $event->allDay property?

Thanks!

Hey @joshuag, thanks for the update! The toggle fix did not solve my problem (quoted above) because you still do not store the value of the checkbox/toggle. Could you please implement something like an $event->allDay property with a simple binary value? 

Thank you in advance!

Share this post


Link to post
Share on other sites
On March 12, 2018 at 10:49 AM, snck said:

Hey @joshuag, thanks for the update! The toggle fix did not solve my problem (quoted above) because you still do not store the value of the checkbox/toggle. Could you please implement something like an $event->allDay property with a simple binary value? 

Thank you in advance!

$event->allDay should be giving you the value of $allDay in the event object true/false. This is also implemented in the json stored in the field. 

Share this post


Link to post
Share on other sites

Fresh install of PW 3.0.62, I'm getting this error when installing the latest version of Recurme:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in /var/sites/t/X/public_html/wire/core/Modules.php on line 3921

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line 0

Never seen this before and I'm a bit stumped... Any ideas?

Edit: Increased memory limit with ini_set on the module to see where this goes and got a 30s execution time error. Can't figure this one out, there must be a loop somewhere as increasing that came back to a 800MB memory limit!

Edit 2: Solved! I'll send you an e-mail with details.

  • Thanks 1

Share this post


Link to post
Share on other sites
On March 14, 2018 at 2:10 PM, DonPachi said:

Fresh install of PW 3.0.62, I'm getting this error when installing the latest version of Recurme:


Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in /var/sites/t/X/public_html/wire/core/Modules.php on line 3921

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line 0

Never seen this before and I'm a bit stumped... Any ideas?

Edit: Increased memory limit with ini_set on the module to see where this goes and got a 30s execution time error. Can't figure this one out, there must be a loop somewhere as increasing that came back to a 800MB memory limit!

Edit 2: Solved! I'll send you an e-mail with details.

I would love to know what happened. Let me know, if I need to, I will issue an update right away. Thank you!

Share this post


Link to post
Share on other sites

Hey @joshuag - not sure if I am just missing it, but is there a method for adding new dates via the API? I have a LOT of events to import. Or, do I have to manually build up the JSON eg:

{"startDate":1518778800,"endDate":1518940740,"allDay":false,"timeEnd":"12:00 pm","dates":["W7/16/Fri/Feb/2018","W7/17/Sat/Feb/2018"],"excluded":[],"active":true,"showResults":true,"rrule":"WKST=MO;FREQ=DAILY;DTSTART=20180216T030000Z;INTERVAL=1;UNTIL=20180217T235900Z"}

and populate with $page->event->date = $jsonStr;

Thanks!

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, adrian said:

Hey @joshuag - not sure if I am just missing it, but is there a method for adding new dates via the API? I have a LOT of events to import. Or, do I have to manually build up the JSON eg:


{"startDate":1518778800,"endDate":1518940740,"allDay":false,"timeEnd":"12:00 pm","dates":["W7/16/Fri/Feb/2018","W7/17/Sat/Feb/2018"],"excluded":[],"active":true,"showResults":true,"rrule":"WKST=MO;FREQ=DAILY;DTSTART=20180216T030000Z;INTERVAL=1;UNTIL=20180217T235900Z"}

and populate with $page->event->date = $jsonStr;

Thanks!

I don’t have a method to add dates via the api, but that is a good idea.

If you do add dates by populating the json manually, I could see some complications arising depending on how you have chosen the repeat pattern in the Recurme Field. Because the dates are generated based on the rrule via JavaScript. 

I will give this some thought and see how we could make this a no-brainer. 

Thanks for the great idea. 

  • Like 1

Share this post


Link to post
Share on other sites
Just now, joshuag said:

I will give this some thought and see how we could make this a no-brainer. 

Thanks for looking into this - right now I am going to have to either build up the JSON, or wait for you to implement an API method. I think the API method is essential because I am sure others will also need to import dates from existing sites. 

I'd appreciate knowing whether you might have time to implement this relatively quickly, or if you think it might take some time to get to - not pressuring, just needing to know if I need to take the JSON approach to meet my deadlines. Thanks for your time!

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, adrian said:

Thanks for looking into this - right now I am going to have to either build up the JSON, or wait for you to implement an API method. I think the API method is essential because I am sure others will also need to import dates from existing sites. 

I'd appreciate knowing whether you might have time to implement this relatively quickly, or if you think it might take some time to get to - not pressuring, just needing to know if I need to take the JSON approach to meet my deadlines. Thanks for your time!

Sending you a pm. 

  • Like 1

Share this post


Link to post
Share on other sites
On 13.3.2018 at 7:42 PM, joshuag said:

$event->allDay should be giving you the value of $allDay in the event object true/false. This is also implemented in the json stored in the field. 

Thanks, it worked for events I received through $recurme->find.

I could not find a way to access the allDay value from an event page.

$allDay = $recurme->event($page->id)->allDay;

Could you please point me in the right direction on how to access the allDay property for one single event?

Thank you!

Share this post


Link to post
Share on other sites

Hey @joshuag - I am quite confused about calling dates via the API.

From the docs it looks like I should do:

$recurme->event($page)->start_date;

but what if I have more than one recurme field on the page?

I am tempted to parse it myself like this:

json_decode($page->event_dates)->startDate;

because this way I can get the start date from my selected "event_dates" field.

However I am sure I am missing something in how this is meant to be used :)

Any tips please?

Share this post


Link to post
Share on other sites

@joshuag - I am also confused about the output of endDate - it's always a day after the specified end date - is this for some reason intentional? It seems confusing to me.

Note that importing using the script you PM'd me is also problematic with this "bug" - if you provide an end date, the end date shown in the field edit dialog is one day before the end, but when you output it via the API it returns the end date I specified on import, so it's quite confusing to the editor.

 

Share this post


Link to post
Share on other sites

Even more confusion. Take these examples - why does the value of enddate vary depending on how I get it?

image.png.74ef1e29bb21d3cac1c7e859afce37f3.png

Share this post


Link to post
Share on other sites

Ok, more details:If I import a date, the json initially looks like this:

{"startDate":1520956800,"endDate":1522440000,"allDay":false,"timeEnd":"02:00 pm","dates":["W11/13/Tue/Mar/2018","W11/14/Wed/Mar/2018","W11/15/Thu/Mar/2018","W11/16/Fri/Mar/2018","W11/17/Sat/Mar/2018","W11/18/Sun/Mar/2018","W12/19/Mon/Mar/2018","W12/20/Tue/Mar/2018","W12/21/Wed/Mar/2018","W12/22/Thu/Mar/2018","W12/23/Fri/Mar/2018","W12/24/Sat/Mar/2018","W12/25/Sun/Mar/2018","W13/26/Mon/Mar/2018","W13/27/Tue/Mar/2018","W13/28/Wed/Mar/2018","W13/29/Thu/Mar/2018","W13/30/Fri/Mar/2018"],"excluded":[],"active":true,"showResults":false,"rrule":"WKST=MO;FREQ=DAILY;DTSTART=20180313T100000Z;INTERVAL=1;UNTIL=20180330T140000Z"}

Then if I open the page in the admin and save the page (without changing anything), it then looks like this:

{"startDate":1520960400,"endDate":1522479540,"allDay":false,"timeEnd":"02:00 pm","dates":["W11/13/Tue/Mar/2018","W11/14/Wed/Mar/2018","W11/15/Thu/Mar/2018","W11/16/Fri/Mar/2018","W11/17/Sat/Mar/2018","W11/18/Sun/Mar/2018","W12/19/Mon/Mar/2018","W12/20/Tue/Mar/2018","W12/21/Wed/Mar/2018","W12/22/Thu/Mar/2018","W12/23/Fri/Mar/2018","W12/24/Sat/Mar/2018","W12/25/Sun/Mar/2018","W13/26/Mon/Mar/2018","W13/27/Tue/Mar/2018","W13/28/Wed/Mar/2018","W13/29/Thu/Mar/2018"],"excluded":[],"active":true,"showResults":false,"rrule":"WKST=MO;FREQ=DAILY;DTSTART=20180313T100000Z;INTERVAL=1;UNTIL=20180330T140000Z"}

Notice the change in the startDate and endDate stamps as well as the fact that "W13/30/Fri/Mar/2018" is removed after saving.

Help :)

Share this post


Link to post
Share on other sites

Sorry, me again :)

When I create a new event through the admin and it's a non-recurring event, it doesn't store the enddate:

{"startDate":1522971420,"endDate":false,"allDay":false,"timeEnd":"08:00 pm"

But you have no API method for getting the end time directly in your API calls (at least not that I can see) - what am I missing?

Share this post


Link to post
Share on other sites
18 hours ago, adrian said:

Hey @joshuag - I am quite confused about calling dates via the API.

From the docs it looks like I should do:


$recurme->event($page)->start_date;

but what if I have more than one recurme field on the page?

I am tempted to parse it myself like this:


json_decode($page->event_dates)->startDate;

because this way I can get the start date from my selected "event_dates" field.

However I am sure I am missing something in how this is meant to be used :)

Any tips please?

I am not sure that multiple recurme fields in a single page would work as expected. Parsing the Json would work well. 

Share this post


Link to post
Share on other sites
14 hours ago, adrian said:

Ok, more details:If I import a date, the json initially looks like this:


{"startDate":1520956800,"endDate":1522440000,"allDay":false,"timeEnd":"02:00 pm","dates":["W11/13/Tue/Mar/2018","W11/14/Wed/Mar/2018","W11/15/Thu/Mar/2018","W11/16/Fri/Mar/2018","W11/17/Sat/Mar/2018","W11/18/Sun/Mar/2018","W12/19/Mon/Mar/2018","W12/20/Tue/Mar/2018","W12/21/Wed/Mar/2018","W12/22/Thu/Mar/2018","W12/23/Fri/Mar/2018","W12/24/Sat/Mar/2018","W12/25/Sun/Mar/2018","W13/26/Mon/Mar/2018","W13/27/Tue/Mar/2018","W13/28/Wed/Mar/2018","W13/29/Thu/Mar/2018","W13/30/Fri/Mar/2018"],"excluded":[],"active":true,"showResults":false,"rrule":"WKST=MO;FREQ=DAILY;DTSTART=20180313T100000Z;INTERVAL=1;UNTIL=20180330T140000Z"}

Then if I open the page in the admin and save the page (without changing anything), it then looks like this:


{"startDate":1520960400,"endDate":1522479540,"allDay":false,"timeEnd":"02:00 pm","dates":["W11/13/Tue/Mar/2018","W11/14/Wed/Mar/2018","W11/15/Thu/Mar/2018","W11/16/Fri/Mar/2018","W11/17/Sat/Mar/2018","W11/18/Sun/Mar/2018","W12/19/Mon/Mar/2018","W12/20/Tue/Mar/2018","W12/21/Wed/Mar/2018","W12/22/Thu/Mar/2018","W12/23/Fri/Mar/2018","W12/24/Sat/Mar/2018","W12/25/Sun/Mar/2018","W13/26/Mon/Mar/2018","W13/27/Tue/Mar/2018","W13/28/Wed/Mar/2018","W13/29/Thu/Mar/2018"],"excluded":[],"active":true,"showResults":false,"rrule":"WKST=MO;FREQ=DAILY;DTSTART=20180313T100000Z;INTERVAL=1;UNTIL=20180330T140000Z"}

Notice the change in the startDate and endDate stamps as well as the fact that "W13/30/Fri/Mar/2018" is removed after saving.

Help :)

endDate will always be startDate -> till END OF THE CURRENT DAY from the interface if you have a timeEnd (11:59 from your example). endDate always represents the UNIX TIMESTAMP of the day/hour/min in seconds of the END TIME of the event. If you want a date for the events to stop if it is repeating, then it refers the the UNTIL value part of the RRULE UNTIL value. The until value tells recurme to expand the repeating dates up to the UNTIL date. I can see how this is confusing. I might rename these variables now that you have brought it to my attention. 
 

Share this post


Link to post
Share on other sites
19 minutes ago, joshuag said:

I am not sure that multiple recurme fields in a single page would work as expected. Parsing the Json would work well. 

I doubt it's a common scenario, but I have never seen a PW fieldtype work this way - normally you just call $page->fieldname so it's weird to get used to parsing an entire page to $recurme.

  • Like 1

Share this post


Link to post
Share on other sites

Looking at this all again now. I am working with manually created events (so there aren't any complications with API import) and I am still confused.

This is what I set up:

image.thumb.png.193df0834b9bf4c0fcf0eab290681280.png

 

$recurme->renderEvent($page, array('dateFormat' => 'M d, Y @ g:i a'));

results in: Error: Trying to get property of non-object on line: 682 of MarkupRecurme.module

If I do:

image.png.48d9ed3b2ca9ede323d68ad38480a5be.png

you can see that the "time" is off by an hour - probably a timezone issue, but how can I manually output something like:

March 13th - March 30th, 2018
10:00 am - 2:00 pm

This sort of output I am sure is quite common.

The problem is that end_date: 1522562399 is 2018-03-31 11:59 but the event only goes until the 30th. So how do I get the 30th - do I have to parse UNTIL from rrule, or can do take end_date and subtract one day - what is the reliable way to get the actual end date?

Sorry if I am being stupid - I can't believe I am the only person to come across these issues, but I don't think I am missing anything - I think the module just needs more properties with things like actual start date, start time, end date and end time so we can easily output custom formats.

Let me know if you want to spend a little time on a live chat/call about this.

Thanks!

 

  • Like 1

Share this post


Link to post
Share on other sites
39 minutes ago, adrian said:

$recurme->renderEvent($page, array('dateFormat' => 'M d, Y @ g:i a'));

results in: Error: Trying to get property of non-object on line: 682 of MarkupRecurme.module

Sorry, I understand my mistake on this. It needs:

image.png.654a491235782a235c9e172d49044b72.png

Although I still don't know why the dateFormat is not being respected in the output.

Share this post


Link to post
Share on other sites

Hey @joshuag - firstly I wanted to send some kudos your way - I feel like I've been complaining lots in my last few posts :) I have been playing around with RenderList, RenderEvent, RenderCalendar etc, and the backend Calendar views and they really are awesome - thanks for all the hard work!

I do have a request though - I have been looking at the rrule in the json and wondering if you'd consider adding a helper to parse the rule into plain english. I'd love to be able to output this: 

WKST=MO;FREQ=MONTHLY;DTSTART=20180402T100000Z;INTERVAL=1;BYDAY=TU;BYSETPOS=2;UNTIL=20180428T235900Z

as: 

Every second Tuesday from 10 am to 2 pm from April 2nd, 2018 till April 28th, 2018

Do you have any thoughts on this? Is there already an inbuilt method that I missed that would help with this?

Thanks again!

 

 

Share this post


Link to post
Share on other sites

Hi @joshuag - sorry to bump this, but wondering if you've had any thoughts on any of my questions above?

Share this post


Link to post
Share on other sites
On March 28, 2018 at 7:25 AM, snck said:

Thanks, it worked for events I received through $recurme->find.

I could not find a way to access the allDay value from an event page.


$allDay = $recurme->event($page->id)->allDay;

Could you please point me in the right direction on how to access the allDay property for one single event?

Thank you!

Try this updated file: 
I will add this to my next release.

Thank you!

MarkupRecurme.module

  • Thanks 1

Share this post


Link to post
Share on other sites
On April 6, 2018 at 5:54 PM, adrian said:

Sorry, I understand my mistake on this. It needs:

image.png.654a491235782a235c9e172d49044b72.png

Although I still don't know why the dateFormat is not being respected in the output.

change the timeFormat option instead,

or

change the xBefore template to use {date} instead of {time}.
 

'xBefore' => '<li class="rm-list-event {original.name}"><span class="rm-event-date">{time}</span> ',

 

On April 6, 2018 at 5:13 PM, adrian said:

Looking at this all again now. I am working with manually created events (so there aren't any complications with API import) and I am still confused.

This is what I set up:

image.thumb.png.193df0834b9bf4c0fcf0eab290681280.png

 


$recurme->renderEvent($page, array('dateFormat' => 'M d, Y @ g:i a'));

results in: Error: Trying to get property of non-object on line: 682 of MarkupRecurme.module

If I do:

image.png.48d9ed3b2ca9ede323d68ad38480a5be.png

you can see that the "time" is off by an hour - probably a timezone issue, but how can I manually output something like:

March 13th - March 30th, 2018
10:00 am - 2:00 pm

This sort of output I am sure is quite common.

The problem is that end_date: 1522562399 is 2018-03-31 11:59 but the event only goes until the 30th. So how do I get the 30th - do I have to parse UNTIL from rrule, or can do take end_date and subtract one day - what is the reliable way to get the actual end date?

Sorry if I am being stupid - I can't believe I am the only person to come across these issues, but I don't think I am missing anything - I think the module just needs more properties with things like actual start date, start time, end date and end time so we can easily output custom formats.

Let me know if you want to spend a little time on a live chat/call about this.

Thanks!

 

yeah, this looks like a timezone issue. I am digging into it. thanks for bringing it up. Subtracting one day won't work or be consistent. 

  • Thanks 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Robin S
      Another little admin helper module...
      Template Field Widths
      Adds a "Field widths" field to Edit Template that allows you to quickly set the widths of inputfields in the template.

      Why?
      When setting up a new template or trying out different field layouts I find it a bit slow and tedious to have to open each field individually in a modal just to set the width. This module speeds up the process.
      Installation
      Install the Template Field Widths module.
      Config options
      You can set the default presentation of the "Field widths" field to collapsed or open. You can choose Name or Label as the primary identifier shown for the field. The unchosen alternative will become the title attribute shown on hover. You can choose to show the original field width next to the template context field width.  
      https://github.com/Toutouwai/TemplateFieldWidths
      https://modules.processwire.com/modules/template-field-widths/
    • By horst
      Croppable Image 3
      for PW 3.0.20+
      Module Version 1.1.16
      Sponsored by http://dreikon.de/, many thanks Timo & Niko!
      You can get it in the modules directory!
      Please refer to the readme on github for instructions.
       
      -------------------------------------------------------------------------
       
      Updating from prior versions:
       
      Updating from Croppable Image 3 with versions prior to 1.1.7, please do this as a one time step:
      In the PW Admin, go to side -> modules -> new, use "install via ClassName" and use CroppableImage3 for the Module Class Name. This will update your existing CroppableImage3 module sub directory, even if it is called a new install. After that, the module will be recogniced by the PW updater module, what makes it a lot easier on further updates.
      -------------------------------------------------------------------------
       
      For updating from the legacy Thumbnail / CropImage to CroppableImage3 read on here.
       
      -------------------------------------------------------------------------
       
    • By MoritzLost
      UPDATE: I have published a stable version of this module!
      Discussion thread:
      Github: https://github.com/MoritzLost/TextformatterPageTitleLinks
      ---
      Hello there,
      I'm working on a tiny textformatter module that searches the text for titles of other pages on your site and creates hyperlinks to them. I'm not sure if something like this exists already, but I haven't found anything in the module directory, so I wrote my own solution 🙂
      It's not properly tested yet and is still missing some functionality I would like to implement, so at the moment it should be considered in BETA. Features include limiting the pages that will get searched by template, and adding a custom CSS class to the generated hyperlinks. As I'm writing this I noticed that it will probably include unpublished and hidden pages at the moment, so yeah ... it's still in development alright 😅
      You can download the module from Github:
      https://github.com/MoritzLost/TextformatterPageTitleLinks
      There's some more information in the readme as well.
      Anyway, let me know what you think! I'm happy about any feedback, possible improvements or ideas on how to improve the module. Cheers.
    • By blad
      Hi guys!
      I just uploaded a module to explore files based on elFinder. By default it will show the "Files" folder.
      Screenshots:

      Video:
       
      To do:
       More options To fix:
       The function of rotating or scaling an image fails  Image editors V 1.01 (view issue)
      Fixed the bug working with the Multi-Language support ( translation of folders ). Fixed the name of elfinder.en  Github:
      https://github.com/LuisSantiago/ProcessElFinder/
      I hope you like it.
    • By BitPoet
      I'm really in love with FormBuilder, but the one thing missing to match all my end users' expectations were repeatable field groups. Think repeaters, in ProcessWire terms. Our primary application of PW is our corporate intranet, so "lines" of fields are quite common in the forms I build. We have all kinds of request forms where the information for a varying number of colleagues needs to be entered (from meal order to flight booking request) and where it is simply impractical to send a form for each, and I don't want to clutter my forms with multiple instances of fields that may only get used ten percent of the time.
      That's why I started to build FormBuilderMultiplier (link to GitHub).
      What it does:
      Adds an option to make a regular Fieldgroup repeatable Lets you limit the number of instances of a Fieldgroup on the form Adds an "Add row" button the form that adds another instance of the Fieldgroup's fields Adds a counter suffix at the end of every affected field's label Stores the entered values just like regular fields Makes the entered values available in preview and email notifications Supports most text based fields, textareas and selects (really, I haven't had enough time to test all the available choices yet) What it doesn't do (yet):
      Support saving to ProcessWire pages (i.e. real Repeaters) I haven't tested all the validation stuff, Date/Time inputs etc. yet, but since I'm utterly swamped with other stuff at work, I didn't want to wait until I have it polished. Any feedback is welcome. There might also be some issues with different output frameworks that I haven't encountered yet. The forms I work with mostly use UIKit.
      Status:
      Still alpha, so test well before using it in the field.
      Known issues:
      When rows are added, the form's iframe needs to be resized, which isn't completely clean yet.
      How it works:
      The Fieldgroup settings are added through regular hooks, as is the logic that adds the necessary field copies for processing the form and displaying previews.
      "Multiplied" field instances are suffixed with _NUM, where NUM is an incremental integer starting from 1. So if you have add two fields named "surname" and "givenname" to a fieldgroup and check the "multiply" checkbox, the form will initially have "surname_1" and "givenname_1" field (I'm still considering changing that to make the risk to shoot oneself into the foot by having a regular "surname_1" field somewhere else in the form less likely).
      When a "row" is added, the first row is cloned through JS and the counter in the fields' IDs, names and "for" attributes as well as the counter in the label are incremented before appending the copies to the Fieldset container in the form.
      To keep backend and frontend in sync, a hidden field named [name of the fieldset]__multiplier_rows is added to the form. Both the backend and the frontend script use this to store and retrieve the number of "rows".
      ToDo:
      Naturally, add the option to store the data in real repeaters when saving to pages. Do a lot of testing (and likely fixing). Make a few things (like the "Add row" button label etc.) configurable in field(set) context. Add a smooth API to retrieve the multiplied values as WireArrays. The mandatory moving screenshot: