This repository has been archived by the owner on Jul 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 65
/
metamanage.php
320 lines (307 loc) · 22.5 KB
/
metamanage.php
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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
<?php
/**
* meta manage page
*/
$this->need('includes/header.php');
//var_dump($this->getPageRow());
$total_category_data = $this->getPageRow()["type_categories_all"];
$tags_num = count($total_category_data);
$total_tags = $this->getPageRow()["tags_all"];
define("CIRCLE_MANAGEURL","/extending.php?panel=OneCircle%2Fmanage%2Fmanage-cat-tags.php");
?>
<?php $this->need('includes/body-layout.php');?>
<div class="hbox hbox-auto-xs hbox-auto-sm index">
<div class="circle-management">
<?php if ($this->user->hasLogin() and $this->user->pass('administrator', true)):?>
<div class="alert alert-warning" role="alert">
<button type="button" class="btn btn-success"><a target="_blank" href="<?php echo Typecho_Common::url(CIRCLE_MANAGEURL, $this->options->adminUrl) ?>">创建圈子分类</a></button>
</div>
<?endif;?>
<ul class="nav nav-pills mb-3" id="pills-tab" role="tablist">
<?php if ($this->user->hasLogin()):?>
<li class="nav-item" role="presentation">
<a class="nav-link active" id="pills-my-tab" data-toggle="pill" href="#pills-my" role="tab" aria-controls="pills-my" aria-selected="true">我的圈子</a>
</li>
<?endif;?>
<li class="nav-item" role="presentation">
<a class="nav-link <?if (!$this->user->hasLogin()) _oc_e('active');?>" id="pills-all-tab" data-toggle="pill" href="#pills-all" role="tab" aria-controls="pills-all" aria-selected="false">所有圈子</a>
</li>
</ul>
<div class="tab-content" id="pills-tabContent">
<!--登录显示我的-->
<?php if ($this->user->hasLogin()):?>
<div class="tab-pane fade show active" id="pills-my" role="tabpanel" aria-labelledby="pills-my-tab">
<div class="row">
<div class="col-md-4 col-lg-3" style="border-bottom: 1px solid rgba(0,0,0,.05);">
<div class="nav flex-column nav-pills" id="v-pills-tab" role="tablist" aria-orientation="vertical">
<a class="nav-link active" id="v-pills-allmy-tab" data-toggle="pill" href="#v-pills-allmy" role="tab" aria-controls="v-pills-allmy" aria-selected="true">默认</a>
</div>
</div>
<div class="col-md-8 col-lg-9">
<div class="tab-content" id="v-pills-tabContent">
<!--输出对应分类圈子-->
<div class="tab-pane fade show active mycicle-content" id="v-pills-allmy" role="tabpanel" aria-labelledby="v-pills-allmy-tab">
<div class="mycicle-content">
<?php // 顶多显示100个,多了放弃吧,看不完也没有意义
$arr = CircleFollow::getFollowObj($this->user->uid,100,$this->options->defaultSlugUrl);
$length = count($arr);
if ($length > 0):
?>
<?for ($i = 0; $i < $length; $i++): ?>
<div class="circle-item">
<a href="<?php echo $arr[$i][2] ?>" class="circle-item-link">
<img src="<?php echo $arr[$i][3] ?>">
<div class="circle-item-link-right">
<div class="circle-item-link-title"><?php echo $arr[$i][1] ?></div>
<div class="circle-item-link-info"><?php echo $arr[$i][4] ?></div>
</div>
</a>
<div class="htbt-right">
<button data-categoryid="<?php _oc_e($arr[$i][0]) ?>"
<?php
if ($this->user->hasLogin()){
if (CircleFollow::statusFollow($this->user->uid,$arr[$i][0])){
echo 'class="fansed circle-event">已加入';
}else{
echo 'class="fans circle-event">加入';
}
}else{
echo 'class="fans circle-event">加入';
}
?>
</button>
</div>
</div>
<?php endfor;?>
<?php else:?>
<div class="circle-item">
<?php if ($this->user->hasLogin()): ?>
<small>还没有关注圈子~</small>
<?php else:?>
<small>登录后可见</small>
<?php endif;?>
</div>
<?php endif;?>
</div>
</div>
</div>
</div>
</div>
</div>
<!--管理员显示编辑-->
<?php if (checkCircleEditPermission($this->user->uid)):?>
<div class="tab-pane fade" id="pills-all" role="tabpanel" aria-labelledby="pills-all-tab">
<div class="row">
<div class="col-md-4 col-lg-3">
<div class="nav flex-column nav-pills" id="v-pills-tab" role="tablist" aria-orientation="vertical">
<?php foreach($total_category_data as $k => $data):?>
<?php if ($k == 'all_'):?> <!-- 所有 ,默认active-->
<a class="nav-link active" id="v-pills-<?php _oc_e($data['id']);?>-tab" data-toggle="pill" href="#v-pills-<?php _oc_e($data['id']);?>" role="tab" aria-controls="v-pills-<?php _oc_e($data['id']);?>" aria-selected="true"><?php _oc_e($data['name']);?></a>
<?php else:?>
<a class="nav-link" id="v-pills-<?php _oc_e($data['id']);?>-tab" data-toggle="pill" href="#v-pills-<?php _oc_e($data['id']);?>" role="tab" aria-controls="v-pills-<?php _oc_e($data['id']);?>" aria-selected="false"><?php _oc_e($data['name']);?></a>
<?php endif;?>
<?php endforeach;?>
</div>
</div>
<div class="col-md-8 col-lg-9">
<div class="tab-content" id="v-pills-tabContent">
<!--输出对应分类圈子-->
<?php foreach($total_category_data as $k => $data):?>
<div class="tab-pane fade <?php if ($k == 'all_') _oc_e('show active');?> mycicle-content" id="v-pills-<?php _oc_e($data['id']);?>" role="tabpanel" aria-labelledby="v-pills-<?php _oc_e($data['id']);?>-tab">
<?php foreach ($data['categories'] as $val):?>
<?php $entry = Typecho_Widget::widget('Widget_Abstract_Metas')->filter(array(
'type'=>"category",
'slug'=>$val['slug']
));
$url_ = Typecho_Router::url("category", array("slug"=>$val['slug']), $this->options->index);
?>
<div class="circle-item">
<a href="<?php _oc_e($url_) ?>" class="circle-item-link">
<img src="<?php echo parseDesc2img($this->options->defaultSlugUrl,$val['description']) ?>">
<div class="circle-item-link-right">
<div class="circle-item-link-title"><?php _oc_e($val['name']); ?></div>
<div class="circle-item-link-info"><?php echo parseDesc2text($val['description']) ?></div>
</div>
</a>
<div class="htbt-right edit-btn">
<button data-categoryid="<?php _oc_e($val['mid']) ?>" data-name="<?php _oc_e($val['name']); ?>" type="button">编辑</button>
</div>
<div class="htbt-right">
<button data-categoryid="<?php _oc_e($val['mid']) ?>"
<?php
if ($this->user->hasLogin()){
if (CircleFollow::statusFollow($this->user->uid,$val['mid'])){
echo 'class="fansed circle-event">已加入';
}else{
echo 'class="fans circle-event">加入';
}
}else{
echo 'class="fans circle-event">加入';
}
?>
</button>
</div>
</div>
<?endforeach;?>
</div>
<?php endforeach;?>
</div>
</div>
</div>
</div>
<?php else:?>
<div class="tab-pane fade" id="pills-all" role="tabpanel" aria-labelledby="pills-all-tab">
<div class="row">
<div class="col-md-4 col-lg-3">
<div class="nav flex-column nav-pills" id="v-pills-tab" role="tablist" aria-orientation="vertical">
<?php foreach($total_category_data as $k => $data):?>
<?php if ($k == 'all_'):?> <!-- 所有 ,默认active-->
<a class="nav-link active" id="v-pills-<?php _oc_e($data['id']);?>-tab" data-toggle="pill" href="#v-pills-<?php _oc_e($data['id']);?>" role="tab" aria-controls="v-pills-<?php _oc_e($data['id']);?>" aria-selected="true"><?php _oc_e($data['name']);?></a>
<?php else:?>
<a class="nav-link" id="v-pills-<?php _oc_e($data['id']);?>-tab" data-toggle="pill" href="#v-pills-<?php _oc_e($data['id']);?>" role="tab" aria-controls="v-pills-<?php _oc_e($data['id']);?>" aria-selected="false"><?php _oc_e($data['name']);?></a>
<?php endif;?>
<?php endforeach;?>
</div>
</div>
<div class="col-md-8 col-lg-9">
<div class="tab-content" id="v-pills-tabContent">
<!--输出对应分类圈子-->
<?php foreach($total_category_data as $k => $data):?>
<div class="tab-pane fade <?php if ($k == 'all_') _oc_e('show active');?> mycicle-content" id="v-pills-<?php _oc_e($data['id']);?>" role="tabpanel" aria-labelledby="v-pills-<?php _oc_e($data['id']);?>-tab">
<?php foreach ($data['categories'] as $val):?>
<?php $entry = Typecho_Widget::widget('Widget_Abstract_Metas')->filter(array(
'type'=>"category",
'slug'=>$val['slug']
));
$url_ = Typecho_Router::url("category", array("slug"=>$val['slug']), $this->options->index);
?>
<div class="circle-item">
<a href="<?php _oc_e($url_) ?>" class="circle-item-link">
<img src="<?php echo parseDesc2img($this->options->defaultSlugUrl,$val['description']) ?>">
<div class="circle-item-link-right">
<div class="circle-item-link-title"><?php _oc_e($val['name']); ?></div>
<div class="circle-item-link-info"><?php echo parseDesc2text($val['description']) ?></div>
</div>
</a>
<div class="htbt-right">
<button data-categoryid="<?php _oc_e($val['mid']) ?>"
<?php
if ($this->user->hasLogin()){
if (CircleFollow::statusFollow($this->user->uid,$val['mid'])){
echo 'class="fansed circle-event">已加入';
}else{
echo 'class="fans circle-event">加入';
}
}else{
echo 'class="fans circle-event">加入';
}
?>
</button>
</div>
</div>
<?endforeach;?>
</div>
<?php endforeach;?>
</div>
</div>
</div>
</div>
<?php endif;?>
<?php else:?>
<div class="tab-pane fade show active" id="pills-all" role="tabpanel" aria-labelledby="pills-all-tab">
<div class="row">
<div class="col-md-4 col-lg-3">
<div class="nav flex-column nav-pills" id="v-pills-tab" role="tablist" aria-orientation="vertical">
<?php foreach($total_category_data as $k => $data):?>
<?php if ($k == 'all_'):?> <!-- 所有 ,默认active-->
<a class="nav-link active" id="v-pills-<?php _oc_e($data['id']);?>-tab" data-toggle="pill" href="#v-pills-<?php _oc_e($data['id']);?>" role="tab" aria-controls="v-pills-<?php _oc_e($data['id']);?>" aria-selected="true"><?php _oc_e($data['name']);?></a>
<?php else:?>
<a class="nav-link" id="v-pills-<?php _oc_e($data['id']);?>-tab" data-toggle="pill" href="#v-pills-<?php _oc_e($data['id']);?>" role="tab" aria-controls="v-pills-<?php _oc_e($data['id']);?>" aria-selected="false"><?php _oc_e($data['name']);?></a>
<?php endif;?>
<?php endforeach;?>
</div>
</div>
<div class="col-md-8 col-lg-9">
<div class="tab-content" id="v-pills-tabContent">
<!--输出对应分类圈子-->
<?php foreach($total_category_data as $k => $data):?>
<div class="tab-pane fade <?php if ($k == 'all_') _oc_e('show active');?> mycicle-content" id="v-pills-<?php _oc_e($data['id']);?>" role="tabpanel" aria-labelledby="v-pills-<?php _oc_e($data['id']);?>-tab">
<?php foreach ($data['categories'] as $val):?>
<?php $entry = Typecho_Widget::widget('Widget_Abstract_Metas')->filter(array(
'type'=>"category",
'slug'=>$val['slug']
));
$url_ = Typecho_Router::url("category", array("slug"=>$val['slug']), $this->options->index);
?>
<div class="circle-item">
<a href="<?php _oc_e($url_) ?>" class="circle-item-link">
<img src="<?php echo parseDesc2img($this->options->defaultSlugUrl,$val['description']) ?>">
<div class="circle-item-link-right">
<div class="circle-item-link-title"><?php _oc_e($val['name']); ?></div>
<div class="circle-item-link-info"><?php echo parseDesc2text($val['description']) ?></div>
</div>
</a>
<div class="htbt-right">
<button data-categoryid="<?php _oc_e($val['mid']) ?>"
<?php
if ($this->user->hasLogin()){
if (CircleFollow::statusFollow($this->user->uid,$val['mid'])){
echo 'class="fansed circle-event">已加入';
}else{
echo 'class="fans circle-event">加入';
}
}else{
echo 'class="fans circle-event">加入';
}
?>
</button>
</div>
</div>
<?endforeach;?>
</div>
<?php endforeach;?>
</div>
</div>
</div>
</div>
<?endif;?>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="changeCatagModal" tabindex="-1" data-backdrop="false" aria-labelledby="changeCatagModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="changeCatagModalLabel">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form>
<div class="form-group">
<label for="selectCircle">当前圈子</label>
<input type="text" class="form-control" id="selectCircle" placeholder="" readonly>
</div>
<div class="form-group">
<label for="changeCircle">更改分类</label>
<select class="form-control" id="changeCircle">
<?php foreach($total_tags as $k => $data):?>
<option value="<?_oc_e($data['id'])?>"><?_oc_e($data['name'])?></option>
<?php endforeach;?>
</select>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
<button type="button" class="btn btn-primary" id="circle-edit-save">保存</button>
</div>
</div>
</div>
</div>
</div>
<?php $this->need('includes/body-layout-end.php');?>
<?php
$this->need('includes/footer.php');
?>