I'm currently doing a research for a new project that has the requirement to allow a user to submit a weekly/monthly schedule/timetable for "something" (availability, spare time, courses/lessons, or likewise repeating dates/"events"), and provide other users with a list of matching users, f.e. to build working groups, find the best date for an event, aso. For example, local user groups on g.d.o could benefit from this: Everyone interested in an event could supply a list of available dates/date ranges.
Simplified example: User A is available on every Monday 2-4 pm, and every Wednesday 4-6 pm. User B is available every Tuesday 8-9 pm, and every Wednesday 5-7 pm. Best match would be every Wednesday 5-6 pm.
I've tested the Availability module, but its features are very limited.
There's also the Resource conflict module, but it's fulfilling another purpose.
I've studied and tested event + eventrepeat modules, but those would require major customizations to realize something like that.
Finally I gave the new Date and Date Repeat modules in HEAD a try, and those look like they would basically suit best.
However, Date Repeat allows to assign either "unlimited" (multiple) or "repeating" only. It does not allow to input both, multiple repeating dates in one field.
In front of digging through all the code, I would like to know if it is planned to support multiple repeating dates in Date/Date API, and if it would be possible to implement from your POV.
If you think it should be possible and you would accept a patch, I would consider coding it, and developing a "Date Match" module that would provide the rest of the functionality: A node/views/block listing containing all nodes sharing the same or similar schedule, and/or a function to find a date that matches most schedules in certain nodes (f.e. filtered by taxonomy).
Since we need to talk to the client in the next few days, I'd be happy to have your opinion on this. Also, if you are open for developing this, please let me know privately, so we are able to take this into account.
Comments
Comment #1
karens commentedI'm not completely sure multiple repeating dates in one field will work, but it might. I tried to keep the API very flexible.
Getting the current interface to work right in FAPI was very challenging -- a field that stores a RRULE strings gets dynamically expanded into a complex selection form and then the user selections are reconstructed into a new RRULE to be stored in the date field and used to compute the dates that match the rule to store them as the multiple values of that date in the database.
I thought getting that much working was pretty challenging, I think I stretched FAPI just about as far as it can go :)
Expanding on that to have multiple RRULEs, each with its own complex selection form and multiple resulting collections of dates that match the rule, hmm... I can see the use case for something like this, and I would say it is at least theoretically possible to do, but it might not be a simple thing to get all the FAPI stuff working together correctly.
The biggest advantage of Date over event + eventrepeat are that eventrepeat constructs a huge table of all the possible date values, and clears out past dates and adds future dates using cron. Then it searches that table for matches, which means you cannot create or edit repeats that started in the past, and you have a lot of overhead. Plus each match is made into a new node, which would not be desirable in this case. The date module can do computations for any date period and creates multiple fields in the original node and could also do the date computations on the fly instead of storing the results.
So I think this module is most likely the right place to start for something like this.
Comment #2
sunHi Karen, thanks for your quick and detailed response! We recently needed to develop a custom CCK field with multiple values, and used the AHAH methods of Imagefield as a template for that. If you're not opposed to this, we would probably implement multiple repeating dates in a similar way.
Comment #3
karens commentedI would love to get AHAH incorporated into the D5 version. It will automatically happen in D6 because of the changes in CCK for D6. So I'd gladly accept a patch for that in the 5.2 Date module, for sure.
Comment #4
cpelham commentedSean recently posted that he is thinking of retiring Event Repeat because it is his impression that Date/Date Repeat/Calendar will provide a better solution:
http://drupal.org/node/177108
From what I've read in this thread, that sounds accurate. I have not had a chance to install and play with dev versions of Date and Event to see if this is already the case or becoming the case. Do you agree? Or do you think Event Repeat provides or could/should provide some additional functionality beyond what Date/Date Repeat is setting out to do?
Comment #5
karens commentedI think Date Repeat will do the same or similar things as have been done by Event Repeat. It's actually an API that Event Repeat could use, but it would require the Date API. The Date module implements the API as a repeating date option.
The question about whether to deprecate Event Repeat is probably more about whether or not people still need the Event module, and lots are still using it. So long as the Event module exists there will probably be a need for Event Repeat.
So if the question is whether you can expect to be able to do the same or similar things with Date/Date Repeat, the answer is yes. The difference between Event and Date/Calendar is that the Event module creates only events and nothing else and does it with no requirement for using CCK or Views, while Date/Calendar builds on CCK and Views. The targeted module is easier to set up, since it has only that one purpose. The Date/Calendar combination is more flexible, but also more complicated to set up since it can do lots of different things.
Comment #6
karens commentedOops, this issue was actually about a different subject which is still active. Sun is proposing to make a way for multiple repeating date fields, and that is still an open feature request.
Comment #7
sunUnfortunately, the mentioned project that caused this issue has been canceled. However, I would still like to see this feature in Date module and I hope that I'll be able to come up with a patch if time permits. I'll assign this issue to me in front of working on it.
Comment #8
korayal commentedIs there any hope about this feature?
I'm using a calendar like a Class Schedule. so if I have a lecture which happens on different days of the week, but also different times, I have to create 2 nodes for both of them. So I'll have two nodes of the same lecture, and this is not practical.
Comment #9
ntripcevich commentedHi--
I'm hoping for a similar feature.
I have equipment reservations to track and it seems like a more flexible structure for Date (recurring bookings/reservations at irregular time intervals) would meet the need perfectly. I can try to combine it with the Resource Conflict module for an adequate solution, or perhaps the Conflict warning ability (via Node Reference) of Resource Conflict would be designed into Date Repeat because it's common problem having overlapping Date ranges for a single Content item. Thanks!
Comment #10
wretched sinner - saved by grace commentedAnother +1 subscribe (I hate those too. My coding skills aren't terribly flash, but I'm happy to test an implementation, if that is something that you are still willing to look at Karen.
Soli Deo gloria
Comment #11
pauldawg commentedI agree this would be a great feature. A sample use case for this is a class that runs every week on Tuesdays from 7 PM to 11 PM and on Thursdays from 7 PM to 8 PM. There are lots of other real-world scenarios here. Currently the only workaround is to create multiple CCK Date fields but there are limitations to this, including that multiple fields do not integrate into a single "Schedule" tab or "Repeat" rule display.
As to the comment about the difficulty in using the FAPI for this, I cannot speak to that directly, but I do have some additional thoughts on the UI which I will be documenting shortly about potential improvements to the UI, so in light of this future enhancement request perhaps there may be a reason to bundle this into a larger enhancement... I will post a link to the enhancement request in a bit; stay tuned...
Comment #12
ntripcevich commentedThis module may be of interest to people reading this thread
MERCI (Manage Equipment Reservations, Checkout and Inventory)
http://drupal.org/project/merci
Comment #13
davpas commentedMERCI does not yet handle repeating/recurring dates.
Comment #14
akolahi commentedI too am looking for something like this. I was wondering if it would be possible to "add another date", where you can add multiple dates to a node, each with it's own repeating pattern.
I have come across situations where it makes sense for one node to have repeated dates such as Mondays from 1-4pm and Tuesdays from 2-5pm.
ideally you could keep adding as many dates as possible. This would be beneficial in situations where there is no logic to the way there are multiple dates i.e. an event that spans four days but each day starts and ends at different times depending on the day etc...
Comment #15
jessefulton commentedHas anybody found a solution to this problem? I need the same functionality (a class/course which occurs at different times on different days.)
Comment #16
pauldawg commentedWhat about some sort of a node-reference approach? Here are some rough thoughts on how this could be done:
Example: content-type: course has a CCK node reference field to a content-type called schedule. The course has all of the fields that are related to the course, whereas the schedule is just a wrapper around a single repeating date field. Although you cannot create multiple values of a repeating date, you can put multiple values of a node reference in the course, each with its own repeating date.
This would require some work with views and either theming or panels to display the nodes appropriately. Here are some further thoughts:
Some of this might not make sense, and I admit that I haven't had a lot of experience with some of these modules, but this is the idea that has been brewing in the back of my mind. One negative to this is that there isn't a single iCal rule that this wraps up into, so if you want to create a single rule for the multiple repeating rules, you'd have to write a module to bring in the multiple references and re-encode them using the specifications from IEEE.
So... does this work? It's not my highest priority, so I won't be able to put any time into it, but if it sparks anything I'd love to hear if this works for anyone.
Along similar lines, it would seem like an obvious solution to use fieldgroups for this rather than node references; the problem is, if I recall correctly, Date won't work in a fieldgroup.
Comment #17
tmsimont commentedI also would benefit from such a feature..
I'm building a yoga site and there's instructors that want to post MWF classes the recur each week.
I've thought of a solution for this, but it requires chopping up the node submission form and creating a bunch of extra fields.. not even sure if it will work.
Basically I'm going to try to create 7 date repeat fields on one node, and have them each correspond to one day of the week.
They'd all be hidden and the user would fill out a separate form that would then either omit or include certain date fields for each day of the week.. We'll see how that goes..
The problem remains however, that there is still a possibility that the user might want two different times to appear on one day.
EG. "every tuesday, at noon for 1 hour, and at 6 for 1 hour"
Comment #18
tmsimont commentedWell I gave it a shot and although i got it to work, if a single event has more than 3 days in one week, and repeats each week in one month, then the views mod freaks out when I go to view the month that has the repeating pattern.
EDIT: by "freaks out" i mean it times out my server:
Why would views slow down so excessively with this?
Comment #19
tmsimont commentedI increased the maximum execution time and restarted apache.
It worked for a bit (after about 45 seconds), but now that I have a few more multiple-date entries, I get this:
So it seems that there is something going on here that is terribly memory-inefficient.
What is it about these combined modules that is so heavy?
Here's what I did:
I've created a content type called recurring_week_event
Then I added 7 date repeat fields:
field_rd_sun
field_rd_mon
field_rd_tues
etc
etc
I created a form that posts a title, master start/finish datestamps, and daily time of day starts/finish.
The form posts to a php page that takes this data, and creates 1 node of type recurring_week_event.
The php page uses some of the date module date_repeat_calc along with a loop to take each posted day of the week value and create the repeating date stamps for each of the 7 date repeat fields (omitting the date fields not checked)
EDIT: I removed the large snippet that performed what is described here --- see below for working copy
This works just fine, except when the node has more than 3 days in one week, repeated for an entire month.
At this point, the node is created without a problem with the above code ( and some other code.. node_save, etc ), and is viewable in the content menu, editable and its just peachy.
But the calendar view can't handle it.
The view is set up to recognize 7 fields ( one for each day of the week )
And its using the date: Date(node) argument OR field_rd_mon OR field_rd_tues etc OR etc OR etc.
I'm guessing that something with the way views works doesn't like that I'm looking at 7 fields?
Any pointers on where I can make this more efficient?
note: if you are going to try to implement this code -- you'll need to set it up to handle your site's timezone, or set each day-field to UTC in the admin/content/node-type/... area
Comment #20
tmsimont commentedSorry I just noticed we're supposed to be talking about 7.x here... I'm working with
calendar 6.x-2.2
date api 6.x-2.4
views 6.x-2.8
I got the repeating date pattern to work
In the above posts, I was working with 7 fields...
scratch that idea... the snippet below works great with just one field.
Perhaps somebody can convert this to a module -- I'm more of a post-to-a-php-page-somewhere kind of guy and am not terribly familiar with the various drupal hooks..
Essentially you want to intercept the submission of a node type, see the comments for an idea of where to put the code (and the above post for a bit more context):
Requirements:
content type with field_dates of type date with the following
After this creates the content -- you need to modify the calendar view to display the field_dates field, and accept field_dates: From along with the Date: Date(node) argument
Comment #21
tmsimont commentedyikes.. i accidentally changed the title of the issue... changing it back -- sorry
Also -- i'm kind of drupal.org newb, is this the appropiate place to be posting this potential solution?
Comment #22
pixelsweatshop commentedsubscribing
Comment #23
saepl commentedI am working on creating a class / course timetable and multiple recurring dates are very appealing to me. I love some of the ideas being thrown around here!
Comment #24
tnanek commentedSubscribing. This would be very useful in my case, which is a schedule of shows being performed, and various times on different days of the week.
I would also request a back-port of this to 6.x once its done in 7.x.
Comment #25
TD540 commentedSubscribing.
I could use this in 6.x as well.
Comment #26
jesss commentedAny update on this? It seems like a fairly common use case -- I know I need it!
Comment #27
bjlewis2 commentedI would really like to have this as well!
Comment #28
kclarkson commentedDoes anybody know if this feature has been added ?
Or if there is another module to provide this feature?
Comment #29
Shadlington commentedSubscribing... Needed by me too.
Comment #30
jackbravo commentedSubscribe, although I think maybe this module does what I want: http://drupal.org/project/date_repeat_presets
Comment #31
highfellow commentedSubscribing. This would be useful for a project I'm working on. If it's not done soon, I'll think about contributing code. It would be good to have some idea how hard this is likely to be.
Comment #32
hazah commentedAny movement? I'll take it up. UI wise, I'm thinking the following:
Add 'Add another repeat' button to the end of
The button behaves just like 'Add another item' button, keeping it familiar
It would add another repeat fieldset
Function:
Treat the repeat rule as an array of rules, and process it one by one using current method for one rule.
Thoghts, comments, ideas are welcome.
Comment #33
bjlewis2 commented@hazah, I think you need to wrap something in the
<code>tag, I'm not sure what you mean by:Comment #34
hazah commentedI meant a similar button that you get on a the date widget with a cardinality setting set to anything but 1 (such as 2,..., unlimited). That button's text is 'Add another item'. I'm simply saying, that since repeat takes that button away, another one should take it's place called 'Add another repeat'. I hope that clarifies.
Comment #35
karens commentedIf you take a look at the roadmap for D7 to D8 at http://groups.drupal.org/node/221229, you will see that the next thing on the table is to create a new 7.3 version of Date that has a lot of changes. One of the big changes is a total revamp of the way repeating dates work. With that new way of doing repeating dates I think multiple repeating dates will be quite easy to do. The 'repeating date' will be nothing but a RRULE and it will spawn the actual dates it creates as separate nodes. There could easily be multiple repeating RRULE fields on an event.
So marking this postponed as something that could go into 7.3, where it will be much easier to solve.
Comment #36
yudarik commentedDoes any one knows when these new features on Date Repeat API are going to be implemented?
I'm working on a new project based on D7 that supose to be some kind of Student information system for a school where student can get information for a courses they are assigned to. I'm using Organic groups to implement the "Course" content type, and date with "date repeat api" to implement the courses schedule. Because any course can be scheduled on different times during the week, I need a way that I can create multiple repeating rules for the same node. Fore example: Sunday: 10:00-12:00, Tusday: 14:00-17:00 and so on. Currently the Date repeat api, allows to add only one repeat instance and repeat it say every sunday and tusday. But there is no way to set different times for different days.
Hope to see this feature created on the next release of date module for D7. Subscribing!
Comment #37
hazah commentedI really hope this isn't redundunt, for this field to be completely generic, the feature can't be limited to "multiple repeating dates", rather, the multiplicity should come from the standard Drupal cardinality setting. What the feature should allow is to add any number of repetitions to each and every single field value. In theory, you should be able to setup an entire schedule for something from a single field, including all day events and any variants you can imagine.
Comment #38
maxheight2 commentedAny progress on an "Add More" button to the date repeat field?
Comment #39
adamtong commentedI also want to have the "add more" button on repeating dates. So I can create multiple repeating date and include some single dates too.
Comment #40
tmsimont commentedhaha this issue was one of the first I'd ever posted to... Almost 3 years later and I've got some of the same code! It has developed quite a bit since then...
I recently put up a sandbox module that attempts to address this issue:
http://drupal.org/sandbox/tmsimont/1917664
I'm trying to get a co-maintainer or two in there -- a lot of work needs to be done to clean up the UX, permissions and other features. I basically separated out repeat patterns, dates, schedules and exclusions all into their own entities... I have a lengthy description of why and how it works on the sandbox module page.
If anyone is willing to help me out with this please let me know, I'd really appreciate it.
Comment #41
tuccio commentedExactly, one would need the possibility to add multiple dates, and for each date, the possibility to make it a repeat date.
Combined with a multiple-value input calendar widget (like eg the Availability Calendar but with time input as well), this would cover all possible schedule needs I can think of.
Comment #42
lzimmerman commentedI'm configuring a schedule requiring the potential for multiple node dates in a single field, some of which may be repeating.
The solution I've got so far (pending changes to e.g. the Date API) is:
I checked the result in displays from the Calendar module.
It's working so far on a test case like: "event A occurs daily 9-10am, and also Fridays 3-5pm."
Comment #43
aramalipoor commentedHi guys,
for those of you who need to query for simple repeating dates (e.g. birthdays) you can use a tiny patch I've created for Views module that may help you.
It's Issue link is: #2014833: Change type of "Filter granularity" from radios to checkboxes to support views to query for repeating events
Comment #44
aramalipoor commentedHi guys,
for those of you who need to query for simple repeating dates (e.g. birthdays) you can use a tiny patch I've created for Views module that may help you.
It's Issue link is: #2014833: Change type of "Filter granularity" from radios to checkboxes to support views to query for repeating events
Comment #45
kclarkson commentedIs there something that needs to be done first in D8 for Multiple repeating Dates to be implemented ?
@lzimmerman - thanks for the idea, I will give it a shot and see how it works and report back.
Comment #46
troybthompson commentedI'm looking for this functionality as well for an events calendar to keep track of things like movie times that happen more than once in a day, or plays that are in the evenings but also have a matinee on the weekend. Any progress on this, or if I do the Field Collection workaround, do you think there will be a conversion later? Unfortunately, I'm not a programmer, but I can help test.
Comment #47
bnadem commented@lzimmerman: Thank you very much for the Idea ! You saved me ;)
Comment #48
scottsawyerJust to extend the awesome idea of using field collections for intricate repeat patterns, I'd like to include some additional configuration to my Calendar views as I couldn't get what I wanted out of the Calendar view I was already using for Events ( content type ).
Create a new calendar view from the template that uses your field collection with the date field as the base table.
Add a relationship, Field collection item: Entity with the Event Schedule (field_event_schedule) ( yours will be whatever your field collection content type field is ), this gives you access to the parent node so you can add fields to your view.
PROFIT!!