<?php include $this->admin_tpl('meta', 'admin');?>
<title>修改组别 - YzmCMS内容管理系统</title>
<style>
	.formdoby_normal ul li .label_box{width:auto;margin-right:10px;}
</style>
</head>
<body>
<article class="page-container">
<div class="formdoby_normal"> 
	<form method="post" onsubmit="return dosub(this)">
		<ul>
			 <li><label><span class="c-red">*</span>组别名称：</label>
			 	<input type="text" class="input" name="name" value="<?php echo $data['name']; ?>">
			 </li>
			 <li><label><span class="c-red">*</span>经验小于：</label>
			 	<input type="text" class="input" name="experience" value="<?php echo $data['experience']; ?>">
			 </li>
			 <li class="yzm-explain-box"><label><span class="c-red">*</span>每日最大投稿量：</label>
			 	<input type="text" class="input" name="max_amount" value="<?php echo $data['max_amount']; ?>"> 
			 	<span class="yzm-explain">VIP用户不受限</span>
			 </li>
			 <li class="yzm-explain-box"><label><span class="c-red">*</span>会员组图标：</label>
			 	<input type="text" class="input" name="icon"  value="<?php echo $data['icon']; ?>">
			 	<span class="yzm-explain">会员组图标需放在<br>/common/static/images/icon/</span>
			 </li>
			 <li><label>组别权限：</label>
			 <span class="span_input">
				<label class="label_box"><input type="checkbox" <?php if(strpos($data['authority'], '1') !== false) echo 'checked="checked"'?> name="authority[]" value="1"> 发送消息</label>
				<label class="label_box"><input type="checkbox" <?php if(strpos($data['authority'], '2') !== false) echo 'checked="checked"'?> name="authority[]" value="2"> 发表评论</label>
				<label class="label_box"><input type="checkbox" <?php if(strpos($data['authority'], '3') !== false) echo 'checked="checked"'?> name="authority[]" value="3"> 发表内容</label>
				<label class="label_box"><input type="checkbox" <?php if(strpos($data['authority'], '4') !== false) echo 'checked="checked"'?> name="authority[]" value="4"> 投稿免审核</label>
				<label class="label_box"><input type="checkbox" <?php if(strpos($data['authority'], '5') !== false) echo 'checked="checked"'?> name="authority[]" value="5"> 删除站内文件</label>
			 </span>
			 </li>
			 <li><label>简洁描述：</label>
			 	<input type="text" class="input" style="width:450px" value="<?php echo $data['description']; ?>"  name="description">
			 </li>
		</ul>
		<div class="footer_btn">
			<input type="hidden" name="dosubmit" value="1">
			<input type="hidden" name="groupid" value="<?php echo $data['groupid'];?>">
			<input class="btn btn-primary radius" type="submit" value="提 交">
			<input class="btn btn-default radius" type="button" value="取 消" onclick="yzmcms_close()">	
		</div>
	</form>
</div>
</article>
<?php include $this->admin_tpl('footer', 'admin');?>

<script type="text/javascript">
	function dosub(obj){
		 if(obj.name.value==''){
			 layer.msg('会员组名称不能为空！', {icon:2});
			 return false;
		 }
		 if(obj.experience.value=='' || isNaN(obj.experience.value)){
			 layer.msg('经验点数只能为数字类型！', {icon:2});
			 return false;
		 }
		if(obj.max_amount.value=='' || isNaN(obj.max_amount.value)){
			layer.msg('每日最大投稿量只能为数字类型！', {icon:2});
			return false;
		}
		 if(obj.icon.value==''){
			 layer.msg('会员组图标不能为空！', {icon:2});
			 return false;
		 }		 
        $.ajax({
            type: 'POST',
            url: '<?php echo U('edit');?>', 
            data: $(obj).serialize(),
		    dataType: "json", 
            success: function (msg) {
				if(msg.status == 1){
					layer.msg(msg.message, {icon:1,time:1500}, function(){
						parent.location.reload();     
					});
			    }else{
					layer.msg(msg.message, {icon:2});
				}
            }
        })		 
		return false;			 
	}
</script> 

</body>
</html>