当前位置: 首页>>代码示例>>PHP>>正文


PHP UserList::sortBy方法代码示例

本文整理汇总了PHP中UserList::sortBy方法的典型用法代码示例。如果您正苦于以下问题:PHP UserList::sortBy方法的具体用法?PHP UserList::sortBy怎么用?PHP UserList::sortBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserList的用法示例。


在下文中一共展示了UserList::sortBy方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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;
 }
开发者ID:VonUniGE,项目名称:concrete5-1,代码行数:59,代码来源:search.php

示例2: 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'));
	}
开发者ID:rii-J,项目名称:concrete5-de,代码行数:14,代码来源:members.php

示例3: 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);
 }
开发者ID:r-bansal,项目名称:janeswalk-web-1,代码行数:19,代码来源:walk_leaders.php

示例4: getRequestedSearchResults

	public function getRequestedSearchResults() {
		$userList = new UserList();
		$userList->sortBy('uDateAdded', 'desc');
		$userList->showInactiveUsers = true;
		$userList->showInvalidatedUsers = true;
		
		$columns = UserSearchColumnSet::getCurrent();
		$this->set('columns', $columns);

		if ($_GET['keywords'] != '') {
			$userList->filterByKeywords($_GET['keywords']);
		}	
		
		if ($_REQUEST['numResults'] && Loader::helper('validation/numbers')->integer($_REQUEST['numResults'])) {
			$userList->setItemsPerPage($_REQUEST['numResults']);
		}
		
		$pk = PermissionKey::getByHandle('access_user_search');
		$asl = $pk->getMyAssignment();

		$p = new Permissions();

		$filterGIDs = array();
		if ($asl->getGroupsAllowedPermission() == 'C') { 
			$userList->filter('u.uID', USER_SUPER_ID, '<>');
			$userList->addToQuery("left join UserGroups ugRequired on ugRequired.uID = u.uID ");	
			if (in_array(REGISTERED_GROUP_ID, $asl->getGroupsAllowedArray())) {
				$userList->filter(false, '(ugRequired.gID in (' . implode(',', $asl->getGroupsAllowedArray()) . ') or ugRequired.gID is null)');
			} else {
				$userList->filter('ugRequired.gID', $asl->getGroupsAllowedArray(), 'in');		
			}
		}
		
		if (isset($_REQUEST['gID']) && is_array($_REQUEST['gID'])) {
			foreach($_REQUEST['gID'] as $gID) {
				$g = Group::getByID($gID);
				if (is_object($g)) {
					if ($pk->validate($g) && (!in_array($g->getGroupID(), $filterGIDs))) {
						$filterGIDs[] = $g->getGroupID();
					}
				}
			}
		}
		
		foreach($filterGIDs 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;
						case "group_set":
							$gsID = $_REQUEST['gsID'];
							$gs = GroupSet::getByID($gsID);
							$groupsetids = array(-1);
							if (is_object($gs)) {
								$groups = $gs->getGroups();
							}
							$userList->addToQuery('left join UserGroups ugs on u.uID = ugs.uID');
							foreach($groups as $g) {
								if ($pk->validate($g) && (!in_array($g->getGroupID(), $groupsetids))) {
									$groupsetids[] = $g->getGroupID();
								}								
							}							
							$instr = 'ugs.gID in (' . implode(',', $groupsetids) . ')';
							$userList->filter(false, $instr);
							break;

						default:
							$akID = $item;
							$fak = UserAttributeKey::get($akID);
							$type = $fak->getAttributeType();
							$cnt = $type->getController();
							$cnt->setAttributeKey($fak);
							$cnt->searchForm($userList);
							break;
					}
//.........这里部分代码省略.........
开发者ID:ronlobo,项目名称:concrete5,代码行数:101,代码来源:search.php

示例5: die

<?php 
defined('C5_EXECUTE') or die("Access Denied.");
$valt = Loader::helper('validation/token');
if ($valt->validate('quick_user_select_' . $_REQUEST['key'], $_REQUEST['token'])) {
	$u = new User();
	Loader::model('user_list');
	$db = Loader::db();
	$userList = new UserList();
	if ($_GET['term'] != '') {
		$term = $db->quote($_GET['term'].'%');
		$userList->filter(false, '( u.uName LIKE ' . $term . ')');
	}
	$userList->sortBy('uName','ASC');
	$users = $userList->get(7);
	$userNames = array();
	foreach($users as $ui) {
		$userNames[] = $ui->getUserName();
	}
	$jh = Loader::helper('json');
	echo $jh->encode($userNames);
}
开发者ID:rii-J,项目名称:concrete5-de,代码行数:21,代码来源:autocomplete.php

示例6: UserList

    // by 'custom template' and choose a block name
    $ul = new UserList();
    $defaultAttribute = ['', true, '='];
    foreach ($filters as $k => $filter) {
        if ($k === 'groups') {
            foreach ($filter as $group) {
                $ul->filterByGroup($group);
            }
        } elseif ($k === 'attributes') {
            // $attribute keys: 'id', 'value', 'compare'
            foreach ($filter as $attribute) {
                list($handle, $value, $comparison) = array_replace($defaultAttribute, $attribute);
                $ul->filterByAttribute($handle, $value, $comparison);
            }
        }
        $ul->sortBy('ak_order', 'asc');
    }
    /**
     * Build doc with all the 'member's in it, and load the values we'll
     * need to display.
     */
    return array_map(function ($member) use($av) {
        return ['id' => $member->getUserID(), 'img' => $av->getImagePath($member), 'name' => trim($member->getAttribute('first_name') . ' ' . $member->getAttribute('last_name')), 'title' => $member->getAttribute('job_title') ?: "Jane's Walk", 'email' => $member->getUserEmail(), 'description' => $member->getAttribute('bio')];
    }, $ul->get(100));
};
echo $controller->getContent();
?>
<ul class="ccm-staff-list">
<?php 
foreach ($getMembers($filters) as $member) {
    ?>
开发者ID:r-bansal,项目名称:janeswalk-web-1,代码行数:31,代码来源:staff_list.php


注:本文中的UserList::sortBy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。