forked from IceWreck/Argon-Dokuwiki-Template
-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.php
275 lines (236 loc) · 10.8 KB
/
main.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
<!--
=========================================================
* Argon Dokuwiki Template
* Based on the Argon Design System by Creative Tim
* Ported to Dokuwiki by Anchit (@IceWreck)
=========================================================
-->
<?php
if (!defined('DOKU_INC')) {
die();
}
/* must be run from within DokuWiki */
@require_once dirname(__FILE__) . '/tpl_functions.php'; /* include hook for template functions */
$showTools = !tpl_getConf('hideTools') || (tpl_getConf('hideTools') && !empty($_SERVER['REMOTE_USER']));
$showSidebar = page_findnearest($conf['sidebar']) && ($ACT == 'show');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="apple-touch-icon" sizes="76x76" href="assets/img/apple-icon.png">
<link rel="icon" type="image/png" href="<?php echo tpl_basedir(); ?>images/favicon<?php echo tpl_getConf('favicon')?>.ico">
<title>
<?php tpl_pagetitle()?> [
<?php echo strip_tags($conf['title']) ?>]</title>
<?php tpl_metaheaders()?>
<?php echo tpl_favicon(array(
'favicon',
'mobile',
))
?>
<?php tpl_includeFile('meta.html')?>
<!--
I know the CSS and JS imports can be done within the style.ini and script.js files,
but I had some issues with styling (and import order) there, so I'm doing those imports here.
-->
<!-- Fonts and icons -->
<!-- <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700" rel="stylesheet"> -->
<link href="<?php echo tpl_basedir(); ?>assets/css/fonts.css" rel="stylesheet">
<!-- CSS Files -->
<link href="<?php echo tpl_basedir(); ?>assets/css/doku.css" rel="stylesheet" />
<!-- JS -->
<script src="<?php echo tpl_basedir(); ?>assets/js/core/bootstrap.min.js" type="text/javascript"></script>
<script src="<?php echo tpl_basedir(); ?>assets/js/argon-design-system.min.js" type="text/javascript"></script>
</head>
<body class="docs ">
<div id="dokuwiki__site">
<header
class="navbar navbar-horizontal navbar-expand navbar-dark flex-row align-items-md-center ct-navbar bg-primary py-2">
<div class="header-title">
<?php
$showIcon = tpl_getConf('showIcon');
if ($showIcon):
?>
<img width="30px" src="<?php echo tpl_basedir(); ?>/images/doku-icon<?php echo tpl_getConf('icon')?>.png"/>
<?php endif; ?>
<?php tpl_link(wl(), $conf['title'], 'accesskey="h" title="[H]"')?>
</div>
<div class="d-none d-sm-block ml-auto">
<ul class="navbar-nav ct-navbar-nav flex-row align-items-center">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<?php
if (!empty($_SERVER['REMOTE_USER'])) {
// $loggedinas = tpl_getLang('loggedinas');
ob_start();
tpl_userinfo();
$value = ob_get_contents();
ob_end_clean();
echo str_replace('Logged in as: ', '', $value);
}
?>
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<?php
$menu_items = (new \dokuwiki\Menu\UserMenu())->getItems();
foreach($menu_items as $item) {
echo '<a class="dropdown-item" href="'.$item->getLink().'" title="'.$item->getTitle().'">'
.'<i class="argon-doku-navbar-icon">'.inlineSVG($item->getSvg()).'</i>'
.$item->getLabel()
. '<span class="a11y">'.$item->getLabel().'</span>'
. '</a>';
}
?>
</div>
</li>
<li class="nav-item">
<div class="search-form">
<?php tpl_searchform()?>
</div>
</li>
</ul>
</div>
<button class="navbar-toggler ct-search-docs-toggle d-block d-md-none ml-auto ml-sm-0" type="button"
data-toggle="collapse" data-target="#ct-docs-nav" aria-controls="ct-docs-nav" aria-expanded="false"
aria-label="Toggle docs navigation">
<span class="navbar-toggler-icon"></span>
</button>
</header>
<div class="container-fluid">
<div class="row flex-xl-nowrap">
<?php
// Render the content initially
ob_start();
tpl_content(false);
$buffer = ob_get_clean();
?>
<!-- left sidebar -->
<div class="col-12 col-md-3 col-xl-2 ct-sidebar">
<nav class="collapse ct-links" id="ct-docs-nav">
<?php if ($showSidebar): ?>
<div id="dokuwiki__aside" class="ct-toc-item active">
<div class="leftsidebar">
<?php tpl_includeFile('sidebarheader.html')?>
<?php tpl_include_page($conf['sidebar'], 1, 1)?>
<a class="ct-toc-link">
<?php echo $lang['site_tools'] ?>
</a>
<?php tpl_includeFile('sidebarfooter.html')?>
</div>
</div>
<?php endif;?>
<div class="ct-toc-item active">
<ul class="nav ct-sidenav">
<?php
$menu_items = (new \dokuwiki\Menu\SiteMenu())->getItems();
foreach($menu_items as $item) {
echo '<li>'
.'<a class="" href="'.$item->getLink().'" title="'.$item->getTitle().'">'
. $item->getLabel()
. '</a></li>';
}
?>
</ul>
</div>
</nav>
</div>
<!-- center content -->
<main class="col-12 col-md-9 col-xl-8 py-md-3 pl-md-5 ct-content" role="main">
<div id="dokuwiki__top" class="site
<?php echo tpl_classes(); ?>
<?php echo ($showSidebar) ? 'hasSidebar' : ''; ?>">
</div>
<?php html_msgarea()?>
<?php tpl_includeFile('header.html')?>
<!-- Trace/Navigation -->
<nav aria-label="breadcrumb" role="navigation">
<ol class="breadcrumb">
<?php if ($conf['breadcrumbs']) {?>
<div class="breadcrumbs"><?php tpl_breadcrumbs()?></div>
<?php }?>
<?php if ($conf['youarehere']) {?>
<div class="breadcrumbs"><?php tpl_youarehere()?></div>
<?php }?>
</ol>
</nav>
<!-- Page Menu -->
<div class="argon-doku-page-menu">
<?php
$menu_items = (new \dokuwiki\Menu\PageMenu())->getItems();
foreach($menu_items as $item) {
echo '<li>'
.'<a class="page-menu__link" href="'.$item->getLink().'" title="'.$item->getTitle().'">'
.'<i class="">'.inlineSVG($item->getSvg()).'</i>'
. '<span class="a11y">'.$item->getLabel().'</span>'
. '</a></li>';
}
?>
</div>
<!-- Floating Top Button -->
<div class="floating-top-button">
<?php
$menu_items = (new \dokuwiki\Menu\PageMenu())->getItems();
foreach($menu_items as $item) {
if ($item->getType() != "top") continue;
echo '<a class="btn" href="'.$item->getLink().'" title="'.$item->getTitle().'">'
.'<i class="">'.inlineSVG($item->getSvg()).'</i>'
. '<span class="a11y">'.$item->getLabel().'</span>'
. '</a>';
}
?>
</div>
<!-- Wiki Contents -->
<div id="dokuwiki__content">
<div class="pad">
<div class="page">
<?php echo $buffer ?>
</div>
</div>
</div>
<hr />
<!-- Footer -->
<footer>
<div class="row">
<p class="page-info"><?php tpl_pageinfo() /* 'Last modified' etc */ ?></p>
</div>
<?php
ob_start();
tpl_license('0');
$buffer = ob_get_clean();
if ($buffer):
?>
<div class="card footer-card">
<div class="card-body">
<div class="container">
<div class="row">
<div class="col">
<div id="dokuwiki__footer">
<div class="pad">
<div class="doc">
</div>
<?php tpl_license('0') /* content license, parameters: img=*badge|button|0, imgonly=*0|1, return=*0|1 */ ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php endif;?>
<?php tpl_includeFile('footer.html') ?>
<?php tpl_indexerWebBug(); ?>
</footer>
</main>
<!-- Right Sidebar -->
<div class="d-none d-xl-block col-xl-2 ct-toc">
<div>
<?php tpl_toc()?>
</div>
</div>
</div>
</div>
</div>
</body>
</html>