diff options
| author | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2023-12-04 15:00:58 +0000 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2023-12-04 15:00:58 +0000 |
| commit | 9ae449f94d2c3c23a272a36c486438430ca454b5 (patch) | |
| tree | 7f1bf367966d809a250e8a34ff02a5119c6a76d1 /lib/classes/InstituteAvatar.class.php | |
| parent | d375c5134f04c995378fa7af6e853ef7545614a4 (diff) | |
use webp for avatars and convert current avatars, fixes #3183
Closes #3183
Merge request studip/studip!2326
Diffstat (limited to 'lib/classes/InstituteAvatar.class.php')
| -rw-r--r-- | lib/classes/InstituteAvatar.class.php | 69 |
1 files changed, 12 insertions, 57 deletions
diff --git a/lib/classes/InstituteAvatar.class.php b/lib/classes/InstituteAvatar.class.php index e05c345..8adbfba 100644 --- a/lib/classes/InstituteAvatar.class.php +++ b/lib/classes/InstituteAvatar.class.php @@ -1,89 +1,44 @@ <?php -# Lifter010: TODO - -/* - * Copyright (C) 2009 - Marcus Lunzenauer (mlunzena@uos) - * André Noack <noack@data-quest.de> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - */ - /** * This class represents the avatar of a institute. * - * @package studip - * @subpackage lib - * * @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 an avatar object of the appropriate class. - * - * @param string the course's id - * - * @return mixed the course's avatar. - */ - static function getAvatar($id) - { - return new InstituteAvatar($id); - } - - /** - * Returns an avatar object for "nobody". - * - * @return mixed the course's avatar. - */ - static function getNobody() - { - return new InstituteAvatar('nobody'); - } - - /** - * Returns the URL to the institute' avatars. + * Returns the CSS class to use for this avatar image. * - * @return string the URL to the avatars + * @param string $size one of the constants Avatar::(NORMAL|MEDIUM|SMALL) + * @return string CSS class to use for the avatar */ - function getAvatarDirectoryUrl() + protected function getCssClass($size) { - return $GLOBALS['DYNAMIC_CONTENT_URL'] . "/institute"; - } - - - /** - * Returns the file system path to the institute' avatars - * - * @return string the file system path to the avatars - */ - function getAvatarDirectoryPath() - { - return $GLOBALS['DYNAMIC_CONTENT_PATH'] . "/institute"; + return "institute-avatar-{$size} institute-{$this->user_id}"; } /** * Return the default title of the avatar. * @return string the default title */ - function getDefaultTitle() + public function getDefaultTitle() { $institute = Institute::find($this->user_id); - return $institute - ? $institute->name - : Avatar::NOBODY; + return $institute ? (string) $institute->name : self::NOBODY; } /** * Return if avatar is visible to the current user. * @return boolean: true if visible */ - protected function checkAvatarVisibility() { + protected function checkAvatarVisibility() + { //no special conditions for visibility of course-avatars yet return true; } |
