Skip to content

Commit b8ce074

Browse files
authored
Merge pull request #91 from LaswitchTech/dev
General: Version bumped to v0.0.91
2 parents 75d45a8 + b068caf commit b8ce074

File tree

5 files changed

+121
-14
lines changed

5 files changed

+121
-14
lines changed

Template/View/website.php

Lines changed: 72 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php if(!$this->Config->get('application','maintenance') || $this->Auth->isAuthorized('Administrator',1)): ?>
22
<!doctype html>
3-
<html lang="en" class="h-100 w-100" data-bs-theme="auto" data-bs-template="index">
3+
<html lang="en" class="h-100 w-100" data-bs-theme="auto" data-bs-template="website">
44
<head>
55
<meta charset="utf-8">
66
<meta name="viewport" content="width=device-width, initial-scale=1">
@@ -36,17 +36,18 @@
3636
<main class="content">
3737

3838
<!-- ======= Header ======= -->
39-
<div class="sticky-top shadow">
39+
<div class="app-header">
40+
4041
<!-- Navbar -->
41-
<nav class="navbar border-bottom text-bg-primary px-5">
42+
<nav class="navbar">
4243
<div class="container-fluid">
4344
<!-- Main Navigation -->
44-
<ul class="nav me-auto my-2">
45+
<ul class="nav">
4546
<?php foreach($this->Builder->menu('topbar') as $route => $nav): ?>
4647
<?php if($route === $this->Route): ?>
47-
<li class="nav-item"><a href="<?= $nav['link'] ?>" class="nav-link px-2 link-body-emphasis rounded rounded-pill text-bg-light active" aria-current="page"><?= $this->Locale->get($nav['label']); ?></a></li>
48+
<li class="nav-item"><a href="<?= $nav['link'] ?>" class="nav-link active" aria-current="page"><?= $this->Locale->get($nav['label']); ?></a></li>
4849
<?php else: ?>
49-
<li class="nav-item"><a href="<?= $nav['link'] ?>" class="nav-link px-2 link-body-emphasis"><?= $this->Locale->get($nav['label']); ?></a></li>
50+
<li class="nav-item"><a href="<?= $nav['link'] ?>" class="nav-link"><?= $this->Locale->get($nav['label']); ?></a></li>
5051
<?php endif; ?>
5152
<?php endforeach; ?>
5253
</ul>
@@ -55,16 +56,16 @@
5556
<?php require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'widgets.php'; ?>
5657
</div>
5758
</nav>
58-
<header class="d-flex flex-wrap justify-content-center align-items-center px-5 py-4 border-bottom text-bg-dark">
59+
<header>
5960

6061
<!-- Branding -->
61-
<a href="/" class="d-flex justify-content-center align-items-center mb-3 mb-md-0 me-md-auto link-light text-decoration-none">
62-
<img class="me-2" src="/logo" alt="Logo" style="height:64px;">
63-
<h1 class="display-5 fw-lighter m-0"><?php echo $this->Config->get('application','name') ?></h1>
62+
<a href="/">
63+
<img src="/logo" alt="Logo">
64+
<h1><?php echo $this->Config->get('application','name') ?></h1>
6465
</a>
6566

6667
<!-- Page Navigation -->
67-
<ul id="page-nav" class="nav nav-pills my-1">
68+
<ul id="page-nav" class="nav nav-pills">
6869
<?php $first = true; ?>
6970
<?php foreach($this->Builder->menu('topnav', $this->Route) as $route => $nav): ?>
7071
<?php if($first): ?>
@@ -84,6 +85,66 @@
8485
<?php require_once $this->view(); ?>
8586
<?php else: $this->interrupt()->Router->render('search'); endif; ?>
8687
</div>
88+
89+
<!-- Footer -->
90+
<footer class="app-footer">
91+
<div class="row">
92+
<?php foreach($this->Builder->menu('topbar') as $route => $nav): ?>
93+
<?php $menu = $this->Builder->menu('topnav', $route); ?>
94+
<?php if(empty($menu)): continue; endif; ?>
95+
<div class="col-12 col-md-6 col-lg-2">
96+
<h5><?= $this->Locale->get($nav['label']); ?></h5>
97+
<ul class="nav">
98+
<?php foreach($menu as $lroute => $lnav): ?>
99+
<li class="nav-item"><a href="<?= $route ?><?= $lroute ?>" class="nav-link"><?= $this->Locale->get($lnav['label']); ?></a></li>
100+
<?php endforeach; ?>
101+
</ul>
102+
</div>
103+
<?php endforeach; ?>
104+
<div class="col-12 col-md-6 col-lg-4">
105+
<h5><?= $this->Locale->get("Subscribe to our newsletter"); ?></h5>
106+
<p class="text-white-50"><?= $this->Locale->get("Monthly figest of what's new and exciting from us."); ?></p>
107+
<form>
108+
<div class="input-group">
109+
<input type="email" class="form-control" placeholder="<?= $this->Locale->get("Email address"); ?>" aria-label="email">
110+
<button type="submit" class="btn btn-primary"><?= $this->Locale->get("Subscribe"); ?></button>
111+
</div>
112+
</form>
113+
</div>
114+
</div>
115+
<div>
116+
<div class="d-flex flex-column flex-lg-row justify-content-between align-items-center border-top border-secondary p-4 gap-4">
117+
<div class="d-flex flex-column justify-content-center align-items-start flex-grow-1">
118+
<p class="text-white-50"><a href="/copyright"><?= $this->Locale->get('Copyright'); ?></a> &copy; <?= $this->Config->get('application','copyright') ?>-<?= date("Y") ?> <?= $this->Config->get('application','owner')?> <?= $this->Locale->get('All rights reserved'); ?>.</p>
119+
<a href="/" class="d-flex align-items-center mb-3 link-light text-decoration-none">
120+
<img class="me-2" src="/logo" alt="Logo" style="height:64px;">
121+
<h1 class="display-5 fw-lighter m-0"><?php echo $this->Config->get('application','name') ?></h1>
122+
</a>
123+
</div>
124+
<!-- Locale -->
125+
<div class="dropdown flex-shrink-1">
126+
<button class="btn btn-link py-1 dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
127+
<?= $this->Locale->locale($this->Locale->current())->language(); ?>
128+
</button>
129+
<ul class="dropdown-menu">
130+
<?php foreach($this->Locale->list() as $locale => $language): ?>
131+
<?php if($locale === $this->Locale->current()){ continue; } ?>
132+
<li><a class="dropdown-item" href="?locale=<?= $locale ?>"><i class="bi bi-globe-americas me-2"></i><?= $language ?></a></li>
133+
<?php endforeach; ?>
134+
</ul>
135+
</div>
136+
<!-- End Locale -->
137+
<!-- Socials -->
138+
<div class="socials d-flex justify-content-center align-items-center gap-3 flex-shrink-1">
139+
<?php $socials = $this->Config->get('application','social'); ?>
140+
<?php foreach($socials as $social => $link): ?>
141+
<a href="<?= $link ?>"><i class="bi bi-<?= $social ?> fs-4"></i></a>
142+
<?php endforeach; ?>
143+
</div>
144+
<!-- End Socials -->
145+
</div>
146+
</div>
147+
</footer>
87148
</div>
88149
</div>
89150
</div>

