From a0901c4b7f2db488cb4fb3be2dd921a0308f4659 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 14:36:40 +0200 Subject: Adding upstream version 1.0.2. Signed-off-by: Daniel Baumann --- application/controllers/ConfigController.php | 63 ++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 application/controllers/ConfigController.php (limited to 'application/controllers/ConfigController.php') diff --git a/application/controllers/ConfigController.php b/application/controllers/ConfigController.php new file mode 100644 index 0000000..0d64fbf --- /dev/null +++ b/application/controllers/ConfigController.php @@ -0,0 +1,63 @@ +assertPermission('config/modules'); +// +// parent::init(); +// } + + public function databaseAction() + { + $form = (new DatabaseConfigForm()) + ->setIniConfig(Config::module('icingadb')); + + $form->handleRequest(); + + $this->mergeTabs($this->Module()->getConfigTabs()->activate('database')); + + $this->addFormToContent($form); + } + + public function redisAction() + { + $form = (new RedisConfigForm()) + ->setIniConfig($this->Config()); + + $form->handleRequest(); + + $this->mergeTabs($this->Module()->getConfigTabs()->activate('redis')); + + $this->addFormToContent($form); + } + + protected function addFormToContent(Form $form) + { + $this->addContent(new HtmlString($form->render())); + } + + protected function mergeTabs(Tabs $tabs): self + { + /** @var Tab $tab */ + foreach ($tabs->getTabs() as $tab) { + $this->tabs->add($tab->getName(), $tab); + } + + return $this; + } +} -- cgit v1.2.3