Rename utils::GetContactPictureAbsUrl() to utils::GetUserPictureAbsUrl()

This commit is contained in:
Molkobain
2021-03-25 17:06:59 +01:00
parent 7d1f5c91a7
commit 58d2b1d3f4
4 changed files with 16 additions and 19 deletions

View File

@@ -1085,18 +1085,16 @@ class UserRights
}
/**
* Return the absolute URL of the contact picture
* @param string $sLogin Login of the user from which we return the picture URL
* @param bool $bAllowDefaultPicture Set to false if you want it to return null instead of the default picture URL when the contact has no picture defined. This can be useful when we want to display something else than the default picture (eg. initials)
*
* @param string $sLogin Login of the user from which we return the picture URL
* @param bool $bAllowDefaultPicture Set to false if you want it to return null instead of the default picture URL when the contact has no picture defined. This can be useful when we want to display something else than the default picture (eg. initials)
*
* @return null|string
* @return null|string Absolute URL of the user picture (from their contact if they have one, or from the preferences)
* @throws \ArchivedObjectException
* @throws \CoreException
* @throws \Exception
* @since 3.0.0
*/
public static function GetContactPictureAbsUrl($sLogin = '', $bAllowDefaultPicture = true)
public static function GetUserPictureAbsUrl($sLogin = '', $bAllowDefaultPicture = true)
{
$sUserPicturesFolder = 'images/user-pictures/';

View File

@@ -20,17 +20,17 @@
namespace Combodo\iTop\Renderer\Bootstrap\FieldRenderer;
use utils;
use Dict;
use UserRights;
use AttributeDateTime;
use AttributeDate;
use AttributeDateTime;
use AttributeText;
use Combodo\iTop\Form\Field\MultipleChoicesField;
use Combodo\iTop\Form\Field\TextAreaField;
use Combodo\iTop\Renderer\RenderingOutput;
use Dict;
use InlineImage;
use MetaModel;
use Combodo\iTop\Renderer\RenderingOutput;
use Combodo\iTop\Form\Field\TextAreaField;
use Combodo\iTop\Form\Field\MultipleChoicesField;
use UserRights;
use utils;
/**
* Description of BsSimpleFieldRenderer
@@ -594,7 +594,7 @@ HTML
$sEntryContactPictureAbsoluteUrl = null;
}
else {
$sEntryContactPictureAbsoluteUrl = UserRights::GetContactPictureAbsUrl($oEntryUser->Get('login'), false);
$sEntryContactPictureAbsoluteUrl = UserRights::GetUserPictureAbsUrl($oEntryUser->Get('login'), false);
}
$aContactPicturesCache[$iEntryUserId] = $sEntryContactPictureAbsoluteUrl;
}

View File

@@ -221,7 +221,7 @@ class ActivityEntry extends UIBlock
// - Initials
$this->sAuthorInitials = UserRights::GetUserInitials($this->sAuthorLogin);
// - Picture
$this->sAuthorPictureAbsUrl = UserRights::GetContactPictureAbsUrl($this->sAuthorLogin, false);
$this->sAuthorPictureAbsUrl = UserRights::GetUserPictureAbsUrl($this->sAuthorLogin, false);
if ((null === $this->sAuthorPictureAbsUrl) && (ITOP_APPLICATION_SHORT === $this->sAuthorLogin)) {
$this->sAuthorPictureAbsUrl = utils::GetAbsoluteUrlAppRoot().static::DEFAULT_AUTHOR_PICTURE_REL_URL;
}

View File

@@ -422,10 +422,9 @@ JS;
protected function ComputeUserData()
{
// Use a picture set in the preferences is there is none in the user's contact
$sPictureUrl = UserRights::GetContactPictureAbsUrl('', false);
if(empty($sPictureUrl))
{
$sPictureUrl = utils::GetAbsoluteUrlAppRoot().'images/user-pictures/' . appUserPreferences::GetPref('user_picture_placeholder', 'user-profile-default-256px.png');
$sPictureUrl = UserRights::GetUserPictureAbsUrl('', false);
if (empty($sPictureUrl)) {
$sPictureUrl = utils::GetAbsoluteUrlAppRoot().'images/user-pictures/'.appUserPreferences::GetPref('user_picture_placeholder', 'user-profile-default-256px.png');
}
// TODO 3.0.0 : what do we show if no contact is linked to the user ?