Created
extends BaseActivity
in package
Description of SpaceCreated
Tags
Table of Contents
Properties
- $clickable : bool
- $moduleId : mixed
- $originator : User
- User which performed the activity.
- $record : ActiveRecord
- An SocialActivity can be represented in the database as ActiveRecord.
- $record : Activity
- An SocialActivity can be represented in the database as ActiveRecord.
- $recordClass : string
- $requireOriginator : bool
- $requireSource : bool
- $source : ActiveRecord
- The source instance which created this activity
- $viewName : mixed
- $visibility : int
- Default content visibility of this Activity.
Methods
- __call() : mixed
- Calls the named method which is not a class method.
- __construct() : mixed
- Constructor.
- __get() : mixed
- Returns the value of an object property.
- __isset() : bool
- Checks if a property is set, i.e. defined and not null.
- __serialize() : array<string|int, mixed>
- Serializes the $source and $originator fields.
- __set() : mixed
- Sets value of an object property.
- __unserialize() : mixed
- Unserializes the given string, calls the init() function and sets the $source and $originator fields (and $record indirectyl).
- __unset() : mixed
- Sets an object property to null.
- about() : $this
- Builder function for the source.
- asArray() : mixed
- Returns an array representation of this notification.
- canGetProperty() : bool
- Returns a value indicating whether a property can be read.
- canSetProperty() : bool
- Returns a value indicating whether a property can be set.
- className() : string
- Returns the fully qualified name of this class.
- container() : BaseActivity
- Builder function for setting ContentContainerActiveRecord
- create() : static
- Creates an activity model and determines the contentContainer/visibility
- from() : SocialActivity
- Builder function for the originator.
- getContent() : Content
- Returns the related content instance in case the source is of type ContentOwner.
- getContentContainer() : ContentContainerActiveRecord
- Determines if the activity source is related to an ContentContainer.
- getContentInfo() : string|null
- Build info text about a content
- getContentName() : string|null
- Returns the content name of $content or if not $content is provided of the notification source.
- getContentPlainTextInfo() : string|null
- Builds plain text info text about a given content
- getContentPlainTextPreview() : string|null
- Returns a short preview text of the content in plain text. The max length can be defined by setting $maxLength (60 by default).
- getContentPreview() : string|null
- Returns a short preview text of the content. The max length can be defined by setting $maxLength (60 by default).
- getSpace() : Space
- getSpaceId() : int
- getUrl() : string
- Url of the origin of this notification If source is a Content / ContentAddon / ContentContainer this will automatically generated.
- getViewName() : string
- getViewParams() : mixed
- Returns an array of view parameter, required for rendering.
- hasContent() : bool
- Determines if this activity is related to a content. This is the case if the activitiy source is of type ContentOwner.
- hasMethod() : bool
- Returns a value indicating whether a method is defined.
- hasProperty() : bool
- Returns a value indicating whether a property is defined.
- html() : string
- init() : mixed
- Initializes the object.
- instance() : static
- Static initializer should be prefered over new initialization, since it makes use of Yii::createObject dependency injection/configuration.
- json() : string
- save() : bool
- Stores the activity in database
- text() : string
- validate() : bool
- Validates the existence of required attributes
- getContentVisibility() : int
- Returns the visibility of the content
- getOriginatorId() : int
- Returns the user id of the originator of this activity
- saveModelInstance() : mixed
- Saves the underlying Activity model record.
Properties
$clickable
public
bool
$clickable
= false
Tags
$moduleId
public
mixed
$moduleId
= 'space'
Tags
$originator
User which performed the activity.
public
User
$originator
$record
An SocialActivity can be represented in the database as ActiveRecord.
public
ActiveRecord
$record
By defining the $recordClass an ActiveRecord will be created automatically within the init function.
The related record for this activitiy
$record
An SocialActivity can be represented in the database as ActiveRecord.
public
Activity
$record
The related record for this activitiy
$recordClass
public
string
$recordClass
= \humhub\modules\activity\models\Activity::class
Record class used for instantiation.
Tags
$requireOriginator
public
bool
$requireOriginator
= true
ensure originator existence
Tags
$requireSource
public
bool
$requireSource
= true
ensure source existence
Tags
$source
The source instance which created this activity
public
ActiveRecord
$source
$viewName
public
mixed
$viewName
= 'created'
Tags
$visibility
Default content visibility of this Activity.
public
int
$visibility
= \humhub\modules\content\models\Content::VISIBILITY_PRIVATE
Methods
__call()
Calls the named method which is not a class method.
public
__call(string $name, array<string|int, mixed> $params) : mixed
Do not call this method directly as it is a PHP magic method that will be implicitly called when an unknown method is being invoked.
Parameters
- $name : string
-
the method name
- $params : array<string|int, mixed>
-
method parameters
Tags
Return values
mixed —the method return value
__construct()
Constructor.
public
__construct([array<string|int, mixed> $config = [] ]) : mixed
The default implementation does two things:
- Initializes the object with the given configuration
$config
. - Call [[init()]].
If this method is overridden in a child class, it is recommended that
- the last parameter of the constructor is a configuration array, like
$config
here. - call the parent implementation at the end of the constructor.
Parameters
- $config : array<string|int, mixed> = []
-
name-value pairs that will be used to initialize the object properties
__get()
Returns the value of an object property.
public
__get(string $name) : mixed
Do not call this method directly as it is a PHP magic method that
will be implicitly called when executing $value = $object->property;
.
Parameters
- $name : string
-
the property name
Tags
Return values
mixed —the property value
__isset()
Checks if a property is set, i.e. defined and not null.
public
__isset(string $name) : bool
Do not call this method directly as it is a PHP magic method that
will be implicitly called when executing isset($object->property)
.
Note that if the property is not defined, false will be returned.
Parameters
- $name : string
-
the property name or the event name
Tags
Return values
bool —whether the named property is set (not null).
__serialize()
Serializes the $source and $originator fields.
public
__serialize() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>__set()
Sets value of an object property.
public
__set(string $name, mixed $value) : mixed
Do not call this method directly as it is a PHP magic method that
will be implicitly called when executing $object->property = $value;
.
Parameters
- $name : string
-
the property name or the event name
- $value : mixed
-
the property value
Tags
__unserialize()
Unserializes the given string, calls the init() function and sets the $source and $originator fields (and $record indirectyl).
public
__unserialize(mixed $unserializedArr) : mixed
Parameters
- $unserializedArr : mixed
Tags
__unset()
Sets an object property to null.
public
__unset(string $name) : mixed
Do not call this method directly as it is a PHP magic method that
will be implicitly called when executing unset($object->property)
.
Note that if the property is not defined, this method will do nothing. If the property is read-only, it will throw an exception.
Parameters
- $name : string
-
the property name
Tags
about()
Builder function for the source.
public
about(mixed $source) : $this
Parameters
- $source : mixed
Tags
Return values
$thisasArray()
Returns an array representation of this notification.
public
asArray(User $user) : mixed
Parameters
- $user : User
canGetProperty()
Returns a value indicating whether a property can be read.
public
canGetProperty(string $name[, bool $checkVars = true ]) : bool
A property is readable if:
- the class has a getter method associated with the specified name (in this case, property name is case-insensitive);
- the class has a member variable with the specified name (when
$checkVars
is true);
Parameters
- $name : string
-
the property name
- $checkVars : bool = true
-
whether to treat member variables as properties
Tags
Return values
bool —whether the property can be read
canSetProperty()
Returns a value indicating whether a property can be set.
public
canSetProperty(string $name[, bool $checkVars = true ]) : bool
A property is writable if:
- the class has a setter method associated with the specified name (in this case, property name is case-insensitive);
- the class has a member variable with the specified name (when
$checkVars
is true);
Parameters
- $name : string
-
the property name
- $checkVars : bool = true
-
whether to treat member variables as properties
Tags
Return values
bool —whether the property can be written
className()
Returns the fully qualified name of this class.
public
static className() : string
Tags
Return values
string —the fully qualified name of this class.
container()
Builder function for setting ContentContainerActiveRecord
public
container(ContentContainerActiveRecord $container) : BaseActivity
Parameters
- $container : ContentContainerActiveRecord
Return values
BaseActivitycreate()
Creates an activity model and determines the contentContainer/visibility
public
create() : static
Tags
Return values
staticfrom()
Builder function for the originator.
public
from(mixed $originator) : SocialActivity
Parameters
- $originator : mixed
Tags
Return values
SocialActivitygetContent()
Returns the related content instance in case the source is of type ContentOwner.
public
getContent() : Content
Return values
Content —Content ActiveRecord or null if not related to a ContentOwner source
getContentContainer()
Determines if the activity source is related to an ContentContainer.
public
getContentContainer() : ContentContainerActiveRecord
This is the case if the source is either a ContentContainerActiveRecord itself or a ContentOwner.
Tags
Return values
ContentContainerActiveRecordgetContentInfo()
Build info text about a content
public
getContentInfo([Content $content = null ][, mixed $withContentName = true ]) : string|null
This is a combination of the type of the content with a short preview of it.
If no $content is provided the contentInfo of $source is returned.
Parameters
- $content : Content = null
- $withContentName : mixed = true
Tags
Return values
string|nullgetContentName()
Returns the content name of $content or if not $content is provided of the notification source.
public
getContentName([ContentOwner $content = null ]) : string|null
Parameters
- $content : ContentOwner = null
Return values
string|nullgetContentPlainTextInfo()
Builds plain text info text about a given content
public
getContentPlainTextInfo([Content $content = null ][, mixed $withContentName = true ]) : string|null
This is a combination of the type of the content with a short preview of it.
Note: This should only be used for mail subjects and other plain text
If no $content is provided the contentInfo of $source is returned.
Parameters
- $content : Content = null
- $withContentName : mixed = true
Tags
Return values
string|nullgetContentPlainTextPreview()
Returns a short preview text of the content in plain text. The max length can be defined by setting $maxLength (60 by default).
public
getContentPlainTextPreview([ContentOwner $content = null ][, int $maxLength = 60 ]) : string|null
If no $content is provided the contentPreview of $source is returned.
Note: This should only be used for mail subjects and other plain text
Parameters
- $content : ContentOwner = null
- $maxLength : int = 60
Tags
Return values
string|nullgetContentPreview()
Returns a short preview text of the content. The max length can be defined by setting $maxLength (60 by default).
public
getContentPreview([ContentOwner $content = null ][, int $maxLength = 60 ]) : string|null
If no $content is provided the contentPreview of $source is returned.
Parameters
- $content : ContentOwner = null
- $maxLength : int = 60
Tags
Return values
string|nullgetSpace()
public
getSpace() : Space
Tags
Return values
Space —related space instance in case the activity source is an related contentcontainer of type space, otherwise null
getSpaceId()
public
getSpaceId() : int
Tags
Return values
int —related space id in case the activity source is an related contentcontainer of type space, otherwise null
getUrl()
Url of the origin of this notification If source is a Content / ContentAddon / ContentContainer this will automatically generated.
public
getUrl() : string
NOTE: Returned URL must be absolute with scheme
Return values
stringgetViewName()
public
getViewName() : string
Tags
Return values
string —viewname of this viewable
getViewParams()
Returns an array of view parameter, required for rendering.
public
getViewParams([mixed $params = [] ]) : mixed
Parameters
- $params : mixed = []
Tags
hasContent()
Determines if this activity is related to a content. This is the case if the activitiy source is of type ContentOwner.
public
hasContent() : bool
Return values
bool —true if this activity is related to a ContentOwner else false
hasMethod()
Returns a value indicating whether a method is defined.
public
hasMethod(string $name) : bool
The default implementation is a call to php function method_exists()
.
You may override this method when you implemented the php magic method __call()
.
Parameters
- $name : string
-
the method name
Return values
bool —whether the method is defined
hasProperty()
Returns a value indicating whether a property is defined.
public
hasProperty(string $name[, bool $checkVars = true ]) : bool
A property is defined if:
- the class has a getter or setter method associated with the specified name (in this case, property name is case-insensitive);
- the class has a member variable with the specified name (when
$checkVars
is true);
Parameters
- $name : string
-
the property name
- $checkVars : bool = true
-
whether to treat member variables as properties
Tags
Return values
bool —whether the property is defined
html()
public
html() : string
Tags
Return values
string —html content representation of this viewable.
init()
Initializes the object.
public
init() : mixed
Tags
instance()
Static initializer should be prefered over new initialization, since it makes use of Yii::createObject dependency injection/configuration.
public
static instance([array<string|int, mixed> $options = [] ]) : static
Parameters
- $options : array<string|int, mixed> = []
Tags
Return values
staticjson()
public
json() : string
Tags
Return values
string —json content representation of this viewable.
save()
Stores the activity in database
public
save() : bool
Return values
booltext()
public
text() : string
Tags
Return values
string —text content representation of this viewable.
validate()
Validates the existence of required attributes
public
validate() : bool
Return values
boolgetContentVisibility()
Returns the visibility of the content
protected
getContentVisibility() : int
Return values
int —the visibility
getOriginatorId()
Returns the user id of the originator of this activity
protected
getOriginatorId() : int
Return values
int —user id
saveModelInstance()
Saves the underlying Activity model record.
private
saveModelInstance() : mixed