Esempio n. 1
0
 /**
  * @inheritdoc
  */
 public function run()
 {
     $friendshipsEnabled = Yii::$app->getModule('friendship')->getIsEnabled();
     $countFriends = 0;
     if ($friendshipsEnabled) {
         $countFriends = Friendship::getFriendsQuery($this->user)->count();
     }
     $countFollowing = $this->user->getFollowingCount(User::className()) + $this->user->getFollowingCount(Space::className());
     $countUserSpaces = Membership::getUserSpaceQuery($this->user)->andWhere(['!=', 'space.visibility', Space::VISIBILITY_NONE])->andWhere(['space.status' => Space::STATUS_ENABLED])->count();
     return $this->render('profileHeader', array('user' => $this->user, 'isProfileOwner' => $this->isProfileOwner, 'friendshipsEnabled' => $friendshipsEnabled, 'countFriends' => $countFriends, 'countFollowers' => $this->user->getFollowerCount(), 'countFollowing' => $countFollowing, 'countSpaces' => $countUserSpaces));
 }