<?php include $this->admin_tpl('meta', 'admin');?>
<title>修改组别 - YzmCMS内容管理系统</title>
</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>会员组图标：</label><input type="text" class="input" name="icon"  value="<?php echo $data['icon']; ?>"  style="width:450px">
			 	<span class="yzm-explain">图标放置在/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>
			 </span>
			 </li>
			 <li><label>简洁描述：</label><input type="text" class="input" style="width:450px" value="<?php echo $data['description']; ?>"  name="description"></li>
			<li><input type="hidden" name="dosubmit" value="1"><input type="hidden" name="groupid" value="<?php echo $data['groupid'];?>">
			 <input class="dosubmit w_120 btn-primary radius" type="submit" value="提交">
			 <input class="btn w_120 btn-default radius" type="button" value="取消" onclick="yzmcms_close()">
			 </li>
		</ul>
	</form>
</div>
</article>
<?php include $this->admin_tpl('footer', 'admin');?>

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

</body>
</html>