From 721d9da998f37aea76b8daca89025a81d3b1b805 Mon Sep 17 00:00:00 2001 From: Belle Aerni Date: Fri, 10 Nov 2023 06:42:16 -0800 Subject: [PATCH] I will finish this in a little bit --- src/Plugins/Admin/Admin.php | 53 ++++++++++++++++++++++++++++++++ src/Plugins/Admin/Controller.php | 21 +++++++++++++ tests/Includes/Include.php | 2 +- 3 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 src/Plugins/Admin/Admin.php create mode 100644 src/Plugins/Admin/Controller.php diff --git a/src/Plugins/Admin/Admin.php b/src/Plugins/Admin/Admin.php new file mode 100644 index 0000000..8b7e530 --- /dev/null +++ b/src/Plugins/Admin/Admin.php @@ -0,0 +1,53 @@ + 'AntCMS Admin Dashboard', + 'AntCMSDescription' => 'The AntCMS admin dashboard', + 'AntCMSAuthor' => 'AntCMS', + 'AntCMSKeywords' => '', + + ]; + + public function __construct() + { + $this->antAuth = new AntAuth; + $this->antTwig = new AntTwig; + $this->antAuth->checkAuth(); + } + + public function renderIndex() + { + $this->params['user'] = AntUsers::getUserPublicalKeys($this->antAuth->getUsername()); + + $response = $this->response; + $response->getBody()->write($this->antTwig->renderWithSubLayout('admin_landing', $this->params)); + return $response; + } + + public function getName(): string + { + return 'Admin'; + } + + /** + * @return string + */ + private function boolToWord(bool $value) + { + return $value ? 'true' : 'false'; + } +} diff --git a/src/Plugins/Admin/Controller.php b/src/Plugins/Admin/Controller.php new file mode 100644 index 0000000..661f422 --- /dev/null +++ b/src/Plugins/Admin/Controller.php @@ -0,0 +1,21 @@ +get('/admin', function (Request $request, Response $response) use ($profilePlugin) { + $profilePlugin->setRequest($request); + $profilePlugin->SetResponse($response); + return $profilePlugin->renderIndex(); + }); + } +} diff --git a/tests/Includes/Include.php b/tests/Includes/Include.php index 2ac604f..dffc776 100644 --- a/tests/Includes/Include.php +++ b/tests/Includes/Include.php @@ -2,4 +2,4 @@ $basedir = dirname(__DIR__, 2); $srcdir = $basedir . DIRECTORY_SEPARATOR . 'src'; -include_once $srcdir . DIRECTORY_SEPARATOR . 'Bootstrap.php'; +include_once $srcdir . DIRECTORY_SEPARATOR . 'bootstrap.php';