Jump to content

Calendar widget - add past events please


Andrey Gaisenok

Recommended Posts

My Calendar widget (upcoming events) is always empty because all my events are "today" events. E.g. we've uploaded a new content for users and added a record to the Calendar.

Could you add a settings to existing widget to shows not only upcoming events but also some events from the past?

Link to comment
Share on other sites

I've looked at the code and made some changes, I added only one string to the file
applications/calendar/widgets/upcomingEvents.php

$_today = \IPS\calendar\Date::getDate( $this->_today->year, $this->_today->mon, 1);

before string

$events = \IPS\calendar\Event::retrieveEvents( $_today, $endDate, NULL, ( isset( $this->configuration['maximum_count'] ) AND $this->configuration['maximum_count'] > 0 ) ? $this->configuration['maximum_count'] : 5, FALSE );

So now I see all events for the month.

But I will be glad if it will realized in the IPB code with an option.

2015-06-20_20h05_06.png

Link to comment
Share on other sites

I've found another solution:

replace

$events = \IPS\calendar\Event::retrieveEvents( $_today, $endDate, NULL, ( isset( $this->configuration['maximum_count'] ) AND $this->configuration['maximum_count'] > 0 ) ? $this->configuration['maximum_count'] : 5, FALSE );

by

$events = \IPS\calendar\Event::retrieveEvents( $_today->adjust( '-1 month' ), $endDate, NULL, ( isset( $this->configuration['maximum_count'] ) AND $this->configuration['maximum_count'] > 0 ) ? $this->configuration['maximum_count'] : 5, FALSE );

Simply, use $_today->adjust( '-1 month' ) instead $_today.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...