/** * Renders the image. * Based on user settings the avatar can be uploaded image, Gravatar image or default one. * @return string */ public function run() { if ($this->author instanceof User) { $avatar = Html::img(Helper::defaultAvatar(), ['class' => 'podium-avatar img-circle img-responsive center-block', 'alt' => Html::encode($this->author->podiumName)]); $meta = $this->author->meta; if ($meta) { if (!empty($meta->gravatar)) { $avatar = Gravatar::widget(['email' => $this->author->email, 'defaultImage' => 'identicon', 'rating' => 'r', 'options' => ['alt' => Html::encode($this->author->podiumName), 'class' => 'podium-avatar img-circle img-responsive center-block']]); } elseif (!empty($meta->avatar)) { $avatar = Html::img('/avatars/' . $meta->avatar, ['class' => 'podium-avatar img-circle img-responsive center-block', 'alt' => Html::encode($this->author->podiumName)]); } } $name = $this->showName ? $this->author->podiumTag : ''; } else { $avatar = Html::img(Helper::defaultAvatar(), ['class' => 'podium-avatar img-circle img-responsive center-block', 'alt' => Yii::t('podium/view', 'User deleted')]); $name = $this->showName ? Helper::deletedUserTag(true) : ''; } $name = $this->showName ? Html::tag('p', $name, ['class' => 'avatar-name']) : ''; return $avatar . $name; }
/** * Returns receiver's name. * @return string */ public function getReceiverName() { return !empty($this->receiverUser) ? $this->receiverUser->getTag() : Helper::deletedUserTag(); }