X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/e19990636073ca1aa353a67033dc0cec311fdab9..460983ff96c7f6b57d7d7d567c767730fb1ba36e:/WEB-INF/lib/ttUser.class.php
diff --git a/WEB-INF/lib/ttUser.class.php b/WEB-INF/lib/ttUser.class.php
index ab5bdbff..25cc83f7 100644
--- a/WEB-INF/lib/ttUser.class.php
+++ b/WEB-INF/lib/ttUser.class.php
@@ -652,4 +652,24 @@ 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;
+ if (!$this->id) return null;
+
+ $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;
+ }
}