Made some miscellaneous changes to the panel and admin classes
This commit is contained in:
parent
f19255f6f3
commit
edf1ce2fa3
|
@ -32,10 +32,25 @@ namespace Module\Admin;
|
|||
|
||||
class AdminRouter implements PageRouterInterface {
|
||||
|
||||
public function route($pagePath) {
|
||||
private $pageObject;
|
||||
|
||||
public function route() {
|
||||
//echo $pagePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Import the page object from the Admin Module
|
||||
* @param Page $pageObject Page object
|
||||
* @return void
|
||||
*/
|
||||
public function importPage($pageObject) {
|
||||
$this->pageObject = $pageObject;
|
||||
}
|
||||
|
||||
public function getPage() {
|
||||
return $this->pageObject;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -54,13 +54,14 @@ class LayoutManager {
|
|||
PageLoader::setPageList(self::$pageList);
|
||||
|
||||
// Get the page we are trying to load
|
||||
$pageHTML = PageLoader::getPage(self::$matches);
|
||||
PageLoader::loadPage(self::$matches);
|
||||
$html = PageLoader::getHtml();
|
||||
$activePage = PageLoader::getActivePage();
|
||||
|
||||
// And add the pageList
|
||||
Layout::assign('pageList', self::$pageList);
|
||||
Layout::assign('activePage', $activePage);
|
||||
Layout::assign('pageHTML', $pageHTML);
|
||||
Layout::assign('pageHTML', $html);
|
||||
|
||||
// And add more basic variables
|
||||
foreach (self::getVariables() as $key => $value) {
|
||||
|
|
|
@ -31,8 +31,132 @@
|
|||
namespace Module\Admin;
|
||||
|
||||
class Page {
|
||||
public $pagePath;
|
||||
public $data = array();
|
||||
|
||||
private $pagePath;
|
||||
private $subPath = array();
|
||||
private $html;
|
||||
private $title;
|
||||
private $breadcrumbs = array();
|
||||
|
||||
/**
|
||||
* Gets the value of pagePath.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getPagePath()
|
||||
{
|
||||
return $this->pagePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of pagePath.
|
||||
*
|
||||
* @param mixed $pagePath the page path
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setPagePath($pagePath)
|
||||
{
|
||||
$this->pagePath = $pagePath;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of subPath.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getSubPath()
|
||||
{
|
||||
return $this->subPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of subPath.
|
||||
*
|
||||
* @param mixed $subPath the sub path
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setSubPath($subPath)
|
||||
{
|
||||
$this->subPath = $subPath;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of html.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getHtml()
|
||||
{
|
||||
return $this->html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of html.
|
||||
*
|
||||
* @param mixed $html the html
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setHtml($html)
|
||||
{
|
||||
$this->html = $html;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of title.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of title.
|
||||
*
|
||||
* @param mixed $title the title
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of breadcrumbs.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getBreadcrumbs()
|
||||
{
|
||||
return $this->breadcrumbs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of breadcrumbs.
|
||||
*
|
||||
* @param mixed $breadcrumbs the breadcrumbs
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setBreadcrumbs($breadcrumbs)
|
||||
{
|
||||
$this->breadcrumbs = $breadcrumbs;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -37,6 +37,9 @@ class PageLoader {
|
|||
|
||||
private static $pageList;
|
||||
private static $activePage;
|
||||
private static $html;
|
||||
private static $breadcrumbs = array();
|
||||
private static $title;
|
||||
|
||||
/**
|
||||
* Set the pageList
|
||||
|
@ -46,13 +49,13 @@ class PageLoader {
|
|||
self::$pageList = $pageList;
|
||||
}
|
||||
|
||||
public static function getPage($matches) {
|
||||
public static function loadPage($matches) {
|
||||
// First check if any data is given at all
|
||||
Logger::newLevel("Retrieving page from module");
|
||||
if (!isset($matches['identifier']) && !isset($matches['page'])) {
|
||||
// If nothing is provided, load the dashboard
|
||||
Logger::log("No input retrieved. Loading dashboard");
|
||||
$html = self::dashboard();
|
||||
return self::dashboard();
|
||||
} elseif (!isset($matches['identifier']) || !isset($matches['page'])) {
|
||||
// If incomplete data is provided, load a 404
|
||||
Logger::log("Invalid input retrieved. Loading 404 not found page");
|
||||
|
@ -81,8 +84,22 @@ class PageLoader {
|
|||
|
||||
// Route the request into the module
|
||||
Logger::log("Input valid and module loaded. Attempting to route request");
|
||||
$htmlPage = new Page();
|
||||
$router->route($matches['page']);
|
||||
|
||||
// Generating page object
|
||||
$pageObject = new Page();
|
||||
$pageObject->setPagePath($matches['page']);
|
||||
$pageObject->setSubPath( (isset($matches['subdata']) ? $matches['subdata'] : null) );
|
||||
|
||||
// And send it
|
||||
$router->importPage($pageObject);
|
||||
$router->route();
|
||||
|
||||
// And retrieve it
|
||||
$pageObject = $router->getPage();
|
||||
|
||||
// And retrieve some data
|
||||
self::$html = $pageObject->getHtml();
|
||||
// $html = $pageObject->getHtml();
|
||||
|
||||
Logger::stopLevel();
|
||||
return '';
|
||||
|
@ -101,6 +118,10 @@ class PageLoader {
|
|||
|
||||
}
|
||||
|
||||
public static function getHtml() {
|
||||
return self::$html;
|
||||
}
|
||||
|
||||
public static function getActivePage() {
|
||||
return 'fuzeadmin/testPage';
|
||||
}
|
||||
|
|
|
@ -32,6 +32,9 @@ namespace Module\Admin;
|
|||
|
||||
interface PageRouterInterface {
|
||||
|
||||
public function importPage($pageObject);
|
||||
public function getPage();
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -7,18 +7,18 @@
|
|||
<!-- Tell the browser to be responsive to screen width -->
|
||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
|
||||
<!-- Bootstrap 3.3.5 -->
|
||||
<link rel="stylesheet" href="<?php echo($vars['viewDir']); ?>bootstrap/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="<?php echo($vars['viewDir']); ?>/assets/bootstrap/css/bootstrap.min.css">
|
||||
<!-- Font Awesome -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
|
||||
<!-- Ionicons -->
|
||||
<link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
|
||||
<!-- Theme style -->
|
||||
<link rel="stylesheet" href="<?php echo($vars['viewDir']); ?>dist/css/AdminLTE.min.css">
|
||||
<link rel="stylesheet" href="<?php echo($vars['viewDir']); ?>/assets/dist/css/AdminLTE.min.css">
|
||||
<!-- AdminLTE Skins. We have chosen the skin-blue for this starter
|
||||
page. However, you can choose any other skin. Make sure you
|
||||
apply the skin class to the body tag so the changes take effect.
|
||||
-->
|
||||
<link rel="stylesheet" href="<?php echo($vars['viewDir']); ?>dist/css/skins/skin-blue.min.css">
|
||||
<link rel="stylesheet" href="<?php echo($vars['viewDir']); ?>/assets/dist/css/skins/skin-blue.min.css">
|
||||
|
||||
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||||
|
@ -236,14 +236,14 @@
|
|||
<!-- REQUIRED JS SCRIPTS -->
|
||||
|
||||
<!-- jQuery 2.1.4 -->
|
||||
<script src="<?php echo($vars['viewDir']); ?>plugins/jQuery/jQuery-2.1.4.min.js"></script>
|
||||
<script src="<?php echo($vars['viewDir']); ?>/assets/plugins/jQuery/jQuery-2.1.4.min.js"></script>
|
||||
<!-- Bootstrap 3.3.5 -->
|
||||
<script src="<?php echo($vars['viewDir']); ?>bootstrap/js/bootstrap.min.js"></script>
|
||||
<script src="<?php echo($vars['viewDir']); ?>/assets/bootstrap/js/bootstrap.min.js"></script>
|
||||
<!-- AdminLTE App -->
|
||||
<script src="<?php echo($vars['viewDir']); ?>dist/js/app.min.js"></script>
|
||||
<script src="<?php echo($vars['viewDir']); ?>/assets/dist/js/app.min.js"></script>
|
||||
|
||||
<!-- SlimScroll -->
|
||||
<script src="<?php echo($vars['viewDir']); ?>plugins/slimScroll/jquery.slimscroll.min.js"></script>
|
||||
<script src="<?php echo($vars['viewDir']); ?>/assets/plugins/slimScroll/jquery.slimscroll.min.js"></script>
|
||||
|
||||
<!-- Optionally, you can add Slimscroll and FastClick plugins.
|
||||
Both of these plugins are recommended to enhance the
|
||||
|
|
Loading…
Reference in New Issue