provide a gender icon on the profile sidebar within reason

This commit is contained in:
zotlabs 2017-06-27 21:55:34 -07:00
parent dab00a98e0
commit 4c50bfebc2
2 changed files with 26 additions and 1 deletions

View File

@ -1162,6 +1162,10 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = fa
$location = $reddress = $pdesc = $gender = $marital = $homepage = False;
}
if($profile['gender']) {
$profile['gender_icon'] = gender_icon($profile['gender']);
}
$firstname = ((strpos($profile['channel_name'],' '))
? trim(substr($profile['channel_name'],0,strpos($profile['channel_name'],' '))) : $profile['channel_name']);
$lastname = (($firstname === $profile['channel_name']) ? '' : trim(substr($profile['channel_name'],strlen($firstname))));
@ -1214,6 +1218,27 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = fa
}
function gender_icon($gender) {
logger('gender: ' . $gender);
// This can easily get throw off if the observer language is different
// than the channel owner language.
if(strpos(strtolower($gender),strtolower(t('Female'))) !== false)
return 'venus';
if(strpos(strtolower($gender),strtolower(t('Male'))) !== false)
return 'mars';
if(strpos(strtolower($gender),strtolower(t('Trans'))) !== false)
return 'transgender';
if(strpos(strtolower($gender),strtolower(t('Neuter'))) !== false)
return 'neuter';
if(strpos(strtolower($gender),strtolower(t('Non-specific'))) !== false)
return 'genderless';
return '';
}
function advanced_profile(&$a) {
require_once('include/text.php');

View File

@ -43,7 +43,7 @@
</dl>
{{/if}}
{{if $gender}}<dl class="mf"><dt class="gender-label">{{$gender}}</dt> <dd class="p-gender">{{$profile.gender}}</dd></dl>{{/if}}
{{if $gender}}<dl class="mf"><dt class="gender-label">{{$gender}}</dt> <dd class="p-gender">{{if $profile.gender_icon}}<i class="fa fa-{{$profile.gender_icon}}"></i>&nbsp;{{/if}}{{$profile.gender}}</dd></dl>{{/if}}
{{if $marital}}<dl class="marital"><dt class="marital-label"><span class="heart"><i class="fa fa-heart"></i>&nbsp;</span>{{$marital}}</dt><dd class="marital-text">{{$profile.marital}}</dd></dl>{{/if}}