app/Resources/views/Includes/login.html.php line 58

Open in your IDE?
  1. <?php
  2. /**
  3.  * @var \Pimcore\Templating\PhpEngine $this
  4.  * @var \Pimcore\Templating\PhpEngine $view
  5.  * @var \Pimcore\Templating\GlobalVariables $app
  6.  */
  7. /** @var \Symfony\Component\Security\Core\User\User $user */
  8. $user $this->app->getUser();
  9. ?>
  10. <li class="dropdown">
  11.     <a href="#" class="dropdown-toggle" id="loginSelector" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="true">
  12.         <?php if ($user): ?>
  13.             <span class="glyphicon glyphicon-user"></span> <strong><?= $user->getUsername() ?></strong>
  14.         <?php else: ?>
  15.             <?= $this->translate('Not logged in'?>
  16.         <?php endif; ?>
  17.         <span class="caret"></span>
  18.     </a>
  19.     <ul class="dropdown-menu navbar-login" aria-labelledby="loginSelector">
  20.         <?php if ($user): ?>
  21.             <?php
  22.             /*
  23.              * Show secure/user and secure/admin links depending on user role. ROLE_ADMIN inherits from ROLE_USER (see
  24.              * role_hierarchy in security.yml, so the secure_user link is shown for all logged in users.
  25.              */
  26.             if ($this->security()->isGranted('ROLE_USER')): ?>
  27.                 <li>
  28.                     <a href="<?= $this->path('demo_secure_user'?>"><?= $this->translate('Secure User Page'?></a>
  29.                 </li>
  30.             <?php endif; ?>
  31.             <?php if ($this->security()->isGranted('ROLE_ADMIN')): ?>
  32.                 <li>
  33.                     <a href="<?= $this->path('demo_secure_admin'?>"><?= $this->translate('Secure Admin Page'?></a>
  34.                 </li>
  35.             <?php endif; ?>
  36.             <li role="separator" class="divider"></li>
  37.         <?php endif; ?>
  38.         <li>
  39.             <?php if ($user): ?>
  40.                 <a href="<?= $this->path('demo_logout'?>">Logout</a>
  41.             <?php else: ?>
  42.                 <a href="<?= $this->path('demo_login'?>">Login</a>
  43.             <?php endif; ?>
  44.         </li>
  45.     </ul>
  46. </li>