New attribute: ImageAttribute

SVN:trunk[4129]
This commit is contained in:
Romain Quetiez
2016-05-24 15:29:44 +00:00
parent 2299d23099
commit 1e719b97d8
20 changed files with 730 additions and 15 deletions

View File

@@ -424,6 +424,25 @@ class ApplicationHelper
}
$oApp['combodo.current_user'] = $oUser;
$sUrl = $oApp['combodo.portal.base.absolute_url'].'img/user-profile-default-256px.png';
$oContact = UserRights::GetContactObject();
if ($oContact)
{
if (MetaModel::IsValidAttCode(get_class($oContact), 'picture'))
{
$oImage = $oContact->Get('picture');
if (is_object($oImage) && !$oImage->IsEmpty())
{
$sUrl = $oImage->GetDownloadURL(get_class($oContact), $oContact->GetKey(), 'picture');
}
else
{
$sUrl = MetaModel::GetAttributeDef(get_class($oContact), 'picture')->Get('default_image');
}
}
}
$oApp['combodo.current_user_img'] = $sUrl;
}
/**

View File

@@ -5,8 +5,7 @@
{% set bUserConnected = true %}
{% set sUserFullname = app['combodo.current_user'].Get('first_name') ~ ' ' ~ app['combodo.current_user'].Get('last_name') %}
{% set sUserEmail = app['combodo.current_user'].Get('email') %}
{% set sUserPhotoUrl = app['combodo.portal.base.absolute_url'] ~ 'img/user-profile-default-256px.png' %}
{% set sUserPhotoUrl = 'https://scontent-fra3-1.xx.fbcdn.net/v/t1.0-9/11050099_10153305298138954_7206181025917413544_n.jpg?oh=728b8e7b1f073b81a2e6b43858c795f8&oe=57E2B0D3' %}
{% set sUserPhotoUrl = app['combodo.current_user_img'] %}
{% else %}
{% set bUserConnected = false %}
{% set sUserFullname = '' %}