Home › Forums › Calendar Products › Events Calendar PRO › Filter out multi day events subsequent days
- This topic has 15 replies, 2 voices, and was last updated 12 years, 10 months ago by
Barry.
-
AuthorPosts
-
June 21, 2013 at 12:59 pm #51869
Briston
ParticipantGreetings. Loving the plugin. Need some assistance in filtering out some days from the returned list. I want to only show the first day of multi day events but can’t seem to get other folks code on the board to help.
Is there a way I can do this using the monthView data in table.php? I’m pulling my events using the monthView array but can’t figure out the conditional to add to see if the event has already been displayed.
if( count( $monthView[$day] ) > 0 ) :
Any help is appreciated.
thanks,June 21, 2013 at 1:56 pm #51896Barry
MemberHi Briston,
Can I clarify first of all if by multiday event you simply mean a regular event that ends one or more days after it starts, or do you mean an event where a recurrence pattern such as every Friday for 10 weeks has been set up – or both?
Also, is this only in the context of the gridview?
Thanks!
June 24, 2013 at 8:28 am #52039Briston
ParticipantHi Barry,
Thanks for the reply. I am referring to events that start on one day and end on a day in the future and not recurring patter events. Indeed, it is only in the context of gridview.
June 24, 2013 at 8:30 am #52040Briston
ParticipantWhoops! Subscribing to thread…
June 24, 2013 at 8:54 am #52045Barry
MemberOK, so please read our Themer’s Guide and this tutorial on template overrides to get some background (unless you are already familiar with the process of customizing templates, of course) and then let’s make some changes to your custom events/table.php.
Find the function named display_day() (it’s the last chunk of code in table.php) and replace it with this version. Does that work for you?
June 24, 2013 at 10:05 am #52056Briston
ParticipantThank you for the reply Barry. Unfortunately that doesn’t get me where I need to be. I’m needing to know if there is really a valid date (not an end date after the first day) in display_day_title() as well. I’m taking care of some classing in that function. Is there any way to modify the results or a custom query instead?
June 24, 2013 at 10:11 am #52059Briston
ParticipantHere is what i’m working with:
http://pastebin.com/CLFfuU5KThank you.
June 24, 2013 at 10:19 am #52061Barry
MemberIām needing to know if there is really a valid date (not an end date after the first day) in display_day_title() as well.
I’m not really clear on what you mean by this.
June 24, 2013 at 11:13 am #52068Briston
ParticipantCheck out this photo:
http://d.pr/i/COKiSee from the 18th on how the multi day event is highlighted? I’m needing to only highlight the first day of the event. I’m classing the div through display_day_title() (~ line 101) function which fires before display_day() and the exclude function we’ve added. I hope this makes sense.
June 24, 2013 at 12:10 pm #52085Barry
MemberOh I see.
Well, one thing is that although you’ve still got the display_day_title() definition in your template you don’t seem to be actually calling it anywhere.
The second thing is, doing this from within display_day_title() is going to be a little clunky.
I think personally I would re-order things somewhat: the logic we just added to display_day() could be extended to also check if there are any new events starting and, only then, apply your highlighting class. Otherwise it could apply a different CSS class/not add a class at all.
Good luck!
June 24, 2013 at 12:13 pm #52087Briston
ParticipantThanks Barry. I’m investigating the CSS route currently. Your right, it is a bit clunky. Any suggestions for refactoring?
June 24, 2013 at 12:21 pm #52089Barry
MemberWell, assuming you keep the display_day() function then – since the “knowledge” of whether a multiday event has already been displayed (and whether there are any new events) is readily available within that function – I would probably look at calling display_day_title() from within there.
I might also adapt display_day_title() to accept an extra parameter to indicate the CSS class to be applied.
Also, if I’m understanding your requirements correctly, you’d probably need an extra check to figure out if the day only contains multiday events which started on an earlier date (in which case we don’t want any highlighting) or if it contains a mix of those (or none) plus some new events (in which case we do want highlighting).
June 24, 2013 at 12:22 pm #52090Briston
ParticipantWhoops I accidentally deleted display_day_title() when carving out the comments for pasting here. The display_day_title() was being called directly before display_day().
Another approach would be to modify the array holding all the events to not have any duplicate id posts. I have no clue how to do that though… Any ideas
June 24, 2013 at 12:32 pm #52094Barry
MemberWell, you could do something similar to the changes I made to display_day() – and either remove unwanted elements or even copy desirable elements into a new array and then use that.
There are many different ways to approach this, but I’ll have to leave the final solution to you š
June 24, 2013 at 12:32 pm #52095Briston
ParticipantAbsolutely. Thank you for your guidance.
-
AuthorPosts
- The topic ‘Filter out multi day events subsequent days’ is closed to new replies.
