-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdrawer.php
197 lines (183 loc) · 11.2 KB
/
drawer.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
<div class="mdl-layout__drawer" id="drawer">
<div class="nav-header"
style="background-image: url('<?php if ($this->options->drawerImageUrl): $this->options->drawerImageUrl(); else:$this->options->themeUrl('image/drawer.jpg'); endif; ?>');">
<div class="drawer-avator zoom-avator avatar-shadow">
<?php echo $this->author->gravatar(50); ?>
</div>
<div class="author">
<?php $this->author('screenName'); ?>
</div>
<div class="desc">
<?php $this->options->description() ?>
</div>
<button class="mdl-button mdl-js-button mdl-button--icon mdl-color-text--white"
id="close-drawer" onclick="$.closeDrawer()">
<i class="material-icons">clear_all</i>
</button>
</div>
<div class="menu-list">
<ul>
<li>
<form id="drawer-search" class="mdl-cell--hide-desktop mdl-cell--hide-tablet mdl-color-text--grey-600"
action="<?php $this->options->siteUrl(); ?>"
style="padding: 0px 16px;">
<div class="mdl-textfield mdl-js-textfield">
<input class="mdl-textfield__input" name="s" type="text" id="drawer-search-input"
style="padding: 6px 0">
<label class="mdl-textfield__label" for="drawer-search-input">Search...</label>
</div>
</form>
</li><!--search-->
<li><a class="close-drawer" href="<?php $this->options->siteUrl(); ?>">
<i class="material-icons">home</i><?php _e('首页'); ?>
</a>
</li><!--home-->
<hr class="menu-divider"/>
<?php if (!empty($this->options->drawerBlock) && in_array('ShowArchive', $this->options->drawerBlock)): ?>
<li class="menu-archive">
<a class="menu-switch">
<i class="material-icons">access_time</i>归档
<div class="mdl-button mdl-button--icon menu-right-btn follow-p"><i class="material-icons">chevron_right</i>
</div>
</a>
<ul class="menu-sub-list">
<?php $this->widget('Widget_Contents_Post_Date', 'type=month&format=F Y')
->parse('<li class="menu-item"><a class="close-drawer" href="{permalink}"><i class="material-icons"></i>{date}<span class="count">{count}</span></a></li>'); ?>
</ul>
</li><!--归档-->
<?php endif; ?>
<?php if (!empty($this->options->drawerBlock) && in_array('ShowCategory', $this->options->drawerBlock)): ?>
<li class="menu-category">
<a class="menu-switch">
<i class="material-icons">dashboard</i>分类
<div class="mdl-button mdl-button--icon menu-right-btn follow-p">
<i class="material-icons">chevron_right</i>
</div>
</a>
<ul class="menu-sub-list">
<!-- --><?php //$this->widget('Widget_Metas_Category_List')->listCategories('wrapClass=widget-list&showCount=true&countTemplate=<span class="count">{%d}</span>'); ?>
<?php $this->widget('Widget_Metas_Category_List')->to($categorys); ?>
<?php while ($categorys->next()): ?>
<?php if ($categorys->levels === 0): ?>
<?php $children = $categorys->getAllChildren($categorys->mid); ?>
<?php if (empty($children)) { ?>
<li class="menu-item" <?php if ($this->is('category', $categorys->slug)): ?> class="active"<?php endif; ?>>
<a class="close-drawer" href="<?php $categorys->permalink(); ?>"
title="<?php $categorys->name(); ?>"><i
class="material-icons"></i><?php $categorys->name(); ?>
<span class="count"><?php $categorys->count(); ?></span>
</a>
</li>
<?php } else { ?>
<li class="menu-item">
<a class="close-drawer" href="<?php $categorys->permalink(); ?>"
title="<?php $categorys->name(); ?>"><i
class="material-icons"></i><?php $categorys->name(); ?>
(<?php $categorys->count(); ?>)
<div class="menu-switch mdl-button mdl-button--icon menu-right-btn">
<i class="material-icons">chevron_right</i>
</div>
</a>
<ul class="menu-sub-list">
<?php foreach ($children as $mid) { ?>
<?php $child = $categorys->getCategory($mid); ?>
<li class="menu-item" <?php if ($this->is('category', $mid)): ?> class="active"<?php endif; ?>>
<a class="close-drawer" href="<?php echo $child['permalink'] ?>"
title="<?php echo $child['name']; ?>"><i
class="material-icons"></i> <?php echo $child['name']; ?>
<span class="count"><?php $categorys->count(); ?></span>
</a>
</li>
<?php } ?>
</ul>
</li>
<?php } ?>
<?php endif; ?>
<?php endwhile; ?>
</ul>
</li>
<?php endif; ?>
<?php if (!empty($this->options->drawerBlock) && in_array('ShowPages', $this->options->drawerBlock)): ?>
<li>
<a class="menu-switch">
<i class="material-icons">description</i>页面
<div class="mdl-button mdl-button--icon menu-right-btn follow-p">
<i class="material-icons">chevron_right</i>
</div>
</a>
<ul class="menu-sub-list">
<?php $this->widget('Widget_Contents_Page_List')->to($pages); ?>
<?php while ($pages->next()): ?>
<?php if (in_array($pages->slug, drawerMenuPages())):continue; endif; ?>
<li>
<a class="close-drawer <?php if ($this->is('page', $pages->slug)): ?> current<?php endif; ?> "
href="<?php $pages->permalink(); ?>"
title="<?php $pages->title(); ?>">
<i class="material-icons"></i><?php $pages->title(); ?>
</a></li>
<?php endwhile; ?>
</ul>
</li><!--页面-->
<?php endif; ?>
<?php $this->widget('Widget_Contents_Page_List')->to($pages); ?>
<?php while ($pages->next()): ?>
<?php if (!in_array($pages->slug, drawerMenuPages())):continue; endif; ?>
<li><a class="close-drawer <?php if ($this->is('page', $pages->slug)): ?>current<?php endif; ?>"
href="<?php $pages->permalink(); ?>"
title="<?php $pages->title(); ?>">
<i class="material-icons">
<?php if ($pages->slug == 'about'):echo 'person';
elseif ($pages->slug == 'links'):echo 'link';
elseif ($pages->slug == 'reading'):echo 'photo_album';
elseif ($pages->slug == 'board'):echo 'sms'; endif; ?>
</i><?php $pages->title(); ?>
</a></li>
<?php endwhile; ?>
<hr class="menu-divider"/>
<?php if ($this->user->hasLogin()): ?>
<li><a class="close-drawer no-pjax" target="_blank"
href="<?php $this->options->adminUrl(); ?>"><?php _e('进入后台'); ?>
(<?php $this->user->screenName(); ?>)</a></li>
<li><a class="close-drawer no-pjax" href="<?php $this->options->logoutUrl(); ?>"><?php _e('退出'); ?></a></li>
<?php else: ?>
<li><a class="close-drawer no-pjax"
href="<?php $this->options->adminUrl('login.php'); ?>"><?php _e('登录'); ?></a></li>
<?php endif; ?>
<li><a class="close-drawer no-pjax" target="_blank" href="<?php $this->options->feedUrl(); ?>"><?php _e('文章 RSS'); ?></a></li>
</ul>
</div>
</div>
<?php if (!empty($this->options->homeCard) && in_array('showAllList', $this->options->homeCard)): ?>
<div class="right-drawer close">
<div class="scroll scroll-bar">
<button id="list-drawer-btn" class="mdl-button mdl-js-button mdl-button--fab mdl-button--mini-fab">
<i class="material-icons">arrow_forward</i>
</button>
<ul>
<?php
$this->widget('Widget_Contents_Post_Recent', 'pageSize=10000')->to($archives);
$COUNT_TAG = 'YYL_TPX4869';
$lastYear = 0;
$tempHtml = '';
$count = 0;
if (!$archives->have()) {
echo "<li class=\"yc\"><div class=\"bg\"><span class=\"y\">最近没有文章!</span><span class=\"count\"></span></div></li>";
}
while ($archives->next()) {
$year_tmp = date('Y', $archives->created);
$date = date('m.d', $archives->created);
if ($year_tmp != $lastYear) {
echo str_replace($COUNT_TAG, $count . '篇', $tempHtml);
$count = 0;
$lastYear = $year_tmp;
$tempHtml = "<li class=\"yc\"><div class=\"bg\"><span class=\"y\">{$year_tmp}</span><span class=\"count\">{$COUNT_TAG}</span></div></li>";
}
$count++;
$tempHtml .= "<li class=\"dc\"><span class=\"d\">{$date}</span><a href='{$archives->permalink}' class=\"c\">{$archives->title}</a></li>";
};
echo str_replace($COUNT_TAG, $count . '篇', $tempHtml);
$this->destory('Widget_Contents_Post_Recent'); ?>
</ul>
</div>
</div>
<?php endif; ?>