本文整理匯總了PHP中UserStatus::getGender方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserStatus::getGender方法的具體用法?PHP UserStatus::getGender怎麽用?PHP UserStatus::getGender使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UserStatus
的用法示例。
在下文中一共展示了UserStatus::getGender方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getCommonInterest
/**
* Get common interests with the user you are watching
*
* @param $target_user_id:current user; $user_id:his id
* @return array
*/
function getCommonInterest($user_id, $target_user_id)
{
global $wgUser;
$user_id = $this->user_id;
$target_user_id = $wgUser->getId();
$res = UserSiteFollow::getCommonInterest($user_id, $target_user_id);
$us = new UserStatus($this->user);
$gender = $us->getGender();
if ($gender == 'male') {
$genderIcon = '他';
} elseif ($gender == 'female') {
$genderIcon = '她';
} else {
$genderIcon = 'TA';
}
$output = '<div class="panel panel-default"><div class="user-section-heading panel-heading">
<div class="user-section-title">我和' . $genderIcon . '的共同興趣:
</div>
<div class="user-section-actions">
<div class="action-right">
</div>
<div class="action-left">
</div>
<div class="cleared"></div>
</div>
</div>
<div class="cleared"></div>
<div class="common-interest-container panel-body">';
if (!empty($res)) {
foreach ($res as $value) {
$Iname = HuijiPrefix::prefixToSiteName($value);
$Iurl = HuijiPrefix::prefixToUrl($value);
$output .= '<span class="label label-primary"><a href="' . $Iurl . '">' . $Iname . ' </a></span>';
}
} else {
$output .= '<p> 您和' . $genderIcon . '還沒有共同興趣~</p>';
}
$output .= '</div></div>';
return $output;
}