本文整理汇总了PHP中UserProfile::getAvatar方法的典型用法代码示例。如果您正苦于以下问题:PHP UserProfile::getAvatar方法的具体用法?PHP UserProfile::getAvatar怎么用?PHP UserProfile::getAvatar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserProfile
的用法示例。
在下文中一共展示了UserProfile::getAvatar方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMember
/**
* Returns the data of a member.
*
* @param array $row
* @return array
*/
protected function getMember($row)
{
$user = new UserProfile(null, $row);
$username = StringUtil::encodeHTML($row['username']);
$protectedProfile = $user->protectedProfile && WCF::getUser()->userID != $user->userID;
$userData = array('user' => $user, 'encodedUsername' => $username, 'protectedProfile' => $protectedProfile);
foreach ($this->activeFields as $field) {
switch ($field) {
// default fields
case 'username':
$userData['username'] = '<div class="containerIconSmall">';
if ($user->isOnline()) {
$title = WCF::getLanguage()->get('wcf.user.online', array('$username' => $username));
$userData['username'] .= '<img src="' . StyleManager::getStyle()->getIconPath('onlineS.png') . '" alt="' . $title . '" title="' . $title . '" />';
} else {
$title = WCF::getLanguage()->get('wcf.user.offline', array('$username' => $username));
$userData['username'] .= '<img src="' . StyleManager::getStyle()->getIconPath('offlineS.png') . '" alt="' . $title . '" title="' . $title . '" />';
}
$userData['username'] .= '</div><div class="containerContentSmall">';
$title = WCF::getLanguage()->get('wcf.user.viewProfile', array('$username' => $username));
$userData['username'] .= '<p><a href="index.php?page=User&userID=' . $row['userID'] . SID_ARG_2ND . '" title="' . $title . '">' . $username . '</a></p>';
if (MODULE_USER_RANK == 1 && $user->getUserTitle()) {
$userData['username'] .= '<p class="smallFont">' . $user->getUserTitle() . ' ' . ($user->getRank() ? $user->getRank()->getImage() : '') . '</p>';
}
$userData['username'] .= '</div>';
break;
case 'registrationDate':
$userData['registrationDate'] = DateUtil::formatDate(null, $row['registrationDate']);
break;
case 'lastActivity':
$userData['lastActivity'] = '';
if ($user->invisible != 1 || WCF::getUser()->getPermission('admin.general.canViewInvisible')) {
$userData['lastActivity'] = DateUtil::formatTime(null, $row['lastActivityTime']);
}
break;
case 'avatar':
if ($user->getAvatar() && ($row['userID'] == WCF::getUser()->userID || WCF::getUser()->getPermission('user.profile.avatar.canViewAvatar'))) {
$user->getAvatar()->setMaxHeight(50);
$title = WCF::getLanguage()->get('wcf.user.viewProfile', array('$username' => $username));
$userData['avatar'] = '<a href="index.php?page=User&userID=' . $row['userID'] . SID_ARG_2ND . '" title="' . $title . '">' . $user->getAvatar()->__toString() . '</a>';
} else {
$userData['avatar'] = '';
}
break;
case 'language':
if ($row['languageID'] && $row['languageCode']) {
$userData['language'] = '<img src="' . RELATIVE_WCF_DIR . 'icon/language' . ucfirst($row['languageCode']) . 'S.png" alt="' . WCF::getLanguage()->get('wcf.global.language.' . $row['languageCode']) . '" title="' . WCF::getLanguage()->get('wcf.global.language.' . $row['languageCode']) . '" />';
} else {
$userData['language'] = '';
}
break;
// user options
// user options
default:
$userData[$field] = '';
$option = $this->userOptions->getOptionValue($field, $user);
if (!$protectedProfile && $option) {
$userData[$field] = $option['optionValue'];
}
}
}
return $userData;
}