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
/
archive.php
158 lines (146 loc) · 9.64 KB
/
archive.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
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php
$tArr = utils::parseUrlQuery(utils::GetCurUrl());
if (count($tArr) == 0){
$tabIndex = 0;
}else{
$tabIndex = $tArr['tabindex']?$tArr['tabindex']:0;
}
if ($tabIndex == 3) { // 热门标签,根据点赞量排序
//清空原有文章的列队
$this->row = [];
$this->stack = [];
$this->length = 0;
$db = Typecho_Db::get();
$sqlt = $this->getCountSql();
$sqlt->order('views',Typecho_Db::SORT_DESC);
// var_dump($sqlt->__toString());
$this->setCountSql($sqlt);
// var_dump($this->getCountSql()->__toString());
$sqlt_clone = clone $sqlt;
$cnt = $this->size($sqlt_clone); // 获取 sql 结果数量
$sqlt->page($this->_currentPage, $this->parameter->pageSize);
$achives_ = $db->fetchAll($sqlt);
foreach($achives_ as $_post) $this->push($_post); //压入列队
$this->setTotal($cnt);
// $this->setTotal($this->length)
}
?>
<?php $this->need('includes/header.php'); ?>
<?php $this->need('includes/body-layout.php');?>
<div class="hbox hbox-auto-xs hbox-auto-sm archive">
<div class="archive-container">
<?php if ($this->is('author')): ?>
<?php $this->need('components/archive/archive-author.php') ?>
<?php elseif ($this->is('category')): ?>
<?php $this->need('components/archive/archive-category.php') ?>
<?php endif; ?>
<div class="archive-content tabindex-<?_oc_e($tabIndex);?>">
<div class="outer">
<div class="react-tabs" data-tabs="true">
<div class="line"></div>
<ul class="react-tabs__tab-list" id="archive_tabs">
<li id="react-tabs-1" data-tabindex="0" class="react-tabs__tab <?if($tabIndex==0){_oc_e("react-tabs__tab--selected");}?>">动态</li>
<?php if ($this->is('author')):?>
<li id="react-tabs-2" data-tabindex="1" class="react-tabs__tab <?if($tabIndex==1){_oc_e("react-tabs__tab--selected");}?>">关注</li>
<li id="react-tabs-3" data-tabindex="2" class="react-tabs__tab <?if($tabIndex==2){_oc_e("react-tabs__tab--selected");}?>">被关注</li>
<?php else:?>
<li id="react-tabs-4" data-tabindex="3" class="react-tabs__tab <?if($tabIndex==3){_oc_e("react-tabs__tab--selected");}?>">热门</li>
<?php endif;?>
</ul>
<div class="item-container">
<div class="list react-tabs__tab-panel react-tabs__tab-panel--selected">
<?php if ($this->have()&&$tabIndex==0): ?>
<?php while ($this->next()): ?>
<?php $this->need('components/index/article-content.php'); ?>
<?php endwhile; ?>
<?php elseif($tabIndex==1):?>
<?php $fobj = UserFollow::getFollowObj($this->getPageRow()['uid']);?>
<?php if (count($fobj)>0):?>
<?php for($i=0;$i<count($fobj);$i++): ?>
<div class="sc-AxjAm sc-AxirZ kQHfHM bITJVr">
<a href="<?php $author_url = Typecho_Common::url('/author/'.$fobj[$i]['uid'].'/',$this->options->index);_oc_e($author_url)?>"
class="sc-AxjAm sc-AxirZ eGdPrb"><img
src="<?php _oc_e(getUserV2exAvatar($fobj[$i]['mail'],$fobj[$i]['userAvatar']))?>"
alt="再多一点可爱" class="sc-AxjAm jZLHXc">
<div class="sc-AxjAm sc-AxirZ hkyonN">
<div class="sc-AxjAm oDrAC"><?php _oc_e($fobj[$i]['screenName'])?></div>
<div class="sc-AxjAm hHqHSX ezzhLs"><?php _oc_e($fobj[$i]['userSign']);?></div>
</div>
</a>
<div class="sc-AxjAm sc-AxirZ hsyNhw">
<button data-authorid="<?php _oc_e($fobj[$i]['uid'])?>" <?php
if ($this->user->hasLogin()){
if (UserFollow::statusFollow($this->user->uid,$fobj[$i]['uid'])){
echo 'class="fansed-little fan-event">已关注';
}else{
echo 'class="fans-little fan-event">关注';
}
}else{
echo 'class="fans-little fan-event">关注';
}
?>
</button>
</div>
</div>
<?php endfor;?>
<?php else:?>
<article class="post-article">
<h6 class="post-title"><?php _oc_e('还没关注别人'); ?></h6>
</article>
<?php endif ?>
<?php elseif($tabIndex==2):?>
<?php $fobj = UserFollow::getOtherFollowObj($this->getPageRow()['uid']);?>
<?php if (count($fobj)>0):?>
<?php for ($i = 0; $i < count($fobj); $i++): ?>
<div class="sc-AxjAm sc-AxirZ kQHfHM bITJVr">
<a href="<?php $author_url = Typecho_Common::url('/author/'.$fobj[$i]['uid'].'/',$this->options->index);_oc_e($author_url)?>"
class="sc-AxjAm sc-AxirZ eGdPrb"><img
src="<?php _oc_e(getUserV2exAvatar($fobj[$i]['mail'],$fobj[$i]['userAvatar']))?>"
alt="再多一点可爱" class="sc-AxjAm jZLHXc">
<div class="sc-AxjAm sc-AxirZ hkyonN">
<div class="sc-AxjAm oDrAC"><?php _oc_e($fobj[$i]['screenName'])?></div>
<div class="sc-AxjAm hHqHSX ezzhLs"><?php _oc_e($fobj[$i]['userSign']);?></div>
</div>
</a>
<div class="sc-AxjAm sc-AxirZ hsyNhw">
<button data-authorid="<?php _oc_e($fobj[$i]['uid'])?>" <?php
if ($this->user->hasLogin()){
if (UserFollow::statusFollow($this->user->uid,$fobj[$i]['uid'])){
echo 'class="fansed-little fan-event">已关注';
}else{
echo 'class="fans-little fan-event">关注';
}
}else{
echo 'class="fans-little fan-event">关注';
}
?>
</button>
</div>
</div>
<?php endfor;?>
<?php else:?>
<article class="post-article">
<h6 class="post-title"><?php _oc_e('还没有人关注你哦'); ?></h6>
</article>
<?php endif ?>
<?php elseif($tabIndex==3 && $this->have()):?>
<?php while ($this->next()): ?>
<?php $this->need('components/index/article-content.php'); ?>
<?php endwhile; ?>
<?php else: ?>
<article class="post-article">
<h6 class="post-title"><?php _oc_e('还没有发布内容'); ?></h6>
</article>
<?php endif; ?>
</div>
</div>
</div>
<?php if ($tabIndex==0 || $tabIndex == 3){$this->need('includes/post-pagination.php');} ?>
</div>
<?php $this->need('includes/archive-right.php'); ?>
</div>
</div>
</div>
<?php $this->need('includes/body-layout-end.php');?>
<?php $this->need('includes/footer.php'); ?>