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


PHP User::find_all方法代码示例

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


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

示例1: fill_user_photos

function fill_user_photos()
{
    $users = User::find_all();
    foreach ($users as $user) {
        create_user_photos($user->id);
    }
}
开发者ID:scottdavis,项目名称:nimblize,代码行数:7,代码来源:test_config.php

示例2: rules

 public function rules()
 {
     if (!$this->rules_cache || $reload) {
         $id = mysql_real_escape_string($this->id);
         $this->rules_cache = User::find_all("aclrules.acls_id = '{$id}'");
     }
     return $this->rules_cache;
 }
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:8,代码来源:acl.php

示例3: testAssociationLoadsData

 public function testAssociationLoadsData()
 {
     $users = User::find_all(array('include' => 'photos'));
     foreach ($users as $user) {
         foreach ($user->photos as $photo) {
             $this->assertEquals($user->id, $photo->user_id);
         }
     }
 }
开发者ID:scottdavis,项目名称:nimblize,代码行数:9,代码来源:AssociationsTest.php

示例4: testFindAll

 public function testFindAll()
 {
     $users = User::find_all();
     $users = collect(function ($o) {
         return $o->name;
     }, $users);
     //we sort them to assure they are compaired in an order that will return true
     $this->assertEquals(asort($users), asort($this->users));
 }
开发者ID:scottdavis,项目名称:active_php,代码行数:9,代码来源:FinderTest.php

示例5: testFindAllConditionsOrderLimit

 public function testFindAllConditionsOrderLimit()
 {
     $users = User::find_all(array('limit' => '0,5', 'order' => 'my_int DESC', 'conditions' => "name LIKE '%names%'"));
     $test_compair = range(10, 6);
     $test = array();
     foreach ($users as $user) {
         $test[] = $user->my_int;
     }
     $this->assertEquals($test_compair, $test);
 }
开发者ID:scottdavis,项目名称:nimblize,代码行数:10,代码来源:FinderTest.php

示例6: up

 public function up()
 {
     $table = $this->alter_table('users');
     $table->timestamp('channel_updated');
     $table->go();
     foreach (User::find_all() as $user) {
         $user->channel_updated = DateHelper::to_string('db', time());
         $user->save();
     }
 }
开发者ID:scottdavis,项目名称:pearfarm_channel_server,代码行数:10,代码来源:1262148568_add_channel_updated_to_users_migration.php

示例7: User

 static function is_logged_in()
 {
     if (!isset(Login::$logged_in)) {
         Login::$logged_in = FALSE;
         if (!empty($_COOKIE['username'])) {
             $conn = Db::get_connection();
             $user_factory = new User();
             $users = $user_factory->find_all(array('where_clause' => "`utente` = '{$conn->escape($_COOKIE['username'])}'", 'limit' => 1));
             if (count($users) > 0) {
                 $user = $users[0];
                 Login::$logged_in = md5($user->utente . self::magic_phrase) == @$_COOKIE['userID'];
             }
             Db::close_connection($conn);
         }
     }
     return Login::$logged_in;
 }
开发者ID:emeraldion,项目名称:creso,代码行数:17,代码来源:login.php

示例8: create

 public function create($group_id = null)
 {
     $group = self::load_group($group_id);
     if ($this->post) {
         $added = false;
         foreach ($_POST['users'] as $id) {
             $user = User::find_by_id($id);
             if ($user) {
                 $user_group = new UserGroup();
                 $user_group->user_id = $user->id;
                 $user_group->group_id = $group->id;
                 if ($user_group->save()) {
                     $added = true;
                 }
             }
         }
         if ($added) {
             Site::Flash("notice", "The users have been added to the group");
         }
         Redirect("admin/groups/{$group->id}");
     }
     $group_users = array();
     foreach ($group->users() as $user) {
         $group_users[] = $user->id;
     }
     $users = array();
     $all_users = User::find_all("", "nickname ASC");
     foreach ($all_users as $user) {
         if (!in_array($user->id, $group_users)) {
             $users[] = $user;
         }
     }
     if (count($users) == 0) {
         Site::Flash("error", "There are no more users to add.");
         Redirect("admin/groups/{$group->id}");
     }
     $this->assign("users", $users);
     $this->assign("group", $group);
     $this->title = "Add Users";
     $this->render("user_group/create.tpl");
 }
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:41,代码来源:user_group.controller.php

