MyCalendar

Month, Week, and List calendar for displaying events on your site.

Back to MyCalendar Support

iamtuxmeister
iamtuxmeister

I would like to show all events from today forward on a single page, how would I do that?

KurtJensen
KurtJensen

Upgrading to 1.0.18 makes this post and original response obsolete.

Please scroll to post 10699 for more details.

Last updated

iamtuxmeister
iamtuxmeister

Awesome that works for all events for this year. I am doing a school club website, so I was trying to get all events for the school year. There was another help you did for doing this month and next, I will attempt to adapt that to do this year and next and see what I come up with. Thank you for your quick response!

iamtuxmeister
iamtuxmeister

here is my solution:

in the Events.php file in components the $query is limiting the returning events to be >= to today's month which means that January of next year is excluded.

here is the code patch I came up with. Line 92 through the end of the stanza. REPLACE :

    $events = $query->where('month', '>=', date('m'))
                    ->where('year', '>=', date('Y'))
                    ->orderBy('time')
                    ->get();

WITH:

    $events = $query->where(function ($query) {
          $query->where('month', '>=', date('m'))
                       ->where('year', '=', date('Y'));
                       })
                    ->orWhere('year', '>', date('Y'))
                    ->orderBy('year')
                    ->orderBy('month')
                    ->orderBy('day')
                    ->orderBy('time')
                    ->get();

Last updated

TiEsse
TiEsse

Hi, this method works but the calendar icon prints the current month, December, even if the event date is January. Ideas for this?

KurtJensen
KurtJensen

So sorry... I completely screwed up the query and it was not showing any future dates in next year.

please update to version 1.0.17: Fixes future date issue and allows choice to include past dates.

TiEsse
TiEsse

Hi, thank you for answer. I have just post one issue on github; the question is partly resolved.

iamtuxmeister
iamtuxmeister

Thanks for the update, in the new version the events are showing properly for next year, but out of order again.

I fixed it with the same descending sort.

REPLACING:

    $events = $query->orderBy('time')
                    ->get();

WITH:

    $events = $query->orderBy('year')
                ->orderBy('month')
                ->orderBy('day')
                ->orderBy('time')
                    ->get();

Last updated

KurtJensen
KurtJensen

iamtuxmeister said:

Thanks for the update, in the new version the events are showing properly for next year, but out of order again.

I fixed it with the same descending sort.

REPLACING:

   $events = $query->orderBy('time')
                   ->get();

WITH:

   $events = $query->orderBy('year')
               ->orderBy('month')
               ->orderBy('day')
               ->orderBy('time')
                   ->get();

Where are you seeing the events displayed out of order? Events are packaged into and array in the form of :

$MyEvents[year][month][day][] = EventPieces

and then displayed by recursively walking the array so the only sorting that is needed is by "time". What am I missing here?

iamtuxmeister
iamtuxmeister

I am seeing the events out of order using the code you gave me at the top of this discussion :)

KurtJensen said:

iamtuxmeister said:

Thanks for the update, in the new version the events are showing properly for next year, but out of order again.

I fixed it with the same descending sort.

REPLACING:

   $events = $query->orderBy('time')
                   ->get();

WITH:

   $events = $query->orderBy('year')
               ->orderBy('month')
               ->orderBy('day')
               ->orderBy('time')
                   ->get();

Where are you seeing the events displayed out of order? Events are packaged into and array in the form of :

$MyEvents[year][month][day][] = EventPieces

and then displayed by recursively walking the array so the only sorting that is needed is by "time". What am I missing here?

KurtJensen
KurtJensen

Many changes in Upgrade to 1.0.18 should make the Event List easier to use.

Please review instructions and review setting of new properties in the Events Component.

  • Set Future Days to how many days you want into the future,
  • Set Past Days to how many days you want into past.

Month Component did not change but may be affected by Events Component restricting future dates. Edit "Events Component" in "Month" pages to set future days to something like 600 days in future to prevent hiding of your future events when people scroll through months.

I am planning to merge events query into Month component in the future to simplify use.

Thanks for your patients.

Last updated

iamtuxmeister
iamtuxmeister

Beautiful! The latest update fixed all my issues with stock code.

Thank you!

TiEsse
TiEsse

Awesome! Nice job! Now the plugin is very functional.

1-13 of 13