optimize code and add phpDoc to \user\widgets\views\accountTopMenu.php

This commit is contained in:
githubjeka 2017-10-18 11:21:47 +03:00
parent 7c1aa0ad47
commit 1bf669b892

View File

@ -1,9 +1,17 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2017 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
use \yii\helpers\Html;
use \yii\helpers\Url;
/** @var \humhub\modules\user\models\User $userModel */
$userModel = Yii::$app->user->getIdentity();
?>
<?php if (Yii::$app->user->isGuest): ?>
<?php if ($userModel === null): ?>
<a href="#" class="btn btn-enter" data-action-click="ui.modal.load" data-action-url="<?= Url::toRoute('/user/auth/login'); ?>">
<?php if (Yii::$app->getModule('user')->settings->get('auth.anonymousRegistration')): ?>
<?= Yii::t('UserModule.base', 'Sign in / up'); ?>
@ -18,12 +26,12 @@ use \yii\helpers\Url;
<?php if ($this->context->showUserName): ?>
<div class="user-title pull-left hidden-xs">
<strong><?= Html::encode(Yii::$app->user->getIdentity()->displayName); ?></strong><br/><span class="truncate"><?= Html::encode(Yii::$app->user->getIdentity()->profile->title); ?></span>
<strong><?= Html::encode($userModel->displayName); ?></strong><br/><span class="truncate"><?= Html::encode(Yii::$app->user->getIdentity()->profile->title); ?></span>
</div>
<?php endif; ?>
<img id="user-account-image" class="img-rounded"
src="<?= Yii::$app->user->getIdentity()->getProfileImage()->getUrl(); ?>"
src="<?= $userModel->getProfileImage()->getUrl(); ?>"
height="32" width="32" alt="<?= Yii::t('base', 'My profile image')?>" data-src="holder.js/32x32"
style="width: 32px; height: 32px;"/>
@ -44,4 +52,4 @@ use \yii\helpers\Url;
</ul>
</li>
</ul>
<?php endif; ?>
<?php endif; ?>