本文整理汇总了PHP中User::all方法的典型用法代码示例。如果您正苦于以下问题:PHP User::all方法的具体用法?PHP User::all怎么用?PHP User::all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类User
的用法示例。
在下文中一共展示了User::all方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public static function index()
{
self::check_admin_logged_in();
$name = self::get_search_term();
$users = User::all($name);
View::make('user/index.html', array('users' => $users));
}
示例2: register
public function register()
{
if (RequestMethods::post('register')) {
$pass = RequestMethods::post("pass");
$cpass = RequestMethods::post("cpass");
$salt = strtr(base64_encode(mcrypt_create_iv(16, MCRYPT_DEV_URANDOM)), '+', '.');
$cost = 10;
$salt = sprintf("\$2a\$%02d\$", $cost) . $salt;
$crypt = crypt($pass, $salt);
$user = new User(array("full_name" => RequestMethods::post("full_name"), "email" => RequestMethods::post("email"), "password" => $crypt));
$exist = User::all(array('email = ?' => RequestMethods::post("email")));
if (empty($exist)) {
if ($pass == $cpass) {
if ($user->validate()) {
$user->save();
return "success";
} else {
return "validation not good";
}
} else {
return "Passwords do not match";
}
} else {
return "User exists";
}
} else {
header('Location: /');
}
}
示例3: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$users = User::all();
$book_count = Book::all()->count();
$chapter_count = Chapter::all()->count();
return View::make('admin.admin_panel', array('pageTitle' => 'Admin Panel', 'users' => $users, 'book_count' => $book_count, 'chapter_count' => $chapter_count));
}
示例4: doRegister
public function doRegister()
{
$username = Input::get('username');
$password = Input::get('password');
$password = Hash::make($password);
if ($username != "" && $password != "") {
$users = User::all();
$usernames = array();
foreach ($users as $user) {
$usernames[] = $user->username;
}
if (!in_array($username, $usernames)) {
$user = new User();
$user->username = $username;
$user->password = $password;
$user->save();
$userdata = array('username' => Input::get('username'), 'password' => Input::get('password'));
if (Auth::attempt($userdata)) {
$user = Auth::user();
return Response::json(array('error' => false, 'userdata' => $user), 200);
} else {
return Response::json(array('error' => true, 'reason' => 'login failed'), 200);
}
} else {
return Response::json(array('error' => true, 'reason' => 'username not unique'), 200);
}
} else {
return Response::json(array('error' => true, 'reason' => 'username or password is empty'), 200);
}
}
示例5: init
public function init($id_tovar)
{
$data = $_REQUEST;
$join = "INNER JOIN koncentrator_tovarishestvo c ON(user.concetrator = c.name_konc)";
$this->_Users = User::all(array('conditions' => array("is_admin <> ? and id_tovar= ?", 1, $id_tovar), 'joins' => $join));
$this->id_tovar = $id_tovar;
/* if (!isset($data[Users::PAGE])) {
$this->_Users = User::find('all', array('limit' => 2), array('conditions' => "is_admin <> 1"));
//var_dump($_Users);
} else {
$this->_Users = User::find('all', array('conditions' => "is_admin <> 1", 'limit' => 2, 'offset' => (($data[Users::PAGE] * 2) - 2)));
//var_dump($_Users);
} */
$this->countPage = ceil(User::count(array('conditions' => "is_admin <> 1")) / 2);
if (isset($data[self::BUTTON_DELETE])) {
$User = User::find_by_login($data['login']);
if ($User instanceof User) {
$User->delete();
Flight::redirect('/admin/users/' . $this->id_tovar . '?success=3');
}
}
if (isset($data['saveUser'])) {
if ($data['idUser'] === 'newUser') {
return $this->addNewUser();
} else {
return $this->changeUser();
}
}
}
示例6: write_user_list
function write_user_list()
{
$this->write_block_begin('User list');
$this->write_form_begin('user_group_add.php', 'get');
$this->write_form_preserve('redirect');
echo '<label>Search for users: ';
$this->write_form_field('text', 'user_filter', @$_REQUEST['user_filter']);
echo '</label>';
$this->write_form_end('Show');
echo '<small>Make sure your lab partner has logged in with Justitia at least once.</small>';
if (!isset($_REQUEST['user_filter'])) {
return;
}
$filter = '%' . @$_REQUEST['user_filter'] . '%';
echo '<table class="user-list">' . "\n";
$users = User::all($filter);
foreach ($users as $user) {
echo '<tr>';
echo '<td>', htmlspecialchars($user->name_and_login()), '</td>';
if (UserGroup::contains($user)) {
echo '<td>[already in group]</td>';
} else {
echo '<td><a href="user_group_add.php?add=' . $user->userid . '&redirect=' . urlencode($_REQUEST['redirect']) . '">[add to group]</a></td>';
}
echo "</tr>\n";
}
echo '</table>';
$this->write_block_end();
}
示例7: loginView
public function loginView()
{
$users = User::all();
if (count($users) == 0) {
$token = Utilities::generateTokenForm();
$action = $this->app->urlFor('add_admin');
$vars = array();
if (isset($_SESSION['vars'])) {
$vars = $_SESSION['vars'];
unset($_SESSION['vars']);
}
$this->view = new NewAdmin($action, $token['token'], $vars);
$this->view->display();
} else {
$action = $this->app->urlFor('login_post');
$token = Utilities::generateTokenForm();
$vars = array();
if (isset($_SESSION['vars'])) {
$vars = $_SESSION['vars'];
unset($_SESSION['vars']);
}
$this->view = new LoginView($action, $token['token'], $vars);
$this->view->display();
}
}
示例8: get_add
public function get_add()
{
$this->data['pools'] = Koki::to_dropdown(Pool::all(), 'id', 'pool_name', array(0 => 'All'));
$this->data['users'] = Koki::to_dropdown(User::all(), 'id', 'first_name');
$this->data['create'] = true;
return View::make('themes.modul.' . $this->views . '.form', $this->data);
}
示例9: run
public function run()
{
$users = User::all();
for ($i = 0, $length = count($users); $i < $length; $i++) {
BusinessUser::create(['user_id' => $users[$i]->user_id, "business_name" => "企业名称_" . ($i + 1), "business_licence_no" => "1111111111111111" . ($i + 1), "business_licence_scan_path" => "http://7sbxao.com1.z0.glb.clouddn.com/avatar.jpg", "operational_name" => "logan", "operational_card_no" => "480023196807150234" . ($i + 1), "operational_phone" => "15902345624" . ($i + 1), "bank_account" => "315247183127" . ($i + 1), "deposit_bank" => "工商银行", "bank_outlets" => "大韩民国宇宙中心支行", "id_card_front_scan_path" => "http://7sbxao.com1.z0.glb.clouddn.com/avatar.jpg", "id_card_back_scan_path" => "http://7sbxao.com1.z0.glb.clouddn.com/avatar.jpg"]);
}
}
示例10: createFakerAd
protected function createFakerAd()
{
$faker = Faker::create();
$adtype = array("Informal Jam", "Formal Jam/Practice/Rehearsal", "Payed Gig", "Offering Lessons", "Wanting Lessons");
$level = array("Beginner", "Intermediate", "Semi-Pro", "Professional");
$original = array("Originals", "Covers", "Both");
$venuetype = array("House", "Venue", "Recording Studio", "Event");
$usertype = array("Band", "Musician");
$genre = array("Acoustic Blues", "Electric Blues", "Bluegrass", "Classical", "Pop Country", "Traditional Country", "House", "Deep House", "Dubstep", "Trap", "Techno", "Downtempo", "Ambient", "Drums & Bass", "Video Game", "Americana", "Acoustic Folk", "Cajun Folk", "Celtic Folk", "Singer/Songwriter Folk", "Combo Jazz", "Dixieland Jazz", "Ensemble Jazz", "Fusion Jazz", "Latin Jazz", "Standards", "Acid Jazz", "Latin", "New Age", "Ambient", "Christian", "Classic Rock", "Dance", "Hard Rock", "Heavy Metal", "Indie Rock", "Latin Rock", "New Wave", "Pop", "Psychedelic", "Punk Rock", "Rock & Roll", "Rockabilly", "Singer/Songwriter", "Ska", "Soft Rock", "Southern Rock", "Top 40", "Hip Hop/Rap", "Classic Soul", "Neo-Soul", "Gospel", "Contemporary R&B", "Reggae", "Soundtrack", "World Music");
$instrument = array("Full Band, Acoustic Guitar", "Classical Guitar", "Electric Guitar", "Steel Guitar", "Electric Bass", "Double Bass", "Ukelele", "Piano", "Keyboard", "Organ", "Accordion", "Drums", "Lead Rock/Pop Vocals", "Lead Jazz Vocals", "Bass Singer", "Baritone Singer", "Tenor Singer", "Alto Singer", "Mezzo-Soprano Singer", "Soprano Singer", "Cello", "Viola", "Violin", "Fiddle", "Banjo", "Harp", "Mandolin", "Trumpet", "Trombone", "Tuba", "French Horn", "Alto Sax", "Tenor Sax", "Flute", "Oboe", "Clarinet", "Harmonica", "Piccolo", "Bassoon");
$equipment = array("P/A System", "Guitar Amp", "Bass Amp", "Drum Set", "Keyboard");
for ($i = 1; $i <= 200; $i++) {
$ad = new Ad();
$ad->ad_type = $faker->randomElement($adtype);
$ad->ad_need = implode(", ", $faker->randomElements($instrument, $count = rand(1, 3)));
$ad->ad_title = $faker->state . " " . $faker->lastName;
$ad->level = $faker->randomElement($level);
$ad->comp = rand(0, 200);
$ad->genre = implode(", ", $faker->randomElements($genre, $count = rand(1, 3)));
$ad->date = $faker->dateTimeBetween($startDate = 'now', $endDate = '3 months');
$ad->start_time = $faker->time($format = 'H:i:s', $min = 'now');
$ad->description = $faker->realText;
$ad->equipment = implode(", ", $faker->randomElements($equipment, $count = rand(0, 5)));
$ad->venue_type = $faker->randomElement($venuetype);
$ad->venue = "Tycoon Flats";
$ad->address = "2926 N. St. Marys Street";
$ad->city = "San Antonio";
$ad->state = "TX";
$ad->zip_code = "78212";
$ad->user_id = User::all()->random(1)->id;
$ad->ad_img = $faker->imageUrl($width = 640, $height = 480, $category = 'nightlife');
$ad->save();
}
}
示例11: index
/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/welcome
* - or -
* http://example.com/index.php/welcome/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to /index.php/welcome/<method_name>
* @see http://codeigniter.com/user_guide/general/urls.html
*/
public function index()
{
$this->load->model('User');
$foos['results'] = User::all();
$data['name'] = 'Mehdi';
$this->twig->render('hello', $data);
}
示例12: staff
public function staff($app)
{
$app->output->addBreadcrumb('', 'CSGOShop');
$app->output->addBreadcrumb('about/staff', 'Staff Team');
$app->output->setTitle('Staff Team');
$app->output->setActiveTab('about');
$staff = User::all(['conditions' => ['rank >= ?', User::RANK_MODERATOR], 'order' => 'rank DESC']);
$steamIDs = [];
foreach ($staff as $user) {
if ($user->requiresSync()) {
$steamIDs[] = $user->id;
}
}
if (count($steamIDs) > 0) {
$data = $app->steam->getUser($steamIDs);
foreach ($staff as $user) {
if ($user->requiresSync()) {
$user->name = $data[$user->id]->personaname;
$user->avatar_url = $data[$user->id]->avatarfull;
$user->steam_status = $data[$user->id]->personastate > 0 ? 1 : 0;
$user->last_sync = time() + 600;
$user->save();
}
}
}
$app->output->render('about.staff', ['staff' => $staff]);
}
示例13: setupDatabases
public function setupDatabases()
{
$name = $this->call('migrate', array('--path' => 'app/database/migrations/setup/'));
$name = $this->call('migrate');
// create the roles
$roles = ['Admin', 'Writer', 'Reader'];
foreach ($roles as $r) {
$role = Role::whereName($r)->first();
if ($role == null) {
$role = new Role();
$role->name = $r;
$role->display_name = $r;
$role->save();
$this->info("{$role->id} Creating Role:{$r}");
}
}
foreach (User::all() as $u) {
$this->info("{$u->id} : user: {$u->username}");
}
// add core assets
$m = Asset::findFromTag('missing-user-image');
if ($m == NULL) {
$m = new Asset();
$m->path = "assets/content/uploads";
$m->saveLocalFile(public_path('assets/content/common/missing/profile-default.png'), 'profile-default.png');
$m->tag = 'missing-user-image';
$m->shared = 1;
$m->type = Asset::ASSET_TYPE_IMAGE;
$m->save();
}
$this->comment("****\tAll Databases for Halp have been setup :-) \t****");
return;
}
示例14: index
public function index()
{
if (!(Auth::check() && Auth::user()->canManageUsers())) {
return Redirect::to('/');
}
return View::make('users.index', array('css' => 'users', 'users' => User::all()));
}
示例15: getUsers
public function getUsers()
{
if (empty($this->users)) {
$this->users = User::all();
}
return $this->users;
}