<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link href="admin/admin/template/style/admin.css" rel="stylesheet" type="text/css" />
<script src="include/js/jquery.js" type="text/javascript"></script>
<script src="include/js/admin.js" type="text/javascript"></script>
</head> 

<body>
<div class="maintop">当前位置：<?php echo $toptxt ?></div>
<div class="main">
<?php if($postgo!='edituser'){ ?>
<div class="oper"><a href="?c=ld_adminuser">管理员管理</a><a href="?c=ld_adminuser&a=add">添加管理员</a><a href="?c=ld_adminuser&a=glist">管理员分组</a><a href="?c=ld_adminuser&a=gadd">添加分组</a></div>
<?php } ?>
<?php if($postgo=='add'||$postgo=='edit'||$postgo=='edituser'){ ?>
	<?php if($postgo!='edituser'){ ?>
	<ul class="switchs"><li id="s1">基本信息</li><li id="s2" class="c">栏目权限</li></ul>
    <?php } ?>
	<div class="info">
    <form action="?c=ld_adminuser&a=<?php echo $postgo ?>&run=1" method="post">
    <input name="auid" type="hidden" value="<?php echo $d['auid'] ?>" />
    <div id="infos1">
    <dl style="border:0;"><dt>用户名称：</dt><dd><?php if($postgo=='add'){ ?>
    <input name="auser" type="text" class="int" /></dd><dd class="t">最大长度20，支持中英文数字</dd>
    <?php }else{ echo $d['auser'];?><input name="auser" type="hidden" value="<?php echo $d['auser'] ?>" /><?php } ?>
    </dl>
    <dl><dt>用户密码：</dt><dd><input name="apass" type="text" class="int" /></dd><?php if($postgo!='add')echo '<dd class="t">不修改请留空</dd>'; ?></dl>
<?php if($postgo!='edituser' && $_SESSION['auser']['level']==1){ ?>
    <dl><dt>管理员分组：</dt><dd><select name="gid">
        <?php foreach($glista as $v){ ?>
            <option value="<?php echo $v['gid'] ?>"<?php if($d['gid']==$v['gid'])echo ' selected="selected"'; ?>><?php echo $v['name'] ?></option>
        <?php } ?>
    </select></dd></dl>
    <dl><dt>超级管理员：</dt><dd><select name="level">
    	<option value="0"<?php if($d['level']==0)echo ' selected="selected"'; ?>>否</option>
      <option value="1"<?php if($d['level']==1)echo ' selected="selected"'; ?>>是</option>
    </select></dd><dd class="t">超级管理员具有系统最高权限(即全部权限)，否则由权限设置限定</dd></dl>
<?php }else{ ?>
	<input name="level" type="hidden" value="<?php echo $d['level'] ?>" /><input name="gid" type="hidden" value="<?php echo $d['gid'] ?>" />
<?php } ?>
    <dl><dt>真实姓名：</dt><dd><input name="aname" type="text" class="int" value="<?php echo $d['aname'] ?>" /></dd><dd class="t">可留空</dd></dl>
    <dl><dt>邮箱：</dt><dd><input name="amail" type="text" class="int" value="<?php echo $d['amail'] ?>" /></dd><dd class="t">可留空</dd></dl>
    <dl><dt>电话：</dt><dd><input name="atel" type="text" class="int" value="<?php echo $d['atel'] ?>" /></dd><dd class="t">可留空 </dd></dl>
    </div>
<?php if($postgo!='edituser'){ ?>
    <div id="infos2" style="display:none">
    <dl><dt>栏目权限：<br /><input id="pclasstype" type="button" value="全选" class="btni" onclick="alls('pclasstype[]','pclasstype');" style="padding:0" /></dt>
    <dd style="line-height:22px;" id="pclasstype">
    <?php foreach($typesdb as $v){ ?>
    <?php if($v['n']>0){echo '|';}echo str_repeat('--',$v['n']); ?>
    <label><input type="checkbox" name="pclasstype[]" value="<?php echo $v['tid']; ?>" id="tid_<?php echo $v['tid']; ?>" <?php if(strpos($d['pclasstype'],','.$v['tid'].',')!==FALSE)echo ' checked="checked" '; ?> onclick="checkboxs('#tid_<?php echo $v['tid']; ?>','<?php echo $types->leafid($v['tid']); ?>','tid_');" /><?php echo $v['name']; ?></label><br />
    <?php } ?> </dd>
	</dl>
    </div>
<?php } ?>
    <dl><dt>&nbsp;</dt><dd><input type="submit" value="提 交" class="btnbig" /></dd></dl>
    </form>
    </div>
    
<?php }if($postgo==''){ ?>   
    <table width="100%" class="tablist">
      <tr class="trbg">
        <td width="40">ID</td>
        <td>用户名</td>
        <td>分组</td>
        <td width="200">操作</td>
      </tr>
    <?php foreach($lists as $v){ ?>
      <tr>
        <td><?php echo $v['auid']; ?></td>
        <td class="tdleft"><a href="?c=ld_adminuser&a=edit&auid=<?php echo $v['auid']; ?>"><?php echo $v['auser']; ?></a></td>
        <td><?php if($v['level']==1){echo '<span style="color:#C00">超级管理员<span>';}else{echo admin_group($v['gid']);} ?></td>
        <td><a href="?c=ld_adminuser&a=edit&auid=<?php echo $v['auid']; ?>">编辑</a>&nbsp;&nbsp;
    <a href="?c=ld_adminuser&a=del&auid=<?php echo $v['auid']; ?>">删除</a></td>
      </tr>
    <?php } ?>
    </table>
<?php } if($postgo=='gadd'||$postgo=='gedit'){ ?>
	<div class="info">
    <form action="?c=ld_adminuser&a=<?php echo $postgo ?>&run=1" method="post">
    <input name="gid" type="hidden" value="<?php echo $d['gid'] ?>" />
    <dl style="border:0;"><dt>分组名称：</dt><dd><input name="name" type="text" class="int" value="<?php echo $d['name'] ?>" /></dd><dd class="t">最大长度20，支持中英文数字</dd></dl>
    <dl><dt>发布默认审核：</dt><dd><label><input name="audit" type="radio" value="1"<?php if($d['audit']==1)echo ' checked="checked"' ?> />已审</label> <label><input type="radio" name="audit" value="0"<?php if($d['audit']==0 || $postgo=='add')echo ' checked="checked"' ?> />未审</label> </dd><dd class="t">本组会员发布内容默认是否审核</dd></dl>

    <dl><dt>操作权限：<br /><input id="paction" type="button" value="全选" class="btni" onclick="alls('paction[]','paction');" style="padding:0" />
    </dt><dd style="line-height:22px;" id="paction">
    <?php foreach($per0 as $v){ ?>
        <label><input type="checkbox" name="paction[]" value="<?php echo $v['action']; ?>" id="id_<?php echo $v['pid']; ?>" <?php if(strpos($d['paction'],','.$v['action'].',')!==FALSE)echo 'checked="checked" '; ?>  onclick="checkboxs('#id_<?php echo $v['pid']; ?>','<?php echo perinfo($v['pid']);?>','id_');"/>
        <strong><?php if($v['molds']!=''){echo moldsinfo($v['molds'],'moldname');}echo $v['name'];?></strong></label>
        <?php 
        $pern=syDB('admin_per')->findAll(array('up'=>$v['pid'],'no'=>0),' orders desc,pid ');
        foreach($pern as $vn){
        ?>
        <label><input type="checkbox" name="paction[]" value="<?php echo $vn['action']; ?>" id="id_<?php echo $vn['pid']; ?>" <?php if(strpos($d['paction'],','.$vn['action'].',')!==FALSE)echo 'checked="checked" '; ?> onclick="checkboxp('#id_<?php echo $vn['pid']; ?>','#id_<?php echo $v['pid']; ?>');"/><?php echo $vn['name'];?></label>&nbsp;
		<?php } ?><br />
	<?php } ?> </dd></dl>
    <div style="display:none">
    <?php foreach($per1 as $v){ ?>
    	<input type="checkbox" name="paction[]" value="<?php echo $v['action']; ?>" checked="checked" />
	<?php } ?>
    </div>
    <dl><dt>&nbsp;</dt><dd><input type="submit" value="提 交" class="btnbig" /></dd></dl>
    </form>
    </div>
<?php } if($postgo=='glist'){ ?>
    <table width="100%" class="tablist">
      <tr class="trbg">
        <td width="40">ID</td>
        <td>分组名称</td>
        <td width="150">操作</td>
      </tr>
    <?php foreach($lists as $v){ ?>
      <tr>
        <td><?php echo $v['gid']; ?></td>
        <td class="tdleft"><a href="?c=ld_adminuser&a=gedit&gid=<?php echo $v['gid']; ?>"><?php echo $v['name']; ?></a></td>
        <td><a href="?c=ld_adminuser&a=gedit&gid=<?php echo $v['gid']; ?>">编辑</a>&nbsp;&nbsp;
    <a href="?c=ld_adminuser&a=gdel&gid=<?php echo $v['gid']; ?>">删除</a></td>
      </tr>
    <?php } ?>
    </table>
<?php } ?>

</div>
</body>
</html>
