This repository has been archived by the owner on Apr 24, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.php
343 lines (278 loc) · 11.5 KB
/
index.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
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
<?php
/**
* @package Joomla.Site
* @subpackage Templates.master3lite
* @copyright Copyright (C) Aleksey A. Morozov. All rights reserved.
* @license GNU General Public License version 3 or later; see http://www.gnu.org/licenses/gpl-3.0.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Filesystem\Path;
use Joomla\CMS\Helper\ModuleHelper;
use Joomla\CMS\Language\Text;
// set base header
$this->setHtml5(true);
$this->setGenerator('');
$this->setMetaData('viewport', 'width=device-width,initial-scale=1');
$this->setMetaData('X-UA-Compatible', 'IE=edge', 'http-equiv');
// include UIkit css
$cssUikit = $this->params->get('cssUikit', 'uikit.min.css');
if ($cssUikit !== 'none') {
$isRTL = strpos($cssUikit, 'rtl') !== false;
$isMin = strpos($cssUikit, 'min') !== false;
HTMLHelper::_('uikit3.css', $isRTL, $isMin);
}
// include jQuery
if ($this->params->get('jsJQ', false)) {
HTMLHelper::_('jquery.framework', true, null, false);
}
// inclide UIkit js
$jsUikit = $this->params->get('jsUikit', 'uikit.min.js');
if ($jsUikit !== 'none') {
$isMin = strpos($jsUikit, 'min') !== false;
HTMLHelper::_('uikit3.js', $isMin);
}
// include UIkit icons js
$jsIcons = $this->params->get('jsIcons', 'uikit-icons.min.js');
if ($jsIcons !== 'none') {
$isMin = strpos($jsIcons, 'min') !== false;
HTMLHelper::_('uikit3.icons', $isMin);
}
// include browser's icons
$this->addFavicon(Uri::base(true) . '/templates/' . $this->template . '/favicon.png', 'image/png', 'shortcut icon');
$this->addHeadLink(Uri::base(true) . '/templates/' . $this->template . '/apple-touch-icon.png', 'apple-touch-icon-precomposed');
/* begin: add your connections to head here */
/* end */
// include custom styles
$customCSS = 'templates/' . $this->template . '/css/custom.css';
if (file_exists(Path::clean(JPATH_ROOT . '/' . $customCSS))) {
HTMLHelper::stylesheet($customCSS, [], ['options' => ['version' => filemtime(Path::clean(JPATH_ROOT . '/' . $customCSS))]]);
}
// include custom scripts
$customJS = 'templates/' . $this->template . '/js/custom.js';
if (file_exists(Path::clean(JPATH_ROOT . '/' . $customJS))) {
HTMLHelper::script($customJS, [], ['options' => ['version' => filemtime(Path::clean(JPATH_ROOT . '/' . $customJS))]]);
}
/* === Menu options === */
// menu toggle breakpoint
$omb = $this->params->get('omb', '@m');
// check offcanvas
$isOffcanvas = $this->countModules('offcanvas') > 0;
// ckeck menu in 'navbar-left' position
$isNavbarMenu = false;
foreach (ModuleHelper::getModules('navbar-left') as $module) {
if ($module->module === 'mod_menu') {
$isNavbarMenu = true;
break;
}
}
$isNavbarMenuLeft = $isNavbarMenu && $isOffcanvas;
// ckeck menu in 'navbar-center' position
if (!$isNavbarMenu) {
foreach (ModuleHelper::getModules('navbar-center') as $module) {
if ($module->module === 'mod_menu') {
$isNavbarMenu = true;
break;
}
}
$isNavbarMenuCenter = $isNavbarMenu && $isOffcanvas;
} else {
$isNavbarMenuCenter = false;
}
// ckeck menu in 'navbar-right' position
if (!$isNavbarMenu) {
foreach (ModuleHelper::getModules('navbar-right') as $module) {
if ($module->module === 'mod_menu') {
$isNavbarMenu = true;
break;
}
}
$isNavbarMenuRight = $isNavbarMenu && $isOffcanvas;
} else {
$isNavbarMenuRight = false;
}
?>
<!DOCTYPE html>
<html lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>">
<head>
<jdoc:include type="head"/>
</head>
<body>
<?php if ($this->countModules('toolbar-left + toolbar-right')) { ?>
<div role="toolbar" id="toolbar" class="uk-section uk-section-xsmall uk-section-primary">
<div class="uk-container">
<div class="uk-flex uk-flex-middle uk-flex-between">
<?php if ($this->countModules('toolbar-left')) { ?>
<jdoc:include type="modules" name="toolbar-left" style="master3lite" />
<?php } ?>
<?php if ($this->countModules('toolbar-right')) { ?>
<jdoc:include type="modules" name="toolbar-right" style="master3lite" />
<?php } ?>
</div>
</div>
</div>
<?php } ?>
<?php if ($this->countModules('logo + headbar')) { ?>
<header id="header" class="uk-section uk-section-xsmall">
<div class="uk-container">
<div data-uk-grid>
<?php if ($this->countModules('logo')) { ?>
<div class="uk-width-auto@s uk-flex uk-flex-middle">
<jdoc:include type="modules" name="logo" style="master3lite" />
</div>
<?php } ?>
<?php if ($this->countModules('headbar')) { ?>
<div class="uk-width-expand@s uk-flex uk-flex-middle uk-flex-right@s">
<jdoc:include type="modules" name="headbar" style="master3lite" />
</div>
<?php } ?>
</div>
</div>
</header>
<?php } ?>
<?php if ($this->countModules('navbar-left + navbar-center + navbar-right')) { ?>
<div role="navigation" id="navbar" class="uk-section uk-padding-remove-vertical uk-navbar-container">
<div class="uk-container">
<div data-uk-navbar>
<?php
if ($this->countModules('navbar-left')) {
if ($isNavbarMenuLeft) {
?>
<div class="uk-navbar-left uk-hidden<?php echo $omb; ?>">
<a href="#offcanvas" class="uk-navbar-toggle" data-uk-navbar-toggle-icon data-uk-toggle aria-label="Menu"></a>
</div>
<?php } ?>
<div class="uk-navbar-left<?php echo ($isNavbarMenuLeft ? ' uk-visible' . $omb : ''); ?>">
<jdoc:include type="modules" name="navbar-left" style="master3lite" />
</div>
<?php } ?>
<?php
if ($this->countModules('navbar-center')) {
if ($isNavbarMenuCenter) {
?>
<div class="uk-navbar-center uk-hidden<?php echo $omb; ?>">
<a href="#offcanvas" class="uk-navbar-toggle" data-uk-navbar-toggle-icon data-uk-toggle aria-label="Menu"></a>
</div>
<?php } ?>
<div class="uk-navbar-center<?php echo ($isNavbarMenuCenter ? ' uk-visible' . $omb : ''); ?>">
<jdoc:include type="modules" name="navbar-center" style="master3lite" />
</div>
<?php } ?>
<?php
if ($this->countModules('navbar-right')) {
if ($isNavbarMenuRight) {
?>
<div class="uk-navbar-right uk-hidden<?php echo $omb; ?>">
<a href="#offcanvas" class="uk-navbar-toggle" data-uk-navbar-toggle-icon data-uk-toggle aria-label="Menu"></a>
</div>
<?php } ?>
<div class="uk-navbar-right<?php echo ($isNavbarMenuRight ? ' uk-visible' . $omb : ''); ?>">
<jdoc:include type="modules" name="navbar-right" style="master3lite" />
</div>
<?php } ?>
</div>
</div>
</div>
<?php } ?>
<?php if ($this->countModules('breadcrumb')) { ?>
<div role="navigation" id="breadcrumb" class="uk-section uk-section-xsmall uk-section-default">
<div class="uk-container">
<jdoc:include type="modules" name="breadcrumb" style="master3lite" />
</div>
</div>
<?php } ?>
<jdoc:include type="message" />
<?php
$topCount = $this->countModules('top');
$topCount = $topCount > 6 ? 6 : $topCount;
if ($topCount) {
?>
<section id="top" class="uk-section uk-section-muted">
<div class="uk-container">
<div class="uk-child-width-1-<?php echo $topCount; ?>@l uk-child-width-1-<?php echo ceil($topCount / 2); ?>@m uk-child-width-1-1@s uk-flex-center" data-uk-grid>
<jdoc:include type="modules" name="top" style="master3lite" />
</div>
</div>
</section>
<?php } ?>
<?php
$mainTopCount = $this->countModules('main-top');
$mainBottomCount = $this->countModules('main-bottom');
$sidebarACount = $this->countModules('sidebar-a');
$sidebarBCount = $this->countModules('sidebar-b');
$mainWidth = $sidebarACount && $sidebarBCount ? '1-2' : ($sidebarACount || $sidebarBCount ? '3-4' : '1-1');
?>
<div id="main" class="uk-section uk-section-default">
<div class="uk-container">
<div data-uk-grid>
<div class="uk-width-<?php echo $mainWidth; ?>@m">
<div class="uk-child-width-1-1 uk-grid divider" data-uk-grid>
<?php if ($mainTopCount) { ?>
<div class="uk-margin-large-bottom uk-child-width-1-1" data-uk-grid>
<jdoc:include type="modules" name="main-top" style="master3lite" />
</div>
<?php } ?>
<main id="content">
<jdoc:include type="component" />
</main>
<?php if ($mainBottomCount) { ?>
<div class="uk-margin-large-top uk-child-width-1-1" data-uk-grid>
<jdoc:include type="modules" name="main-bottom" style="master3lite" />
</div>
<?php } ?>
</div>
</div>
<?php if ($sidebarACount) { ?>
<aside class="uk-width-1-4@m uk-width-1-1@s uk-flex-first@m">
<div class="uk-child-width-1-1" data-uk-grid>
<jdoc:include type="modules" name="sidebar-a" style="master3lite" />
</div>
</aside>
<?php } ?>
<?php if ($sidebarBCount) { ?>
<aside class="uk-width-1-4@m uk-width-1-1@s">
<div class="uk-child-width-1-1" data-uk-grid>
<jdoc:include type="modules" name="sidebar-b" style="master3lite" />
</div>
</aside>
<?php } ?>
</div>
</div>
</div>
<?php
$bottomCount = $this->countModules('bottom');
$bottomCount = $bottomCount > 6 ? 6 : $bottomCount;
if ($bottomCount) {
?>
<section id="bottom" class="uk-section uk-section-muted">
<div class="uk-container">
<div class="uk-child-width-1-<?php echo $bottomCount; ?>@l uk-child-width-1-<?php echo ceil($bottomCount / 2); ?>@m uk-child-width-1-1@s uk-flex-center" data-uk-grid>
<jdoc:include type="modules" name="bottom" style="master3lite" />
</div>
</div>
</section>
<?php } ?>
<?php if ($this->countModules('footer')) { ?>
<footer id="footer" class="uk-section uk-section-xsmall uk-section-secondary">
<div class="uk-container">
<div class="uk-child-width-auto uk-flex-wrap uk-flex-between" data-uk-grid>
<jdoc:include type="modules" name="footer" style="master3lite" />
</div>
</div>
</footer>
<?php } ?>
<a class="uk-padding-small uk-position-bottom-left uk-position-fixed" data-uk-totop data-uk-scroll aria-label="Up"></a>
<?php if ($isOffcanvas) { ?>
<aside id="offcanvas" data-uk-offcanvas="mode:slide;overlay:true;">
<div class="uk-offcanvas-bar">
<a class="uk-offcanvas-close" data-uk-close aria-label="<?php echo Text::_('JLIB_HTML_BEHAVIOR_CLOSE'); ?>"></a>
<jdoc:include type="modules" name="offcanvas" style="master3lite" />
</div>
</aside>
<?php } ?>
<?php if ($this->countModules('debug')) { ?>
<jdoc:include type="modules" name="debug" style="none" />
<?php } ?>
</body>
</html>