Improved: The Router now accepts actions, either trough the _action as parameter, or on the URL pattern after the controller name Example: http://youdomain/[controllername]/[actionname]/ It is now possible to load as many navigations on the page as wanted by passing the name to the JsonNavigation::getInstance()->loadJsonNavigationArray('[NAME]'); call in the navigationAction of the Controller Building forms by simple adding the namespace use Nibiru\Factory\Form; and calling Example: Form::addInputTypeText( array( 'name' => 'lastname', 'value' => 'placeholder' ) ); To finalize the form the last call should be something like this: Form::addForm( array('name' => 'testform', 'method' => 'post', 'action' => '/' . Router::getInstance()->currentPage(), 'target' => '_self') ); The Database design has fully been refactored, now it contains an autoloading mechanism which can be triggert by createing a database folder in the application folder, a Example file is in the folder applicatoin/database The Database access can now be implemented anywhere in your application by adding the namespace to your database accessing Logic: use Nibiru\Factory\Db;
51 lines
1.2 KiB
PHP
51 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: skasdorf
|
|
* Date: 18.07.17
|
|
* Time: 16:50
|
|
*/
|
|
|
|
namespace Nibiru;
|
|
|
|
|
|
final class Dispatcher
|
|
{
|
|
private static $_instance;
|
|
|
|
protected function __construct()
|
|
{
|
|
|
|
}
|
|
|
|
public static function getInstance()
|
|
{
|
|
$className = get_called_class();
|
|
if(self::$_instance==null) self::$_instance = new $className();
|
|
return self::$_instance;
|
|
}
|
|
|
|
public function run()
|
|
{
|
|
Router::getInstance();
|
|
Router::getInstance()->route();
|
|
require_once __DIR__ . '/../../application/controller/' . Router::getInstance()->tplName() . 'Controller.php';
|
|
$class = "Nibiru\\".\Nibiru\Router::getInstance()->tplName()."Controller";
|
|
$controller = new $class();
|
|
if(array_key_exists('_action', $_REQUEST))
|
|
{
|
|
$action = $_REQUEST['_action']."Action";
|
|
$controller->navigationAction();
|
|
$controller->$action();
|
|
$controller->pageAction();
|
|
}
|
|
else
|
|
{
|
|
$controller->navigationAction();
|
|
$controller->pageAction();
|
|
}
|
|
|
|
Debug::getInstance();
|
|
Display::getInstance()->display();
|
|
}
|
|
} |