Implemented some basics of the admin module. Development underway

This commit is contained in:
Abel Hoogeveen 2016-01-23 14:09:23 +01:00
parent 84b3154ea2
commit f19255f6f3
18 changed files with 1273 additions and 1 deletions

5
.gitignore vendored
View File

@ -17,4 +17,7 @@ Core/Logs/Error.log
# Build Files
vendor/
build/
build/
Modules/admin/themes/adminlte2.1/plugins/
Modules/admin/themes/adminlte2.1/dist/
Modules/admin/themes/adminlte2.1/bootstrap/

View File

@ -0,0 +1,96 @@
<?php
/**
* FuzeWorks
*
* The FuzeWorks MVC PHP FrameWork
*
* Copyright (C) 2015 TechFuze
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author TechFuze
* @copyright Copyright (c) 2013 - 2015, Techfuze. (http://techfuze.net)
* @copyright Copyright (c) 1996 - 2015, Free Software Foundation, Inc. (http://www.fsf.org/)
* @license http://opensource.org/licenses/GPL-3.0 GPLv3 License
* @link http://fuzeworks.techfuze.net
* @since Version 0.0.1
* @version Version 0.0.1
*/
namespace Module\Admin;
use \FuzeWorks\Module;
/**
* Admin Module
*
* Admin panel module controller
* @package net.techfuze.fuzeworks.admin
* @author Abel Hoogeveen <abel@techfuze.net>
* @copyright Copyright (c) 2013 - 2016, Techfuze. (http://techfuze.net)
*/
class Main {
use Module;
/**
* Loads the module and registers the events
*
* @access public
*/
public function onLoad() {
require_once(self::getModulePath() . "/classes/class.layout_manager.php");
require_once(self::getModulePath() . "/classes/class.admin_exception.php");
require_once(self::getModulePath() . "/classes/class.theme_manager.php");
require_once(self::getModulePath() . "/classes/class.advertise_fetcher.php");
require_once(self::getModulePath() . "/classes/class.page_loader.php");
require_once(self::getModulePath() . "/classes/class.page_data.php");
require_once(self::getModulePath() . "/classes/class.page.php");
require_once(self::getModulePath() . "/classes/class.page_list.php");
require_once(self::getModulePath() . "/classes/class.page_router_interface.php");
require_once(self::getModulePath() . "/classes/class.page_interface.php");
require_once(self::getModulePath() . "/classes/class.admin_router.php");
}
/**
* Gets called when the path matches the regex of this module.
* @access public
* @param array Regex matches
* @return void
*/
public function route($matches = array()) {
// First create a pageList based on the advertisements
$advertisements = self::getAdvertisements('admin');
if (!is_array($advertisements))
throw new AdminException("Could not load advertised modules. Malformed object retrieved", 1);
$pageList = AdvertiseFetcher::getPageList($advertisements);
// After that, load the authenticator and check if user is logged in
// @TODO IMPLEMENT
// After that, load the theme that is set
LayoutManager::setPageList($pageList);
LayoutManager::setMatches($matches);
$html = LayoutManager::loadPanel();
// And print it
echo $html;
}
public function getAdminRouter() {
return new AdminRouter();
}
}
?>

View File

@ -0,0 +1,41 @@
<?php
/**
* FuzeWorks
*
* The FuzeWorks MVC PHP FrameWork
*
* Copyright (C) 2015 TechFuze
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author TechFuze
* @copyright Copyright (c) 2013 - 2015, Techfuze. (http://techfuze.net)
* @copyright Copyright (c) 1996 - 2015, Free Software Foundation, Inc. (http://www.fsf.org/)
* @license http://opensource.org/licenses/GPL-3.0 GPLv3 License
* @link http://fuzeworks.techfuze.net
* @since Version 0.0.1
* @version Version 0.0.1
*/
namespace Module\Admin;
/**
* Class Exception
* @package net.techfuze.fuzeworks.admin
* @author Abel Hoogeveen <abel@techfuze.net>
* @copyright Copyright (c) 2013 - 2015, Techfuze. (http://techfuze.net)
*/
class AdminException extends \Exception{}
?>

View File

