+ add the feature of deactivate and activate user.
This commit is contained in:
@@ -32,6 +32,8 @@ $lang->colon = '::';
|
||||
$lang->reset = '重填';
|
||||
$lang->edit = '编辑';
|
||||
$lang->delete = '删除';
|
||||
$lang->activate = '激活';
|
||||
$lang->delete = '删除';
|
||||
$lang->save = '保存';
|
||||
$lang->action = '操作';
|
||||
$lang->comment = '备注';
|
||||
|
||||
@@ -55,6 +55,7 @@ include '../../common/tablesorter.html.php';
|
||||
<th><?php echo $lang->user->phone;?></th>
|
||||
<th><?php echo $lang->user->join;?></th>
|
||||
<th><?php echo $lang->user->visits;?></th>
|
||||
<th><?php echo $lang->user->status;?></th>
|
||||
<th><?php echo $lang->action;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -70,9 +71,13 @@ include '../../common/tablesorter.html.php';
|
||||
<td><?php echo $user->phone;?></td>
|
||||
<td><?php echo $user->join;?></td>
|
||||
<td><?php echo $user->visits;?></td>
|
||||
<td><?php echo $lang->user->statusList[$user->status];?></td>
|
||||
<td>
|
||||
<?php common::printLink('user', 'edit', "userID=$user->id&from=company", $lang->user->edit);?>
|
||||
<?php common::printLink('user', 'delete', "userID=$user->id", $lang->user->delete, "hiddenwin");?>
|
||||
<?php
|
||||
common::printLink('user', 'edit', "userID=$user->id&from=company", $lang->edit);
|
||||
if($user->status == 'active') common::printLink('user', 'delete', "userID=$user->id", $lang->delete, "hiddenwin");
|
||||
if($user->status == 'delete') common::printLink('user', 'activate', "userID=$user->id", $lang->activate, "hiddenwin");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
|
||||
+16
-4
@@ -232,14 +232,26 @@ class user extends control
|
||||
{
|
||||
if($confirm == 'no')
|
||||
{
|
||||
echo js::confirm($this->lang->user->confirmDelete, $this->createLink('user', 'delete', "userID=$userID&confirm=yes"));
|
||||
exit;
|
||||
die(js::confirm($this->lang->user->confirmDelete, $this->createLink('user', 'delete', "userID=$userID&confirm=yes")));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->user->delete($userID);
|
||||
echo js::locate($this->createLink('admin', 'browseuser', "companyID={$this->app->company->id}"), 'parent');
|
||||
exit;
|
||||
die(js::locate($this->createLink('company', 'browse'), 'parent'));
|
||||
}
|
||||
}
|
||||
|
||||
/* 激活一个用户。*/
|
||||
public function activate($userID, $confirm = 'no')
|
||||
{
|
||||
if($confirm == 'no')
|
||||
{
|
||||
die(js::confirm($this->lang->user->confirmActivate, $this->createLink('user', 'activate', "userID=$userID&confirm=yes")));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->user->activate($userID);
|
||||
die(js::locate($this->createLink('company', 'browse'), 'parent'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,17 +29,19 @@ $lang->user->read = "查看用户";
|
||||
$lang->user->edit = "编辑用户";
|
||||
$lang->user->update = "编辑用户";
|
||||
$lang->user->delete = "删除用户";
|
||||
$lang->user->activate = "激活";
|
||||
$lang->user->browse = "浏览用户";
|
||||
$lang->user->login = "用户登录";
|
||||
$lang->user->userView = "人员视图";
|
||||
$lang->user->editProfile = "修改个人信息";
|
||||
$lang->user->editPassword = "修改密码";
|
||||
$lang->user->deny = "访问受限";
|
||||
$lang->user->confirmDelete = "您确认删除该用户吗?";
|
||||
$lang->user->relogin = "重新登录";
|
||||
$lang->user->asGuest = "游客访问";
|
||||
$lang->user->goback = "返回前一页";
|
||||
$lang->user->allUsers = '全部用户';
|
||||
$lang->user->confirmDelete = "您确认删除该用户吗?";
|
||||
$lang->user->confirmActivate = "您确认激活该用户吗?";
|
||||
$lang->user->relogin = "重新登录";
|
||||
$lang->user->asGuest = "游客访问";
|
||||
$lang->user->goback = "返回前一页";
|
||||
$lang->user->allUsers = '全部用户';
|
||||
|
||||
$lang->user->profile = '用户档案';
|
||||
$lang->user->project = '用户项目';
|
||||
@@ -55,6 +57,8 @@ $lang->user->errorDeny = "抱歉,您无权访问『<b>%s</b>』模块的『<b>
|
||||
|
||||
$lang->user->gendarList->m = '男';
|
||||
$lang->user->gendarList->f = '女';
|
||||
$lang->user->statusList['active'] = '正常';
|
||||
$lang->user->statusList['delete'] = '删除';
|
||||
|
||||
$lang->user->id = '用户编号';
|
||||
$lang->user->company = '所属公司';
|
||||
@@ -82,3 +86,4 @@ $lang->user->join = '加入日期';
|
||||
$lang->user->visits = '访问次数';
|
||||
$lang->user->ip = '最后IP';
|
||||
$lang->user->last = '最后登录时间';
|
||||
$lang->user->status = '状态';
|
||||
|
||||
@@ -137,10 +137,15 @@ class userModel extends model
|
||||
}
|
||||
|
||||
/* 删除一个用户。*/
|
||||
function delete($userID)
|
||||
public function delete($userID)
|
||||
{
|
||||
$sql = "DELETE FROM " . TABLE_USER . " WHERE id = '$userID' LIMIT 1";
|
||||
return $this->dbh->exec($sql);
|
||||
return $this->dao->update(TABLE_USER)->set('status')->eq('delete')->where('id')->eq($userID)->limit(1)->exec();
|
||||
}
|
||||
|
||||
/* 激活一个用户。*/
|
||||
public function activate($userID)
|
||||
{
|
||||
return $this->dao->update(TABLE_USER)->set('status')->eq('active')->where('id')->eq($userID)->limit(1)->exec();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -157,7 +162,7 @@ class userModel extends model
|
||||
$password = filter_var($password, FILTER_SANITIZE_STRING);
|
||||
if(!$account or !$password) return false;
|
||||
|
||||
$sql = "SELECT * FROM " . TABLE_USER . " WHERE account = '$account' AND password = md5('$password') AND company = '$companyID' LIMIT 1";
|
||||
$sql = "SELECT * FROM " . TABLE_USER . " WHERE account = '$account' AND password = md5('$password') AND company = '$companyID' AND status = 'active' LIMIT 1";
|
||||
$user = $this->dbh->query($sql)->fetch();
|
||||
if($user)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user