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   1 member

  • Similar Content

    • By Macrura
      Field Descriptions Extended
      This module enables you to extend field descriptions by dividing short descriptions with a longer text that is revealed in a toggle.
      Modules Directory: http://modules.processwire.com/modules/field-descriptions-extended/
      Github: https://github.com/outflux3/FieldDescriptionsExtended
      Extending your field descriptions using the standard field's description field.
      Once this module is installed, it will automatically search your description field for the presence of 5 dashes (-----).
      Any content above the 5 dashes will be visible and the content below the dashes will be hidden. A 'More...' link will appear at the end of the short description which when clicked will reveal the rest of the description.
      Using Simple Markdown Editor with the description field
      If you have Simple Markdown Editor (InputfieldSimpleMDE) installed, you can enable the field description to have that editor.
      *When using Simple MDE, you can use the button (Insert Horizontal Line) instead of typing 5 dashes. More about SimpleMDE.
      Extending your field descriptions using content from a ProcessWire Page for the field description.
      You may use the content from a ProcessWire page as a field description. This would allow you to easily insert images, links, and use hanna codes.
      To use page content for your field descriptions, please follow these instructions:
      Install Select Fields module (FieldtypeFields) http://modules.processwire.com/modules/fieldtype-fields/ Create a new field using this field type, e.g. field_select. Add the field to any template you will be using for your field descriptions. Setup your help pages (for example under a settings branch) where you will store the field description content,using the template containing the Field Select. Add content to a page and select the field where that content should show. To show a short text before the link to the longer content, separate them with 5 dashes Be sure to update your settings on this page, first enable page content descriptions,then specify the name of the Select Fields field, template to search, and content field. If you create a field description using this method, please note that the description field must be blank for contexts where you want the page content to appear.
      You can freely use template context for field descriptions, but the Page Content method is not context sensitive and will display under all contexts where the description is blank.
      ----
      original post:
      This is a new module, hope to release soon, which allows extended field descriptions, in currently 2 ways.
      The main feature of the module is that you can have a short description and then a 'more...' link which drops down a longer block of text.
      This is achieved by separating the intro/visible text and the rest with 5 dashes.

      Example setup:

      the 2nd way is if you are using AdminThemeUiKit, you can show extended field instructions in a panel. The content of the panel is edited on a regular PW page. This use case would probably not be that common, but if you had a field that required some extended instructions for how to use, this could be useful; Also, since this allows you to target information and instructions down at the field level, it could reduce the amount of documentation needed on a global level, since it is a lot more context targeted.

    • By Robin S
      Breadcrumb Dropdowns
      Adds dropdown menus of page edit links to the breadcrumbs in Page Edit.

      Installation
      Install the Breadcrumb Dropdowns module. The module requires ProcessWire >= v3.0.83 and AdminThemeUikit.
      There is a checkbox option in the module config that determines if the breadcrumb dropdowns will include pages that the user does not have permission to edit.
      Features/details
      The module adds an additional breadcrumb item at the end for the currently edited page. That's because I think it's more intuitive for the dropdown under each breadcrumb item to show the item's sibling pages rather than the item's child pages. In the dropdown menus the current page and the current page's parents are highlighted in a crimson colour to make it easier to quickly locate them in case you want to edit the next or previous sibling page. If the option to include uneditable pages is selected then those pages are indicated by a reduced text opacity and the "not-allowed" cursor is shown on hover. There is a limit of 25 sibling pages per dropdown for performance reasons and to avoid the dropdown becoming unwieldy. Incompatibilities
      This module replaces the AdminThemeUikit::renderBreadcrumbs method so will potentially be incompatible with other modules that hook the same method.
       
      https://modules.processwire.com/modules/breadcrumb-dropdowns/
      https://github.com/Toutouwai/BreadcrumbDropdowns
    • By joshuag
      Hey guys, 
      Thought I would share a quick preview of Designme. A module we (Eduardo @elabx and I) are building for visually laying out your templates/edit screens. 🙂
      This is a really quick, zero polish screen grab. FYI. 
      Video #2 - UPDATE
      This new video shows the following features in Designme:
      Re-arranging fields via Drag & Drop Re-sizing fields via Dragging. Adjusting field settings - with live refresh. Working on "hidden" fields while Designme is active. Creating New fields. Deleting fields. Creating/Deleting Tabs. Dragging fields between tabs. Creating fieldsets. Tagging/Un-tagging fields. Fields without headers expand when hovered (like checkboxes). Live filtering of fields in the sidebar. Ability to adjust (all) Template settings without leaving Designme. Template File Tree Editing Template files source code with ACE Editor. Editing Multiple files with ACE Editor. (New Tabs) Saving files. Techie stuff Fields load their own js/css dependancies. *ready to use on creation (*most fields)  Everything happens via Ajax to ProcessPageEdit (via module + hooks). Designme has a JS api that you can use.  All actions trigger events.  We would love any detailed feedback on what you see so far. If you are interested in testing Designme. Let me know below. 🙂
       
       
      Video #1. 
       
    • By dreerr
      TemplateEnginePug (formally TemplateEngineJade)
       
      This module adds Pug templates to the TemplateEngineFactory. It uses https://github.com/pug-php/pug to render templates.
      doctype html html(lang='en') head meta(http-equiv='content-type', content='text/html; charset=utf-8') title= $page->title link(rel='stylesheet', type='text/css', href=$config->urls->templates . 'styles/main.css') body include header.pug h1= $page->title if $page->editable() p: a(href=$page->editURL) Edit Project on GitHub: github.com/dreerr/TemplateEnginePug
      Project in modules directory: modules.processwire.com/modules/template-engine-pug/
       
      For common problems/features/questions about the Factory, use the TemplateEngineFactory thread.
       
    • By tpr
      ProcessNetteTester
      Run Nette Tester tests within ProcessWire admin.
      (continued from here)

      Features
      AJAX interface for running Nette Tester tests, in bulk or manually display counter, error message and execution time in a table run all tests at once or launch single tests show formatted test error messages and report PHP syntax errors stop on first failed test (optional) hide passed tests (optional) display failed/total instead passed/total (optional) re-run failed tests only (optional) auto scroll (optional) include or exclude tests based on query parameters start/stop all tests with the spacebar reset one test or all tests (ctrl+click) https://modules.processwire.com/modules/process-nette-tester/
      https://github.com/rolandtoth/ProcessNetteTester