familyHub/index.php

56 lines
1.6 KiB
PHP

<?php
require_once 'config/config.php';
require_once 'includes/db.php';
require_once 'includes/utils.php';
require_once 'includes/persona.php';
require_once 'includes/family_settings.php';
startFamilyHubSession();
$people = normalizePeopleList(readJsonFile('people.json'));
if (getActivePersonId() !== null && getActivePerson($people) === null) {
clearPersonaSession();
}
$activePerson = getActivePerson($people);
$familySettings = loadFamilySettings();
if (isset($TABS['currency'])) {
$TABS['currency']['title'] = currencyTabLabel($familySettings);
}
$activeTab = isset($_GET['tab']) ? (string) $_GET['tab'] : 'chores';
if (!isset($TABS[$activeTab])) {
$activeTab = 'chores';
}
$familyHubApiBase = familyHubWebApiBase();
$favoriteColor = '#4a90e2';
if (
$activePerson !== null
&& !empty($activePerson['favoriteColor'])
&& preg_match('/^#[0-9A-Fa-f]{6}$/', (string) $activePerson['favoriteColor'])
) {
$favoriteColor = (string) $activePerson['favoriteColor'];
}
include 'includes/header.php';
?>
<div class="container">
<div class="tabs">
<?php foreach ($TABS as $tabId => $tab): ?>
<a href="?tab=<?= htmlspecialchars($tabId, ENT_QUOTES, 'UTF-8') ?>" class="tab <?= $activeTab === $tabId ? 'active' : '' ?>">
<i class="fa fa-<?= htmlspecialchars($tab['icon'], ENT_QUOTES, 'UTF-8') ?>"></i> <?= htmlspecialchars($tab['title'], ENT_QUOTES, 'UTF-8') ?>
</a>
<?php endforeach; ?>
</div>
<div class="tab-content">
<?php include 'tabs/' . $activeTab . '.php'; ?>
</div>
</div>
<?php include 'includes/footer.php'; ?>