Version 4.7.13
This commit is contained in:
1 parent
fd22d99e69
commit
7124a02564
954 files changed
+29277
-59308
No files matched your search
@@ -34,7 +34,7 @@ class _Event extends \IPS\Content\Item implements
|
||||
\IPS\Content\EditHistory,
|
||||
\IPS\Content\Anonymous
|
||||
{
|
||||
use \IPS\Content\Reactable, \IPS\Content\Reportable;
|
||||
use \IPS\Content\Reactable, \IPS\Content\Reportable, \IPS\Content\ViewUpdates, \IPS\Content\Statistics;
|
||||
|
||||
/**
|
||||
* @brief Application
|
||||
@@ -366,7 +366,7 @@ class _Event extends \IPS\Content\Item implements
|
||||
|
||||
/* Return the results we found after storing them */
|
||||
$timezone = ( !empty( $this->timezone ) and \in_array( \IPS\DateTime::getFixedTimezone( $this->timezone ), \DateTimeZone::listIdentifiers() ) ) ? new \DateTimeZone( $this->timezone ) : NULL;
|
||||
$this->parsedOccurrences = static::_findOccurances( $this->_start_date, $this->_end_date, $startDate, $endDate, $recurringData, $timezone );
|
||||
$this->parsedOccurrences = static::_findOccurances( $this->_start_date, $this->_end_date, $startDate, $endDate, $recurringData, $timezone, $this->all_day );
|
||||
|
||||
return $this->parsedOccurrences;
|
||||
}
|
||||
@@ -407,9 +407,10 @@ class _Event extends \IPS\Content\Item implements
|
||||
* @param \IPS\calendar\Date $endDate Date to end at
|
||||
* @param array $recurringData Reccurance data
|
||||
* @param \DateTimeZone $eventTimezone Event timezone
|
||||
* @param boolean $allDay All day event?
|
||||
* @return array
|
||||
*/
|
||||
public static function _findOccurances( $eventStart, $eventEnd, $startDate, $endDate, $recurringData, ?\DateTimeZone $eventTimezone=NULL )
|
||||
public static function _findOccurances( $eventStart, $eventEnd, $startDate, $endDate, $recurringData, ?\DateTimeZone $eventTimezone=NULL, bool $allDay=FALSE )
|
||||
{
|
||||
$keyword = NULL;
|
||||
$results = array();
|
||||
@@ -435,7 +436,14 @@ class _Event extends \IPS\Content\Item implements
|
||||
/* adjust repeat freq relative to event start date */
|
||||
$offset = 0;
|
||||
|
||||
if( $eventTimezone )
|
||||
/* Due to a change made in PR #2058, all day events are stored as UTC regardless of chosen TZ. This causes issues
|
||||
when adjusting the wday (added in d75481b) as timed events do store the TZ as per the user's choice.
|
||||
For now, we will only adjust the wday if the event is not all day.
|
||||
processForm() has also been changed to allow the correct TZ to be stored for all day events, so we have the
|
||||
correct data for a potenital future change in how all day events are processed.
|
||||
*/
|
||||
|
||||
if( ! $allDay and $eventTimezone )
|
||||
{
|
||||
$relativeDate = clone $eventStart;
|
||||
$relativeDate->setTimezone( $eventTimezone );
|
||||
@@ -450,7 +458,8 @@ class _Event extends \IPS\Content\Item implements
|
||||
{
|
||||
if ( $recurringData['repeat_freq_on_' . $day['ical'] ] == TRUE )
|
||||
{
|
||||
$_repeatDays[] = \IPS\calendar\Date::getDayNames()[$key-$offset]['english'];
|
||||
$lookup = ( $key - $offset ) < 0 ? ( $key + $offset ) : ( $key - $offset );
|
||||
$_repeatDays[] = \IPS\calendar\Date::getDayNames()[ $lookup ]['english'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1752,11 +1761,7 @@ class _Event extends \IPS\Content\Item implements
|
||||
}
|
||||
|
||||
/* Store time zone information */
|
||||
if ( isset( $values['event_dates']['all_day'] ) AND $values['event_dates']['all_day'] )
|
||||
{
|
||||
$this->timezone = 'UTC';
|
||||
}
|
||||
elseif ( isset( $values['event_dates']['event_timezone'] ) )
|
||||
if ( isset( $values['event_dates']['event_timezone'] ) )
|
||||
{
|
||||
$this->timezone = $values['event_dates']['event_timezone'];
|
||||
}
|
||||
@@ -2077,7 +2082,7 @@ class _Event extends \IPS\Content\Item implements
|
||||
|
||||
if( $location )
|
||||
{
|
||||
$where[] = array( '( event_location IS NOT NULL )' );
|
||||
$where[] = array( '( event_latitude IS NOT NULL AND event_longitude IS NOT NULL )' );
|
||||
}
|
||||
|
||||
/* Load member */
|
||||
@@ -2436,7 +2441,7 @@ class _Event extends \IPS\Content\Item implements
|
||||
$nextOccurance = $startDate;
|
||||
if ( $itemData['event_recurring'] )
|
||||
{
|
||||
$occurances = \IPS\calendar\Event::_findOccurances( $startDate, $endDate, $startDate->adjust( "-1 month" ), $startDate->adjust( "+2 years" ), \IPS\calendar\Icalendar\ICSParser::parseRrule( $itemData['event_recurring'] ) );
|
||||
$occurances = \IPS\calendar\Event::_findOccurances( $startDate, $endDate, $startDate->adjust( "-1 month" ), $startDate->adjust( "+2 years" ), \IPS\calendar\Icalendar\ICSParser::parseRrule( $itemData['event_recurring'] ), NULL, $itemData['event_all_day'] );
|
||||
foreach( $occurances as $occurrence )
|
||||
{
|
||||
if ( $occurrence['startDate'] AND $occurrence['startDate']->mysqlDatetime( FALSE ) >= $startDate->mysqlDatetime( FALSE ) )
|
||||
@@ -2748,4 +2753,16 @@ class _Event extends \IPS\Content\Item implements
|
||||
|
||||
return $this->happeningData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can the member copy the calendar event?
|
||||
*
|
||||
* @param \IPS\Member|NULL $member
|
||||
* @return bool
|
||||
*/
|
||||
public function canCopyEvent( \IPS\Member $member = NULL ): bool
|
||||
{
|
||||
$member = $member ?: \IPS\Member::loggedIn();
|
||||
return $this->author()->member_id == $member->member_id and $this->container()->can( 'add', $member );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user