<?php if (!defined('APP_PATH')) exit;?><!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="http://127.0.0.5/magic/Data/Public/css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://127.0.0.5/magic/Data/Public/js/jquery.js"></script>
<script src="http://127.0.0.5/magic/Data/Public/js/main.js"></script>
</head>
<body>
<div class="place">
	<span>位置：</span>
	<ul class="placeul">
		<li>首页</li>
		<li>系统设置</li>
		<li>网站管理员</li>
	</ul>
</div>

<div class="rightinfo">
    <div class="tools">
		<ul class="toolbar">
			<li><a href="?r=admin-edit"><span><img src="http://127.0.0.5/magic/Data/Public/images/t01.png" /></span>添加管理员</a></li>
			<li><a href="?r=admin"><span><img src="http://127.0.0.5/magic/Data/Public/images/d09.png" width="24" height="24" /></span>管理员列表</a></li>
			<li><a href="?r=rbac"><span><img src="http://127.0.0.5/magic/Data/Public/images/icon5.png" width="24" height="24" /></span>管理员组</a></li>
		</ul>
    </div>  
   <div class="formtitle1"><span>管理员权限管理</span></div>
   <iframe id="blank" name="blank"  style="display:none" ></iframe>
   <form method="post" target="blank" action="?r=admin-rbac-save">
   <input type="hidden" name="rid"  value="<?php echo $rid;?>">
    <div class="">
		<ul class="level1">
       <?php foreach ($node as $n){?>
        <li class="li1">
		 <h3 style="display:none"><?php echo $n['checkbox'];?></h3>
            <ul class="level2">
            <?php foreach ($n['_data'] as $c){?>
             <li class="li2">
                 <h4><?php echo $c['checkbox'];?></h4>
					<ul class="level3">
                        <?php foreach ($c['_data'] as $s){?>
                        <li><?php echo $s['checkbox'];?></li>
							<?php foreach ($s['_data'] as $v){?>
							<li><?php echo $v['checkbox'];?></li>
							<?php }?>
                        <?php }?>
                    </ul>
             </li>
            <?php }?>
            </ul>
        </li>
        <?php }?>
    </ul>
	 </div>
</div>
<table style="margin:5px auto">
	<tr>
		<td align="center" height="40" colspan="10"><input type="submit" class="scbtn7" value="保存">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" value="重置" class="scbtn8"></td>
	</tr>
</table>
</form>
<script>
    $("input").click(function () {
        var _obj = $(this);
        //将所有子节点选中
        $(this).parents("li").eq(0).find("input").not($(this)).each(function (i) {
            $(this).attr("checked", _obj.attr("checked") == "checked");
        });

        //将父级NID选中
        if ($(this).attr("checked")) {
            $(this).parents("li").each(function (i) {
                $(this).children("label,h3,h4").find("input").attr("checked", "checked");
            })
        }
    })
</script>
</body>
</html>
