Repository navigation
Expand file tree
/
Copy pathManage_UserController.php
More file actions
75 lines (58 loc) · 1.82 KB
/
Copy pathManage_UserController.php
File metadata and controls
75 lines (58 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/**
* Created by PhpStorm.
* User: anguoyue
* Date: 15/08/2018
* Time: 10:59 AM
*/
class Manage_UserController extends Manage_CommonController
{
public function doRequest()
{
$params = ["lang" => $this->language];
$method = $_SERVER['REQUEST_METHOD'];
if ($method == 'POST') {
//get user list by page
$offset = $_POST['offset'];
$length = $_POST['length'];
} else {
//get user list by page
$offset = $_GET['offset'];
$length = $_GET['length'];
if (empty($offset)) {
$offset = 0;
}
if (empty($length)) {
$length = 2000;
}
$userList = $this->getUserListByOffset($offset, $length);
if ($userList) {
$userProfiles = [];
foreach ($userList as $user) {
$userProfiles[] = [
'userId' => $user['userId'],
'nickname' => htmlspecialchars($user['nickname']),
'loginName' => htmlspecialchars($user['loginName']),
];
}
$params['userList'] = $userProfiles;
}
$params['totalUserCount'] = $this->getTotalUsers();
echo $this->display("manage_user_indexList", $params);
}
return;
}
private function getUserListByOffset($offset, $length)
{
return $this->ctx->SiteUserTable->getSiteUserListByOffset($offset, $length);
}
private function getTotalUsers()
{
$tag = __CLASS__ . "->" . __FUNCTION__;
try {
return $this->ctx->SiteUserTable->getSiteUserCount();
} catch (Exception $e) {
$this->logger->error($tag, $e);
}
}
}