Cms.php
10.2 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
<?php
namespace addons\cms;
use addons\cms\model\Archives;
use addons\cms\model\Channel;
use app\common\library\Auth;
use app\common\library\Menu;
use fast\Tree;
use think\Addons;
use think\Request;
use think\View;
/**
* CMS插件
*/
class Cms extends Addons
{
/**
* 插件安装方法
* @return bool
*/
public function install()
{
$menu = [
[
'name' => 'cms',
'title' => 'CMS管理',
'sublist' => [
[
'name' => 'cms/archives',
'title' => '内容管理',
'icon' => 'fa fa-file-text-o',
'sublist' => [
['name' => 'cms/archives/index', 'title' => '查看'],
['name' => 'cms/archives/content', 'title' => '副表管理', 'remark' => '用于管理模型副表的数据列表,不建议在此进行删除操作'],
['name' => 'cms/archives/add', 'title' => '添加'],
['name' => 'cms/archives/edit', 'title' => '修改'],
['name' => 'cms/archives/del', 'title' => '删除'],
['name' => 'cms/archives/multi', 'title' => '批量更新'],
]
],
[
'name' => 'cms/channel',
'title' => '栏目管理',
'icon' => 'fa fa-list',
'sublist' => [
['name' => 'cms/channel/index', 'title' => '查看'],
['name' => 'cms/channel/add', 'title' => '添加'],
['name' => 'cms/channel/edit', 'title' => '修改'],
['name' => 'cms/channel/del', 'title' => '删除'],
['name' => 'cms/channel/multi', 'title' => '批量更新'],
['name' => 'cms/channel/admin', 'title' => '栏目授权'],
],
'remark' => '用于管理网站的分类,可进行无限级分类,注意只有类型为列表的才可以添加文章'
],
[
'name' => 'cms/modelx',
'title' => '模型管理',
'icon' => 'fa fa-th',
'sublist' => [
['name' => 'cms/modelx/index', 'title' => '查看'],
['name' => 'cms/modelx/add', 'title' => '添加'],
['name' => 'cms/modelx/edit', 'title' => '修改'],
['name' => 'cms/modelx/del', 'title' => '删除'],
['name' => 'cms/modelx/multi', 'title' => '批量更新'],
[
'name' => 'cms/fields',
'title' => '字段管理',
'icon' => 'fa fa-fields',
'ismenu' => 0,
'sublist' => [
['name' => 'cms/fields/index', 'title' => '查看'],
['name' => 'cms/fields/add', 'title' => '添加'],
['name' => 'cms/fields/edit', 'title' => '修改'],
['name' => 'cms/fields/del', 'title' => '删除'],
['name' => 'cms/fields/multi', 'title' => '批量更新'],
],
'remark' => '用于管理模型或表单的字段,进行相关的增删改操作'
]
],
'remark' => '在线添加修改删除模型,管理模型字段和相关模型数据'
],
[
'name' => 'cms/tags',
'title' => '标签管理',
'icon' => 'fa fa-tags',
'sublist' => [
['name' => 'cms/tags/index', 'title' => '查看'],
['name' => 'cms/tags/add', 'title' => '添加'],
['name' => 'cms/tags/edit', 'title' => '修改'],
['name' => 'cms/tags/del', 'title' => '删除'],
['name' => 'cms/tags/multi', 'title' => '批量更新'],
],
'remark' => '用于管理文章关联的标签,标签的添加在添加文章时自动维护,无需手动添加标签'
],
[
'name' => 'cms/block',
'title' => '区块管理',
'icon' => 'fa fa-th-large',
'sublist' => [
['name' => 'cms/block/index', 'title' => '查看'],
['name' => 'cms/block/add', 'title' => '添加'],
['name' => 'cms/block/edit', 'title' => '修改'],
['name' => 'cms/block/del', 'title' => '删除'],
['name' => 'cms/block/multi', 'title' => '批量更新'],
],
'remark' => '用于管理站点的自定义区块内容,常用于广告、JS脚本、焦点图、片段代码等'
],
[
'name' => 'cms/page',
'title' => '单页管理',
'icon' => 'fa fa-file',
'sublist' => [
['name' => 'cms/page/index', 'title' => '查看'],
['name' => 'cms/page/add', 'title' => '添加'],
['name' => 'cms/page/edit', 'title' => '修改'],
['name' => 'cms/page/del', 'title' => '删除'],
['name' => 'cms/page/multi', 'title' => '批量更新'],
],
'remark' => '用于管理网站的单页面,可任意创建修改删除单页面'
],
[
'name' => 'cms/comment',
'title' => '评论管理',
'icon' => 'fa fa-comment',
'sublist' => [
['name' => 'cms/comment/index', 'title' => '查看'],
['name' => 'cms/comment/add', 'title' => '添加'],
['name' => 'cms/comment/edit', 'title' => '修改'],
['name' => 'cms/comment/del', 'title' => '删除'],
['name' => 'cms/comment/multi', 'title' => '批量更新'],
],
'remark' => '用于管理用户在网站上发表的评论,可任意修改或隐藏评论'
],
[
'name' => 'cms/diyform',
'title' => '自定义表单管理',
'icon' => 'fa fa-list',
'sublist' => [
['name' => 'cms/diyform/index', 'title' => '查看'],
['name' => 'cms/diyform/add', 'title' => '添加'],
['name' => 'cms/diyform/edit', 'title' => '修改'],
['name' => 'cms/diyform/del', 'title' => '删除'],
['name' => 'cms/diyform/multi', 'title' => '批量更新'],
],
'remark' => '可在线创建自定义表单,管理表单字段和数据列表'
],
[
'name' => 'cms/diydata',
'title' => '自定义表单数据管理',
'icon' => 'fa fa-list',
'ismenu' => 0,
'sublist' => [
['name' => 'cms/diydata/index', 'title' => '查看'],
['name' => 'cms/diydata/add', 'title' => '添加'],
['name' => 'cms/diydata/edit', 'title' => '修改'],
['name' => 'cms/diydata/del', 'title' => '删除'],
['name' => 'cms/diydata/multi', 'title' => '批量更新'],
],
'remark' => '可在线管理自定义表单的数据列表'
],
[
'name' => 'cms/order',
'title' => '订单管理',
'icon' => 'fa fa-cny',
'ismenu' => 1,
'sublist' => [
['name' => 'cms/order/index', 'title' => '查看'],
['name' => 'cms/order/add', 'title' => '添加'],
['name' => 'cms/order/edit', 'title' => '修改'],
['name' => 'cms/order/del', 'title' => '删除'],
['name' => 'cms/order/multi', 'title' => '批量更新'],
],
'remark' => '可在线管理付费查看所产生的订单'
]
]
]
];
Menu::create($menu);
return true;
}
/**
* 插件卸载方法
* @return bool
*/
public function uninstall()
{
Menu::delete('cms');
return true;
}
/**
* 插件启用方法
*/
public function enable()
{
Menu::enable('cms');
}
/**
* 插件禁用方法
*/
public function disable()
{
Menu::disable('cms');
}
/**
* 会员中心边栏后
* @return mixed
* @throws \Exception
*/
public function userSidenavAfter()
{
$request = Request::instance();
$actionname = strtolower($request->action());
$data = [
'actionname' => $actionname
];
return $this->fetch('view/hook/user_sidenav_after', $data);
}
}