示例9: test_basic_find

 public function test_basic_find()
 {
     $count = User::count();
     FuzzyTest::assert_equal($count, 3, "Should find three users here");
     $matches = User::find_all();
     FuzzyTest::assert_equal(count($matches), 3, "Should find three users here");
     $count = User::count(array('email' => 'ben@allseeing-i.com'));
     FuzzyTest::assert_equal($count, 1, "Should find one user here");
     $matches = User::find(array('email' => 'ben@allseeing-i.com'));
     FuzzyTest::assert_equal(count($matches), 1, "Should find one user here");
     $u = $matches[0];
     FuzzyTest::assert_equal($u->email, "ben@allseeing-i.com", "Found wrong user");
     $count = User::count(array('first_name' => 'Ben'));
     FuzzyTest::assert_equal($count, 2, "Should find two users here");
     $matches = User::find(array('first_name' => 'Ben'));
     FuzzyTest::assert_equal(count($matches), 2, "Should find two users here");
     $matches = User::find_all_by_first_name('Ben');
     FuzzyTest::assert_equal(count($matches), 2, "Should find two users here");
     $count = User::count_by_first_name('Ben');
     FuzzyTest::assert_equal($count, 2, "Should find two users here");
     $matches = User::find_all_by_email('ben@allseeing-i.com');
     FuzzyTest::assert_equal(count($matches), 1, "Should find one user here");
     $count = User::count_by_email('ben@allseeing-i.com');
     FuzzyTest::assert_equal($count, 1, "Should find one user here");
     $u = $matches[0];
     FuzzyTest::assert_equal($u->email, "ben@allseeing-i.com", "Found wrong user");
     $u = User::find_by_email('ben@allseeing-i.com');
     FuzzyTest::assert_equal($u->email, "ben@allseeing-i.com", "Found wrong user");
     $matches = User::find_all_by_email_and_first_name('ben@allseeing-i.com', 'Ben');
     FuzzyTest::assert_equal(count($matches), 1, "Should find one user here");
     $count = User::count_by_email_and_first_name('ben@allseeing-i.com', 'Ben');
     FuzzyTest::assert_equal($count, 1, "Should find one user here");
     $u = $matches[0];
     FuzzyTest::assert_equal($u->email, "ben@allseeing-i.com", "Found wrong user");
     $matches = User::find(array('first_name' => 'Ben', 'limit' => 1));
     FuzzyTest::assert_equal(count($matches), 1, "Should find one user here");
     $matches = User::find(array('first_name' => 'Ben', 'order_by' => 'registration_date'));
     FuzzyTest::assert_equal(count($matches), 2, "Should find two users here");
     $u = $matches[0];
     FuzzyTest::assert_equal($u->email, "ben@allseeing-i.com", "Sorted results in the wrong order");
     $matches = User::find(array('first_name' => 'Ben', 'order_by' => 'email', 'sort' => "descending"));
     FuzzyTest::assert_equal(count($matches), 2, "Should find two users here");
     $u = $matches[0];
     FuzzyTest::assert_equal($u->email, "ben@allseeing-i.com", "Sorted results in the wrong order");
     $matches = User::find(array('first_name' => 'Ben', 'order_by' => 'email', 'sort' => "ascending"));
     FuzzyTest::assert_equal(count($matches), 2, "Should find two users here");
     $u = $matches[1];
     FuzzyTest::assert_equal($u->email, "ben@allseeing-i.com", "Found wrong user");
     $matches = User::find(array('email_not' => 'ben@allseeing-i.com'));
     FuzzyTest::assert_equal(count($matches), 2, "Should find two users here");
 }
开发者ID:pokeb,项目名称:fuzzy-record,代码行数:51,代码来源:TestFind.php

示例10: redirect_to

<?php

require_once "../includes/initialize.php";
if (!$session->is_logged_in()) {
    redirect_to("login.php");
}
?>


