1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-12 08:04:05 +02:00

Admin plugin #3 General Updates

This commit is contained in:
Awilum
2018-04-03 00:54:05 +03:00
parent 4ee14ec5ea
commit e6f95336b2
5 changed files with 45 additions and 4 deletions

View File

@@ -38,6 +38,8 @@ class Admin {
*/
protected static $instance = null;
protected static $isLoggedIn = true;
/**
* Protected clone method to enforce singleton behavior.
*
@@ -61,17 +63,52 @@ class Admin {
protected static function init()
{
if (static::isLoggedIn()) {
echo 'ADMIN AREA';
static::getAdminPage();
} else {
echo 'LOGIN AREA';
static::getAuthPage();
}
Request::shutdown();
}
protected static function isLoggedIn() : bool
protected static function getAdminPage()
{
return false;
switch (Url::getUriSegment(1)) {
case 'pages':
static::getPagesManagerPage();
break;
case 'settings':
static::getSettingsPage();
break;
default:
static::getDashboardPage();
break;
}
}
protected static function getPagesManagerPage()
{
include 'views/pages.php';
}
protected static function getSettingsPage()
{
include 'views/settings.php';
}
protected static function getDashboardPage()
{
include 'views/dashboard.php';
}
protected static function getAuthPage()
{
include 'views/login.php';
}
public static function isLoggedIn() : bool
{
return static::$isLoggedIn;
}
/**

View File

@@ -0,0 +1 @@
Dashboard

View File

@@ -0,0 +1 @@
Login page

View File

@@ -0,0 +1 @@
Pages

View File

@@ -0,0 +1 @@
Settings