本文整理汇总了PHP中Activity::CreateForContent方法的典型用法代码示例。如果您正苦于以下问题:PHP Activity::CreateForContent方法的具体用法?PHP Activity::CreateForContent怎么用?PHP Activity::CreateForContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Activity
的用法示例。
在下文中一共展示了Activity::CreateForContent方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: afterSave
public function afterSave()
{
parent::afterSave();
if ($this->isNewRecord) {
$activity = Activity::CreateForContent($this);
$activity->type = "DocumentCreated";
$activity->module = "documents";
$activity->save();
$activity->fire();
}
return true;
}
示例2: afterSave
/**
* After Save Addons
*
* @return type
*/
public function afterSave()
{
parent::afterSave();
if ($this->isNewRecord) {
$activity = Activity::CreateForContent($this);
$activity->type = "QuestionCreated";
$activity->module = "questionanswer";
$activity->save();
$activity->fire();
}
HSearch::getInstance()->addModel($this);
return true;
}
示例3: afterSave
/**
* After Saving of comments, fire an activity
*
* @return type
*/
protected function afterSave()
{
// flush the cache
$this->flushCache();
$activity = Activity::CreateForContent($this);
$activity->type = "CommentCreated";
$activity->module = "comment";
$activity->save();
$activity->fire();
// Send Notifications
NewCommentNotification::fire($this);
AlsoCommentedNotification::fire($this);
return parent::afterSave();
}
示例4: afterSave
/**
* Before Save Addons
*
* @return type
*/
public function afterSave()
{
parent::afterSave();
if ($this->isNewRecord) {
$activity = Activity::CreateForContent($this);
$activity->type = "PostCreated";
$activity->module = "post";
$activity->save();
$activity->fire();
}
// Handle mentioned users
UserMentioning::parse($this, $this->message);
return true;
}
示例5: afterSave
/**
* After Save, delete LikeCount (Cache) for target object
*/
protected function afterSave()
{
Yii::app()->cache->delete('likes_' . $this->object_model . "_" . $this->object_id);
$activity = Activity::CreateForContent($this);
$activity->type = "Like";
$activity->module = "like";
// Object Id for likes are not the Like Object itself
$activity->object_model = $this->object_model;
$activity->object_id = $this->object_id;
$activity->save();
$activity->fire();
// Send Notifications
NewLikeNotification::fire($this);
return parent::afterSave();
}
示例6: afterSave
/**
* After Saving of comments, fire an activity
*
* @return type
*/
protected function afterSave()
{
// flush the cache
$this->flushCache();
$activity = Activity::CreateForContent($this);
$activity->type = "CommentCreated";
$activity->module = "comment";
$activity->save();
$activity->fire();
// Handle mentioned users
// Execute before NewCommentNotification to avoid double notification when mentioned.
UserMentioning::parse($this, $this->message);
if ($this->isNewRecord) {
// Send Notifications
NewCommentNotification::fire($this);
}
return parent::afterSave();
}
示例7: afterSave
/**
* After Saving album fire the album created activity
*/
public function afterSave()
{
parent::afterSave();
if ($this->isNewRecord) {
$activity = Activity::CreateForContent($this);
$activity->type = "AlbumCreated";
$activity->module = "album";
$activity->save();
$activity->fire();
/**
* Fire the Notification to user followers.
*/
AlbumNotification::fire($this);
}
}