本文整理汇总了PHP中UserProfile::getRank方法的典型用法代码示例。如果您正苦于以下问题:PHP UserProfile::getRank方法的具体用法?PHP UserProfile::getRank怎么用?PHP UserProfile::getRank使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserProfile
的用法示例。
在下文中一共展示了UserProfile::getRank方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: readEntries
public function readEntries($sortField = 'updateDate', $sortOrder = 'DESC', $pageNo = 1, $itemsPerPage = 20)
{
$ret = array();
$i = 0;
if (preg_match('/(userID|avatarID)/', $sortField)) {
$sortField = 'u.' . $sortField;
}
require_once WCF_DIR . 'lib/data/user/UserProfile.class.php';
require_once WCF_DIR . 'lib/data/user/avatar/Avatar.class.php';
$sql = "SELECT uwp.*, IFNULL(SUM(attachmentSize),0) + LENGTH(uwp.text) AS size, COUNT(attachmentID) AS aCnt, u.*, a.*, rank.*, uo.*" . "\n FROM wcf" . WCF_N . "_user_wanted_poster uwp" . "\n JOIN wcf" . WCF_N . "_user u ON u.userID = uwp.userID" . "\n LEFT JOIN wcf" . WCF_N . "_attachment wat ON (wat.userID = uwp.userID AND wat.messageType = 'wantedPoster')" . "\n LEFT JOIN wcf" . WCF_N . "_avatar a ON (a.avatarID = u.avatarID)" . "\n LEFT JOIN wcf" . WCF_N . "_user_rank rank ON (rank.rankID = u.rankID)" . "\n LEFT JOIN wcf" . WCF_N . "_user_option_value uo ON (uo.userID = u.userID)";
if (!WCF::getUser()->getPermission('mod.wantedPoster.canLockEntries')) {
$sql .= "\n WHERE uwp.locked != 1";
}
$sql .= "\n GROUP BY uwp.userID, uwp.insertDate, uwp.updateDate, uwp.text, uwp.views, uwp.enableSmilies, uwp.enableHtml, uwp.enableBBCodes, uwp.locked, uwp.lockDate, uwp.lockUser" . "\n ORDER BY " . $sortField . " " . $sortOrder . "\n LIMIT " . $itemsPerPage . "\nOFFSET " . ($pageNo - 1) * $itemsPerPage;
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
$ret[$i]['userID'] = $row['userID'];
$ret[$i]['insertDate'] = $row['insertDate'];
$ret[$i]['updateDate'] = $row['updateDate'];
$ret[$i]['views'] = $row['views'];
$ret[$i]['locked'] = $row['locked'];
$ret[$i]['size'] = StringUtil::formatInteger($row['size']);
$ret[$i]['aCnt'] = StringUtil::formatInteger($row['aCnt']);
// username
$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);
$userData['username'] = '<div class="containerIconSmall">';
if ($user->isOnline()) {
$title = WCF::getLanguage()->get('wcf.user.online', array('$username' => $username));
$userData['username'] .= '<img src="' . RELATIVE_WCF_DIR . 'icon/onlineS.png" alt="' . $title . '" title="' . $title . '" />';
} else {
$title = WCF::getLanguage()->get('wcf.user.offline', array('$username' => $username));
$userData['username'] .= '<img src="' . RELATIVE_WCF_DIR . 'icon/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 ($user->getUserTitle()) {
$userData['username'] .= '<p class="smallFont">' . $user->getUserTitle() . ' ' . ($user->getRank() ? $user->getRank()->getImage() : '') . '</p>';
}
$userData['username'] .= '</div>';
$ret[$i]['username'] = $userData['username'];
// avatar
if (empty($row['disableAvatar']) && !empty($row['avatarID']) && !empty($row['avatarExtension'])) {
$avatar = new Avatar(null, $row);
$avatar->setMaxHeight(50);
$title = WCF::getLanguage()->get('wcf.user.viewProfile', array('$username' => $row['username']));
$ret[$i]['avatar'] = '<a href="index.php?page=User&userID=' . $row['userID'] . SID_ARG_2ND . '" title="' . $title . '">' . $avatar->__toString() . '</a>';
} else {
$ret[$i]['avatar'] = ' ';
}
$i++;
}
return $ret;
}
示例3: getGuestbookList
public function getGuestbookList($sortField = 'lastEntry', $sortOrder = 'DESC', $pageNo = 1, $itemsPerPage = 20)
{
$ret = array();
$i = 0;
$optID = self::getOptionID('userGuestbook_enable');
if (preg_match('/(userID|avatarID)/', $sortField)) {
$sortField = 'u.' . $sortField;
}
require_once WCF_DIR . 'lib/data/user/avatar/Avatar.class.php';
$gbUserIDs = 0;
$sql = "SELECT ugb.*, u.*, rank.*, a.*, uo.*, leu.username AS lastEntryUser, lv.username AS lastVisitor" . "\n FROM wcf" . WCF_N . "_user_guestbook_header ugb" . "\n JOIN wcf" . WCF_N . "_user u ON (u.userID = ugb.userID)" . "\n LEFT JOIN wcf" . WCF_N . "_user leu ON (leu.userID = ugb.lastEntryUserID)" . "\n LEFT JOIN wcf" . WCF_N . "_user lv ON (lv.userID = ugb.visitorID)" . "\n LEFT JOIN wcf" . WCF_N . "_avatar a ON (a.avatarID = u.avatarID)" . "\n LEFT JOIN wcf" . WCF_N . "_user_rank rank ON (rank.rankID = u.rankID)" . "\n LEFT JOIN wcf" . WCF_N . "_user_option_value uo ON (uo.userID = u.userID)" . "\n LEFT JOIN wcf" . WCF_N . "_user_option_value ov ON (ov.userID = ugb.userID)" . "\n LEFT JOIN wcf" . WCF_N . "_user_to_groups ug ON (ug.userID = ugb.userID)" . "\n LEFT JOIN wcf" . WCF_N . "_group_option_value gv ON (gv.groupID = ug.groupID)" . "\n LEFT JOIN wcf" . WCF_N . "_group_option go ON (go.optionID = gv.optionID)" . "\n WHERE ov.userOption" . $optID . " = '1'" . "\n AND gv.optionValue = '1'" . "\n AND go.optionName = 'user.guestbook.canUseOwn'";
if (!WCF::getUser()->getPermission('mod.guestbook.canLock')) {
$sql .= "\n AND ugb.locked != 1";
$sql .= "\n AND ugb.entries > 0";
} else {
$sql .= "\n AND (ugb.locked = 1 OR ugb.entries > 0)";
}
$sql .= "\n GROUP BY ugb.userID, ugb.userLastVisit, ugb.lastEntryUserID, ugb.lastEntry, ugb.entries, ugb.newEntries, ugb.views, ugb.visitorID, ugb.visitorLastVisit, ugb.locked, ugb.lockTime, ugb.lockUserID" . "\n ORDER BY " . $sortField . " " . $sortOrder . "\n LIMIT " . $itemsPerPage . "\nOFFSET " . ($pageNo - 1) * $itemsPerPage;
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
$user = new UserProfile(null, $row);
if (!$user->userGuestbook_enable) {
continue;
}
$gbUserIDs .= ',' . $row['userID'];
$ret[$i]['curUserEntry'] = false;
$ret[$i]['userID'] = $row['userID'];
$ret[$i]['userLastVisit'] = $row['userLastVisit'];
$ret[$i]['userLastCommentTime'] = $row['userLastCommentTime'];
$ret[$i]['lastEntry'] = $row['lastEntry'];
$ret[$i]['visitorLastVisit'] = $row['visitorLastVisit'];
$ret[$i]['entries'] = StringUtil::formatInteger($row['entries']);
$ret[$i]['newEntries'] = StringUtil::formatInteger($row['newEntries']);
$ret[$i]['views'] = StringUtil::formatInteger($row['views']);
$ret[$i]['locked'] = $row['locked'];
if (empty($row['lastEntryUser'])) {
$ret[$i]['lastEntryUser'] = StringUtil::encodeHTML($row['lastEntryUsername']);
$ret[$i]['lastEntryUserID'] = 0;
} else {
$ret[$i]['lastEntryUser'] = StringUtil::encodeHTML($row['lastEntryUser']);
$ret[$i]['lastEntryUserID'] = $row['lastEntryUserID'];
}
$ret[$i]['lastVisitor'] = StringUtil::encodeHTML($row['lastVisitor']);
$ret[$i]['lastVisitorID'] = $row['visitorID'];
// username
$username = StringUtil::encodeHTML($row['username']);
$protectedProfile = $user->protectedProfile && WCF::getUser()->userID != $user->userID;
$userData = array('user' => $user, 'encodedUsername' => $username, 'protectedProfile' => $protectedProfile);
$userData['username'] = '<div class="containerIconSmall">';
if ($user->isOnline()) {
$title = WCF::getLanguage()->get('wcf.user.online', array('$username' => $username));
$userData['username'] .= '<img src="' . RELATIVE_WCF_DIR . 'icon/onlineS.png" alt="' . $title . '" title="' . $title . '" />';
} else {
$title = WCF::getLanguage()->get('wcf.user.offline', array('$username' => $username));
$userData['username'] .= '<img src="' . RELATIVE_WCF_DIR . 'icon/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 ($user->getUserTitle()) {
$userData['username'] .= '<p class="smallFont">' . $user->getUserTitle() . ' ' . ($user->getRank() ? $user->getRank()->getImage() : '') . '</p>';
}
$userData['username'] .= '</div>';
$ret[$i]['username'] = $userData['username'];
// avatar
if (empty($row['disableAvatar']) && !empty($row['avatarID']) && !empty($row['avatarExtension'])) {
$avatar = new Avatar(null, $row);
$avatar->setMaxHeight(50);
$title = WCF::getLanguage()->get('wcf.user.viewProfile', array('$username' => $row['username']));
$ret[$i]['avatar'] = '<a href="index.php?page=User&userID=' . $row['userID'] . SID_ARG_2ND . '" title="' . $title . '">' . $avatar->__toString() . '</a>';
} else {
$ret[$i]['avatar'] = ' ';
}
$i++;
}
if (!empty($gbUserIDs) && WCF::getUser()->userID) {
$sql = "SELECT DISTINCT userID" . "\n FROM wcf" . WCF_N . "_user_guestbook" . "\n WHERE userID IN (" . $gbUserIDs . ")" . "\n AND fromUserID = " . WCF::getUser()->userID;
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
foreach ($ret as $k => $v) {
if ($ret[$k]['userID'] == $row['userID']) {
$ret[$k]['curUserEntry'] = true;
}
}
}
}
return $ret;
}