Template/View/widgets.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@
115115
<ul class="dropdown-menu">
116116
<?php foreach($this->Locale->list() as $locale => $language): ?>
117117
<li>
118-
<a href="?locale=<?= $locale ?>" class="dropdown-item d-flex align-items-center <?php if($locale === $this->Locale->current('name')){ echo 'active'; } ?>" aria-pressed="false">
118+
<a href="?locale=<?= $locale ?>" class="dropdown-item d-flex align-items-center <?php if($locale === $this->Locale->current()){ echo 'active'; } ?>" aria-pressed="false">
119119
<i class="bi bi-globe-americas me-2" aria-hidden="true"></i>
120120
<span><?= $language ?></span>
121-
<i class="bi bi-check2 ms-auto <?php if($locale !== $this->Locale->current('name')){ echo 'd-none'; } ?>" aria-hidden="true"></i>
121+
<i class="bi bi-check2 ms-auto <?php if($locale !== $this->Locale->current()){ echo 'd-none'; } ?>" aria-hidden="true"></i>
122122
</a>
123123
</li>
124124
<?php endforeach; ?>

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.0.90
1+
v0.0.91

src/Builder.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ public function menu($location = 'sidebar', $parent = null, int $maxDepth = 2):
118118
'color' => $p['color'] ?? null,
119119
'link' => $route,
120120
'parents' => $parents,
121+
'view' => $p['view'] ?? null,
121122
];
122123
}
123124
if (!$eligible) return [];
@@ -227,6 +228,7 @@ public function menu($location = 'sidebar', $parent = null, int $maxDepth = 2):
227228
'color' => $eligible[$route]['color'],
228229
'items' => [],
229230
'link' => $eligible[$route]['link'],
231+
'view' => $eligible[$route]['view']
230232
];
231233
};
232234

src/Objects/User.php

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ public function __construct(int|string $user)
6060
// Set Properties
6161
$this->user = $user[0];
6262

63+
// Parse JSON fields
64+
$this->user['settings'] = json_decode($this->user['settings'], true);
65+
6366
// Retrieve the user vCard's Avatar
6467
$query = $this->Database->query()
6568
->table('files')
@@ -145,6 +148,47 @@ public function __construct(int|string $user)
145148
$this->token = $this->UUID->toString($this->user['id']) . '-' . $this->UUID->toString($this->user['username']);
146149
}
147150

151+
/**
152+
* Retrieve a User Setting
153+
*
154+
* @param string $key
155+
* @return mixed
156+
*/
157+
public function setting(string $key): mixed
158+
{
159+
// Ensure settings is an array
160+
if (!isset($this->user['settings']) || !is_array($this->user['settings'])) {
161+
return null;
162+
}
163+
164+
// Split on dots and walk the array
165+
$segments = array_filter(explode('.', $key), fn($s) => $s !== '');
166+
$cursor = $this->user['settings'];
167+
168+
foreach ($segments as $seg) {
169+
// Allow numeric indexes if settings contains numeric-keyed arrays
170+
$candidateKeys = [$seg];
171+
if (ctype_digit($seg)) {
172+
$candidateKeys[] = (int)$seg;
173+
}
174+
175+
$found = false;
176+
foreach ($candidateKeys as $ck) {
177+
if (is_array($cursor) && array_key_exists($ck, $cursor)) {
178+
$cursor = $cursor[$ck];
179+
$found = true;
180+
break;
181+
}
182+
}
183+
184+
if (!$found) {
185+
return null;
186+
}
187+
}
188+
189+
return $cursor;
190+
}
191+
148192
/**
149193
* Retrieve the Backend
150194
*

0 commit comments

Comments
 (0)