diff --git a/src/Controller/UsersController.php b/src/Controller/UsersController.php index 4b13df6..ec17d6b 100644 --- a/src/Controller/UsersController.php +++ b/src/Controller/UsersController.php @@ -148,6 +148,11 @@ class UsersController extends AppController } } + public function settings() + { + $this->set('user', $this->ACL->getUser()); + } + public function register() { $this->InboxProcessors = TableRegistry::getTableLocator()->get('InboxProcessors'); diff --git a/src/Model/Entity/Individual.php b/src/Model/Entity/Individual.php index a14e339..15ea1f2 100644 --- a/src/Model/Entity/Individual.php +++ b/src/Model/Entity/Individual.php @@ -16,4 +16,14 @@ class Individual extends AppModel protected $_accessibleOnNew = [ 'uuid' => true, ]; + + protected $_virtual = ['full_name']; + + protected function _getFullName() + { + if (empty($this->first_name) && empty($this->last_name)) { + return $this->username; + } + return sprintf("%s %s", $this->first_name, $this->last_name); + } } diff --git a/templates/Instance/settings.php b/templates/Instance/settings.php index 0e9adf6..5e85df6 100644 --- a/templates/Instance/settings.php +++ b/templates/Instance/settings.php @@ -42,8 +42,6 @@ function genNavcard($settingsProvider, $appView) ]); array_unshift($cardContent, $notice); $tabsOptions0 = [ - // 'vertical' => true, - // 'vertical-size' => 2, 'card' => false, 'pills' => false, 'justify' => 'center', diff --git a/templates/Users/settings.php b/templates/Users/settings.php new file mode 100644 index 0000000..22222bf --- /dev/null +++ b/templates/Users/settings.php @@ -0,0 +1,80 @@ + [ + 'ui.bsTheme' => [ + 'description' => 'The Bootstrap theme to use for the application', + 'default' => 'default', + 'name' => 'UI Theme', + 'options' => (function () { + $instanceTable = TableRegistry::getTableLocator()->get('Instance'); + $themes = $instanceTable->getAvailableThemes(); + return array_combine($themes, $themes); + })(), + 'severity' => 'info', + 'type' => 'select' + ], + ], + __('Bookmarks') => 'Bookmarks', + __('Account Security') => 'Account Security', +]; + +$cardNavs = array_keys($settings); +$cardContent = []; + +$sectionHtml = ''; +foreach ($settings[__('Appearance')] as $sectionName => $sectionContent) { + $sectionHtml .= $this->element('Settings/panel', [ + 'sectionName' => $sectionName, + 'panelName' => $sectionName, + 'panelSettings' => $sectionContent, + ]); +} +$cardContent[] = $sectionHtml; +$cardContent[] = $settings[__('Bookmarks')]; +$cardContent[] = $settings[__('Account Security')]; + +$tabsOptions = [ + 'vertical' => true, + 'vertical-size' => 2, + 'card' => true, + 'pills' => true, + 'justify' => 'center', + 'nav-class' => ['settings-tabs'], + 'data' => [ + 'navs' => $cardNavs, + 'content' => $cardContent + ] +]; +$tabs = $this->Bootstrap->tabs($tabsOptions); +?> + +