本文整理汇总了PHP中UserList类的典型用法代码示例。如果您正苦于以下问题:PHP UserList类的具体用法?PHP UserList怎么用?PHP UserList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UserList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wp_getauthors
/**
* wp.getAuthors
*
* @see http://codex.wordpress.org/XML-RPC_wp#wp.getAuthors
*
* @param xmlrpcmsg XML-RPC Message
* 0 blogid (int): Unique identifier of the blog.
* 1 username (string): User login.
* 2 password (string): Password for said username.
*/
function wp_getauthors($m)
{
// CHECK LOGIN:
/**
* @var User
*/
if (!($current_User =& xmlrpcs_login($m, 1, 2))) {
// Login failed, return (last) error:
return xmlrpcs_resperror();
}
// GET BLOG:
/**
* @var Blog
*/
if (!($Blog =& xmlrpcs_get_Blog($m, 0))) {
// Login failed, return (last) error:
return xmlrpcs_resperror();
}
if (!$current_User->check_perm('users', 'view')) {
return xmlrpcs_resperror(5, T_('You have no permission to view other users!'));
}
load_class('users/model/_userlist.class.php', 'UserList');
$UserList = new UserList('', NULL, 'u_', array('join_group' => false, 'join_session' => false, 'join_country' => false, 'join_city' => false));
// Run the query:
$UserList->query();
logIO('Found users: ' . $UserList->result_num_rows);
$data = array();
while ($User =& $UserList->get_next()) {
$data[] = new xmlrpcval(array('user_id' => new xmlrpcval($User->ID, 'int'), 'user_login' => new xmlrpcval($User->login), 'display_name' => new xmlrpcval($User->get_preferred_name())), 'struct');
}
logIO('OK.');
return new xmlrpcresp(new xmlrpcval($data, 'array'));
}
示例2: __construct
/**
* Constructor.
*
* @access public
* @param UserList $list User List Object.
* @param User $user User object owning tag/note metadata.
* @param int $listId ID of list containing desired tags/notes (or
* null to show tags/notes from all user's lists).
* @param bool $allowEdit Should we display edit controls?
*/
public function __construct($list, $user, $allowEdit = true)
{
$this->list = $list;
$this->user = $user;
$this->listId = $list->id;
$this->allowEdit = $allowEdit;
// Determine Sorting Option //
if (isset($list->defaultSort)) {
$this->defaultSort = $list->defaultSort;
}
// when list as a sort setting use that
if (isset($_REQUEST['sort']) && (in_array($_REQUEST['sort'], $this->solrSortOptions) || in_array($_REQUEST['sort'], array_keys($this->userListSortOptions)))) {
// if URL variable is a valid sort option, set the list's sort setting
$this->sort = $_REQUEST['sort'];
} else {
$this->sort = $this->defaultSort;
}
$this->isUserListSort = in_array($this->sort, array_keys($this->userListSortOptions));
// Get the Favorites //
$userListSort = $this->isUserListSort ? $this->userListSortOptions[$this->sort] : null;
$this->favorites = $list->getListEntries($userListSort);
// when using a user list sorting, rather than solr sorting, get results in order
// Process the IDs found in the favorites
foreach ($this->favorites as $favorite) {
if (is_object($favorite)) {
$this->ids[] = $favorite->groupedWorkPermanentId;
} else {
$this->ids[] = $favorite;
}
}
}
示例3: createuser
public function createuser()
{
$errmsg = array();
if ($this->registry->auth->check()) {
header("Location: /store");
return;
}
if (false == preg_match('/^[a-zA-Z0-9_]+$/', $this->registry->request->login)) {
$errmsg[] = 'Login should consist from alphanumeric characters';
}
if (false == preg_match('/^[a-zA-Z0-9_]+$/', $this->registry->request->pass)) {
$errmsg[] = 'Password should consist from alphanumeric characters';
}
if ($this->registry->request->pass !== $this->registry->request->pass_confirm) {
$errmsg[] = 'Wrong password confirmation';
}
/** Instance of UserList class, lib/userlist.class.php */
$ul = new UserList();
/** Check if user exists */
if ($ul->isRegistered($this->registry->request->login)) {
$errmsg[] = 'This username is unavailable.';
}
/** Create new user */
if (false == $ul->createUser($this->registry->request->login, $this->registry->request->pass)) {
$errmsg[] = 'Fatal error. Try again later.';
}
if (count($errmsg) > 0) {
$this->registry->view->errormessages = $errmsg;
$this->registry->view->render('register');
return;
}
unset($ul);
$this->registry->view->render('register_ok');
}
示例4: signin
public function signin()
{
$errmsg = array();
if ($this->registry->auth->check()) {
header("Location: /store");
return;
}
if (false == preg_match('/^[a-zA-Z0-9_]+$/', $this->registry->request->login)) {
$errmsg[] = 'Login should consist from alphanumeric characters';
}
if (false == preg_match('/^[a-zA-Z0-9_]+$/', $this->registry->request->pass)) {
$errmsg[] = 'Password should consist from alphanumeric characters';
}
/** instance of UserList class, lib/userlist.class.php */
$ul = new UserList();
if (!($passwordHash = $ul->isRegistered($this->registry->request->login))) {
$errmsg[] = 'Wrong login.';
}
if (md5($this->registry->request->pass) !== $passwordHash) {
$errmsg[] = 'Wrong password.';
}
if (count($errmsg) > 0) {
$this->registry->view->errormessages = $errmsg;
$this->registry->view->render('login');
return;
}
unset($ul);
$this->registry->auth->login();
$this->registry->view->username = $this->registry->request->login;
$this->registry->view->render('login_ok');
}
示例5: getRequestedSearchResults
public function getRequestedSearchResults()
{
$userList = new UserList();
$userList->sortBy('uDateAdded', 'desc');
$userList->showInactiveUsers = true;
$userList->showInvalidatedUsers = true;
if ($_GET['keywords'] != '') {
$userList->filterByKeywords($_GET['keywords']);
}
if ($_REQUEST['numResults']) {
$userList->setItemsPerPage($_REQUEST['numResults']);
}
if (isset($_REQUEST['gID']) && is_array($_REQUEST['gID'])) {
foreach ($_REQUEST['gID'] as $gID) {
$userList->filterByGroupID($gID);
}
}
if (is_array($_REQUEST['selectedSearchField'])) {
foreach ($_REQUEST['selectedSearchField'] as $i => $item) {
// due to the way the form is setup, index will always be one more than the arrays
if ($item != '') {
switch ($item) {
case 'is_active':
if ($_GET['active'] === '0') {
$userList->filterByIsActive(0);
} else {
if ($_GET['active'] === '1') {
$userList->filterByIsActive(1);
}
}
break;
case "date_added":
$dateFrom = $_REQUEST['date_from'];
$dateTo = $_REQUEST['date_to'];
if ($dateFrom != '') {
$dateFrom = date('Y-m-d', strtotime($dateFrom));
$userList->filterByDateAdded($dateFrom, '>=');
$dateFrom .= ' 00:00:00';
}
if ($dateTo != '') {
$dateTo = date('Y-m-d', strtotime($dateTo));
$dateTo .= ' 23:59:59';
$userList->filterByDateAdded($dateTo, '<=');
}
break;
default:
$akID = $item;
$fak = UserAttributeKey::get($akID);
$type = $fak->getAttributeType();
$cnt = $type->getController();
$cnt->setAttributeKey($fak);
$cnt->searchForm($userList);
break;
}
}
}
}
return $userList;
}
示例6: getAccessEntityUsers
public function getAccessEntityUsers(PermissionAccess $pa)
{
$gl = new UserList();
foreach ($this->groups as $g) {
$gl->filterByGroupID($g->getGroupID());
}
return $gl->get();
}
示例7: get_filterset_user_IDs
/**
* Get user IDs from current filterset of users list
*
* @param string Filterset name
* return array User IDs
*/
function get_filterset_user_IDs($filterset_name = 'admin')
{
load_class('users/model/_userlist.class.php', 'UserList');
// Initialize users list from session cache in order to get users IDs for newsletter
$UserList = new UserList($filterset_name);
$UserList->memorize = false;
$UserList->load_from_Request();
return $UserList->filters['users'];
}
示例8: view
public function view() {
$userList = new UserList();
$userList->sortBy('uName', 'asc');
$keywords = $this->get('keywords');
if ($keywords != '') {
$userList->filterByKeywords($keywords);
}
$users = $userList->getPage();
$this->set('userList', $userList);
$this->set('users', $users);
$this->set('attribs', UserAttributeKey::getMemberListList());
$this->set('keywords', htmlentities($keywords, ENT_COMPAT, APP_CHARSET));
$this->addHeaderItem(Loader::helper('html')->css('ccm.profile.css'));
}
示例9: __construct
public function __construct($seedUserListId = null, $seedUserListName = null, $seedUserListDescription = null, $seedUserListStatus = null, $seedListSize = null, $id = null, $isReadOnly = null, $name = null, $description = null, $status = null, $integrationCode = null, $accessReason = null, $accountUserListStatus = null, $membershipLifeSpan = null, $size = null, $sizeRange = null, $sizeForSearch = null, $sizeRangeForSearch = null, $listType = null, $isEligibleForSearch = null, $isEligibleForDisplay = null, $UserListType = null)
{
parent::__construct();
$this->seedUserListId = $seedUserListId;
$this->seedUserListName = $seedUserListName;
$this->seedUserListDescription = $seedUserListDescription;
$this->seedUserListStatus = $seedUserListStatus;
$this->seedListSize = $seedListSize;
$this->id = $id;
$this->isReadOnly = $isReadOnly;
$this->name = $name;
$this->description = $description;
$this->status = $status;
$this->integrationCode = $integrationCode;
$this->accessReason = $accessReason;
$this->accountUserListStatus = $accountUserListStatus;
$this->membershipLifeSpan = $membershipLifeSpan;
$this->size = $size;
$this->sizeRange = $sizeRange;
$this->sizeForSearch = $sizeForSearch;
$this->sizeRangeForSearch = $sizeRangeForSearch;
$this->listType = $listType;
$this->isEligibleForSearch = $isEligibleForSearch;
$this->isEligibleForDisplay = $isEligibleForDisplay;
$this->UserListType = $UserListType;
}
示例10: launch
function launch()
{
global $interface;
//Get all lists for the user
// Fetch List object
if (isset($_REQUEST['id'])) {
/** @var UserList $list */
$list = UserList::staticGet($_GET['listId']);
}
$interface->assign('favList', $list);
// Get all titles on the list
// $favorites = $list->getListEntries();
// $favList = new FavoriteHandler($favorites, null, $list->id, false);
//TODO: test this
$favList = new FavoriteHandler($list, null, false);
$citationFormat = $_REQUEST['citationFormat'];
$citationFormats = CitationBuilder::getCitationFormats();
$interface->assign('citationFormat', $citationFormats[$citationFormat]);
$citations = $favList->getCitations($citationFormat);
$interface->assign('citations', $citations);
// Display Page
$interface->assign('listId', strip_tags($_REQUEST['id']));
$interface->setTemplate('listCitations.tpl');
$interface->display('layout.tpl');
}
示例11: launch
function launch($msg = null)
{
global $interface;
global $configArray;
if (!($user = UserAccount::isLoggedIn())) {
require_once ROOT_DIR . '/services/MyAccount/Login.php';
MyAccount_Login::launch();
exit;
}
// Save Data
if (isset($_POST['submit'])) {
$this->saveChanges($user);
// After changes are saved, send the user back to an appropriate page;
// either the list they were viewing when they started editing, or the
// overall favorites list.
if (isset($_REQUEST['list_id'])) {
$nextAction = 'MyList/' . $_REQUEST['list_id'];
} else {
$nextAction = 'Home';
}
header('Location: ' . $configArray['Site']['path'] . '/MyAccount/' . $nextAction);
exit;
}
require_once ROOT_DIR . '/sys/LocalEnrichment/UserList.php';
$userList = new UserList();
$userList->id = $_REQUEST['list_id'];
$userList->find(true);
$interface->assign('list', $userList);
require_once ROOT_DIR . '/RecordDrivers/GroupedWorkDriver.php';
$id = $_GET['id'];
$groupedWorkDriver = new GroupedWorkDriver($id);
if ($groupedWorkDriver->isValid) {
$interface->assign('recordDriver', $groupedWorkDriver);
}
// Record ID
$interface->assign('recordId', $id);
// Retrieve saved information about record
require_once ROOT_DIR . '/sys/LocalEnrichment/UserListEntry.php';
$userListEntry = new UserListEntry();
$userListEntry->groupedWorkPermanentId = $id;
$userListEntry->listId = $_REQUEST['list_id'];
$userListEntry->find(true);
$interface->assign('listEntry', $userListEntry);
$interface->assign('listFilter', $_GET['list_id']);
$interface->setTemplate('editListTitle.tpl');
$interface->display('layout.tpl');
}
示例12: handleSearch
function handleSearch($p)
{
$list = UserList::getUsers($p['q']);
echo '<h2>Showing users matching <u>' . $p['q'] . '</u>';
echo ' (' . count($list) . ' hits)</h2>';
$dt = new YuiDatatable();
$dt->addColumn('id', 'Username', 'link', 'u/profile/', 'name');
$dt->addColumn('time_last_active', 'Last active');
$dt->setDataSource($list);
echo $dt->render();
}
示例13: getLeaders
public function getLeaders($searchString, $city, $limit)
{
Loader::model('user_list');
$av = Loader::helper('concrete/avatar');
$ul = new UserList();
$ul->filterByKeywords($searchString);
$ul->filterByGroup('Walk Leaders');
$ul->filterByIsActive(1);
$ul->filterByFirstName(null, '!=');
$ul->filterByFirstName('', '!=');
$ul->filter('uLastLogin', 0, '!=');
$ul->sortBy('uLastLogin');
$userSet = [];
foreach ($ul->get($limit ?: 5) as $user) {
$home_city = $user->getAttribute('home_city');
$userSet[$user->getUserID()] = ['user_id' => $user->getUserID(), 'first_name' => $user->getAttribute('first_name'), 'last_name' => $user->getAttribute('last_name'), 'city_name' => $home_city ? $home_city->getCollectionName() : null, 'city_id' => $home_city ? $home_city->getCollectionID() : null, 'bio' => $user->getAttribute('bio'), 'twitter' => $user->getAttribute('twitter'), 'facebook' => $user->getAttribute('facebook'), 'website' => $user->getAttribute('website'), 'avatar' => $av->getImagePath($user)];
}
return json_encode($userSet);
}
示例14: actionIndex
public function actionIndex()
{
$taxModel = LbTax::model()->getTaxes();
$list = UserList::model()->getList();
$translate = Translate::model()->search();
$translate = new Translate('search');
$translate->unsetAttributes();
// clear any default values
if (isset($_GET['Translate'])) {
$translate->attributes = $_GET['Translate'];
}
LBApplication::render($this, 'index', array('taxModel' => $taxModel, 'list' => $list, 'translate' => $translate));
// $this->render('index');
}
示例15: widget
/**
* Echo widget content = list of blog users.
*/
function widget($args, $instance)
{
require_once 'UserList.class.php';
// parse hidden users string
if (!empty($instance['hiddenusers'])) {
$hiddenusers = explode(',', $instance['hiddenusers']);
$hiddenusers = array_map('trim', $hiddenusers);
} else {
$hiddenusers = array();
}
$userlist = new UserList();
$userlist->roles = $instance['roles'];
$userlist->blogs = $instance['blogs'];
$userlist->group_by = $instance['group_by'];
$userlist->hiddenusers = $hiddenusers;
if (is_array($instance['display'])) {
$userlist->show_name = in_array('show_name', $instance['display']);
$userlist->show_postcount = in_array('show_postcount', $instance['display']);
$userlist->show_bbpress_post_count = in_array('show_bbpress_post_count', $instance['display']);
$userlist->show_biography = in_array('show_biography', $instance['display']);
$userlist->user_link = $instance['display']['user_link'];
$userlist->avatar_size = $instance['display']['avatar_size'];
$userlist->limit = $instance['display']['limit'];
$userlist->min_post_count = $instance['display']['min_post_count'];
$userlist->order = $instance['display']['order'];
$userlist->sort_direction = $instance['display']['sort_direction'];
}
// extract widget arguments
extract($args, EXTR_SKIP);
// add the standard title filter
$title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
// build the widget html
echo $before_widget;
echo $before_title . $title . $after_title;
$userlist->output();
echo $after_widget;
}