<?php 
include_layout_template('header.php');
$user = User::find_by_id(1, "users");
echo $user->fullname;
echo "<hr />";
$users = User::find_all("users");
foreach ($users as $user) {
    echo "User: " . $user->username . "<br />";
    echo "Name: " . $user->fullname . "<br /><br />";
}
?>

	<ul>
		<li><a href="logfile.php">View Log file</a></li>
		<li><a href="logout.php">Logout</a></li>
	</ul>

<?php 
include_layout_template('footer.php');
开发者ID:niteshsinha,项目名称:OQM,代码行数:28,代码来源:index.php

示例11: date

                    $user_name_input = Input::get('name');
                    $salt = Hash::salt(32);
                    try {
                        $user->create(['username' => Input::get('username'), 'password' => Hash::make(Input::get('password'), $salt), 'salt' => $salt, 'name' => Input::get('name'), 'joined' => date('Y-m-d H:i:s'), 'group' => Input::get('group')]);
                        Session::flash('register', $user_name_input . ' has been registered and can now log in!');
                    } catch (Exception $e) {
                        die($e->getMessage());
                    }
                }
            }
        }
        //The code below holds true
        //even if no submission is made
        //to register a new user
        $all_users_obj = new User();
        $all_users_obj->find_all();
        $all_users_data = $all_users_obj->data();
    }
}
?>

<!--include reg_user_header.php-->
<?php 
include '../includes/layout/reg_user_header.php';
?>

	<section class="user_interface row">
	
		<section class="user_interface_panel col-xs-12 col-sm-8">
			<article>
				<p>
开发者ID:reggiegulle,项目名称:StoryOfMH370,代码行数:31,代码来源:manage_users.php

示例12: edit

 public function edit()
 {
     $signup = self::load_signup($id);
     if ($signup->event->enddate <= time()) {
         Site::Flash("error", "It is not possible to edit this booking");
         Redirect("bookings/{$signup->id}");
     }
     // Seating Manager
     $managers = array('' => 'None');
     $clan = mysql_real_escape_string(Site::CurrentUser()->clan);
     if ($clan != '') {
         $id = mysql_real_escape_string(Site::CurrentUser()->id);
         $allManagers = User::find_all("users.clan = '{$clan}'", "users.nickname ASC");
         foreach ($allManagers as $manager) {
             $permalink = $manager->permalink();
             $managers[$permalink] = $manager->nickname;
         }
     }
     $currentManager = '';
     if ($signup->manager_id) {
         $currentManager = $signup->manager->permalink();
     }
     if ($this->post and !$this->csrf) {
         global $site;
         $site['flash']['error'] = "Invalid form submission";
     } elseif ($this->post) {
         $signup->lift_required = $_POST['lift_required'];
         if (!$signup->paid and !$signup->event_ticket->hidden) {
             $ticket_id = mysql_real_escape_string($_POST['ticket']);
             if ($ticket_id != $signup->event_ticket_id) {
                 $event_id = mysql_real_escape_string($signup->event_id);
                 $ticket = EventTicket::find("event_tickets.id = '{$ticket_id}' AND event_tickets.event_id = '{$event_id}' AND event_tickets.hidden = false");
                 if ($ticket) {
                     $signup->event_ticket_id = $ticket->id;
                     $signup->event_ticket = $ticket;
                 }
             }
         }
         $save = true;
         if ($this->PostData('manager_id')) {
             $manager = User::find_by_nickname($this->PostData('manager_id'));
             if ($manager && array_key_exists($manager->permalink(), $managers)) {
                 $signup->manager_id = $manager->id;
             } else {
                 global $site;
                 $site['flash']['error'] = "Unable to find the seat manager you selected";
                 $save = false;
             }
         } else {
             $signup->manager_id = null;
         }
         if ($save && $signup->save()) {
             // Remove any services that don't fit this booking
             if (!$signup->event_ticket->participant) {
                 $signup_id = mysql_real_escape_string($signup->id);
                 $services = EventService::find_all("event_services.event_signup_id = '{$signup_id}' AND participant = true");
                 $paid = array();
                 foreach ($services as $service) {
                     if ($service->paid) {
                         // Service has been paid, don't remove it, email staff
                         $paid[] = $service;
                     } else {
                         $service->destroy();
                     }
                 }
                 if (count($paid) > 0) {
                     // One or more services were unsuitable but paid for (this should
                     // really not happen! Let's email staff and they can handle it
                 }
             }
             Site::Flash("notice", "Your event booking has been updated");
             Redirect("bookings/{$signup->id}");
         }
     }
     $this->assign("signup", $signup);
     $this->assign("tickets", $signup->event->public_tickets());
     $this->assign("managers", $managers);
     $this->assign("currentManager", $currentManager);
     $this->title = "My Bookings :: " . $signup->event->name . " :: Edit";
     $this->render("event_signup/edit.tpl");
 }
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:81,代码来源:event_signup.controller.php

