diff --git a/src/UnicaenAuth/View/Helper/UserCurrent.php b/src/UnicaenAuth/View/Helper/UserCurrent.php index 61fde9208d43afc4354827c076e66c07a08fab1a..b2079f73f976bf3d349cd44d14ca4f18520d0852 100644 --- a/src/UnicaenAuth/View/Helper/UserCurrent.php +++ b/src/UnicaenAuth/View/Helper/UserCurrent.php @@ -44,31 +44,32 @@ class UserCurrent extends UserAbstract public function __toString() { try { + $id = 'user-current-info'; + $status = $this->getView()->userStatus(false); + if ($this->getIdentity()) { - $id = 'user-current-info'; - $status = $this->getView()->userStatus(false); $content = $this->getView()->userProfile() . $this->getView()->userInfo($this->getAffectationFineSiDispo()); - $content = preg_replace('/\r\n|\n|\r/', '', $content); - $out = <<<EOS + } + else { + $content = "Aucun"; + } + + $content = preg_replace('/\r\n|\n|\r/', '', $content); + $out = <<<EOS <a class="navbar-link" id="$id" title="Utilisateur connecté" data-placement="bottom" data-toggle="popover" data-content="$content" href="#">$status</a> EOS; - $out .= <<<EOS + $out .= <<<EOS <script type="text/javascript"> $(function() { $("#$id").popover({ html: true, container: 'body' }); }); </script> EOS; - } - else { - $out = "" . $this->getView()->userStatus(false); - } } catch (\Exception $e) { var_dump($e); $out = '<p>' . $e->getMessage() . '</p><p>' . $e->getTraceAsString() . '</p>'; } - return $out; }