2021-10-12 10:16:36 +02:00
|
|
|
<?php
|
2021-10-18 13:24:30 +02:00
|
|
|
$navLinks = [];
|
|
|
|
$tabContents = [];
|
|
|
|
|
|
|
|
foreach ($settingsProvider as $settingTitle => $settingContent) {
|
|
|
|
$navLinks[] = h($settingTitle);
|
|
|
|
$tabContents[] = $this->element('Settings/category', [
|
|
|
|
'settings' => $settingContent,
|
|
|
|
'includeScrollspy' => false,
|
2021-10-12 10:16:36 +02:00
|
|
|
]);
|
|
|
|
}
|
2021-10-18 13:24:30 +02:00
|
|
|
|
2022-01-26 12:11:44 +01:00
|
|
|
if (empty($editingAnotherUser)) {
|
|
|
|
$navLinks[] = __('Bookmarks');
|
|
|
|
$tabContents[] = $this->element('UserSettings/saved-bookmarks', [
|
|
|
|
'bookmarks' => !empty($user->user_settings_by_name['ui.bookmarks']['value']) ? json_decode($user->user_settings_by_name['ui.bookmarks']['value'], true) : []
|
|
|
|
]);
|
|
|
|
}
|
2021-10-12 10:16:36 +02:00
|
|
|
|
|
|
|
$tabsOptions = [
|
|
|
|
'vertical' => true,
|
|
|
|
'vertical-size' => 2,
|
|
|
|
'card' => true,
|
|
|
|
'pills' => true,
|
|
|
|
'justify' => 'center',
|
|
|
|
'nav-class' => ['settings-tabs'],
|
|
|
|
'data' => [
|
2021-10-18 13:24:30 +02:00
|
|
|
'navs' => $navLinks,
|
|
|
|
'content' => $tabContents
|
2021-10-12 10:16:36 +02:00
|
|
|
]
|
|
|
|
];
|
|
|
|
$tabs = $this->Bootstrap->tabs($tabsOptions);
|
2021-10-18 13:24:30 +02:00
|
|
|
echo $this->Html->script('settings');
|
2022-01-26 12:11:44 +01:00
|
|
|
$saveUrl = '/userSettings/saveSetting';
|
|
|
|
if(!empty($editingAnotherUser)) {
|
|
|
|
$saveUrl .= '/' . h($user->id);
|
|
|
|
}
|
2021-10-12 10:16:36 +02:00
|
|
|
?>
|
|
|
|
|
2021-10-18 13:24:30 +02:00
|
|
|
<script>
|
|
|
|
window.settingsFlattened = <?= json_encode($settingsFlattened) ?>;
|
2022-01-26 12:11:44 +01:00
|
|
|
window.saveSettingURL = '<?= $saveUrl ?>'
|
2021-10-18 13:24:30 +02:00
|
|
|
</script>
|
|
|
|
|
2021-10-12 10:16:36 +02:00
|
|
|
<h2 class="fw-light"><?= __('Account settings') ?></h2>
|
|
|
|
<div class="p-2">
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<span class="fw-bold font-monospace me-2 fs-5"><?= h($user->username) ?></span>
|
|
|
|
<span><?= h($user->individual->full_name) ?></span>
|
|
|
|
</div>
|
2022-01-26 12:11:44 +01:00
|
|
|
<?php if (!empty($editingAnotherUser)): ?>
|
|
|
|
<?=
|
|
|
|
$this->Bootstrap->alert([
|
2022-01-27 08:41:31 +01:00
|
|
|
'text' => __('Currently editing the account settings of another user.'),
|
2022-01-26 12:11:44 +01:00
|
|
|
'variant' => 'warning',
|
|
|
|
'dismissible' => false
|
|
|
|
])
|
|
|
|
?>
|
|
|
|
<?php else: ?>
|
|
|
|
<div class="fw-light"><?= __('Your personnal account') ?></div>
|
|
|
|
<?php endif; ?>
|
2021-10-12 10:16:36 +02:00
|
|
|
</div>
|
|
|
|
<div class="mt-2">
|
|
|
|
<?= $tabs ?>
|
|
|
|
</div>
|
|
|
|
</div>
|