init
This commit is contained in:
167
app/admin/view/user_role/add.html
Executable file
167
app/admin/view/user_role/add.html
Executable file
@@ -0,0 +1,167 @@
|
||||
<!-- Content Wrapper. Contains page content -->
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
新增角色
|
||||
</h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="<?php echo url('/admin/index/index');?>"><i class="fa fa-dashboard"></i> 首页</a></li>
|
||||
<li><a href="<?php echo url('/admin/user_role/lists');?>"> 角色列表</a></li>
|
||||
<li class="active"> 角色</li>
|
||||
</ol>
|
||||
</section>
|
||||
|
||||
<!-- Main content -->
|
||||
<section class="content">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="nav-tabs-custom">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active">
|
||||
<a data-toggle="tab" href="#tabfirst">新增角色</a>
|
||||
</li>
|
||||
<li class="pull-right"><a href="" class="text-muted"><i class="fa fa-refresh"></i></a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<!-- /.tab-pane -->
|
||||
<div class="tab-pane active" id="tabfirst">
|
||||
<form class="form-horizontal" action="<?php echo url('/admin/user_role/create');?>" method="post">
|
||||
<div class="form-group">
|
||||
<label for="name" class="col-sm-2 control-label">角色名称<em style="color:red;">*</em></label>
|
||||
<div class="col-sm-5">
|
||||
<input type="text" class="form-control" name="name" id="name" required>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block">(角色名称)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="description" class="col-sm-2 control-label">角色描述</label>
|
||||
<div class="col-sm-5">
|
||||
<textarea class="form-control" name="description"></textarea>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block">(角色描述)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="yesorno" class="col-sm-2 control-label">权限类型</label>
|
||||
<div class="col-sm-5">
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="yesorno" value="1" checked> 拥有以下权限
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="yesorno" value="0"> 否认以下权限
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block">(权限类型)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">权限分配</label>
|
||||
<div class="col-sm-10">
|
||||
<div class="box box-solid no-shadow" id="rbac_acl">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title">
|
||||
<input type="checkbox" class="check-all"> 全选
|
||||
</h3>
|
||||
<div class="box-tools">
|
||||
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<?php foreach($group_list as $group):?>
|
||||
<div class="row margin-bottom">
|
||||
<div class="col-sm-2">
|
||||
<div class="text-center">
|
||||
<?php echo $group['name'];?> <input type="checkbox" class="check-group">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-10">
|
||||
<?php if(array_key_exists($group['id'],$access_list)):?>
|
||||
<ul class="list-inline">
|
||||
<?php foreach($access_list[$group['id']] as $access):?>
|
||||
<li class="col-sm-2">
|
||||
<input type="checkbox" name="acl[]" value="<?php echo $access['id'];?>" class="check-access"> <?php echo $access['name'];?>
|
||||
</li>
|
||||
<?php endforeach;?>
|
||||
</ul>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach;?>
|
||||
</div>
|
||||
<!-- /.box-body -->
|
||||
</div>
|
||||
<!-- /.box -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" name="agree"> 确认添加
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<button type="reset" class="btn btn-warning">重置</button>
|
||||
<button type="submit" class="btn btn-danger">提交</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<!-- /.tab-pane -->
|
||||
</div>
|
||||
<!-- /.tab-content -->
|
||||
</div>
|
||||
<!-- /.nav-tabs-custom -->
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
<!-- /.content-wrapper -->
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
//Enable check and uncheck all functionality
|
||||
$(".check-all").click(function() {
|
||||
var clicks = $(this).prop("checked");
|
||||
//Uncheck all checkboxes
|
||||
//Check all checkboxes
|
||||
$.each($("#rbac_acl .check-access[name='acl[]']"), function() {
|
||||
//$(this).attr("checked", flag);
|
||||
$(this).prop("checked", clicks);
|
||||
});
|
||||
});
|
||||
$(".check-group").click(function() {
|
||||
var clicks = $(this).prop("checked");
|
||||
//Uncheck all checkboxes
|
||||
//Check all checkboxes
|
||||
$.each($(".check-access[name='acl[]']", $(this).parent().parent().siblings("div")), function() {
|
||||
//$(this).attr("checked", flag);
|
||||
$(this).prop("checked", clicks);
|
||||
});
|
||||
});
|
||||
$("form.form-horizontal").submit(function(e) {
|
||||
var nameObj = document.getElementById('name');
|
||||
if (isNull(nameObj.value)) {
|
||||
alert('名称必须填写');
|
||||
nameObj.focus();
|
||||
return false;
|
||||
}
|
||||
var agree = $("input[name='agree']", this).prop('checked');
|
||||
if (agree) {
|
||||
//alert("Submitted");
|
||||
//e.preventDefault();
|
||||
} else {
|
||||
e.preventDefault();
|
||||
alert("请勾选确认");
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
168
app/admin/view/user_role/edit.html
Executable file
168
app/admin/view/user_role/edit.html
Executable file
@@ -0,0 +1,168 @@
|
||||
<!-- Content Wrapper. Contains page content -->
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
编辑角色
|
||||
</h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="<?php echo url('/admin/index/index');?>"><i class="fa fa-dashboard"></i> 首页</a></li>
|
||||
<li><a href="<?php echo url('/admin/user_role/lists');?>"> 角色列表</a></li>
|
||||
<li class="active"> 角色</li>
|
||||
</ol>
|
||||
</section>
|
||||
|
||||
<!-- Main content -->
|
||||
<section class="content">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="nav-tabs-custom">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active">
|
||||
<a data-toggle="tab" href="#tabfirst">编辑角色</a>
|
||||
</li>
|
||||
<li class="pull-right"><a href="" class="text-muted"><i class="fa fa-refresh"></i></a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<!-- /.tab-pane -->
|
||||
<div class="tab-pane active" id="tabfirst">
|
||||
<form class="form-horizontal" action="<?php echo url('/admin/user_role/update');?>" method="post">
|
||||
<div class="form-group">
|
||||
<label for="name" class="col-sm-2 control-label">角色名称<em style="color:red;">*</em></label>
|
||||
<div class="col-sm-5">
|
||||
<input type="text" class="form-control" name="name" id="name" required value="<?php echo $user_role['name'];?>">
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block">(角色名称)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="description" class="col-sm-2 control-label">角色描述</label>
|
||||
<div class="col-sm-5">
|
||||
<textarea class="form-control" name="description"><?php echo $user_role['description'];?></textarea>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block">(角色描述)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="yesorno" class="col-sm-2 control-label">权限类型</label>
|
||||
<div class="col-sm-5">
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="yesorno" value="1" <?php if($user_role['yesorno']):?>checked<?php endif;?>> 拥有以下权限
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="yesorno" value="0" <?php if(!$user_role['yesorno']):?>checked<?php endif;?>> 否认以下权限
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block">(权限类型)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">权限分配</label>
|
||||
<div class="col-sm-10">
|
||||
<div class="box box-solid no-shadow" id="rbac_acl">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title">
|
||||
<input type="checkbox" class="check-all"> 全选
|
||||
</h3>
|
||||
<div class="box-tools">
|
||||
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<?php foreach($group_list as $group):?>
|
||||
<div class="row margin-bottom">
|
||||
<div class="col-sm-2">
|
||||
<div class="text-center">
|
||||
<?php echo $group['name'];?> <input type="checkbox" class="check-group">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-10">
|
||||
<?php if(array_key_exists($group['id'],$access_list)):?>
|
||||
<ul class="list-inline">
|
||||
<?php foreach($access_list[$group['id']] as $access):?>
|
||||
<li class="col-sm-2">
|
||||
<input type="checkbox" name="acl[]" value="<?php echo $access['id'];?>" class="check-access" <?php if(in_array($access['id'],$user_role['rbac_acl'])):?>checked<?php endif;?>> <?php echo $access['name'];?>
|
||||
</li>
|
||||
<?php endforeach;?>
|
||||
</ul>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach;?>
|
||||
</div>
|
||||
<!-- /.box-body -->
|
||||
</div>
|
||||
<!-- /.box -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" name="agree"> 确认更新
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="hidden" name="id" value="<?php echo $user_role['id'];?>">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<button type="reset" class="btn btn-warning">重置</button>
|
||||
<button type="submit" class="btn btn-danger">提交</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<!-- /.tab-pane -->
|
||||
</div>
|
||||
<!-- /.tab-content -->
|
||||
</div>
|
||||
<!-- /.nav-tabs-custom -->
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
<!-- /.content-wrapper -->
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
//Enable check and uncheck all functionality
|
||||
$(".check-all").click(function() {
|
||||
var clicks = $(this).prop("checked");
|
||||
//Uncheck all checkboxes
|
||||
//Check all checkboxes
|
||||
$.each($("#rbac_acl .check-access[name='acl[]']"), function() {
|
||||
//$(this).attr("checked", flag);
|
||||
$(this).prop("checked", clicks);
|
||||
});
|
||||
});
|
||||
$(".check-group").click(function() {
|
||||
var clicks = $(this).prop("checked");
|
||||
//Uncheck all checkboxes
|
||||
//Check all checkboxes
|
||||
$.each($(".check-access[name='acl[]']", $(this).parent().parent().siblings("div")), function() {
|
||||
//$(this).attr("checked", flag);
|
||||
$(this).prop("checked", clicks);
|
||||
});
|
||||
});
|
||||
$("form.form-horizontal").submit(function(e) {
|
||||
var nameObj = document.getElementById('name');
|
||||
if (isNull(nameObj.value)) {
|
||||
alert('名称必须填写');
|
||||
nameObj.focus();
|
||||
return false;
|
||||
}
|
||||
var agree = $("input[name='agree']", this).prop('checked');
|
||||
if (agree) {
|
||||
//alert("Submitted");
|
||||
//e.preventDefault();
|
||||
} else {
|
||||
e.preventDefault();
|
||||
alert("请勾选确认");
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
109
app/admin/view/user_role/lists.html
Executable file
109
app/admin/view/user_role/lists.html
Executable file
@@ -0,0 +1,109 @@
|
||||
<!-- Content Wrapper. Contains page content -->
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
角色管理
|
||||
<small>角色列表</small>
|
||||
</h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="<?php echo url('/admin/index/index');?>"><i class="fa fa-dashboard"></i> 首页</a></li>
|
||||
<li><a href="<?php echo url('/admin/user_role/lists');?>"> 角色列表</a></li>
|
||||
<li class="active"> 角色</li>
|
||||
</ol>
|
||||
</section>
|
||||
|
||||
<!-- Main content -->
|
||||
<section class="content">
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">配置</h3>
|
||||
<div class="box-tools pull-right">
|
||||
<div class="input-group input-group-sm">
|
||||
<input type="text" class="form-control pull-right" id="list-search-in" placeholder="Search Name" value="<?php echo $search['skeyword'];?>">
|
||||
<div class="input-group-btn">
|
||||
<button type="button" class="btn btn-default" id="list-search-btn"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-tools -->
|
||||
</div>
|
||||
<!-- /.box-header -->
|
||||
<div class="box-body no-padding">
|
||||
<?php if(!empty($list)):?>
|
||||
<div class="table-responsive lists-table">
|
||||
<table class="table table-hover table-striped">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th>ID</th>
|
||||
<th>名称</th>
|
||||
<th>描述</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
<?php foreach($list as $k=>$user_role):?>
|
||||
<tr>
|
||||
<td><input type="checkbox" name="ids[]" value="<?php echo $user_role['id'];?>"></td>
|
||||
<td><?php echo $user_role['id'];?></td>
|
||||
<td><a href="<?php echo url('/admin/user_role/edit',['id'=>$user_role['id']]);?>"><?php echo $user_role['name'];?></a></td>
|
||||
<td><?php echo $user_role['description'];?></td>
|
||||
<td>
|
||||
<a class="btn btn-xs btn-info" href="<?php echo url('/admin/user_role/edit',['id'=>$user_role['id']]);?>">编辑</a>
|
||||
<a class="btn btn-xs btn-info" data-id="<?php echo $user_role['id'];?>" data-url="<?php echo url('/admin/user_role/delete');?>" data-cod="dowarn">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- /.table -->
|
||||
</div>
|
||||
<?php endif;?>
|
||||
<!-- /.lists-table -->
|
||||
</div>
|
||||
<!-- /.box-body -->
|
||||
<div class="box-footer no-padding">
|
||||
<div class="mailbox-controls row">
|
||||
<div class="col-sm-3">
|
||||
<button type="button" class="btn btn-default btn-sm checkbox-toggle"><i class="fa fa-square-o"></i></button>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-default btn-sm" data-url="<?php echo url('/admin/user_role/deletes');?>" data-cod="batch">删除</button>
|
||||
<button type="button" class="btn btn-default btn-sm" data-cod="refresh">刷新</button>
|
||||
</div>
|
||||
<!-- /.btn-group -->
|
||||
<a href="<?php echo url('/admin/user_role/add');?>" class="btn btn-default btn-sm">添加</a>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<!-- <div class="form-inline input-group">
|
||||
<span class="input-group-addon">角色</span>
|
||||
<select name="roleid" id="roleid" class="form-control input-sm">
|
||||
<option value="0">默认值</option>
|
||||
<?php //echo $roleOption;?>
|
||||
</select>
|
||||
<span class="input-group-btn">
|
||||
<button type="button" class="btn btn-info btn-sm" id="move_archive">选择</button>
|
||||
</span>
|
||||
</div>-->
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="pull-right">
|
||||
<?php if($page):?>
|
||||
<?php echo $page;?>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
<!-- /.pull-right -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box -->
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
<!-- /.content-wrapper -->
|
||||
|
||||
<!-- Page Script -->
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user