From: Nik Okuntseff Date: Fri, 23 Nov 2018 16:58:23 +0000 (+0000) Subject: Wrote ttUser::getUserPartForHeader and included on behalf group in output. X-Git-Tag: timetracker_1.19-1~564 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=b9450dc964f5b244713dc5c799a81a660269f22b;p=timetracker.git Wrote ttUser::getUserPartForHeader and included on behalf group in output. --- diff --git a/WEB-INF/lib/ttUser.class.php b/WEB-INF/lib/ttUser.class.php index ab5bdbff..f89bba68 100644 --- a/WEB-INF/lib/ttUser.class.php +++ b/WEB-INF/lib/ttUser.class.php @@ -652,4 +652,23 @@ class ttUser { return $max_rank; } + + // getUserPartForHeader constructs a string for user to display on pages header. + // It changes with "on behalf" attributes for both user and group. + function getUserPartForHeader() { + global $i18n; + + $user_part = htmlspecialchars($this->name); + $user_part .= ' - '.htmlspecialchars($this->role_name); + if ($this->behalf_id) { + $user_part .= ' '.$i18n->get('label.on_behalf').' '.htmlspecialchars($this->behalf_name).''; + } + if ($this->behalf_group_id) { + $user_part .= ', '.$i18n->get('label.on_behalf').' '.htmlspecialchars($this->behalf_group_name).''; + } else { + if ($this->group_name) // Note: we did not require group names in the past. + $user_part .= ', '.$this->group_name; + } + return $user_part; + } } diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index a59278ed..0240ecfb 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.27.4500 | Copyright © Anuko | +  Anuko Time Tracker 1.18.27.4501 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/WEB-INF/templates/header.tpl b/WEB-INF/templates/header.tpl index 23dfdc11..de25c066 100644 --- a/WEB-INF/templates/header.tpl +++ b/WEB-INF/templates/header.tpl @@ -165,11 +165,7 @@ {if $title} - {if $user->name} - - {else} - - {/if} + {* No need to escape as it is done in the class. *}
{$title}{if $timestring}: {$timestring}{/if}
{$user->name|escape} - {$user->role_name|escape}{if $user->behalf_id > 0} {$i18n.label.on_behalf} {$user->behalf_name|escape}{/if}{if $user->group_name}, {$user->group_name|escape}{/if}
 
{$user->getUserPartForHeader()}
{/if} diff --git a/default.css b/default.css index ee6a5b16..47dc81e4 100644 --- a/default.css +++ b/default.css @@ -74,6 +74,10 @@ input[type=checkbox], label { color: #444444; } +.onBehalf { + font-weight: bold; +} + .tableHeader { font-weight: bold; text-align: left;