当前位置: 首页>>代码示例>>PHP>>正文


PHP Activity::fire方法代码示例

本文整理汇总了PHP中Activity::fire方法的典型用法代码示例。如果您正苦于以下问题:PHP Activity::fire方法的具体用法?PHP Activity::fire怎么用?PHP Activity::fire使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Activity的用法示例。


在下文中一共展示了Activity::fire方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: afterSave

 /**
  * After Save Addons
  */
 protected function afterSave()
 {
     // Try To Delete Search Model
     HSearch::getInstance()->deleteModel($this);
     // Newer index a hidden workspace
     if ($this->visibility != self::VISIBILITY_NONE) {
         HSearch::getInstance()->addModel($this);
     }
     $userId = $this->created_by;
     if ($this->isNewRecord) {
         // Create new wall record for this space
         $wall = new Wall();
         $wall->object_model = 'Space';
         $wall->object_id = $this->id;
         $wall->save();
         $this->wall_id = $wall->id;
         $this->wall = $wall;
         Space::model()->updateByPk($this->id, array('wall_id' => $wall->id));
         // Auto add creator as admin
         $membership = new SpaceMembership();
         $membership->space_id = $this->id;
         $membership->user_id = $userId;
         $membership->status = SpaceMembership::STATUS_MEMBER;
         $membership->invite_role = 1;
         $membership->admin_role = 1;
         $membership->share_role = 1;
         $membership->save();
         $activity = new Activity();
         $activity->content->created_by = $userId;
         $activity->content->space_id = $this->id;
         $activity->content->user_id = $userId;
         $activity->content->visibility = Content::VISIBILITY_PUBLIC;
         $activity->created_by = $userId;
         $activity->type = "ActivitySpaceCreated";
         $activity->save();
         $activity->fire();
     }
     Yii::app()->cache->delete('userSpaces_' . $userId);
     parent::afterSave();
 }
开发者ID:skapl,项目名称:design,代码行数:43,代码来源:Space.php

示例2: removeMember

 /**
  * Remove Membership
  *
  * @param $userId UserId of User to Remove
  */
 public function removeMember($userId = "")
 {
     if ($userId == "") {
         $userId = Yii::app()->user->id;
     }
     $user = User::model()->findByPk($userId);
     $membership = $this->getMembership($userId);
     if ($this->isRoomOwner($userId)) {
         return false;
     }
     if ($membership == null) {
         return true;
     }
     // If was member, create a activity for that
     if ($membership->status == RoomMembership::STATUS_MEMBER) {
         $activity = new Activity();
         $activity->content->room_id = $this->getOwner()->id;
         $activity->content->visibility = Content::VISIBILITY_PRIVATE;
         $activity->type = "ActivityRoomMemberRemoved";
         $activity->created_by = $userId;
         $activity->save();
         $activity->fire();
     }
     // Was invited, but declined the request
     if ($membership->status == RoomMembership::STATUS_INVITED) {
         RoomInviteDeclinedNotification::fire($membership->originator_user_id, $user, $this->getOwner());
     }
     foreach (RoomMembership::model()->findAllByAttributes(array('user_id' => $userId, 'room_id' => $this->getOwner()->id)) as $membership) {
         $membership->delete();
     }
     // Cleanup Notifications
     RoomApprovalRequestNotification::remove($userId, $this->getOwner());
     RoomInviteNotification::remove($userId, $this->getOwner());
     RoomApprovalRequestNotification::remove($userId, $this->getOwner());
 }
开发者ID:verdin12345,项目名称:humhub-modules-rooms,代码行数:40,代码来源:RoomModelMembershipBehavior.php

示例3: afterSave

 /**
  * After Save Addons
  */
 protected function afterSave()
 {
     if ($this->status != self::VISIBILITY_NONE) {
         Yii::app()->search->update($this);
     } else {
         Yii::app()->search->delete($this);
     }
     $userId = $this->created_by;
     if ($this->isNewRecord) {
         // Create new wall record for this room
         $wall = new Wall();
         $wall->object_model = 'Room';
         $wall->object_id = $this->id;
         $wall->save();
         $this->wall_id = $wall->id;
         $this->wall = $wall;
         Room::model()->updateByPk($this->id, array('wall_id' => $wall->id));
         // Auto add creator as admin
         $membership = new RoomMembership();
         $membership->room_id = $this->id;
         $membership->user_id = $userId;
         $membership->status = RoomMembership::STATUS_MEMBER;
         $membership->invite_role = 1;
         $membership->admin_role = 1;
         $membership->share_role = 1;
         $membership->save();
         $activity = new Activity();
         $activity->content->created_by = $userId;
         $activity->content->room_id = $this->id;
         $activity->content->user_id = $userId;
         $activity->content->visibility = Content::VISIBILITY_PUBLIC;
         $activity->created_by = $userId;
         $activity->type = "ActivityRoomCreated";
         $activity->save();
         $activity->fire();
     }
     Yii::app()->cache->delete('userRooms_' . $userId);
     parent::afterSave();
 }
开发者ID:verdin12345,项目名称:humhub-modules-rooms,代码行数:42,代码来源:Room.php


注:本文中的Activity::fire方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。