<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
		<title>修改系统会员组</title>
		<link rel="stylesheet" href="/static/web/css/font-awesome.min.css">
		<link rel="stylesheet" href="/static/web/css/bootstrap.min.css">
		<link rel="stylesheet" href="/static/web/css/admin.css">
	</head>
	<body>
		<div class="container-fluid">
			<ol class="breadcrumb">
				<li class="breadcrumb-item"><a href="index_body.php">后台面板</a></li>
				<li class="breadcrumb-item"><a href="sys_group.php">会员组管理</a></li>
				<li class="breadcrumb-item active">修改系统会员组</li>
			</ol>
			<div class="card shadow-sm">
				<div class="card-header">修改系统会员组</div>
				<div class="card-body">
					<form name="form1" action="sys_group_edit.php" method="post">
						<input type="hidden" name="dopost" value="save">
						<div class="table-responsive">
							<table class="table table-borderless">
								<tbody>
									<tr>
										<td width="160">组名称</td>
										<td><input type="text" name="typename" id="typename" value="<?php echo $groupSet['typename']?>" class="admin-input-sm" required></td>
									</tr>
									<tr>
										<td>级别值</td>
										<td><input type="hidden" name="rank" id="rank" value="<?php echo $groupSet['rank']?>" class="admin-input-sm"><?php echo $groupSet['rank']?></td>
									</tr>
									<?php
									$start = 0;
									$k = 0;
									$gouplists = file(DEDEADMIN.'/inc/grouplist.txt');
									foreach($gouplists as $line) {
										$line = trim($line);
										if ($line=="") continue;
										if (preg_match("#^>>#", $line)) {
											if ($start>0) echo "</td></tr>";
											$line = str_replace('>>','',$line);
											$ls = explode('>',$line);
											if (DEDEBIZ_SAFE_MODE && $ls[1]==="unsafe") {
												continue;
											}
											$start++;
											$lhead = "<tr> <td colspan='2'>{$start}、".$ls[0]."</td></tr><tr><td colspan='2'>";
											echo  $lhead;
										} else if (preg_match("#^>#", $line)) {
											$ls = explode('>',$line);
											if (DEDEBIZ_SAFE_MODE && $ls[3]==="unsafe") {
												continue;
											}
											$tag = $ls[1];
											$tagname = str_replace('[br]','<br>',$ls[2]);
											if (!preg_match("#<br>#", $tagname) ) $tagname .= "<span>($tag)</span>";
											else $tagname = str_replace('<br>', "<span>($tag)</span><br>", $tagname);
											echo " <label><input name='purviews[]' type='checkbox' id='purviews$k' value='$tag'".CRank($tag)."> $tagname</label> ";
											$k++;
											}
										}
										$start++;
									?>
									<tr>
										<td colspan="2"><?php echo $start?>、插件权限</td>
									</tr>
									<tr>
										<td colspan="2">
											<?php
											$l = 0;
											$dsql->SetQuery('SELECT plusname FROM `#@__plus`');
											$dsql->Execute();
											while($row=$dsql->GetObject()){
												echo " <label><input name='purviews[]' type='checkbox' id='purviews$k' value='plus_{$row->plusname}'".CRank("plus_{$row->plusname}")."> {$row->plusname}</label> ";
												$k++;
												$l++;
												if ($l % 6 == 0) echo "<br>";
											}
											?>
										</td>
									</tr>
									<tr>
										<td colspan="2" align="center">
											<button type="submit" class="btn btn-success btn-sm">保存</button>
											<button type="reset" class="btn btn-outline-success btn-sm">重置</button>
										</td>
									</tr>
								</tbody>
							</table>
						</div>
					</form>
				</div>
			</div>
		</div>
	</body>
</html>