X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/d82f2da8a4df2190f26f1ce8a44fe35c42bba1da..b9450dc964f5b244713dc5c799a81a660269f22b:/WEB-INF/lib/ttUser.class.php
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;
+ }
}