@ -0,0 +1,41 @@
<?php
/**
* FuzeWorks
*
* The FuzeWorks MVC PHP FrameWork
*
* Copyright (C) 2015 TechFuze
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author TechFuze
* @copyright Copyright (c) 2013 - 2015, Techfuze. (http://techfuze.net)
* @copyright Copyright (c) 1996 - 2015, Free Software Foundation, Inc. (http://www.fsf.org/)
* @license http://opensource.org/licenses/GPL-3.0 GPLv3 License
* @link http://fuzeworks.techfuze.net
* @since Version 0.0.1
* @version Version 0.0.1
*/
namespace Module\Admin;
class AdminRouter implements PageRouterInterface {
public function route($pagePath) {
//echo $pagePath;
}
}
?>

View File

@ -0,0 +1,97 @@
<?php
/**
* FuzeWorks
*
* The FuzeWorks MVC PHP FrameWork
*
* Copyright (C) 2015 TechFuze
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author TechFuze
* @copyright Copyright (c) 2013 - 2015, Techfuze. (http://techfuze.net)
* @copyright Copyright (c) 1996 - 2015, Free Software Foundation, Inc. (http://www.fsf.org/)
* @license http://opensource.org/licenses/GPL-3.0 GPLv3 License
* @link http://fuzeworks.techfuze.net
* @since Version 0.0.1
* @version Version 0.0.1
*/
namespace Module\Admin;
use \FuzeWorks\Logger;
class AdvertiseFetcher {
/**
* Create a pageList using the advertisements from the admin module
* @param array $advertisements The advertisement repository
* @throws AdminException On fatal and/or missing data
* @return PageList An object oriented page list with details
* @todo Implement Unit Test
*/
public static function getPageList($advertisements) {
// Prepare a pageList
Logger::newLevel('Generating PageList');
$pageList = new PageList();
// First get the modules
foreach ($advertisements as $module => $data) {
// Apple regular data
$identifier = (isset($data['identifier']) ? $data['identifier'] : null);
$pages = (isset($data['pages']) ? $data['pages'] : null);
// Check if everything is set, if not shout out in terror
if (is_null($identifier) || is_null($pages))
throw new AdminException("Incomplete data for module '".$module."'", 1);
// And then the pages
foreach ($pages as $pageData) {
// Create page variable and add module and identifier
$page = new PageData();
$page->setModule($module);
$page->setIdentifier($identifier);
// First the required data for every page
$page_path = (isset($pageData['page_path']) ? $pageData['page_path'] : null);
$name = (isset($pageData['name']) ? $pageData['name'] : null);
// And throw errors if non-existent
if (is_null($page_path) || is_null($name))
throw new AdminException("Incomplete data for module '".$module."'", 1);
// And set those values
$page->setPagePath($page_path);
$page->setName($name);
$unique_identifier = $identifier . "/" . $page_path;
Logger::log("Adding page '".$name."' on '".$unique_identifier."'");
// And at last for the optional values
$page->setIcon( (isset($pageData['icon']) ? $pageData['icon'] : '') );
$page->setPermissionGroups( (isset($pageData['permissionGroups']) ? $pageData['permissionGroups'] : array()) );
$page->setPriority( (isset($pageData['priority']) ? $pageData['priority'] : 1) );
// And finally add the page
$pageList->addPage($page, $unique_identifier);
}
}
// And finally return the pageList\
Logger::stopLevel();
return $pageList;
}
}
?>

View File

