_menu.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /*
  3. * This file is part of the Dektrium project.
  4. *
  5. * (c) Dektrium project <http://github.com/dektrium>
  6. *
  7. * For the full copyright and license information, please view the LICENSE.md
  8. * file that was distributed with this source code.
  9. */
  10. use yii\helpers\Html;
  11. use yii\widgets\Menu;
  12. /**
  13. * @var dektrium\user\models\User $user
  14. */
  15. $user = Yii::$app->user->identity;
  16. $networksVisible = count(Yii::$app->authClientCollection->clients) > 0;
  17. ?>
  18. <div class="panel panel-default">
  19. <div class="panel-heading">
  20. <h3 class="panel-title">
  21. <?= Html::img($user->profile->getAvatarUrl(24), [
  22. 'class' => 'img-rounded',
  23. 'alt' => $user->username,
  24. ]) ?>
  25. <?= $user->username ?>
  26. </h3>
  27. </div>
  28. <div class="panel-body">
  29. <?= Menu::widget([
  30. 'options' => [
  31. 'class' => 'nav nav-pills nav-stacked',
  32. ],
  33. 'items' => [
  34. ['label' => Yii::t('user', 'Profile'), 'url' => ['/user/settings/profile']],
  35. ['label' => Yii::t('user', 'Account'), 'url' => ['/user/settings/account']],
  36. [
  37. 'label' => Yii::t('user', 'Networks'),
  38. 'url' => ['/user/settings/networks'],
  39. 'visible' => $networksVisible
  40. ],
  41. ],
  42. ]) ?>
  43. </div>
  44. </div>