122 lines
4.1 KiB
PHTML
122 lines
4.1 KiB
PHTML
<?php
|
|
$this->headTitle($this->config->title->site);
|
|
$this->headTitle('后台管理');
|
|
$this->headTitle()->setSeparator(' - ');
|
|
$this->headLink()->appendStylesheet('/css/admin.css');
|
|
$this->headScript()->appendFile('/static/js/jquery-1.7.2.min.js');
|
|
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
|
|
$this->headLink()->appendStylesheet('/css/colorbox.css');
|
|
$this->breadcrumb('<a href="/">首页</a>');
|
|
$this->breadcrumb('<a href="/admin/">后台首页</a>');
|
|
$this->breadcrumb('<a href="/admin/user">用户管理</a>');
|
|
$this->breadcrumb()->setSeparator(' > ');
|
|
?>
|
|
<div id="leftPanel">
|
|
<?= $this->partial('user/left.phtml'); ?>
|
|
</div>
|
|
|
|
<?php if ($this->msg or $this->messages) :?>
|
|
<div id="message">
|
|
<?php if ($this->msg) : ?>
|
|
<p><?php echo $this->msg; ?></p>
|
|
<?php endif; if ($this->messages): foreach($this->messages as $msg): ?>
|
|
<p><?php echo $msg; ?></p>
|
|
<?php endforeach;endif; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
|
|
<div id="rightPanel">
|
|
<div style="font-size:16px;line-height:30px; font-weight:bold;">组用户查看</div>
|
|
<div id="userform" style="margin:5px 0;">
|
|
<form id="userform" >
|
|
用户ID(数字) <input type="text" id="addUserInputUid" name="uid" />
|
|
组ID(数字) <input type="text" id="addUserInputGid" name="gid" value="<?php if(!empty($this->groupid)) echo $this->groupid; ?>" readonly="readonly" />
|
|
<input type="hidden" name="ac" value="adduser" />
|
|
<i id="checkbtn_addUser">
|
|
<input type="button" class="btn btn-green" onclick="SubmitUser()" value="添加" />
|
|
</i>
|
|
</form>
|
|
</div>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<td width='150'>ID</td>
|
|
<td width='250'>用户名</td>
|
|
<td width='250'>姓名</td>
|
|
<td width='150'>操作</td>
|
|
</tr>
|
|
</thead><!-- table's head -->
|
|
<?php if (count($this->paginator)): ?>
|
|
<?php $autoindex=0;?>
|
|
<?php foreach ($this->paginator as $item): ?>
|
|
<?php $autoindex++;?>
|
|
<tr class="<?php if($autoindex%2 == 0) echo 'even'; else echo 'odd'; ?>" id="row_<?= $item['uid'];?>">
|
|
<td><?= $item['uid']?></td>
|
|
<td><?= $item['username']; ?></td>
|
|
<td><?= $item['realname']; ?></td>
|
|
<td>
|
|
<i id="del_chectbtn_<?= $item['id']?>"><a href='javascript:removeUserFromGroup(<?= $item['uid'];?>,<?= $item['gid'];?>);' onclick="return confirm('确定将此用户移除?')">移除</a></i>
|
|
<a href='/admin/user/show/id/<?= $item['id'];?>'>查看用户</a>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|
|
</table>
|
|
<div class="pagenavi"><?= $this->paginator; ?></div>
|
|
</div>
|
|
<script>
|
|
//<-- users
|
|
|
|
function showuserform(){
|
|
$('#userform').toggle();
|
|
}
|
|
function SubmitUser(){
|
|
uid = $('#addUserInputUid').val();
|
|
gid = $('#addUserInputGid').val();
|
|
dom = '#checkbtn_addUser';
|
|
addUserToGroup(dom,uid,gid);
|
|
}
|
|
function addUserToGroup(dom,uid,gid){
|
|
html = $(dom).html();
|
|
$.ajax({
|
|
'type': "POST",
|
|
'url': "/admin/user/group/",
|
|
'data': 'ac=adduser&uid='+uid+'&gid='+gid,
|
|
'success': function(data){
|
|
if($.isEmptyObject(data)){Alert('遇到错误,请重试');return false;}
|
|
if(data.error!=null){Alert(data.error);return false;}
|
|
if(data.status==1){top.location=top.location;}
|
|
},
|
|
'beforeSend':function(){$(dom).html('<img src="/images/ajax-load-small.gif" />');},
|
|
'complete':function(){$(dom).html(html)},
|
|
'timeout': 20000,
|
|
'dataType': 'json',
|
|
'error': function(){Alert('处理中出现问题,请重试');return false;}
|
|
});
|
|
}
|
|
function removeUserFromGroup(uid,gid){
|
|
html = $('#del_chectbtn_'+uid).html();
|
|
$.ajax({
|
|
'type': "POST",
|
|
'url': "/admin/user/group/",
|
|
'data': 'ac=deluser&uid='+uid+'&gid='+gid,
|
|
'success': function(data){
|
|
if($.isEmptyObject(data)){Alert('遇到错误,请重试');return false;}
|
|
if(data.error!=null){Alert(data.error);return false;}
|
|
if(data.status==1){$('#row_'+uid).fadeOut();}
|
|
},
|
|
'beforeSend':function(){$('#del_chectbtn_'+uid).html('<img src="/images/ajax-load-small.gif" />');},
|
|
'complete':function(){$('#del_chectbtn_'+uid).html(html)},
|
|
'timeout': 20000,
|
|
'dataType': 'json',
|
|
'error': function(){Alert('处理中出现问题,请重试');}
|
|
});
|
|
}
|
|
|
|
// users -->
|
|
|
|
function Alert(html){
|
|
$.colorbox({'innerWidth':'50%','html':'<h4>'+html+'</h4>'});
|
|
}
|
|
</script>
|