Filter out multi day events subsequent days

Home Forums Calendar Products Events Calendar PRO Filter out multi day events subsequent days

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #51869
    Briston
    Participant

    Greetings. 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,

    #51896
    Barry
    Member

    Hi 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!

    #52039
    Briston
    Participant

    Hi 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.

    #52040
    Briston
    Participant

    Whoops! Subscribing to thread…

    #52045
    Barry
    Member

    OK, 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?

    #52056
    Briston
    Participant

    Thank 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?

    #52059
    Briston
    Participant

    Here is what i’m working with:
    http://pastebin.com/CLFfuU5K

    Thank you.

    #52061
    Barry
    Member

    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 not really clear on what you mean by this.

    #52068
    Briston
    Participant

    Check out this photo:
    http://d.pr/i/COKi

    See 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.

    #52085
    Barry
    Member

    Oh 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!

    #52087
    Briston
    Participant

    Thanks Barry. I’m investigating the CSS route currently. Your right, it is a bit clunky. Any suggestions for refactoring?

    #52089
    Barry
    Member

    Well, 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).

    #52090
    Briston
    Participant

    Whoops 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

    #52094
    Barry
    Member

    Well, 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 šŸ™‚

    #52095
    Briston
    Participant

    Absolutely. Thank you for your guidance.

Viewing 15 posts - 1 through 15 (of 16 total)
  • The topic ‘Filter out multi day events subsequent days’ is closed to new replies.