本文整理汇总了PHP中CUserHelper::filterUserByName方法的典型用法代码示例。如果您正苦于以下问题:PHP CUserHelper::filterUserByName方法的具体用法?PHP CUserHelper::filterUserByName怎么用?PHP CUserHelper::filterUserByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUserHelper
的用法示例。
在下文中一共展示了CUserHelper::filterUserByName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ajaxLoadGroupEventMembers
public function ajaxLoadGroupEventMembers($namePrefix, $cid, $limitstart = 0, $limit = 200)
{
// pending filter
$objResponse = new JAXResponse();
$filter = JFilterInput::getInstance();
$callback = 'events,inviteUsers';
$cid = $filter->clean($cid, 'int');
$namePrefix = $filter->clean($namePrefix, 'string');
$my = CFactory::getUser();
//get the handler
$handlerName = '';
//load the event
$event = JTable::getInstance('Event', 'CTable');
$event->load($cid);
//check permission here
//get all the members of the group
$groupid = $event->contentid;
$groupsModel = CFactory::getModel('groups');
$guestIds = $event->getMembers(COMMUNITY_EVENT_STATUS_ATTEND, 0, false, false, false);
//get a list of attending users
$userids = array();
foreach ($guestIds as $uid) {
$userids[] = $uid->id;
}
$members = $groupsModel->getMembers($groupid, 0, true, false, SHOW_GROUP_ADMIN, true);
$memberList = array();
foreach ($members as $member) {
if ($member->id == $my->id || in_array($member->id, $userids)) {
continue;
//exclude myself and those who already attending
}
$memberList[] = $member->id;
}
//calculate pending group list
$results = CUserHelper::filterUserByName($memberList, $namePrefix, $limitstart, $limit);
$memberList = $results['users'];
$invitation = JTable::getInstance('Invitation', 'CTable');
$invitation->load($callback, $cid);
$tmpl = new CTemplate();
$tmpl->set('friends', $memberList)->set('selected', $invitation->getInvitedUsers());
$html = $tmpl->fetch('ajax.friend.list.events');
$loadedFriend = $limitstart + count($memberList);
if ($results['total'] > $loadedFriend) {
//update limitstart
$limitstart = $limitstart + count($memberList);
$moreCount = $results['total'] - $loadedFriend;
//load more option
$loadMore = '<a onClick="joms.friends.loadMoreFriend(\'' . $callback . '\',\'' . $cid . '\',\'' . $limitstart . '\',\'' . $limit . '\');" href="javascript:void(0)">' . JText::_('COM_COMMUNITY_INVITE_LOAD_MORE') . '(' . $moreCount . ') </a>';
} else {
//nothing to load
$loadMore = '';
}
$json = array('html' => $html, 'loadMore' => $loadMore ? true : false, 'moreCount' => isset($moreCount) ? $moreCount : 0);
die(json_encode($json));
}