@ -0,0 +1,110 @@
<?php
/**
* FuzeWorks
*
* The FuzeWorks MVC PHP FrameWork
*
* Copyright (C) 2015 TechFuze
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author TechFuze
* @copyright Copyright (c) 2013 - 2015, Techfuze. (http://techfuze.net)
* @copyright Copyright (c) 1996 - 2015, Free Software Foundation, Inc. (http://www.fsf.org/)
* @license http://opensource.org/licenses/GPL-3.0 GPLv3 License
* @link http://fuzeworks.techfuze.net
* @since Version 0.0.1
* @version Version 0.0.1
*/
namespace Module\Admin;
use \FuzeWorks\Layout;
use \FuzeWorks\Config;
class LayoutManager {
private static $pageList;
private static $matches;
/**
* Load the panel of this admin interface
* @throws AdminException
* @return string HTML
*/
public static function loadPanel() {
// First check if the pageList is set and valid
if (is_null(self::$pageList))
throw new AdminException("Can not load panel. PageList is not set", 1);
// Load the theme
ThemeManager::loadTheme();
// Set the PageLoader variables
PageLoader::setPageList(self::$pageList);
// Get the page we are trying to load
$pageHTML = PageLoader::getPage(self::$matches);
$activePage = PageLoader::getActivePage();
// And add the pageList
Layout::assign('pageList', self::$pageList);
Layout::assign('activePage', $activePage);
Layout::assign('pageHTML', $pageHTML);
// And add more basic variables
foreach (self::getVariables() as $key => $value) {
Layout::assign($key, $value);
}
// And load the file
return Layout::get('panel');
}
public static function loadPanelAPI() {
}
public static function loadLogin() {
}
public static function loadLoginAPI() {
}
/**
* Set the pageList
* @param PageList $pageList PageList
*/
public static function setPageList($pageList) {
self::$pageList = $pageList;
}
public static function setMatches($matches) {
self::$matches = $matches;
}
/**
* Get all the basic variables required for every template
* @return array with settings
*/
private static function getVariables() {
$vars = array();
$vars['adminURL'] = Config::get('main')->SITE_URL . "admin/";
return $vars;
}
}
?>

View File

@ -0,0 +1,38 @@
<?php
/**
* FuzeWorks
*
* The FuzeWorks MVC PHP FrameWork
*
* Copyright (C) 2015 TechFuze
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author TechFuze
* @copyright Copyright (c) 2013 - 2015, Techfuze. (http://techfuze.net)
* @copyright Copyright (c) 1996 - 2015, Free Software Foundation, Inc. (http://www.fsf.org/)
* @license http://opensource.org/licenses/GPL-3.0 GPLv3 License
* @link http://fuzeworks.techfuze.net
* @since Version 0.0.1
* @version Version 0.0.1
*/
namespace Module\Admin;
class Page {
public $pagePath;
public $data = array();
}
?>

View File

@ -0,0 +1,212 @@
<?php
/**
* FuzeWorks
*
* The FuzeWorks MVC PHP FrameWork
*
* Copyright (C) 2015 TechFuze
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author TechFuze
* @copyright Copyright (c) 2013 - 2015, Techfuze. (http://techfuze.net)
* @copyright Copyright (c) 1996 - 2015, Free Software Foundation, Inc. (http://www.fsf.org/)
* @license http://opensource.org/licenses/GPL-3.0 GPLv3 License
* @link http://fuzeworks.techfuze.net
* @since Version 0.0.1
* @version Version 0.0.1
*/
namespace Module\Admin;
class PageData {
public $module;
public $identifier;
public $page_path;
public $icon;
public $permissionGroups = array();
public $name;
public $priority;
/**
* Gets the value of module.
*
* @return mixed
*/
public function getModule()
{
return $this->module;
}
/**
* Sets the value of module.
*
* @param mixed $module the module
*
* @return self
*/
public function setModule($module)
{
$this->module = $module;
return $this;
}
/**
* Gets the value of identifier.
*
* @return mixed
*/
public function getIdentifier()
{
return $this->identifier;
}
/**
* Sets the value of identifier.
*
* @param mixed $identifier the identifier
*
* @return self
*/
public function setIdentifier($identifier)
{
$this->identifier = $identifier;
return $this;
}
/**
* Gets the value of page_path.
*
* @return mixed
*/
public function getPagePath()
{
return $this->page_path;
}
/**
* Sets the value of page_path.
*
* @param mixed $page_path the page path
*
* @return self
*/
public function setPagePath($page_path)
{
$this->page_path = $page_path;
return $this;
}
/**
* Gets the value of icon.
*
* @return mixed
*/
public function getIcon()
{
return $this->icon;
}
/**
* Sets the value of icon.
*
* @param mixed $icon the icon
*
* @return self
*/
public function setIcon($icon)
{
$this->icon = $icon;
return $this;
}
/**
* Gets the value of permissionGroups.
*
* @return mixed
*/
public function getPermissionGroups()
{
return $this->permissionGroups;
}
/**
* Sets the value of permissionGroups.
*
* @param mixed $permissionGroups the permission groups
*
* @return self
*/
public function setPermissionGroups($permissionGroups)
{
$this->permissionGroups = $permissionGroups;
return $this;
}
/**
* Gets the value of name.
*
* @return mixed
*/
public function getName()
{
return $this->name;
}
/**
* Sets the value of name.
*
* @param mixed $name the name
*
* @return self
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Gets the value of priority.
*
* @return mixed
*/
public function getPriority()
{
return $this->priority;
}
/**
* Sets the value of priority.
*
* @param mixed $priority the priority
*
* @return self
*/
public function setPriority($priority)
{
$this->priority = $priority;
return $this;
}
}
?>

