本文整理汇总了PHP中UserPeer::searchUsers方法的典型用法代码示例。如果您正苦于以下问题:PHP UserPeer::searchUsers方法的具体用法?PHP UserPeer::searchUsers怎么用?PHP UserPeer::searchUsers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserPeer
的用法示例。
在下文中一共展示了UserPeer::searchUsers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeUsergroupIndex
/**
* Executes group index action
*
* @param sfRequest $request A request object
*/
public function executeUsergroupIndex(sfWebRequest $request)
{
$this->forward404Unless($this->usergroup = UsergroupPeer::retrieveByPk($request->getParameter('usergroupId')), sprintf('Object usergroup does not exist (%s).', $request->getParameter('usergroupId')));
$this->forward404Unless($this->user = $this->getUser()->getTemposUser(), 'No user logged-in.');
$this->forward404Unless($this->getUser()->getTemposUser()->isLeader($this->usergroup), 'The logged user is not leader of the specified usergroup.');
$this->form = new UserSearchForm();
$formName = $this->form->getName();
$this->form->setIsActive(null);
$this->form->setCardNumber(null);
$this->form->setUsergroupsAsLeader(null);
$this->form->setUsergroupsAsMember(null);
$this->getUser()->syncParameters($this, 'home', 'usergroupIndex', array($formName, 'sort_column', 'sort_direction'), $request);
if (is_null($this->sort_column)) {
$this->sort_column = 'name';
$this->sort_direction = 'up';
}
$c = new Criteria();
SortCriteria::addSortCriteria($c, $this->sort_column, UserPeer::getSortAliases(), $this->sort_direction);
if (!is_null($this->{$formName})) {
$this->filtered = true;
$this->form->bind($this->{$formName}, $request->getFiles($formName));
$c = UserPeer::getUsergroupMemberCriteria($this->usergroup->getId(), $c);
if ($this->form->isValid()) {
$this->user_list = UserPeer::searchUsers($this->form->getValue('login'), $this->form->getValue('family_name'), $this->form->getValue('surname'), $this->form->getValue('usergroupsAsLeader'), $this->form->getValue('usergroupsAsMember'), $this->form->getValue('activities'), $this->form->getValue('is_active'), $this->form->getValue('card_number'), $this->form->getValue('year_min'), $this->form->getValue('year_max'), $this->form->getValue('email_address'), $this->form->getValue('address'), $this->form->getValue('phone_number'), $c);
}
}
if (!isset($this->user_list)) {
$this->filtered = false;
$this->user_list = $this->usergroup->getMembers();
}
$this->count = count($this->user_list);
$this->getUser()->setAttribute('usergroupId', $this->usergroup->getId());
}
示例2: executeIndex
public function executeIndex(sfWebRequest $request)
{
$this->is_admin = $this->getUser()->hasCredential('admin', false);
$this->form = new UserSearchForm();
$formName = $this->form->getName();
$this->step = sfConfig::get('app_max_users_on_userlist');
$this->getUser()->syncParameters($this, 'user', 'index', array('offset', 'limit', $formName, 'sort_column', 'sort_direction'), $request);
if (is_null($this->sort_column)) {
$this->sort_column = 'name';
$this->sort_direction = 'up';
}
if (is_null($this->offset)) {
$this->offset = 0;
}
if (is_null($this->limit) || $this->limit <= 0) {
$this->limit = $this->step;
}
$c = new Criteria();
SortCriteria::addSortCriteria($c, $this->sort_column, UserPeer::getSortAliases(), $this->sort_direction);
if (!is_null($this->{$formName})) {
$this->filtered = true;
$this->form->bind($this->{$formName}, $request->getFiles($formName));
if ($this->form->isValid()) {
$this->user_list = UserPeer::searchUsers($this->form->getValue('login'), $this->form->getValue('family_name'), $this->form->getValue('surname'), $this->form->getValue('usergroupsAsLeader'), $this->form->getValue('usergroupsAsMember'), $this->form->getValue('activities'), $this->form->getValue('is_active'), $this->form->getValue('card_number'), strtotime($this->form->getValue('begin_date')), strtotime($this->form->getValue('end_date')), $this->form->getValue('email_address'), $this->form->getValue('address'), $this->form->getValue('phone_number'), $c);
$this->count = count($this->user_list);
$this->user_list = array_slice($this->user_list, $this->offset, $this->limit);
} else {
$this->setTemplate('search');
}
} else {
$c->setOffset($this->offset);
if ($this->limit >= 0) {
$c->setLimit($this->limit);
}
$this->filtered = false;
$this->user_list = UserPeer::doSelectMembers($c);
$this->count = UserPeer::doCountMembers(new Criteria());
}
if ($this->offset < 0 || $this->offset >= $this->count && $this->count > 0) {
$this->forward404('Invalid offset/count values.');
}
}