* @return object
*/
_createListItem: function(listItemData) {
- $('<li class="box16"><span><span class="icon icon16 icon-user" /> ' + listItemData.label + '</span></li>').data('username', listItemData.label).click($.proxy(this._click, this)).appendTo(this._suggestionList);
+ var $listItem = $('<li />').data('username', listItemData.label).click($.proxy(this._click, this)).appendTo(this._suggestionList);
+
+ var $box16 = $('<div />').addClass('box16').appendTo($listItem);
+ $box16.append($(listItemData.icon).addClass('framed'));
+ $box16.append($('<div />').append($('<span />').text(listItemData.label)));
},
/**
_createListItem: function(item) {
var $listItem = this._super(item);
+ var $icon = null;
+ if (item.icon) {
+ $icon = $(item.icon);
+ }
+ else if (this._includeUserGroups && item.type === 'group') {
+ $icon = $('<span class="icon icon16 icon-group" />');
+ }
+
+ if ($icon) {
+ var $label = $listItem.find('span').detach();
+
+ var $box16 = $('<div />').addClass('box16').appendTo($listItem);
+
+ $box16.append($icon.addClass('framed'));
+ $box16.append($('<div />').append($label));
+ }
+
// insert item type
- if (this._includeUserGroups) $('<span class="icon icon16 icon-' + (item.type === 'group' ? 'group' : 'user') + '" style="margin-right: 4px;" />').prependTo($listItem.children('span:eq(0)'));
$listItem.data('type', item.type);
return $listItem;
}
}
- $conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add("username LIKE ?", array($searchString.'%'));
+ // find users
+ $userProfileList = new UserProfileList();
+ $userProfileList->getConditionBuilder()->add("username LIKE ?", array($searchString.'%'));
if (!empty($excludedSearchValues)) {
- $conditionBuilder->add("username NOT IN (?)", array($excludedSearchValues));
+ $userProfileList->getConditionBuilder()->add("username NOT IN (?)", array($excludedSearchValues));
}
+ $userProfileList->sqlLimit = 10;
+ $userProfileList->readObjects();
- // find users
- $sql = "SELECT userID, username
- FROM wcf".WCF_N."_user
- ".$conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql, 10);
- $statement->execute($conditionBuilder->getParameters());
- while ($row = $statement->fetchArray()) {
+ foreach ($userProfileList as $userProfile) {
$list[] = array(
- 'label' => $row['username'],
- 'objectID' => $row['userID'],
+ 'icon' => $userProfile->getAvatar()->getImageTag(16),
+ 'label' => $userProfile->username,
+ 'objectID' => $userProfile->userID,
'type' => 'user'
);
}