本文整理汇总了PHP中User::getAllUsers方法的典型用法代码示例。如果您正苦于以下问题:PHP User::getAllUsers方法的具体用法?PHP User::getAllUsers怎么用?PHP User::getAllUsers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类User
的用法示例。
在下文中一共展示了User::getAllUsers方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetAllUsers
/**
* @covers User::getAllUsers
*/
public function testGetAllUsers()
{
$users = $this->object->getAllUsers();
$this->assertInternalType('array', $users, 'Return should be an array');
$this->assertNotCount(0, $users, 'Array should contain at least 1 user');
$this->assertInstanceOf('User', $users[0], 'Array should contain User class');
}
示例2: getSearch
public function getSearch()
{
$this_user = Session::get('user');
$users = User::getAllUsers($this_user);
// make a list of user_ids that have a filled relationship_status
$withRelationships = array();
foreach ($users as $user) {
if ($user->relationship_status != NULL && !in_array($user->user_id, $withRelationships)) {
$withRelationships[] = $user->user_id;
}
}
for ($x = 0; $x < count($users); $x++) {
if ($users[$x]->user_id == $this_user->user_id) {
unset($users[$x]);
}
}
$users1 = array_values($users);
unset($users);
for ($x = 0; $x < count($users1); $x++) {
if ($users1[$x]->relationship_target == $this_user->user_id && $users1[$x]->relationship_status == 'active') {
unset($users1[$x]);
}
}
$users = array_values($users1);
for ($x = 0; $x < count($users); $x++) {
if ($users[$x]->relationship_status == NULL && in_array($users[$x]->user_id, $withRelationships)) {
unset($users[$x]);
}
}
$users1 = array_values($users);
unset($users);
return View::make('connection.search', array('users' => $users1, 'this_user' => $this_user));
}
示例3: getByLogin
static function getByLogin($login)
{
$returnedUser = new User();
$users = User::getAllUsers();
foreach ($users as $user) {
if ($user->getLogin() == $login) {
$returnedUser = $user;
}
}
return $returnedUser;
}
示例4: getUsers
public function getUsers()
{
$users = User::getAllUsers();
$grpUsers = array();
foreach ($users as $user) {
if ($user->inGroup($this->name)) {
$grpUsers[] = $user;
}
}
return $grpUsers;
}
示例5: testCorrectUserListOutput
/**
* @group 47156
*/
public function testCorrectUserListOutput()
{
$this->user1 = $this->createUser(11, 'Active');
$this->user2 = $this->createUser(12, 'Inactive');
$allUsers = User::getAllUsers();
$this->assertArrayHasKey($this->user1->id, $allUsers);
$this->assertArrayHasKey($this->user2->id, $allUsers);
$dbManager = $GLOBALS['db'];
$dbManager->query('DELETE FROM users WHERE id IN (' . $dbManager->quoted($this->user1->id) . ', ' . $dbManager->quoted($this->user2->id) . ')');
$dbManager->query('DELETE FROM user_preferences WHERE assigned_user_id IN (' . $dbManager->quoted($this->user1->id) . ', ' . $dbManager->quoted($this->user2->id) . ')');
$dbManager->query('DELETE FROM teams WHERE associated_user_id IN (' . $dbManager->quoted($this->user1->id) . ', ' . $dbManager->quoted($this->user2->id) . ')');
$dbManager->query('DELETE FROM team_memberships WHERE user_id IN (' . $dbManager->quoted($this->user1->id) . ', ' . $dbManager->quoted($this->user2->id) . ')');
}
示例6: getUsers
public function getUsers()
{
$users = User::getAllUsers();
$found = [];
foreach ($users as $user) {
$companies = $user->getCompanies();
foreach ($companies as $company) {
if ($company->id == $this->id) {
$found[] = $user;
}
}
}
return $found;
}
示例7: ajax
public function ajax()
{
/**@$Logger This for instantiate of new translog.*/
/**@$SOP This for instantiate of new sophisticated.*/
/**@$USER This for instantiate of new user.*/
/**@$type This for input type.*/
$Logger = new TransLog();
$UserModel = new User();
$type = Input::get('type');
if ($type) {
switch ($type) {
case 'users-list':
$pending = $UserModel->getAllUsers();
$dtResult = GlobalController::setDatatable($pending, array('id', 'user_fname', 'user_lname', 'user_email', 'user_username', 'user_status', 'user_type'), 'id');
foreach ($dtResult['objResult'] as $aRow) {
try {
$usertype = $UserModel->getUserType($aRow->id);
$pro = $usertype->user_type;
} catch (Exception $ex) {
$pro = 0;
}
switch ($pro) {
case 1:
$pro = 'Admin';
break;
case 2:
$pro = 'Default';
break;
}
$data = array($aRow->id, $aRow->user_fname, $aRow->user_lname, $aRow->user_email, $aRow->user_username, $aRow->user_status ? "Active" : "Inactive", $pro, 'Action');
$dtResult['aaData'][] = $data;
}
unset($dtResult['objResult']);
echo json_encode($dtResult);
break;
}
}
}
示例8: getAllUsersDT
function getAllUsersDT()
{
global $bdd, $_TABLES;
if (!is_null($bdd) && !is_null($_TABLES)) {
$content = '<thead>';
$content .= '<tr>';
$content .= '<th>Id</th>';
$content .= '<th>Name</th>';
$content .= '<th>Login</th>';
$content .= '<th>Pass</th>';
$content .= '<th>Valid</th>';
$content .= '<th>Action</th>';
$content .= '</tr>';
$content .= '</thead>';
$content .= '<tbody>';
$objUser = new User($bdd, $_TABLES);
$users = $objUser->getAllUsers();
if ($users) {
foreach ($users as $key => $user) {
$content .= '<tr user_id=' . $user->id . '>';
$content .= '<td>' . $user->id . '</td>';
$content .= '<td><input type="text" class="input_dt input_dt_name" value="' . $user->name . '" /></td>';
$content .= '<td><input type="text" class="input_dt input_dt_login" value="' . $user->login . '" /></td>';
$content .= '<td><input type="text" class="input_dt input_dt_pass" value="" /></td>';
$content .= '<td><input type="checkbox" class="input_dt input_dt_valid" value="' . $user->valid . '" /></td>';
$content .= "<td><input type='button' class='edit edit_user_dt' value='Save' />\n\t\t\t\t <input type='button' class='delete delete_user_dt' value='Supprimer' /></td>";
$content .= '</tr>';
}
}
$content .= '</tbody>';
return $content;
} else {
error_log("BDD ERROR : " . json_encode($bdd));
error_log("TABLES ERROR : " . json_encode($_TABLES));
}
}
示例9: process
function process()
{
if ($this->login == 'anonymous') {
return false;
}
if ($this->login) {
$info = User::getInfo($this->login);
}
$req =& Request::getInstance();
$tmpPassword = @$info['password'];
$passwordMd5OrNot = !empty($tmpPassword) ? $tmpPassword : '';
if ($req->getActionName() === 'modCur') {
$formElements = array(array('hidden', 'form_login', $this->login), array('password', 'form_passwordold', "Old password:", 'value=""'), array('password', 'form_password', "New password:", 'value=""'), array('password', 'form_password2', $GLOBALS['lang']['admin_type_again'], 'value=""'), array('text', 'form_alias', "Alias", 'size=40 value="' . @$info['alias'] . '"'), array('text', 'form_email', "email", 'value="' . @$info['email'] . '"'), array('radio', 'form_send_mail', $GLOBALS['lang']['install_send_mail'], $GLOBALS['lang']['install_oui'], 'yes'), array('radio', 'form_send_mail', null, $GLOBALS['lang']['install_non'], 'no'));
$formRules = array(array('form_email', $GLOBALS['lang']['admin_valid_email'], 'email', '', 'server'), array('form_email', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['admin_admin_mail']), 'required'), array('form_passwordold', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['admin_user_oldPwd']), 'required'), array('form_passwordold', $GLOBALS['lang']['admin_user_oldPwd_bad'], 'checkOldCurrentPassword'), array('form_password', $GLOBALS['lang']['admin_valid_pass'], 'complexPassword'), array('form_password', $GLOBALS['lang']['admin_match_pass'], 'compareField', 'form_password2'), array('form_password', $GLOBALS['lang']['admin_valid_pass'], 'changePassword'));
} else {
$formElements = array(array('password', 'form_password', "Password:", 'value="' . $passwordMd5OrNot . '"'), array('password', 'form_password2', $GLOBALS['lang']['admin_type_again'], 'value="' . $passwordMd5OrNot . '"'), array('text', 'form_alias', "Alias", 'size=40 value="' . @$info['alias'] . '"'), array('text', 'form_email', "email", 'value="' . @$info['email'] . '"'), array('radio', 'form_send_mail', $GLOBALS['lang']['install_send_mail'], $GLOBALS['lang']['install_oui'], 'yes'), array('radio', 'form_send_mail', null, $GLOBALS['lang']['install_non'], 'no'));
$formRules = array(array('form_email', $GLOBALS['lang']['admin_valid_email'], 'email', '', 'server'), array('form_email', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['admin_admin_mail']), 'required'), array('form_password', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['install_mdpadmin']), 'required'), array('form_password', $GLOBALS['lang']['admin_valid_pass'], 'complexPassword'), array('form_password', $GLOBALS['lang']['admin_match_pass'], 'compareField', 'form_password2'));
}
// when adding a new element, add an input named login
// else read the login in url
if ($req->getActionName() === 'add') {
$formElements = array_merge(array(array('text', 'form_login', "Login:", 'value=""')), $formElements);
$formRules[] = array('form_login', sprintf($GLOBALS['lang']['admin_required'], "Login"), 'required');
$formRules[] = array('form_login', "Alpha numeric only", 'alphanumeric');
if ($login = $this->getSubmitValue('form_login')) {
$all = array_keys(User::getAllUsers());
if (in_array($login, $all)) {
$this->setElementError('form_login', 'Login already exist in database!');
}
}
}
$this->addElements($formElements, 'User Information');
$this->setChecked('form_send_mail', @$info['send_mail'] == '1' ? 'yes' : 'no');
$this->addRules($formRules);
return parent::process('install_general_setup');
}
示例10: filter_input
// sanitize the email
$email = filter_input(INPUT_GET, "email", FILTER_SANITIZE_EMAIL);
// grab the mySQL connection
$pdo = connectToEncryptedMySql("/etc/apache2/ninja-mysql/appsbyninja.ini");
// handle all RESTful calls to User today
// get some or all Users
if ($method === "GET") {
// set an XSRF cookie on GET requests
setXsrfCookie("/");
if (empty($userId) === false) {
$reply->data = User::getUserByUserId($pdo, $userId);
} else {
if (empty($email) === false) {
$reply->data = User::getUserByEmail($pdo, $email);
} else {
$reply->data = User::getAllUsers($pdo);
}
}
// post to a new User
} else {
if ($method === "POST") {
// convert POSTed JSON to an object
verifyXsrf();
$requestContent = file_get_contents("php://input");
$requestObject = json_decode($requestContent);
if ($requestObject->password !== $requestObject->passwordConfirm) {
throw new InvalidArgumentException("passwords do not match", 400);
}
$salt = bin2hex(openssl_random_pseudo_bytes(32));
$hash = hash_pbkdf2("sha512", $requestObject->password, $salt, 262144, 128);
// handle optional fields
示例11: User
<?php
/* Inclusion de la classe General pour la récupération des données de la base */
require_once "../php/model/User.php";
/* Inclusion du fichier de connexion à la BD */
include_once "../php/controller/connect-bd.php";
$users = new User($bdd);
$data = $users->getAllUsers();
示例12: dirname
require_once dirname(dirname(dirname(__FILE__))) . '/modules/User.class.php';
require_once dirname(dirname(dirname(__FILE__))) . '/modules/Dynamo.class.php';
if ($_SESSION['user_type'] == 1 && trim($_GET['del']) == 'true' && trim($_GET['id']) != '') {
$users_obj = new Dynamo("users");
$query = "DELETE FROM users WHERE id = " . $_GET['id'];
$users_obj->customExecuteQuery($query);
}
$userObj = new User();
$listUsers = array();
$companyId = isset($_SESSION['company_id']) ? $_SESSION['company_id'] : 0;
if ($userObj) {
$userRoleId = isset($_SESSION['user_type']) ? $_SESSION['user_type'] : 0;
if ($userRoleId == 2) {
$listUsers = $userObj->getAllUsersPerCompany($companyId, false);
} else {
$listUsers = $userObj->getAllUsers(false);
}
}
?>
<div class="pull-left"><h4>Users</h4></div>
<div class="pull-right"><a href="add_user.html" class="btn btn-warning"><i class="icon-plus icon-white"></i> Add User</a></div>
<div class="clearfix"></div>
<div id="status-message"></div>
<table id="userTable" class="common-table">
<tr>
<th>Username/Email</th>
<th>Name</th>
<th>Company</th>
<th>User Type</th>
示例13: User
} else {
$per_page = 50;
}
if ($per_page > 500) {
$per_page = 1;
}
if (isset($_GET['iDisplayStart'])) {
$start = $_GET['iDisplayStart'];
} else {
$start = 0;
}
$user = new User();
if (isset($_GET['sSearch']) && $_GET['sSearch']) {
$users = $user->search($_GET['sSearch'], $start, $per_page, $sortby, $sortdir);
} else {
$users = $user->getAllUsers(null, $start, $per_page, $sortby, $sortdir);
}
$res = array();
$res['sEcho'] = $echo;
if (isset($_GET['sSearch']) && $_GET['sSearch']) {
$res['iTotalDisplayRecords'] = $user->getUserCount($_GET['sSearch']);
} else {
$res['iTotalDisplayRecords'] = $user->getUserCount();
}
$res['iTotalRecords'] = count($users);
$res['aaData'] = array();
if (count($users)) {
foreach ($users as $key => $val) {
extract($val);
if ($fb_id) {
$facebook_link = "<a href='http://www.facebook.com/profile.php?id={$fb_id}' target='_blank'>{$fb_id}</a>";
示例14: authentificationRequire
<?php
authentificationRequire();
echo "<section id='listUser'>" . "<h2>Les utilisateurs connectés</h2>";
foreach (User::getAllUsers() as $user) {
echo "<a href='/Salon/Canal/" . $user->getID() . "'>" . $user->getPseudo() . "</a><br/>";
}
echo "</section>";
?>
示例15: getSendLink
public function getSendLink($id)
{
$sendto = User::findOrFail($id);
$users = User::getAllUsers();
$this->layout->content = View::make('users.chat', array('sendto' => $sendto, 'users' => $users));
}