Version 4.3.0
This commit is contained in:
1 parent
96997ddd8e
commit
fe1acf984a
1349 files changed
+116159
-67711
No files matched your search
@@ -25,7 +25,6 @@ class _Event extends \IPS\Content\Item implements
|
||||
\IPS\Content\Permissions,
|
||||
\IPS\Content\Tags,
|
||||
\IPS\Content\Followable,
|
||||
\IPS\Content\ReportCenter,
|
||||
\IPS\Content\ReadMarkers,
|
||||
\IPS\Content\Hideable, \IPS\Content\Featurable, \IPS\Content\Lockable,
|
||||
\IPS\Content\Shareable,
|
||||
@@ -33,7 +32,7 @@ class _Event extends \IPS\Content\Item implements
|
||||
\IPS\Content\Embeddable,
|
||||
\IPS\Content\MetaData
|
||||
{
|
||||
use \IPS\Content\Reactable;
|
||||
use \IPS\Content\Reactable, \IPS\Content\Reportable;
|
||||
|
||||
/**
|
||||
* @brief Application
|
||||
@@ -124,6 +123,11 @@ class _Event extends \IPS\Content\Item implements
|
||||
* @brief Cover Photo Storage Extension
|
||||
*/
|
||||
public static $coverPhotoStorageExtension = 'calendar_Events';
|
||||
|
||||
/**
|
||||
* @brief Use a default cover photo
|
||||
*/
|
||||
public static $coverPhotoDefault = true;
|
||||
|
||||
/**
|
||||
* @brief Cached date objects
|
||||
@@ -134,6 +138,11 @@ class _Event extends \IPS\Content\Item implements
|
||||
* @brief Cached venue
|
||||
*/
|
||||
protected $venueObject = NULL;
|
||||
|
||||
/**
|
||||
* @brief Location Data Cache
|
||||
*/
|
||||
protected $locationData = NULL;
|
||||
|
||||
/**
|
||||
* @brief [Content] Key for hide reasons
|
||||
@@ -546,19 +555,19 @@ class _Event extends \IPS\Content\Item implements
|
||||
/* Do we have an occurrences limit? */
|
||||
if( $recurringData['repeat_end_occurrences'] )
|
||||
{
|
||||
while( $occurrences < $recurringData['repeat_end_occurrences'] )
|
||||
$period = new \DatePeriod( $date, new \DateInterval( 'P' . $recurringData['event_repeat_freq'] . mb_strtoupper( mb_substr( $keyword, 0, 1 ) ) ), $recurringData['repeat_end_occurrences'] );
|
||||
|
||||
foreach( $period as $dateOccurrence )
|
||||
{
|
||||
if( ( $date->mysqlDatetime( FALSE ) >= $startDate->mysqlDatetime( FALSE ) AND $date->mysqlDatetime( FALSE ) <= $endDate->mysqlDatetime( FALSE ) ) OR
|
||||
if( ( $dateOccurrence->mysqlDatetime( FALSE ) >= $startDate->mysqlDatetime( FALSE ) AND $dateOccurrence->mysqlDatetime( FALSE ) <= $endDate->mysqlDatetime( FALSE ) ) OR
|
||||
( $eDate !== NULL AND $eDate->mysqlDatetime( FALSE ) >= $startDate->mysqlDatetime( FALSE ) AND $eDate->mysqlDatetime( FALSE ) <= $endDate->mysqlDatetime( FALSE ) ) OR
|
||||
( $eDate !== NULL AND $date->mysqlDatetime( FALSE ) <= $startDate->mysqlDatetime( FALSE ) AND $eDate->mysqlDatetime( FALSE ) >= $endDate->mysqlDatetime( FALSE ) )
|
||||
)
|
||||
{
|
||||
$results[] = array( 'startDate' => $date, 'endDate' => $eDate );
|
||||
$results[] = array( 'startDate' => new \IPS\calendar\Date( $dateOccurrence->mysqlDatetime( FALSE, TRUE ) ), 'endDate' => $eDate );
|
||||
}
|
||||
|
||||
$date = $date->adjust( "+{$recurringData['event_repeat_freq']} {$keyword}" );
|
||||
$eDate = ( $eDate !== NULL ) ? $eDate->adjust( "+{$recurringData['event_repeat_freq']} {$keyword}" ) : NULL;
|
||||
$occurrences++;
|
||||
}
|
||||
}
|
||||
/* Do we have an end date for the recurrences? */
|
||||
@@ -566,34 +575,36 @@ class _Event extends \IPS\Content\Item implements
|
||||
{
|
||||
$endDateToUse = ( $endDate->mysqlDatetime( FALSE ) < $recurringData['repeat_end_date']->mysqlDatetime( FALSE ) ) ? $endDate : $recurringData['repeat_end_date'];
|
||||
|
||||
while( $date->mysqlDatetime( FALSE ) <= $endDateToUse->mysqlDatetime( FALSE ) )
|
||||
$period = new \DatePeriod( $date, new \DateInterval( 'P' . $recurringData['event_repeat_freq'] . mb_strtoupper( mb_substr( $keyword, 0, 1 ) ) ), $endDateToUse );
|
||||
|
||||
foreach( $period as $dateOccurrence )
|
||||
{
|
||||
if( ( $date->mysqlDatetime( FALSE ) >= $startDate->mysqlDatetime( FALSE ) AND $date->mysqlDatetime( FALSE ) <= $endDate->mysqlDatetime( FALSE ) ) OR
|
||||
if( ( $dateOccurrence->mysqlDatetime( FALSE ) >= $startDate->mysqlDatetime( FALSE ) AND $dateOccurrence->mysqlDatetime( FALSE ) <= $endDate->mysqlDatetime( FALSE ) ) OR
|
||||
( $eDate !== NULL AND $eDate->mysqlDatetime( FALSE ) >= $startDate->mysqlDatetime( FALSE ) AND $eDate->mysqlDatetime( FALSE ) <= $endDate->mysqlDatetime( FALSE ) ) OR
|
||||
( $eDate !== NULL AND $date->mysqlDatetime( FALSE ) <= $startDate->mysqlDatetime( FALSE ) AND $eDate->mysqlDatetime( FALSE ) >= $endDate->mysqlDatetime( FALSE ) )
|
||||
)
|
||||
{
|
||||
$results[] = array( 'startDate' => $date, 'endDate' => $eDate );
|
||||
$results[] = array( 'startDate' => new \IPS\calendar\Date( $dateOccurrence->mysqlDatetime( FALSE, TRUE ) ), 'endDate' => $eDate );
|
||||
}
|
||||
|
||||
$date = $date->adjust( "+{$recurringData['event_repeat_freq']} {$keyword}" );
|
||||
$eDate = ( $eDate !== NULL ) ? $eDate->adjust( "+{$recurringData['event_repeat_freq']} {$keyword}" ) : NULL;
|
||||
}
|
||||
}
|
||||
/* Recurs indefinitely... the most fun type... */
|
||||
else
|
||||
{
|
||||
while( $date->mysqlDatetime( FALSE ) <= $endDate->mysqlDatetime( FALSE ) )
|
||||
$period = new \DatePeriod( $date, new \DateInterval( 'P' . $recurringData['event_repeat_freq'] . mb_strtoupper( mb_substr( $keyword, 0, 1 ) ) ), $endDate );
|
||||
|
||||
foreach( $period as $dateOccurrence )
|
||||
{
|
||||
if( ( $date->mysqlDatetime( FALSE ) >= $startDate->mysqlDatetime( FALSE ) AND $date->mysqlDatetime( FALSE ) <= $endDate->mysqlDatetime( FALSE ) ) OR
|
||||
if( ( $dateOccurrence->mysqlDatetime( FALSE ) >= $startDate->mysqlDatetime( FALSE ) AND $dateOccurrence->mysqlDatetime( FALSE ) <= $endDate->mysqlDatetime( FALSE ) ) OR
|
||||
( $eDate !== NULL AND $eDate->mysqlDatetime( FALSE ) >= $startDate->mysqlDatetime( FALSE ) AND $eDate->mysqlDatetime( FALSE ) <= $endDate->mysqlDatetime( FALSE ) ) OR
|
||||
( $eDate !== NULL AND $date->mysqlDatetime( FALSE ) <= $startDate->mysqlDatetime( FALSE ) AND $eDate->mysqlDatetime( FALSE ) >= $endDate->mysqlDatetime( FALSE ) )
|
||||
)
|
||||
{
|
||||
$results[] = array( 'startDate' => $date, 'endDate' => $eDate );
|
||||
$results[] = array( 'startDate' => new \IPS\calendar\Date( $dateOccurrence->mysqlDatetime( FALSE, TRUE ) ), 'endDate' => $eDate );
|
||||
}
|
||||
|
||||
$date = $date->adjust( "+{$recurringData['event_repeat_freq']} {$keyword}" );
|
||||
$eDate = ( $eDate !== NULL ) ? $eDate->adjust( "+{$recurringData['event_repeat_freq']} {$keyword}" ) : NULL;
|
||||
}
|
||||
}
|
||||
@@ -622,7 +633,7 @@ class _Event extends \IPS\Content\Item implements
|
||||
{
|
||||
foreach( $this->parsedOccurrences as $occurrence )
|
||||
{
|
||||
if( $occurrence[ $type ] AND $occurrence[ $type ]->mysqlDatetime( FALSE ) >= $date->mysqlDatetime( FALSE ) )
|
||||
if( $occurrence[ $type ] AND $occurrence[ $type ]->mysqlDatetime( FALSE, TRUE ) >= $date->mysqlDatetime( FALSE, TRUE ) )
|
||||
{
|
||||
return $occurrence[ $type ];
|
||||
}
|
||||
@@ -632,7 +643,7 @@ class _Event extends \IPS\Content\Item implements
|
||||
/* Get the occurrences over the next year then and try from there. We go back one month to start with to account for the event stream. */
|
||||
foreach( $this->findOccurrences( $date->adjust( "-1 month" ), $date->adjust( "+2 years" ) ) as $occurrence )
|
||||
{
|
||||
if( $occurrence[ $type ] AND $occurrence[ $type ]->mysqlDatetime( FALSE ) >= $date->mysqlDatetime( FALSE ) )
|
||||
if( $occurrence[ $type ] AND $occurrence[ $type ]->mysqlDatetime( FALSE, TRUE ) >= $date->mysqlDatetime( FALSE, TRUE ) )
|
||||
{
|
||||
return $occurrence[ $type ];
|
||||
}
|
||||
@@ -905,9 +916,9 @@ class _Event extends \IPS\Content\Item implements
|
||||
*/
|
||||
public static function contentTableTemplate()
|
||||
{
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'calendar.css', 'calendar' ) );
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'calendar_responsive.css', 'calendar' ) );
|
||||
return array( \IPS\Theme::i()->getTemplate( 'global', 'calendar' ), 'rows' );
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'calendar.css', 'calendar', 'front' ) );
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'calendar_responsive.css', 'calendar', 'front' ) );
|
||||
return array( \IPS\Theme::i()->getTemplate( 'global', 'calendar', 'front' ), 'rows' );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1011,7 +1022,7 @@ class _Event extends \IPS\Content\Item implements
|
||||
{
|
||||
if ( $container and $container->moderate and !$member->group['g_avoid_q'] )
|
||||
{
|
||||
return TRUE;
|
||||
return !static::modPermission( 'approve', $member, $container );
|
||||
}
|
||||
|
||||
return parent::moderateNewItems( $member, $container );
|
||||
@@ -1086,6 +1097,15 @@ class _Event extends \IPS\Content\Item implements
|
||||
'repeat_end_date' => NULL, /* Ends on x date (which is separate from the event end date - e.g. jan 9 2014 3pm to jan 10 2014 3pm, repeat annually until jan 9 2019) */
|
||||
);
|
||||
|
||||
/* If we're copying an event, reset the date & time fields */
|
||||
if ( \IPS\Request::i()->do === 'copy' )
|
||||
{
|
||||
$dateValues['start_date'] = NULL;
|
||||
$dateValues['start_time'] = NULL;
|
||||
$dateValues['end_date'] = NULL;
|
||||
$dateValues['end_time'] = NULL;
|
||||
}
|
||||
|
||||
foreach( \IPS\calendar\Date::getDayNames() as $day )
|
||||
{
|
||||
$dateValues['repeat_freq_on_' . $day['ical'] ] = NULL; /* If repeating weekly, this is the days of the week as checkboxes (e.g. repeat every wed, fri and sat) */
|
||||
@@ -1112,6 +1132,11 @@ class _Event extends \IPS\Content\Item implements
|
||||
$val['start_time'] = str_replace( '.', ':', $val['start_time'] );
|
||||
}
|
||||
|
||||
if( isset( $val['no_end_time'] ) AND $val['no_end_time'] AND isset( $val['end_time'] ) )
|
||||
{
|
||||
unset( $val['end_time'] );
|
||||
}
|
||||
|
||||
if( isset( $val['end_time'] ) )
|
||||
{
|
||||
$val['end_time'] = str_replace( '.', ':', $val['end_time'] );
|
||||
@@ -1192,7 +1217,7 @@ class _Event extends \IPS\Content\Item implements
|
||||
}, NULL, NULL, 'event_dates' );
|
||||
|
||||
/* Init */
|
||||
if ( !$container or !$container->club() )
|
||||
if ( ( !$container or !$container->club() ) AND !\IPS\calendar\Calendar::theOnlyNode() )
|
||||
{
|
||||
$return['calendar'] = new \IPS\Helpers\Form\Node( static::$formLangPrefix . 'container', $container ? $container->id : ( isset( \IPS\Request::i()->calendar ) ? \IPS\Request::i()->calendar : NULL ), TRUE, array(
|
||||
'url' => \IPS\Http\Url::internal( 'app=calendar&module=calendar&controller=submit', 'front', 'calendar_submit' ),
|
||||
@@ -1207,7 +1232,7 @@ class _Event extends \IPS\Content\Item implements
|
||||
$return = array_merge( $return, parent::formElements( $item, $container ) );
|
||||
|
||||
/* Event description */
|
||||
$return['description'] = new \IPS\Helpers\Form\Editor( 'event_content', $item ? $item->content : NULL, TRUE, array( 'app' => 'calendar', 'key' => 'Calendar', 'autoSaveKey' => 'calendar-event', 'attachIds' => ( $item === NULL ? NULL : array( $item->id ) ) ) );
|
||||
$return['description'] = new \IPS\Helpers\Form\Editor( 'event_content', $item ? $item->content : NULL, TRUE, array( 'app' => 'calendar', 'key' => 'Calendar', 'autoSaveKey' => 'calendar-event', 'attachIds' => ( $item === NULL ? NULL : array( $item->id, NULL, 'description' ) ) ) );
|
||||
|
||||
/* Cover photo and location */
|
||||
$return['header'] = new \IPS\Helpers\Form\Upload( 'event_cover_photo', ( $item AND $item->cover_photo ) ? \IPS\File::get( 'calendar_Events', $item->cover_photo ) : NULL, FALSE, array( 'image' => TRUE, 'storageExtension' => 'calendar_Events' ) );
|
||||
@@ -1250,6 +1275,12 @@ class _Event extends \IPS\Content\Item implements
|
||||
$return['rsvplimit'] = new \IPS\Helpers\Form\Number( 'event_rsvp_limit', $item ? $item->rsvp_limit : -1, FALSE, array( 'unlimited' => -1 ), NULL, NULL, NULL, 'event_rsvp_limit' );
|
||||
}
|
||||
|
||||
/* If the calendar does not allow comments or reviews, disable the auto follow option */
|
||||
if( $container AND !$container->allow_comments AND !$container->allow_reviews )
|
||||
{
|
||||
unset( $return['auto_follow'] );
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
@@ -1262,7 +1293,7 @@ class _Event extends \IPS\Content\Item implements
|
||||
protected function processBeforeCreate( $values )
|
||||
{
|
||||
/* Post key is very much needed because...bacon */
|
||||
$this->post_key = isset( $values['post_key'] ) ? $values['post_key'] : md5( uniqid() );
|
||||
$this->post_key = isset( $values['post_key'] ) ? $values['post_key'] : md5( mt_rand() );
|
||||
|
||||
parent::processBeforeCreate( $values );
|
||||
}
|
||||
@@ -1281,6 +1312,11 @@ class _Event extends \IPS\Content\Item implements
|
||||
$values['event_dates']['start_time'] = str_replace( '.', ':', $values['event_dates']['start_time'] );
|
||||
}
|
||||
|
||||
if( isset( $values['event_dates']['no_end_time'] ) AND $values['event_dates']['no_end_time'] AND isset( $values['event_dates']['end_time'] ) )
|
||||
{
|
||||
unset( $values['event_dates']['end_time'] );
|
||||
}
|
||||
|
||||
if( isset( $values['event_dates']['end_time'] ) )
|
||||
{
|
||||
$values['event_dates']['end_time'] = str_replace( '.', ':', $values['event_dates']['end_time'] );
|
||||
@@ -1324,7 +1360,7 @@ class _Event extends \IPS\Content\Item implements
|
||||
$this->end_date = \IPS\calendar\Date::createFromForm( $values['event_dates']['start_date'], $values['event_dates']['end_time'], ( isset( $values['event_dates']['all_day'] ) AND $values['event_dates']['all_day'] ) ? 'UTC' : $values['event_dates']['event_timezone'] )->format( 'Y-m-d H:i' );
|
||||
}
|
||||
}
|
||||
else if( ( !isset( $values['event_dates']['all_day'] ) OR !$values['event_dates']['all_day'] ) AND $values['event_dates']['end_time'] != $values['event_dates']['start_time'] )
|
||||
else if( ( !isset( $values['event_dates']['all_day'] ) OR !$values['event_dates']['all_day'] ) AND isset( $values['event_dates']['end_time'] ) AND $values['event_dates']['end_time'] != $values['event_dates']['start_time'] )
|
||||
{
|
||||
$this->end_date = \IPS\calendar\Date::createFromForm( $values['event_dates']['start_date'], $values['event_dates']['end_time'], ( isset( $values['event_dates']['all_day'] ) AND $values['event_dates']['all_day'] ) ? 'UTC' : $values['event_dates']['event_timezone'] )->format( 'Y-m-d H:i' );
|
||||
}
|
||||
@@ -1365,7 +1401,10 @@ class _Event extends \IPS\Content\Item implements
|
||||
$venue = new \IPS\calendar\Venue;
|
||||
$venue->address = json_encode( $values['event_location'] );
|
||||
$venue->save();
|
||||
|
||||
|
||||
/* Node titles can contain HTML, but we should prevent this from user submissions as these go right into the language DB */
|
||||
$values['venue_title'] = array_map( 'strip_tags', $values['venue_title'] );
|
||||
|
||||
\IPS\Lang::saveCustom( 'calendar', 'calendar_venue_' . $venue->id, $values['venue_title'] );
|
||||
\IPS\Lang::saveCustom( 'calendar', 'calendar_venue_' . $venue->id . '_desc', $values['venue_description'] );
|
||||
$venue->title_seo = \IPS\Http\Url\Friendly::seoTitle( $values['venue_title'][ \IPS\Lang::defaultLanguage() ] );
|
||||
@@ -1416,8 +1455,6 @@ class _Event extends \IPS\Content\Item implements
|
||||
{
|
||||
parent::processAfterCreate( $comment, $values );
|
||||
|
||||
$this->expireWidgetCaches();
|
||||
|
||||
/* And claim attachments */
|
||||
\IPS\File::claimAttachments( 'calendar-event', $this->id );
|
||||
|
||||
@@ -1671,7 +1708,7 @@ class _Event extends \IPS\Content\Item implements
|
||||
foreach( $recurringEvents as $event )
|
||||
{
|
||||
/* Find occurrences within our date range (if any) */
|
||||
$thisEndDate = ( $endDate ? $endDate : $startDate->adjust( "+2 years" ) );
|
||||
$thisEndDate = ( $endDate ? $endDate->setTime( 23, 59, 59 ) : $startDate->adjust( "+2 years" ) );
|
||||
$occurrences = $event->findOccurrences( $startDate, $thisEndDate );
|
||||
|
||||
/* Do we have any? */
|
||||
@@ -1739,6 +1776,36 @@ class _Event extends \IPS\Content\Item implements
|
||||
$formattedEvents = array_slice( $formattedEvents, 0, $limit, TRUE );
|
||||
}
|
||||
}
|
||||
/* Resort formatted events by time */
|
||||
else
|
||||
{
|
||||
foreach( $formattedEvents as $date => $type )
|
||||
{
|
||||
foreach( $type as $typeKey => $event )
|
||||
{
|
||||
/* @note: Error suppressor is needed due to PHP bug https://bugs.php.net/bug.php?id=50688 */
|
||||
@usort( $formattedEvents[ $date ][ $typeKey ], function( $a, $b ) use ( $startDate )
|
||||
{
|
||||
if( $a->nextOccurrence( $startDate, 'startDate' ) === NULL )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if( $b->nextOccurrence( $startDate, 'startDate' ) === NULL )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( $a->nextOccurrence( $startDate, 'startDate' )->mysqlDatetime() == $b->nextOccurrence( $startDate, 'startDate' )->mysqlDatetime() )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ( $a->nextOccurrence( $startDate, 'startDate' )->format( 'H:i:s' ) < $b->nextOccurrence( $startDate, 'startDate' )->format( 'H:i:s' ) ) ? -1 : 1;
|
||||
} );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $formattedEvents;
|
||||
}
|
||||
@@ -1855,6 +1922,7 @@ class _Event extends \IPS\Content\Item implements
|
||||
/**
|
||||
* Get output for API
|
||||
*
|
||||
* @param \IPS\Member|NULL $authorizedMember The member making the API request or NULL for API Key / client_credentials
|
||||
* @return array
|
||||
* @apiresponse int id ID number
|
||||
* @apiresponse string title Title
|
||||
@@ -1865,7 +1933,8 @@ class _Event extends \IPS\Content\Item implements
|
||||
* @apiresponse bool rsvp If this event accepts RSVPs
|
||||
* @apiresponse int rsvpLimit The number of RSVPs the event is limited to
|
||||
* @apiresponse \IPS\GeoLocation location The location where the event is taking place
|
||||
* @apiresponse \IPS\Member author The member thgat created the event
|
||||
* @apiresponse \IPS\calendar\Venue venue The venue data
|
||||
* @apiresponse \IPS\Member author The member that created the event
|
||||
* @apiresponse datetime postedDate When the event was created
|
||||
* @apiresponse string description Event description
|
||||
* @apiresponse int comments Number of comments
|
||||
@@ -1878,19 +1947,20 @@ class _Event extends \IPS\Content\Item implements
|
||||
* @apiresponse bool featured Event is featured
|
||||
* @apiresponse string url URL
|
||||
*/
|
||||
public function apiOutput()
|
||||
public function apiOutput( \IPS\Member $authorizedMember = NULL )
|
||||
{
|
||||
return array(
|
||||
'id' => $this->tid,
|
||||
'id' => $this->id,
|
||||
'title' => $this->title,
|
||||
'calendar' => $this->container()->apiOutput(),
|
||||
'calendar' => $this->container()->apiOutput( $authorizedMember ),
|
||||
'start' => $this->_start_date->rfc3339(),
|
||||
'end' => $this->_end_date ? $this->_end_date->rfc3339() : NULL,
|
||||
'recurrence' => $this->recurring,
|
||||
'rsvp' => (bool) $this->rsvp,
|
||||
'rsvpLimit' => $this->rsvp_limit == -1 ? null : $this->rsvp_limit,
|
||||
'location' => $this->location ? \IPS\GeoLocation::buildFromJson( $this->location )->apiOutput() : null,
|
||||
'author' => $this->author()->apiOutput(),
|
||||
'rsvpLimit' => $this->rsvp_limit == -1 ? NULL : $this->rsvp_limit,
|
||||
'location' => $this->_location ? $this->_location->apiOutput( $authorizedMember ) : NULL,
|
||||
'venue' => $this->venue() ? $this->venue()->apiOutput( $authorizedMember ) : NULL,
|
||||
'author' => $this->author()->apiOutput( $authorizedMember ),
|
||||
'postedDate' => \IPS\DateTime::ts( $this->saved )->rfc3339(),
|
||||
'description' => $this->content(),
|
||||
'comments' => $this->comments,
|
||||
@@ -2009,4 +2079,30 @@ class _Event extends \IPS\Content\Item implements
|
||||
{
|
||||
return array( 'core_FeaturedComments', 'core_ContentMessages' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the real location, this method takes also the venue into account
|
||||
*
|
||||
* @return NULL|\IPS\GeoLocation
|
||||
*/
|
||||
public function get__location()
|
||||
{
|
||||
if ( $this->locationData === NULL )
|
||||
{
|
||||
if ( $this->venue() )
|
||||
{
|
||||
$this->locationData = \IPS\GeoLocation::buildFromjson( $this->venue()->address );
|
||||
}
|
||||
else if ( $this->location )
|
||||
{
|
||||
$this->locationData = \IPS\GeoLocation::buildFromjson( $this->location );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->locationData = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->locationData;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user