Skip to content

Commit

Permalink
I will finish this in a little bit
Browse files Browse the repository at this point in the history
  • Loading branch information
BelleNottelling committed Nov 10, 2023
1 parent 4143a75 commit 721d9da
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 1 deletion.
53 changes: 53 additions & 0 deletions src/Plugins/Admin/Admin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

namespace Plugins\Admin;

use AntCMS\AntPlugin;
use AntCMS\AntConfig;
use AntCMS\AntTools;
use AntCMS\AntCMS;
use AntCMS\AntTwig;
use AntCMS\AntAuth;
use AntCMS\AntUsers;

class Admin extends AntPlugin
{
protected AntAuth $antAuth;
protected AntTwig $antTwig;
protected array $params = [
'AntCMSTitle' => '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)

Check failure on line 49 in src/Plugins/Admin/Admin.php

View workflow job for this annotation

GitHub Actions / build-test

Method Plugins\Admin\Admin::boolToWord() is unused.
{
return $value ? 'true' : 'false';
}
}
21 changes: 21 additions & 0 deletions src/Plugins/Admin/Controller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace Plugins\Admin;

use \Slim\App;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;

class Controller
{
public function registerRoutes(App $app)
{
$profilePlugin = new Admin;

$app->get('/admin', function (Request $request, Response $response) use ($profilePlugin) {
$profilePlugin->setRequest($request);
$profilePlugin->SetResponse($response);
return $profilePlugin->renderIndex();
});
}
}
2 changes: 1 addition & 1 deletion tests/Includes/Include.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';

0 comments on commit 721d9da

Please sign in to comment.