本文整理匯總了PHP中Model\User::getList方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::getList方法的具體用法?PHP User::getList怎麽用?PHP User::getList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Model\User
的用法示例。
在下文中一共展示了User::getList方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getAllUsers
/**
* Get allowed and not allowed users for a project
*
* @access public
* @param integer $project_id Project id
* @return array
*/
public function getAllUsers($project_id)
{
$users = array('allowed' => array(), 'not_allowed' => array());
$userModel = new User($this->db, $this->event);
$all_users = $userModel->getList();
$users['allowed'] = $this->getAllowedUsers($project_id);
foreach ($all_users as $user_id => $username) {
if (!isset($users['allowed'][$user_id])) {
$users['not_allowed'][$user_id] = $username;
}
}
return $users;
}
示例2: isset
*/
use Model\User;
$act = isset($_GET['act']) ? $_GET['act'] : '';
if ($act == 'data') {
$page = isset($_POST['page']) ? intval($_POST['page']) : 1;
$limit = isset($_POST['rows']) ? intval($_POST['rows']) : 10;
if ($page < 1) {
$page = 1;
}
if ($limit < 10) {
$limit = 10;
}
if ($limit > 50) {
$limit = 50;
}
$userData = User::getList($page, $limit);
echo json_encode($userData);
exit(0);
}
?>
<div id="tb">
<a href="#" onclick="add_user();" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true">添加</a>
<a href="#" onclick="edit_user();" class="easyui-linkbutton" data-options="iconCls:'icon-edit',plain:true">編輯</a>
<a href="#" onclick="del_user();" class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true">刪除</a>
</div>
<div id="module-wrap">
<h2>用戶管理</h2>
<table id="user_grid" style="width: 100%; height: auto;"></table>
</div>
<div id="user_dialog"></div>
<script type="text/javascript" src="<?php
示例3: testGetList
public function testGetList()
{
$u = new User($this->container);
$this->assertEquals(2, $u->create(array('username' => 'you')));
$this->assertEquals(3, $u->create(array('username' => 'me', 'name' => 'Me too')));
$users = $u->getList();
$expected = array(1 => 'admin', 3 => 'Me too', 2 => 'you');
$this->assertEquals($expected, $users);
$users = $u->getList(true);
$expected = array(User::EVERYBODY_ID => 'Everybody', 1 => 'admin', 3 => 'Me too', 2 => 'you');
$this->assertEquals($expected, $users);
}