View File

@ -0,0 +1,67 @@
<?php
/**
* FuzeWorks
*
* The FuzeWorks MVC PHP FrameWork
*
* Copyright (C) 2015 TechFuze
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author TechFuze
* @copyright Copyright (c) 2013 - 2015, Techfuze. (http://techfuze.net)
* @copyright Copyright (c) 1996 - 2015, Free Software Foundation, Inc. (http://www.fsf.org/)
* @license http://opensource.org/licenses/GPL-3.0 GPLv3 License
* @link http://fuzeworks.techfuze.net
* @since Version 0.0.1
* @version Version 0.0.1
*/
namespace Module\Admin;
class PageList {
public $pages = array();
/**
* Gets the value of pages.
*
* @return mixed
*/
public function getPages()
{
return $this->pages;
}
/**
* Retrieve a page
* @param string $unique_identifier Unique name for the page
* @return PageData PageData Object
*/
public function getPage($unique_identifier) {
return $this->pages[$unique_identifier];
}
/**
* Add a page to the array
* @param PageData $page PageData Object
*
* @return void
*/
public function addPage($page, $unique_identifier) {
$this->pages[$unique_identifier] = $page;
}
}
?>

View File

@ -0,0 +1,123 @@
<?php
/**
* FuzeWorks
*
* The FuzeWorks MVC PHP FrameWork
*
* Copyright (C) 2015 TechFuze
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author TechFuze
* @copyright Copyright (c) 2013 - 2015, Techfuze. (http://techfuze.net)
* @copyright Copyright (c) 1996 - 2015, Free Software Foundation, Inc. (http://www.fsf.org/)
* @license http://opensource.org/licenses/GPL-3.0 GPLv3 License
* @link http://fuzeworks.techfuze.net
* @since Version 0.0.1
* @version Version 0.0.1
*/
namespace Module\Admin;
use \FuzeWorks\Logger;
use \FuzeWorks\Layout;
use \FuzeWorks\Modules;
class PageLoader {
private static $pageList;
private static $activePage;
/**
* Set the pageList
* @param PageList $pageList PageList
*/
public static function setPageList($pageList) {
self::$pageList = $pageList;
}
public static function getPage($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();
} 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");
return self::error404();
}
// If enough data is provided, try and load a page
Logger::log("Input received. Attempting to find page");
$unique_identifier = $matches['identifier'] . '/' . $matches['page'];
if (isset(self::$pageList->pages[$unique_identifier])) {
// Page found, start loading process
$page = self::$pageList->getPage($unique_identifier);
// Load the designated module
$module = Modules::get($page->getModule());
// Check if it implements the PageRouterInterface
if (method_exists($module, 'getAdminRouter')) {
$router = $module->getAdminRouter();
// Then check if the router is valid, if not, return 500
if (!$router instanceof PageRouterInterface) {
Logger::logError("Could not load '".$unique_identifier."' on module '".$page->getModule()."'. ".get_class($router)." does not implement \Module\Admin\PageRouterInterface");
return self::error500();
}
// Route the request into the module
Logger::log("Input valid and module loaded. Attempting to route request");
$htmlPage = new Page();
$router->route($matches['page']);
Logger::stopLevel();
return '';
} else {
// Error, router does not exist
Logger::logError("Could not load '".$unique_identifier."' on module '".$page->getModule()."'. ".get_class($module)." does not implement method getAdminRouter()");
Logger::stopLevel();
return self::error500();
}
}
Logger::log("Matching page was not found. Loading 404 not found page");
Logger::stopLevel();
return self::error404();
}
public static function getActivePage() {
return 'fuzeadmin/testPage';
}
public static function dashboard() {
}
public static function error404() {
Logger::http_error(404, false);
return Layout::get('404');
}
public static function error500() {
Logger::http_error(500, false);
return Layout::get('500');
}
}
?>

