Exemple #1
0
 /**
  * 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;
 }
Exemple #2
0
        <?php 
    echo Gravatar::widget(['email' => $model->getEmail(), 'defaultImage' => 'identicon', 'rating' => 'r', 'options' => ['alt' => Yii::t('podium/view', 'Your Gravatar image'), 'class' => 'img-circle img-responsive']]);
} elseif (!empty($model->meta->avatar)) {
    ?>
        <img class="img-circle img-responsive" src="/avatars/<?php 
    echo $model->meta->avatar;
    ?>
" alt="<?php 
    echo Yii::t('podium/view', 'Your avatar');
    ?>
">
<?php 
} else {
    ?>
        <img class="img-circle img-responsive" src="<?php 
    echo Helper::defaultAvatar();
    ?>
" alt="<?php 
    echo Yii::t('podium/view', 'Default avatar');
    ?>
">
<?php 
}
?>
    </div>
</div>
<?php 
if (!Yii::$app->user->isGuest) {
    ?>
<div class="modal fade" tabindex="-1" role="dialog" aria-labelledby="podiumModalIgnoreLabel" aria-hidden="true" id="podiumModalIgnore">
    <div class="modal-dialog">