Пример #1
0
 public function init()
 {
     parent::init();
 }
Пример #2
0
 /**
  * Get dialog image
  *
  * @return array
  */
 public function getInterlocutorImage()
 {
     $users = $this->innerMessageUsers;
     if (empty($users)) {
         throw new \BadMethodCallException();
     }
     $image = [];
     $userAvatar = Yii::$app->getSession()->get(Chat::getSessionName()) . Chat::$defaultUserAvatar;
     $avatarMethod = $this->pchatSettings['userAvatarMethod'];
     foreach ($users as $user) {
         if ($user->user_id != Yii::$app->user->id) {
             if ($this->pchatSettings['userModel'] == $avatarMethod['class']) {
                 $tempAvatar = $this->user->{$avatarMethod}['method'];
             } else {
                 $tempAvatar = $this->user->{$avatarMethod}['relation']->{$avatarMethod}['method'];
             }
             if (!empty($tempAvatar)) {
                 $userAvatar = $tempAvatar;
             }
             $image[] = $userAvatar;
         }
     }
     return $image;
 }
Пример #3
0
 /**
  * Get user avatar
  * @return string
  */
 public function getUserAvatar()
 {
     $userAvatar = Yii::$app->getSession()->get(Chat::getSessionName()) . Chat::$defaultUserAvatar;
     if (!empty($this->pchatSettings['userAvatarMethod'])) {
         $avatarMethod = $this->pchatSettings['userAvatarMethod'];
         if ($this->pchatSettings['userModel'] == $avatarMethod['class']) {
             $tempAvatar = $this->user->{$avatarMethod}['method'];
         } else {
             $tempAvatar = $this->user->{$avatarMethod}['relation']->{$avatarMethod}['method'];
         }
         if (!empty($tempAvatar)) {
             $userAvatar = $tempAvatar;
         }
     }
     return $userAvatar;
 }