Abstract Class humhub\modules\activity\components\BaseActivity

Inheritancehumhub\modules\activity\components\BaseActivity » humhub\components\SocialActivity » yii\base\BaseObject
ImplementsSerializable, humhub\components\rendering\Viewable
Subclasseshumhub\modules\comment\activities\NewComment, humhub\modules\content\activities\ContentCreated, humhub\modules\like\activities\Liked, humhub\modules\space\activities\Created, humhub\modules\space\activities\MemberAdded, humhub\modules\space\activities\MemberRemoved, humhub\modules\space\activities\SpaceArchived, humhub\modules\space\activities\SpaceUnArchived, humhub\modules\user\activities\UserFollow

BaseActivity is the base class for all activities.

Public Methods

Hide inherited methods

MethodDescriptionDefined By
about() Builder function for the source. humhub\modules\activity\components\BaseActivity
asArray() Returns an array representation of this notification. humhub\components\SocialActivity
container() Builder function for setting ContentContainerActiveRecord humhub\modules\activity\components\BaseActivity
create() Creates an activity model and determines the contentContainer/visibility humhub\modules\activity\components\BaseActivity
from() Builder function for the originator. humhub\modules\activity\components\BaseActivity
getContent() Returns the related content instance in case the source is of type ContentOwner. humhub\components\SocialActivity
getContentContainer() Determines if the activity source is related to an ContentContainer. humhub\components\SocialActivity
getContentInfo() Build info text about a content humhub\components\SocialActivity
getContentName() Returns the content name of $content or if not $content is provided of the notification source. humhub\components\SocialActivity
getContentPreview() Returns a short preview text of the content. The max length can be defined by setting $maxLength (25 by default). humhub\components\SocialActivity
getSpace() humhub\components\SocialActivity
getSpaceId() humhub\components\SocialActivity
getUrl() Url of the origin of this notification If source is a Content / ContentAddon / ContentContainer this will automatically generated. humhub\components\SocialActivity
getViewName() humhub\components\rendering\Viewable
getViewParams() Returns an array of view parameter, required for rendering. humhub\modules\activity\components\BaseActivity
hasContent() Determines if this activity is related to a content. This is the case if the activitiy source is of type ContentOwner. humhub\components\SocialActivity
html() humhub\components\rendering\Viewable
init() humhub\modules\activity\components\BaseActivity
instance() Static initializer should be prefered over new initialization, since it makes use of Yii::createObject dependency injection/configuration. humhub\components\SocialActivity
json() humhub\components\rendering\Viewable
save() Stores the activity in database humhub\modules\activity\components\BaseActivity
serialize() Serializes the $source and $originator fields. humhub\components\SocialActivity
text() humhub\components\rendering\Viewable
unserialize() Unserializes the given string, calls the init() function and sets the $source and $originator fields (and $record indirectyl). humhub\components\SocialActivity
validate() Validates the existence of required attributes humhub\components\SocialActivity

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
getContentVisibility() Returns the visibility of the content humhub\modules\activity\components\BaseActivity
getOriginatorId() Returns the user id of the originator of this activity humhub\modules\activity\components\BaseActivity

Property Details

$clickable public property
public boolean $clickable true
$recordClass public property

Record class used for instantiation.

public string $recordClass = \humhub\modules\activity\models\Activity::class
$visibility public property
public integer $visibility = \humhub\modules\content\models\Content::VISIBILITY_PRIVATE

Method Details

about() public method

Builder function for the source.

public $this about ( $source )
$source \yii\db\ActiveRecord
container() public method

Builder function for setting ContentContainerActiveRecord

public humhub\modules\activity\components\BaseActivity container ( $container )
$container humhub\modules\content\components\ContentContainerActiveRecord
create() public method

Creates an activity model and determines the contentContainer/visibility

public static create ( )
throws \yii\base\Exception
from() public method

Builder function for the originator.

public humhub\components\SocialActivity from ( $originator )
$originator humhub\modules\user\models\User
getContentVisibility() protected method

Returns the visibility of the content

protected integer getContentVisibility ( )
return integer

The visibility

getOriginatorId() protected method

Returns the user id of the originator of this activity

protected integer getOriginatorId ( )
return integer

User id

getViewParams() public method

Returns an array of view parameter, required for rendering.

public void getViewParams ( $params = [] )
$params array
init() public method

public void init ( )
save() public method

Stores the activity in database

public boolean save ( )