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:
Stephan Kasdorf
2018-02-04 22:16:21 +01:00
parent 16d86ad95e
commit 86433af5bf
39 changed files with 2292 additions and 232 deletions

View File

@@ -19,6 +19,8 @@ class JsonNavigation extends Config
private static $_instance;
private static $_file_content_string = NULL;
private static $_file_content_array = array();
private static $_name = false;
private static $_section_name = self::NAVIGATION;
public static function getInstance()
{
@@ -31,6 +33,38 @@ class JsonNavigation extends Config
return self::$_instance;
}
/**
* @return string
*/
protected static function getSectionName()
{
return self::$_section_name;
}
/**
* @param string $section_name
*/
private static function setSectionName( $section_name )
{
self::$_section_name = $section_name;
}
/**
* @return boolean
*/
protected static function getName()
{
return self::$_name;
}
/**
* @param boolean $name
*/
private static function setName( $name )
{
self::$_name = $name;
}
/**
* @return null
*/
@@ -44,7 +78,7 @@ class JsonNavigation extends Config
*/
private static function setFileContentString( )
{
self::$_file_content_string = file_get_contents( Settings::SETTINGS_PATH . parent::getInstance()->getConfig()["SETTINGS"]["navigation"] );
self::$_file_content_string = file_get_contents( Settings::SETTINGS_PATH . parent::getInstance()->getConfig()["SETTINGS"][self::getSectionName()] );
}
/**
@@ -60,7 +94,7 @@ class JsonNavigation extends Config
*/
private static function setFileContentArray( )
{
self::$_file_content_array = file( Settings::SETTINGS_PATH . parent::getInstance()->getConfig()["SETTINGS"]["navigation"] );
self::$_file_content_array = file( Settings::SETTINGS_PATH . parent::getInstance()->getConfig()["SETTINGS"][self::getSectionName()] );
}
/**
@@ -106,12 +140,22 @@ class JsonNavigation extends Config
* Loads the navigation from a json file into
* the view, making the variables available
*/
public function loadJsonNavigationArray( )
public function loadJsonNavigationArray( $name = false )
{
if( $name )
{
self::$_navigation_array = array();
self::setSectionName( $name );
self::setName( $name );
parent::getInstance();
self::setFileContentString();
self::setFileContentArray();
self::setNavigation();
}
$nav = self::getNavigation();
foreach ( $nav as $item => $value)
{
if($item == self::NAVIGATION)
if($item == self::getSectionName())
{
$keys = array_keys($value);
for($i=0; sizeof($keys)>$i;$i++)
@@ -137,6 +181,13 @@ class JsonNavigation extends Config
}
}
}
View::getInstance()->getEngine()->assignGlobal("navigationJson", self::$_navigation_array);
if( $name )
{
View::getInstance()->getEngine()->assignGlobal(self::getName(), self::$_navigation_array);
}
else
{
View::getInstance()->getEngine()->assignGlobal("navigationJson", self::$_navigation_array);
}
}
}