Methods

generateEvent()

generateEvent() : \OCP\Activity\IEvent

Generates a new IEvent object

Make sure to call at least the following methods before sending it to the app with via the publish() method:

  • setApp()
  • setType()
  • setAffectedUser()
  • setSubject()

Returns

\OCP\Activity\IEvent

publish()

publish(\OCP\Activity\IEvent  $event) : null

Publish an event to the activity consumers

Make sure to call at least the following methods before sending an Event:

  • setApp()
  • setType()
  • setAffectedUser()
  • setSubject()

Parameters

\OCP\Activity\IEvent $event

Returns

null

publishActivity()

publishActivity(string  $app, string  $subject, array  $subjectParams, string  $message, array  $messageParams, string  $file, string  $link, string  $affectedUser, string  $type, integer  $priority) : null

Parameters

string $app

The app where this event is associated with

string $subject

A short description of the event

array $subjectParams

Array with parameters that are filled in the subject

string $message

A longer description of the event

array $messageParams

Array with parameters that are filled in the message

string $file

The file including path where this event is associated with

string $link

A link where this event is associated with

string $affectedUser

Recipient of the activity

string $type

Type of the notification

integer $priority

Priority of the notification

Returns

null

registerConsumer()

registerConsumer(\Closure  $callable) : void

In order to improve lazy loading a closure can be registered which will be called in case activity consumers are actually requested

$callable has to return an instance of \OCP\Activity\IConsumer

Parameters

\Closure $callable

registerExtension()

registerExtension(\Closure  $callable) : void

In order to improve lazy loading a closure can be registered which will be called in case activity consumers are actually requested

$callable has to return an instance of \OCP\Activity\IExtension

Parameters

\Closure $callable

getNotificationTypes()

getNotificationTypes(string  $languageCode) : array

Will return additional notification types as specified by other apps

Parameters

string $languageCode

Returns

array —

Array "stringID of the type" => "translated string description for the setting" or Array "stringID of the type" => [ 'desc' => "translated string description for the setting" 'methods' => [\OCP\Activity\IExtension::METHOD_*], ]

getDefaultTypes()

getDefaultTypes(string  $method) : array

Parameters

string $method

Returns

array

getTypeIcon()

getTypeIcon(string  $type) : string

Parameters

string $type

Returns

string

setFormattingObject()

setFormattingObject(string  $type, integer  $id) 

Parameters

string $type
integer $id

isFormattingFilteredObject()

isFormattingFilteredObject() : boolean

Returns

boolean

translate()

translate(string  $app, string  $text, array  $params, boolean  $stripPath, boolean  $highlightParams, string  $languageCode) : string|false

Parameters

string $app
string $text
array $params
boolean $stripPath
boolean $highlightParams
string $languageCode

Returns

string|false

getSpecialParameterList()

getSpecialParameterList(string  $app, string  $text) : array|false

Parameters

string $app
string $text

Returns

array|false

getGroupParameter()

getGroupParameter(array  $activity) : integer|false

Parameters

array $activity

Returns

integer|false

getNavigation()

getNavigation() : array

Returns

array

isFilterValid()

isFilterValid(string  $filterValue) : boolean

Parameters

string $filterValue

Returns

boolean

filterNotificationTypes()

filterNotificationTypes(array  $types, string  $filter) : array

Parameters

array $types
string $filter

Returns

array

getQueryForFilter()

getQueryForFilter(string  $filter) : array

Parameters

string $filter

Returns

array

setCurrentUserId()

setCurrentUserId(string|null  $currentUserId) 

Set the user we need to use

Parameters

string|null $currentUserId

Throws

\UnexpectedValueException

If the user is invalid

getCurrentUserId()

getCurrentUserId() : string

Get the user we need to use

Either the user is logged in, or we try to get it from the token

Throws

\UnexpectedValueException

If the token is invalid, does not exist or is not unique

Returns

string