public function run() { $currentRoom = null; $currentRoomGuid = ""; if (isset(Yii::app()->params['currentRoom']) && Yii::app()->params['currentRoom'] != null) { $currentRoom = Yii::app()->params['currentRoom']; $currentRoomGuid = $currentRoom->guid; } $this->render('yourRoomsMenu', array('currentRoom' => $currentRoom, 'currentRoomGuid' => $currentRoomGuid, 'usersRooms' => RoomMembership::GetUserRooms())); }
/** * On User delete, also delete his space related stuff * * @param type $event */ public static function onUserDelete($event) { $user = $event->sender; // Check if the user owns some spaces foreach (RoomMembership::GetUserRooms($user->id) as $room) { if ($room->isRoomOwner($user->id)) { throw new CHttpException(500, Yii::t('RoomsModule.base', 'Could not delete user who is a room owner! Name of Room: {roomName}', array('roomName' => $room->name))); } } // Cancel all space memberships foreach (RoomMembership::model()->findAllByAttributes(array('user_id' => $user->id)) as $membership) { $membership->room->removeMember($user->id); } // Cancel all space invites by the user foreach (RoomMembership::model()->findAllByAttributes(array('originator_user_id' => $user->id, 'status' => RoomMembership::STATUS_INVITED)) as $membership) { $membership->room->removeMember($membership->user_id); } return true; }