Version 0.3 beta 04.02.2018
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;
This commit is contained in:
69
core/c/autoloader.php
Normal file
69
core/c/autoloader.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
namespace Nibiru\Autoloader;
|
||||
use Nibiru\Config;
|
||||
use Nibiru\View;
|
||||
|
||||
require_once __DIR__ . '/../i/db.php';
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: kasdorf
|
||||
* Date: 10.11.17
|
||||
* Time: 09:44
|
||||
*/
|
||||
class Autoloader
|
||||
{
|
||||
const MY_FILE_NAME = "autoloader.php";
|
||||
const DB_MODEL_FOLDER = "dbmodels";
|
||||
|
||||
private static $_filesInFoler = array();
|
||||
private static $_instance;
|
||||
|
||||
protected function __construct()
|
||||
{
|
||||
self::_setFilesInFoler();
|
||||
}
|
||||
|
||||
public static function getInstance()
|
||||
{
|
||||
$className = get_called_class();
|
||||
if(self::$_instance==null) self::$_instance = new $className();
|
||||
return self::$_instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @desc includes all database model files in preparation for the
|
||||
* database factory model
|
||||
*/
|
||||
public function runRequireOnce()
|
||||
{
|
||||
foreach (self::getFilesInFoler() as $file)
|
||||
{
|
||||
require_once $file;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
private static function getFilesInFoler()
|
||||
{
|
||||
return self::$_filesInFoler;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $filesInFoler
|
||||
*/
|
||||
private static function _setFilesInFoler( )
|
||||
{
|
||||
$iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(__DIR__ . Config::getInstance()->getConfig()[View::NIBIRU_SETTINGS][self::DB_MODEL_FOLDER] ));
|
||||
foreach ($iterator as $item)
|
||||
{
|
||||
if($item->getFileName()!= self::MY_FILE_NAME && $item->getFileName()!="." && $item->getFileName()!="..")
|
||||
{
|
||||
self::$_filesInFoler[] = $item->getPathName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user