View File

@ -0,0 +1,37 @@
<?php
/**
* FuzeWorks
*
* The FuzeWorks MVC PHP FrameWork
*
* Copyright (C) 2015 TechFuze
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author TechFuze
* @copyright Copyright (c) 2013 - 2015, Techfuze. (http://techfuze.net)
* @copyright Copyright (c) 1996 - 2015, Free Software Foundation, Inc. (http://www.fsf.org/)
* @license http://opensource.org/licenses/GPL-3.0 GPLv3 License
* @link http://fuzeworks.techfuze.net
* @since Version 0.0.1
* @version Version 0.0.1
*/
namespace Module\Admin;
interface PageRouterInterface {
}
?>

View File

@ -0,0 +1,54 @@
<?php
/**
* FuzeWorks
*
* The FuzeWorks MVC PHP FrameWork
*
* Copyright (C) 2015 TechFuze
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author TechFuze
* @copyright Copyright (c) 2013 - 2015, Techfuze. (http://techfuze.net)
* @copyright Copyright (c) 1996 - 2015, Free Software Foundation, Inc. (http://www.fsf.org/)
* @license http://opensource.org/licenses/GPL-3.0 GPLv3 License
* @link http://fuzeworks.techfuze.net
* @since Version 0.0.1
* @version Version 0.0.1
*/
namespace Module\Admin;
use \FuzeWorks\Layout;
use \FuzeWorks\Logger;
class ThemeManager {
private static $themeDir = 'views/adminlte2.1/';
public static function loadTheme($theme = null) {
self::$themeDir = Main::getModulePath() . 'themes/adminlte2.1/';
Layout::setDirectory(self::$themeDir);
}
public static function getDirectory() {
// First check if the theme is actually loaded
if (empty(self::$themeDir))
throw new AdminException("Could not load panel. Theme not loaded", 1);
// And then return the theme Directory
return self::$themeDir;
}
}
?>

View File

@ -0,0 +1,51 @@
<?php
/**
* FuzeWorks
*
* The FuzeWorks MVC PHP FrameWork
*
* Copyright (C) 2015 TechFuze
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author TechFuze
* @copyright Copyright (c) 2013 - 2015, Techfuze. (http://techfuze.net)
* @copyright Copyright (c) 1996 - 2015, Free Software Foundation, Inc. (http://www.fsf.org/)
* @license http://opensource.org/licenses/GPL-3.0 GPLv3 License
* @link http://fuzeworks.techfuze.net
* @since Version 0.0.1
* @version Version 0.0.1
*/
return array(
'module_class' => 'Module\Admin\Main',
'module_file' => 'class.main.php',
'module_name' => 'Admin',
'abstract' => false,
'aliases' => array(),
'dependencies' => array(),
'events' => array(),
'routes' => array('/^admin(|\/(?P<identifier>.*?)(|\/(?<page>.*?)(|\/(?P<subdata>.*?))))$/'),
'advertise' => array('admin' => array( 'identifier' => 'fuzeadmin', 'pages' => array( array( 'name' => 'TEST', 'page_path' => 'testPage', 'icon' => 'fa-plane')) )),
'listenFor' => array('admin'),
'name' => 'FuzeWorks Admin Panel',
'description' => 'Control Panel for FuzeWorks Modules and FrameWork',
'author' => 'core',
'version' => '1.0.0',
'website' => 'http://fuzeworks.techfuze.net/',
'date_created' => '13-01-2016',
'date_updated' => '17-01-2016',
'enabled' => true
);

View File

@ -0,0 +1,18 @@
<div class="error-page">
<h2 class="headline text-yellow"> 404</h2>
<div class="error-content">
<h3><i class="fa fa-warning text-yellow"></i> Oops! Page not found.</h3>
<p>
We could not find the page you were looking for.
Meanwhile, you may <a href="../../index.html">return to dashboard</a> or try using the search form.
</p>
<form class="search-form">
<div class="input-group">
<input type="text" name="search" class="form-control" placeholder="Search">
<div class="input-group-btn">
<button type="submit" name="submit" class="btn btn-warning btn-flat"><i class="fa fa-search"></i></button>
</div>
</div><!-- /.input-group -->
</form>
</div><!-- /.error-content -->
</div><!-- /.error-page -->

