diff options
| author | Philipp Schüttlöffel <schuettloeffel@zqs.uni-hannover.de> | 2024-09-24 10:53:31 +0200 |
|---|---|---|
| committer | Philipp Schüttlöffel <schuettloeffel@zqs.uni-hannover.de> | 2024-09-24 10:53:31 +0200 |
| commit | 4459dd7917f4d1c34f40bb68f0e991e9c3d53e4c (patch) | |
| tree | 5c07151ae61276d334e88f6309c30d439a85c12e /lib/classes/InstituteAvatar.php | |
| parent | da0022e5c1abbf9825ae76debaabdff7e8623bb4 (diff) | |
| parent | 97a188592c679890a25c37ab78463add76a52ff7 (diff) | |
Merge branch 'main' into issue-3911issue-3911
Diffstat (limited to 'lib/classes/InstituteAvatar.php')
| -rw-r--r-- | lib/classes/InstituteAvatar.php | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/lib/classes/InstituteAvatar.php b/lib/classes/InstituteAvatar.php new file mode 100644 index 0000000..8adbfba --- /dev/null +++ b/lib/classes/InstituteAvatar.php @@ -0,0 +1,45 @@ +<?php +/** + * This class represents the avatar of a institute. + * + * @author André Noack <noack@data-quest.de> + * @author Marcus Lunzenauer <mlunzena@uos> + * @copyright (c) Authors + * @license GPL2 or any later version + * @since 1.10 + */ +class InstituteAvatar extends CourseAvatar +{ + public const AVATAR_TYPE = 'institute'; + + /** + * Returns the CSS class to use for this avatar image. + * + * @param string $size one of the constants Avatar::(NORMAL|MEDIUM|SMALL) + * @return string CSS class to use for the avatar + */ + protected function getCssClass($size) + { + return "institute-avatar-{$size} institute-{$this->user_id}"; + } + + /** + * Return the default title of the avatar. + * @return string the default title + */ + public function getDefaultTitle() + { + $institute = Institute::find($this->user_id); + return $institute ? (string) $institute->name : self::NOBODY; + } + + /** + * Return if avatar is visible to the current user. + * @return boolean: true if visible + */ + protected function checkAvatarVisibility() + { + //no special conditions for visibility of course-avatars yet + return true; + } +} |
