Repository navigation
Expand file tree
/
Copy pathindex.php
More file actions
162 lines (161 loc) · 3.9 KB
/
Copy pathindex.php
File metadata and controls
162 lines (161 loc) · 3.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<?php
require('../../global.php');
//验证是否登入
if(!checkLogin()){
redirect('../error.php?code='.$errorcode['noLogin']);
}
//验证是否为管理员
else if(!checkAdmin()){
redirect('../error.php?code='.$errorcode['noAdmin']);
}
//验证是否有权限
else if(!checkPermissions(1)){
redirect('../error.php?code='.$errorcode['noPermissions']);
}
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>应用管理</title>
<?php include('sysapp/global_css.php'); ?>
<style>
body{
margin: 0 10px;
}
.appicon{
width: 32px;
height: 32px;
}
.appname{
margin-left: 10px;
}
</style>
</head>
<body>
<div id="toorbar">
<div class="form-inline">
<div class="form-group">
<a class="btn btn-primary" href="javascript:openDetailIframe('detail.php');"><i class="glyphicon glyphicon-plus"></i> 添加新应用</a>
</div>
<div class="form-group">
<label class="control-label">分类:</label>
<select class="form-control" id="s_app_category_id">
<option value="">全部</option>
<?php
$appcategory = $db->select('tb_app_category', '*');
foreach($appcategory as $ac){
echo '<option value="'.$ac['tbid'].'">'.$ac['name'].'</option>';
}
?>
<option value="0">未分类</option>
</select>
</div>
<div class="form-group">
<label class="control-label">类型:</label>
<select class="form-control" id="s_type">
<option value="">全部</option>
<option value="window">窗口</option>
<option value="widget">挂件</option>
</select>
</div>
</div>
</div>
<table id="table"></table>
<?php include('sysapp/global_module_detailIframe.php'); ?>
<?php include('sysapp/global_js.php'); ?>
<script>
$(function(){
$('#table').bootstrapTable({
height : $(window).height(),
url : 'index.ajax.php',
queryParams : function(params){
params['ac'] = 'getList';
params['app_category_id'] = $('#s_app_category_id').val();
params['type'] = $('#s_type').val();
return params;
},
columns : [
{
title : '图标',
field : 'icon',
align : 'center',
valign : 'middle',
width : 50
},
{
title : '应用名称',
field : 'name',
halign : 'left',
valign : 'middle',
sortable : true
},
{
title : '类型',
field : 'type',
align : 'center',
valign : 'middle',
width : 100
},
{
title : '分类',
field : 'app_category_id',
align : 'center',
valign : 'middle',
width : 100
},
{
title : '使用人数',
field : 'usecount',
align : 'center',
valign : 'middle',
width : 100
},
{
title : '操作',
field : 'do',
align : 'center',
valign : 'middle',
width : 120
}
],
striped : true, // 开启隔行换色
showRefresh : true, // 显示刷新按钮
// 工具栏
toolbar : '#toorbar',
// 搜索
search : true,
// 分页
pagination : true, // 开启分页
sidePagination : 'server', // 在服务器进行分页
paginationPreText : '上一页',
paginationNextText : '下一页',
});
$('#s_app_category_id, #s_type').change(function(){
$('#table').bootstrapTable('refresh');
});
//删除
$('#table').on('click', '.do-del', function(){
var id = $(this).data().id;
var name = $(this).data().name;
swal({
type : 'warning',
title : '',
text : '确定要删除 “' + name + '” 该应用么?',
showCancelButton : true,
confirmButtonText : '确认',
cancelButtonText : '取消'
}, function(){
$.ajax({
type : 'POST',
url : 'index.ajax.php',
data : 'ac=del&id=' + id
}).done(function(){
$('#table').bootstrapTable('refresh');
});
});
});
});
</script>
</body>
</html>