View File

@ -0,0 +1,18 @@
<div class="error-page">
<h2 class="headline text-red">500</h2>
<div class="error-content">
<h3><i class="fa fa-warning text-red"></i> Oops! Something went wrong.</h3>
<p>
We will work on fixing that right away.
Meanwhile, you may <a href="../../index.html">return to dashboard</a> or try using the search form.
</p>
<form class="search-form">
<div class="input-group">
<input type="text" name="search" class="form-control" placeholder="Search">
<div class="input-group-btn">
<button type="submit" name="submit" class="btn btn-danger btn-flat"><i class="fa fa-search"></i></button>
</div>
</div><!-- /.input-group -->
</form>
</div>
</div><!-- /.error-page -->

View File

@ -0,0 +1,253 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>FuzeDev | @todo: Implement</title>
<!-- 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">
<!-- 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">
<!-- 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">
<!-- 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:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<!-- Main Header -->
<header class="main-header">
<!-- Logo -->
<a href="index2.html" class="logo">
<!-- mini logo for sidebar mini 50x50 pixels -->
<span class="logo-mini"><b>F</b>Dev</span>
<!-- logo for regular state and mobile devices -->
<span class="logo-lg"><b>Fuze</b>Dev</span>
</a>
<!-- Header Navbar -->
<nav class="navbar navbar-static-top" role="navigation">
<!-- Sidebar toggle button-->
<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
<span class="sr-only">Toggle navigation</span>
</a>
<!-- Navbar Right Menu -->
<div class="navbar-custom-menu">
<ul class="nav navbar-nav">
<!-- User Account Menu -->
<li class="dropdown user user-menu">
<!-- Menu Toggle Button -->
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<!-- The user image in the navbar-->
<img src="" class="user-image" alt="User Image">
<!-- hidden-xs hides the username on small devices so only the image appears. -->
<span class="hidden-xs">USERNAME</span>
</a>
<ul class="dropdown-menu">
<!-- The user image in the menu -->
<li class="user-header">
<img src="" class="img-circle" alt="User Image">
<p>
USERNAME - RANK
<small>Member since MEMBER_TIME</small>
</p>
</li>
<!-- Menu Body -->
<li class="user-body">
<div class="col-xs-4 text-center">
<a href="#">Followers</a>
</div>
<div class="col-xs-4 text-center">
<a href="#">Sales</a>
</div>
<div class="col-xs-4 text-center">
<a href="#">Friends</a>
</div>
</li>
<!-- Menu Footer-->
<li class="user-footer">
<div class="pull-left">
<a href="#" class="btn btn-default btn-flat">Profile</a>
</div>
<div class="pull-right">
<a href="#" class="btn btn-default btn-flat">Sign out</a>
</div>
</li>
</ul>
</li>
<!-- Control Sidebar Toggle Button -->
<li>
<a href="#" data-toggle="control-sidebar"><i class="fa fa-gears"></i></a>
</li>
</ul>
</div>
</nav>
</header>
<!-- Left side column. contains the logo and sidebar -->
<aside class="main-sidebar">
<!-- sidebar: style can be found in sidebar.less -->
<section class="sidebar">
<!-- Sidebar user panel (optional) -->
<div class="user-panel">
<div class="pull-left image">
<img src="" class="img-circle" alt="User Image">
</div>
<div class="pull-left info">
<p>USERNAME</p>
<!-- Status -->
<a href="#"><i class="fa fa-circle text-success"></i> Online</a>
</div>
</div>
<!-- search form (Optional) -->
<form action="#" method="get" class="sidebar-form">
<div class="input-group">
<input type="text" name="q" class="form-control" placeholder="Search...">
<span class="input-group-btn">
<button type="submit" name="search" id="search-btn" class="btn btn-flat"><i class="fa fa-search"></i></button>
</span>
</div>
</form>
<!-- /.search form -->
<!-- Sidebar Menu -->
<ul class="sidebar-menu">
<li class="header">Navigate</li>
<?php include('view.sidebar.php'); ?>
</ul><!-- /.sidebar-menu -->
</section>
<!-- /.sidebar -->
</aside>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
Page Header
<small>Optional description</small>
</h1>
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-dashboard"></i> Level</a></li>
<li class="active">Here</li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<?php echo($vars['pageHTML']); ?>
<!-- Your Page Content Here -->
</section><!-- /.content -->
</div><!-- /.content-wrapper -->
<!-- Main Footer -->
<footer class="main-footer">
<!-- To the right -->
<div class="pull-right hidden-xs">
<b>Version</b> 0.0.1
</div>
<!-- Default to the left -->
<strong>Copyright &copy; 2016 <a href="#">FuzeDev</a>.</strong> All rights reserved.
</footer>
<!-- Control Sidebar -->
<aside class="control-sidebar control-sidebar-dark">
<!-- Create the tabs -->
<ul class="nav nav-tabs nav-justified control-sidebar-tabs">
<li class="active"><a href="#control-sidebar-home-tab" data-toggle="tab"><i class="fa fa-home"></i></a></li>
<li><a href="#control-sidebar-settings-tab" data-toggle="tab"><i class="fa fa-gears"></i></a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<!-- Home tab content -->
<div class="tab-pane active" id="control-sidebar-home-tab">
<h3 class="control-sidebar-heading">Recent Activity</h3>
<ul class="control-sidebar-menu">
<li>
<a href="javascript::;">
<i class="menu-icon fa fa-birthday-cake bg-red"></i>
<div class="menu-info">
<h4 class="control-sidebar-subheading">Langdon's Birthday</h4>
<p>Will be 23 on April 24th</p>
</div>
</a>
</li>
</ul><!-- /.control-sidebar-menu -->
<h3 class="control-sidebar-heading">Tasks Progress</h3>
<ul class="control-sidebar-menu">
<li>
<a href="javascript::;">
<h4 class="control-sidebar-subheading">
Custom Template Design
<span class="label label-danger pull-right">70%</span>
</h4>
<div class="progress progress-xxs">
<div class="progress-bar progress-bar-danger" style="width: 70%"></div>
</div>
</a>
</li>
</ul><!-- /.control-sidebar-menu -->
</div><!-- /.tab-pane -->
<!-- Stats tab content -->
<div class="tab-pane" id="control-sidebar-stats-tab">Stats Tab Content</div><!-- /.tab-pane -->
<!-- Settings tab content -->
<div class="tab-pane" id="control-sidebar-settings-tab">
<form method="post">
<h3 class="control-sidebar-heading">General Settings</h3>
<div class="form-group">
<label class="control-sidebar-subheading">
Report panel usage
<input type="checkbox" class="pull-right" checked>
</label>
<p>
Some information about this general settings option
</p>
</div><!-- /.form-group -->
</form>
</div><!-- /.tab-pane -->
</div>
</aside><!-- /.control-sidebar -->
<!-- Add the sidebar's background. This div must be placed
immediately after the control sidebar -->
<div class="control-sidebar-bg"></div>
</div><!-- ./wrapper -->
<!-- REQUIRED JS SCRIPTS -->
<!-- jQuery 2.1.4 -->
<script src="<?php echo($vars['viewDir']); ?>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>
<!-- AdminLTE App -->
<script src="<?php echo($vars['viewDir']); ?>dist/js/app.min.js"></script>
<!-- SlimScroll -->
<script src="<?php echo($vars['viewDir']); ?>plugins/slimScroll/jquery.slimscroll.min.js"></script>
<!-- Optionally, you can add Slimscroll and FastClick plugins.
Both of these plugins are recommended to enhance the
user experience. Slimscroll is required when using the
fixed layout. -->
</body>
</html>

View File

@ -0,0 +1,13 @@
<?php
// First retrieve the pageList
$pageList = $vars['pageList'];
// The cycle through all and print the sidebar links
foreach ($pageList->getPages() as $page) {
echo("<li name='sidebar:".$page->getIdentifier()."/".$page->getPagePath()."'><a href='".$vars['adminURL']. $page->getIdentifier()."/".$page->getPagePath()."'>
<i class='".($page->getIcon() == '' ? '' : 'fa ' . $page->getIcon())."'></i> <span>".$page->getName()."</span></a></li>");
}
?>