Exemple #1
0
 /**
  * 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;
 }
Exemple #2
0
 */
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 
Exemple #3
0
 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);
 }