N°2836 - Portal: Introduce bubbles conversation as default caselog rendering

This commit is contained in:
Molkobain
2020-10-24 12:52:39 +02:00
parent 95a2ffa0f2
commit 27e1f3d64b
7 changed files with 1029 additions and 365 deletions

View File

@@ -1110,12 +1110,13 @@ 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
* @throws \ArchivedObjectException
* @throws \CoreException
* @throws \Exception
* @since 3.0.0
*/
public static function GetContactPictureAbsUrl($sLogin = '', $bAllowDefaultPicture = true)
@@ -1134,10 +1135,10 @@ class UserRights
$sContactId = UserRights::GetContactId($sLogin);
if(!empty($sContactId))
{
$oContact = MetaModel::GetObject('Contact', $sContactId);
$oContact = MetaModel::GetObject('Contact', $sContactId, false, true);
$sContactClass = get_class($oContact);
// Check that contact has a picture attribute
// Check that Contact object still exists and that Contact class has a picture attribute
if(!is_null($oContact) && MetaModel::IsValidAttCode($sContactClass, static::DEFAULT_CONTACT_PICTURE_ATTCODE))
{
/** @var \ormDocument $oPicture */
@@ -1157,7 +1158,12 @@ class UserRights
}
else
{
$sPictureUrl = $oPicture->GetDisplayURL($sContactClass, $oContact->GetKey(), static::DEFAULT_CONTACT_PICTURE_ATTCODE);
if (ContextTag::Check(ContextTag::TAG_PORTAL)) {
$sPictureUrl = utils::GetAbsoluteUrlAppRoot().'pages/exec.php/object/document/display/'.$sContactClass.'/'.$oContact->GetKey().'/'.static::DEFAULT_CONTACT_PICTURE_ATTCODE.'?exec_module=itop-portal-base&exec_page=index.php&portal_id='.PORTAL_ID;
}
else {
$sPictureUrl = $oPicture->GetDisplayURL($sContactClass, $oContact->GetKey(), static::DEFAULT_CONTACT_PICTURE_ATTCODE);
}
}
}
}