本文整理汇总了PHP中Users::search方法的典型用法代码示例。如果您正苦于以下问题:PHP Users::search方法的具体用法?PHP Users::search怎么用?PHP Users::search使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Users
的用法示例。
在下文中一共展示了Users::search方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndex
public function actionIndex()
{
$model = new Users('search');
$model->unsetAttributes();
if (isset($_GET['Users'])) {
$model->setAttributes($_GET['Users']);
}
$dataProvider = $model->search();
$this->render('//users/index', array('dataProvider' => $dataProvider, 'model' => $model));
}
示例2: actionIndex
public function actionIndex()
{
$model = new Users("search");
$model->unsetAttributes();
if (isset($_GET['Users'])) {
$model->attributes = $_GET['Users'];
}
$data = $model->search();
$this->render("index", ["dataProvider" => $data, "model" => $model]);
}
示例3: actionIndex
public function actionIndex()
{
$dataProvider = new CActiveDataProvider('Users');
$model = new Users('search');
if (!Yii::app()->request->isAjaxRequest && !Yii::app()->request->getParam('ajax')) {
$this->render('list', ['dataProvider' => $dataProvider, 'model' => $model]);
} else {
$model->setAttributes(Yii::app()->request->getParam('Users'));
$dataProvider = $model->search();
$this->renderPartial('_list', ['dataProvider' => $dataProvider, 'model' => $model]);
}
}
示例4: switch
switch ($type) {
// search in articles
default:
case 'articles':
case 'images':
$values['items'] = Articles::search($search, 0, 30, 'feed');
break;
// search in files
// search in files
case 'files':
$values['items'] = Files::search($search, 0, 30, 'feed');
break;
// search in users
// search in users
case 'users':
$values['items'] = Users::search($search, 1.0, 30, 'feed');
break;
}
// make a text
include_once 'codec.php';
include_once 'rss_codec.php';
$result = rss_Codec::encode($values);
$status = @$result[0];
$text = @$result[1];
// handle the output correctly
render_raw('text/xml; charset=' . $context['charset']);
// actual transmission except on a HEAD request
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'HEAD') {
echo $text;
}
// the post-processing hook
示例5: array_merge
// search in sections
if ($items = Sections::search_in_section($section_id, $boolean_search, $offset, $bucket)) {
$result = array_merge($result, $items);
}
// global search
if (!$section_id) {
// search in categories
if ($items = Categories::search($boolean_search, $offset, $bucket)) {
$result = array_merge($result, $items);
}
// search in files
if ($items = Files::search($boolean_search, $offset, $bucket)) {
$result = array_merge($result, $items);
}
// search in users
if ($items = Users::search($boolean_search, $offset, $bucket)) {
$result = array_merge($result, $items);
}
}
// compare scores of two items
function compare_scores($a, $b)
{
if ($a[0] < $b[0]) {
return 1;
}
if ($a[0] == $b[0]) {
return 0;
}
return -1;
}
// sort the full array of results
示例6: die
// some input is mandatory
if (!isset($_REQUEST['term']) || !$_REQUEST['term']) {
Safe::header('Status: 400 Bad Request', TRUE, 400);
die(i18n::s('Request is invalid.'));
}
// just for sanity
$_REQUEST['term'] = preg_replace(FORBIDDEN_IN_NAMES, '_', $_REQUEST['term']);
// stop crawlers
if (Surfer::is_crawler()) {
Safe::header('Status: 401 Unauthorized', TRUE, 401);
die(i18n::s('You are not allowed to perform this operation.'));
}
// we return some text
$output = '';
// look for matching items
$items = Users::search($_REQUEST['term'], 1.0, 50, 'complete');
// build an unordered list
if (count($items)) {
$output .= '[';
$i = 0;
foreach ($items as $label => $more) {
if ($i > 0) {
$output .= ',';
}
$i++;
$output .= '{"value":"' . $label . '","label":"' . $more . '"}';
}
$output .= ']';
}
// allow for data compression
render_raw('application/json; charset=' . $context['charset']);
示例7: actionCheckUsername
/**
* Check whether the username exists.
**/
public function actionCheckUsername()
{
$username = isset($_POST['username']) ? $_POST['username'] : '';
$user = new Users();
$user->username = $username;
$provider = $user->search();
$provider->getData(true);
$success = $provider->itemCount;
echo "{success: {$success}}";
}
示例8: validateDocumentPost
}
// a search form for users
if (!$search) {
$search = i18n::s('Look for some user');
}
$context['text'] .= '<form method="get" action="' . $context['script_url'] . '" onsubmit="return validateDocumentPost(this)" id="main_form">' . '<p>' . '<input type="text" name="search" size="40" value="' . encode_field($search) . '" onfocus="this.value=\'\'" maxlength="128" />' . ' ' . Skin::build_submit_button(i18n::s('Go')) . '</p>' . "</form>\n";
// the script used for form handling at the browser
Page::insert_script(' func' . 'tion validateDocumentPost(container) {' . "\n" . ' if(!container.search.value) {' . "\n" . ' alert("' . i18n::s('Please type something to search for.') . '");' . "\n" . ' Yacs.stopWorking();' . "\n" . ' return false;' . "\n" . ' }' . "\n" . ' return true;' . "\n" . ' }' . "\n" . "\n" . '$("#search").focus();' . "\n");
// nothing found yet
$no_result = TRUE;
// search in users
$box = array();
$box['title'] = '';
$box['text'] = '';
$cap = 0;
if ($items = Users::search($search, 1.0, USERS_PER_PAGE + 1, 'full')) {
// link to next page if greater than USERS_PER_PAGE
$cap = count($items);
// limit the number of boxes displayed
if ($cap > USERS_PER_PAGE) {
@array_splice($items, USERS_PER_PAGE);
}
}
// we have found some articles
if ($cap || $page > 1) {
$no_result = FALSE;
}
// actually render the html
if (@count($box['bar'])) {
$box['text'] .= Skin::build_list($box['bar'], 'menu_bar');
}
示例9: process_request
protected final function process_request()
{
// Process
//
if ($this->request_noun === REQUEST_NOUN_USERS) {
if ($this->request_verb === 'show') {
// Show
//
if (count($this->inputter->additional_uri_arguments) === 1 && isset($this->inputter->additional_uri_arguments[0]) && $this->http_method === HTTP_METHOD_GET) {
Users::show($this->inputter, $this->outputter);
} else {
$this->invalid_process_additional_argument(count($this->inputter->additional_uri_arguments) - 1);
}
} else {
if ($this->request_verb === 'search' && $this->http_method === HTTP_METHOD_GET) {
// Search
//
Users::search($this->inputter, $this->outputter);
} else {
if ($this->request_verb === 'lookup' && $this->http_method === HTTP_METHOD_GET) {
// Lookup
//
Users::lookup($this->inputter, $this->outputter);
} else {
$this->invalid_process_verb();
}
}
}
} else {
if ($this->request_noun === REQUEST_NOUN_FRIENDS) {
if ($this->request_verb === 'list' && $this->http_method === HTTP_METHOD_GET) {
// List
//
Friends::_list($this->inputter, $this->outputter);
} else {
if ($this->request_verb === 'ids' && $this->http_method === HTTP_METHOD_GET) {
// User IDs
//
Friends::ids($this->inputter, $this->outputter);
} else {
$this->invalid_process_verb();
}
}
} else {
if ($this->request_noun === REQUEST_NOUN_FOLLOWERS) {
if ($this->request_verb === 'list' && $this->http_method === HTTP_METHOD_GET) {
// List
//
Followers::_list($this->inputter, $this->outputter);
} else {
if ($this->request_verb === 'ids' && $this->http_method === HTTP_METHOD_GET) {
// User IDs
//
Followers::ids($this->inputter, $this->outputter);
} else {
$this->invalid_process_verb();
}
}
} else {
if ($this->request_noun === REQUEST_NOUN_IN_PRODUCT_PROMOTIONS) {
if ($this->request_verb === 'show') {
// Show
//
if (count($this->inputter->additional_uri_arguments) === 1 && isset($this->inputter->additional_uri_arguments[0]) && $this->http_method === HTTP_METHOD_GET) {
// In Product Promotion ID
//
InProductPromotions::show($this->inputter, $this->outputter);
} else {
$this->invalid_process_additional_argument(count($this->inputter->additional_uri_arguments) - 1);
}
} else {
if ($this->request_verb === 'create' && $this->http_method === HTTP_METHOD_POST) {
// Create
//
InProductPromotions::create($this->inputter, $this->outputter);
} else {
if ($this->request_verb === 'update' && $this->http_method === HTTP_METHOD_POST) {
// Update
//
InProductPromotions::update($this->inputter, $this->outputter);
} else {
if ($this->request_verb === 'destroy') {
// Destroy
//
if (count($this->inputter->additional_uri_arguments) === 1 && isset($this->inputter->additional_uri_arguments[0]) && $this->http_method === HTTP_METHOD_DELETE) {
// In Product Promotion ID
//
InProductPromotions::destroy($this->inputter, $this->outputter);
} else {
$this->invalid_process_additional_argument(count($this->inputter->additional_uri_arguments) - 1);
}
} else {
$this->invalid_process_verb();
}
}
}
}
} else {
if ($this->request_noun === REQUEST_NOUN_INVITATIONS) {
if ($this->request_verb === 'show') {
//.........这里部分代码省略.........
开发者ID:adamcarter93,项目名称:university-final-year-project-rest-api,代码行数:101,代码来源:EventsRESTController.php
示例10: xhtmlMenu
<?php
require_once 'config.php';
require 'design_head.php';
echo xhtmlMenu($user_menu, 'blog_menu');
echo '<h2>Search for users</h2>';
echo Users::search();
require 'design_foot.php';
示例11: array_merge
$links = array_merge($links, array($context['url_to_root'] => i18n::s('Front page')));
$links = array_merge($links, array('sections/' => i18n::s('Site map')));
$links = array_merge($links, array('users/' => i18n::s('People')));
$links = array_merge($links, array('categories/' => i18n::s('Categories')));
$links = array_merge($links, array('search.php' => i18n::s('Search')));
$context['components']['boxes'] .= Skin::build_box(i18n::s('Navigate'), Skin::build_list($links, 'compact'), 'boxes');
// failed authentication
} else {
// set permanent name shown from top level
Safe::setcookie('surfer_name', preg_replace('/(@.+)$/', '', $name), time() + 60 * 60 * 24 * 500, '/');
// reset the current session
Surfer::reset();
// share status
Logger::error(i18n::s('Failed authentication'), FALSE);
// help surfer to recover
if ($items =& Users::search($name, 1.0, 7, 'password')) {
// display candidate profiles
if (is_array($items)) {
$items =& Skin::build_list($items, 'decorated');
}
$context['text'] .= Skin::build_box(i18n::s('Have you lost your password?'), $items);
}
// ask for support
$context['text'] .= Skin::build_box(i18n::s('Do you need more help?'), '<p>' . sprintf(i18n::s('Use the %s to ask for help'), Skin::build_link('query.php', i18n::s('query form'), 'shortcut')) . '</p>');
}
// provide the empty form by default
} elseif (!Surfer::is_logged()) {
// the page title
if (isset($_REQUEST['url'])) {
$context['page_title'] = i18n::s('The page you requested is available only to registered members.');
}