示例13: echo_memory_usage

 */
function echo_memory_usage()
{
    $mem_usage = memory_get_usage(true);
    if ($mem_usage < 1024) {
        var_dump($mem_usage . " bytes");
    } elseif ($mem_usage < 1048576) {
        var_dump(round($mem_usage / 1024, 2) . " kilobytes");
    } else {
        var_dump(round($mem_usage / 1048576, 2) . " megabytes");
    }
}
echo_memory_usage();
define('MYSQL_DATABASE', 'nimble_record_test');
require_once dirname(__FILE__) . '/../../../nimble_support/base.php';
require_once dirname(__FILE__) . '/../../../nimble_record/base.php';
require_once dirname(__FILE__) . '/../../../nimble_record/migrations/migration.php';
require_once dirname(__FILE__) . '/../../../nimble_record/migrations/lib/migration_runner.php';
require_once dirname(__FILE__) . '/../model/user.php';
require_once dirname(__FILE__) . '/../model/photo.php';
$settings = array('host' => 'localhost', 'database' => MYSQL_DATABASE, 'username' => 'root', 'password' => '', 'adapter' => 'mysql');
NimbleRecord::establish_connection($settings);
echo_memory_usage();
$u = User::find_all(array('limit' => '0,500'));
echo_memory_usage();
$u->clear();
echo_memory_usage();
$u2 = User::find_all();
echo_memory_usage();
$u2->clear();
echo_memory_usage();
开发者ID:scottdavis,项目名称:nimblize,代码行数:31,代码来源:profile_find_all.php

示例14: users

 public function users()
 {
     if (!$this->users_cache || $reload) {
         $id = mysql_real_escape_string($this->id);
         $this->users_cache = User::find_all("users.aclgroup_id = '{$id}'");
     }
     return $this->users_cache;
 }
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:8,代码来源:aclgroup.php

示例15: syncAgenti

 public function syncAgenti()
 {
     $imopediaSoap = new ImopediaSoap('http://syncapi.imopedia.ro/api2/sync.wsdl?' . time(), "ag1173api", "qrjefpkn8wa45ghsJw31l");
     $imopediaSoap->connect();
     $agenti = User::find_all();
     foreach ($agenti as $agent) {
         $agarr['AGENTIA'] = 1173;
         $agarr['AGENT_ID'] = $agent->id;
         $agarr['CONTACT_PERS'] = $agent->full_name();
         $agarr['CONTACT_TEL'] = $agent->Telefon;
         $agarr['CONTACT_EMAIL'] = $agent->Email;
         //$agarr['AGENT_IMAGE']	= base64_encode(file_get_contents("http://igor.lanconect.ro/Imob2009/".$agent->image_path()));
         $agarr['AGENT_IMAGE'] = str_replace(" ", "%20", "http://igor.lanconect.ro/Imob2009/" . $agent->image_path());
         $agobj = $this->arrayToObject($agarr);
         //$soap_result = $imopediaSoap->execute('saveAgent', $options);
         $rrr = $imopediaSoap->execute('saveAgent', $agobj);
     }
     $imopediaSoap->disconnect();
     return true;
 }
开发者ID:hionuth,项目名称:Imob2009,代码行数:20,代码来源:imopedia.php


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