Commit 18434c57 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Légère modif pour testabilité.

parent a8dad842
......@@ -37,31 +37,30 @@ class UserCurrent extends UserAbstract
*/
public function __toString()
{
try {
$id = 'user-current-info';
$userStatusHelper = $this->getView()->plugin('userStatus'); /* @var $userStatusHelper \UnicaenAuth\View\Helper\UserStatus */
$status = $userStatusHelper(false);
if ($this->getIdentity()) {
$userProfileHelper = $this->getView()->plugin('userProfile'); /* @var $userProfileHelper \UnicaenAuth\View\Helper\UserProfile */
$userInfoHelper = $this->getView()->plugin('userInfo'); /* @var $userInfoHelper \UnicaenAuth\View\Helper\UserInfo */
$content = $userProfileHelper . $userInfoHelper($this->getAffectationFineSiDispo());
}
else {
$content = _("Aucun");
if ($this->getTranslator()) {
$content = $this->getTranslator()->translate($content, $this->getTranslatorTextDomain());
}
}
$content = preg_replace('/\r\n|\n|\r/', '', $content);
$title = _("Utilisateur connecté à l'application");
$id = 'user-current-info';
$userStatusHelper = $this->getView()->plugin('userStatus'); /* @var $userStatusHelper \UnicaenAuth\View\Helper\UserStatus */
$status = $userStatusHelper(false);
if ($this->getIdentity()) {
$userProfileHelper = $this->getView()->plugin('userProfile'); /* @var $userProfileHelper \UnicaenAuth\View\Helper\UserProfile */
$userInfoHelper = $this->getView()->plugin('userInfo'); /* @var $userInfoHelper \UnicaenAuth\View\Helper\UserInfo */
$content = $userProfileHelper . $userInfoHelper($this->getAffectationFineSiDispo());
}
else {
$content = _("Aucun");
if ($this->getTranslator()) {
$title = $this->getTranslator()->translate($title, $this->getTranslatorTextDomain());
$content = $this->getTranslator()->translate($content, $this->getTranslatorTextDomain());
}
$out = <<<EOS
}
$content = preg_replace('/\r\n|\n|\r/', '', $content);
$title = _("Utilisateur connecté à l'application");
if ($this->getTranslator()) {
$title = $this->getTranslator()->translate($title, $this->getTranslatorTextDomain());
}
$out = <<<EOS
<a class="navbar-link"
id="$id"
title="$title"
......@@ -70,20 +69,15 @@ class UserCurrent extends UserAbstract
data-content="$content"
href="#">$status</a>
EOS;
$out .= PHP_EOL;
$out .= <<<EOS
$out .= PHP_EOL;
$out .= <<<EOS
<script type="text/javascript">
$(function() {
$("#$id").popover({ html: true, container: '#navbar' });
});
</script>
EOS;
$out .= PHP_EOL;
}
catch (\Exception $e) {
var_dump($e);
$out = '<p>' . $e->getMessage() . '</p><p>' . $e->getTraceAsString() . '</p>';
}
$out .= PHP_EOL;
return $out;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment