diff --git a/application/controller/controllerController.php b/application/controller/controllerController.php new file mode 100644 index 0000000..5fe43e9 --- /dev/null +++ b/application/controller/controllerController.php @@ -0,0 +1,23 @@ + 'rapid prototyping framework', + 'title' => 'Nibiru Controller Example', + 'css' => Config::getInstance()->getConfig()[View::NIBIRU_SETTINGS]["smarty.css"], + 'js' => Config::getInstance()->getConfig()[View::NIBIRU_SETTINGS]["smarty.js"] + ]); + } + + public function navigationAction() + { + JsonNavigation::getInstance()->loadJsonNavigationArray(); + } + +} \ No newline at end of file diff --git a/application/controller/formsController.php b/application/controller/formsController.php new file mode 100644 index 0000000..4280196 --- /dev/null +++ b/application/controller/formsController.php @@ -0,0 +1,88 @@ + 'Full Name', + 'for' => 'full-name', + 'class' => 'contacts-label' + ) + ); + + Form::addInputTypeText( + array( + 'name' => 'full-name', + 'required' => 'required', + 'id' => 'full-name', + 'class' => 'contacts-input form-control' + ), + array( + 'class' => 'input-text' + ) + ); + + Form::addTypeLabel( + array( + 'value' => 'Email', + 'for' => 'email', + 'class' => 'contacts-label' + ) + ); + + Form::addInputTypeText( + array( + 'name' => 'email', + 'required' => 'required', + 'id' => 'email', + 'class' => 'contacts-input form-control' + ), + array( + 'class' => 'input-email' + ) + ); + + Form::addTypeButton( + array( + 'class' => 'btn-block btn-info', + 'name' => 'Send Message' + ) + ); + + $this->form = Form::addForm( + array( + 'name' => 'newregister', + 'method' => 'post', + 'action' => 'YOURPOSTURL', + 'target' => '_self' + ) + ); + } + + public function pageAction() + { + View::assign([ + 'name' => 'rapid prototyping framework', + 'title' => 'Nibiru Forms Example', + 'formdata' => $this->form, + 'css' => Config::getInstance()->getConfig()[View::NIBIRU_SETTINGS]["smarty.css"], + 'js' => Config::getInstance()->getConfig()[View::NIBIRU_SETTINGS]["smarty.js"] + ]); + } + + public function navigationAction() + { + JsonNavigation::getInstance()->loadJsonNavigationArray(); + } + +} \ No newline at end of file diff --git a/application/controller/indexController.php b/application/controller/indexController.php index 05ad232..5a0814e 100644 --- a/application/controller/indexController.php +++ b/application/controller/indexController.php @@ -12,21 +12,15 @@ use Nibiru\Adapter\Controller; class indexController extends Controller { - public function __construct() - { - - } public function pageAction() { - View::getInstance()->assign( - array( - 'name' => 'Beispielseite', - 'title' => 'Stephan Kasdorf - Nibiru Example', + View::assign([ + 'name' => 'rapid prototyping framework', + 'title' => 'Nibiru Example Startpage', 'css' => Config::getInstance()->getConfig()[View::NIBIRU_SETTINGS]["smarty.css"], 'js' => Config::getInstance()->getConfig()[View::NIBIRU_SETTINGS]["smarty.js"] - ) - ); + ]); } public function navigationAction() diff --git a/application/settings/config/navigation.json b/application/settings/config/navigation.json index 0115bb2..681021a 100644 --- a/application/settings/config/navigation.json +++ b/application/settings/config/navigation.json @@ -1,6 +1,8 @@ { "navigation" : { - "Home": { "link": "/", "tooltip": "Home", "icon": "icon icon-home", "footer": "false" } + "Home": { "link": "/", "tooltip": "Home", "icon": "icon icon-home", "footer": "false" }, + "Controller": { "link": "/controller", "tooltip": "Controller", "icon": "icon icon-pencil", "footer": "false" }, + "Forms": { "link": "/forms", "tooltip": "Forms", "icon": "icon icon-clipboard", "footer": "false" } } } \ No newline at end of file diff --git a/application/settings/config/settings.development.ini b/application/settings/config/settings.development.ini index 74cb032..435b689 100644 --- a/application/settings/config/settings.development.ini +++ b/application/settings/config/settings.development.ini @@ -36,7 +36,7 @@ smarty.css[] = "public/css/v3/toolkit-inverse.css" smarty.css[] = "public/css/v3/application.css" smarty.css[] = "public/css/v3/jquery-ui.css" smarty.css[] = "public/css/v3/nibiru-debug.css" -smarty.css[] = "public/css/v3/tiamat-form.css" +;;smarty.css[] = "public/css/v3/tiamat-form.css" smarty.js[] = "public/js/v3/jquery.min.js" smarty.js[] = "public/js/v3/tether.min.js" smarty.js[] = "public/js/v3/jquery-ui.js" @@ -48,7 +48,8 @@ smarty.js[] = "public/js/v3/nibiru-debug.js" [ROUTING] route[index] = "/" -route[example] = "/example" +route[controller] = "/controller" +route[forms] = "/forms" [DATABASE] username = "YOURUSER" diff --git a/application/view/templates/controller.tpl b/application/view/templates/controller.tpl new file mode 100644 index 0000000..df98acd --- /dev/null +++ b/application/view/templates/controller.tpl @@ -0,0 +1,31 @@ +{include 'shared/header.tpl'} + +
+
+ {include file="navigation.tpl"} +
+
+
+
+
{$name}
+

{$title}

+
+
+
+
+
+
+
+
+
+
+
+
+
This is just a basic example for a controller, for more details read this section: Controllers.
+
+
+
+{include 'shared/footer.tpl'} + + + diff --git a/application/view/templates/forms.tpl b/application/view/templates/forms.tpl new file mode 100644 index 0000000..c180d9a --- /dev/null +++ b/application/view/templates/forms.tpl @@ -0,0 +1,34 @@ +{include 'shared/header.tpl'} + +
+
+ {include file="navigation.tpl"} +
+
+
+
+
Rapid Prototyping Framework
+

{$title}

+
+
+
+
+
+
+
+
+
+
+ {$formdata} +
+
+
+
+
This is just a basic example for a form, for more details read this section: Forms.
+
+
+
+{include 'shared/footer.tpl'} + + + diff --git a/application/view/templates/index.tpl b/application/view/templates/index.tpl index 5030ef3..799c80e 100644 --- a/application/view/templates/index.tpl +++ b/application/view/templates/index.tpl @@ -7,39 +7,25 @@
-
Rapid Prototyping Framework
-

Nibiru

+
{$name}
+

{$title}

-
-
- - +
+
+
+
+
+
+
+
+
+
This is just a basic example, for more details read this section: Nibiru Framework.
- - - {include 'shared/footer.tpl'} - diff --git a/core/a/controller.php b/core/a/controller.php index ade1c97..2f98137 100644 --- a/core/a/controller.php +++ b/core/a/controller.php @@ -13,6 +13,11 @@ use Nibiru; abstract class Controller extends Nibiru\Controller implements IController { + public function __construct() + { + //basic constructor for the Controller can be overwritten + } + /** * This should be part of any extended controller * class in order to implement a page structure diff --git a/core/c/auth.php b/core/c/auth.php index b485687..ba8b185 100644 --- a/core/c/auth.php +++ b/core/c/auth.php @@ -16,6 +16,9 @@ class Auth extends Controller implements IAuth private $_username = ""; private $_password = ""; + /** + * Auth constructor. + */ protected function __construct() { parent::__construct(); @@ -23,7 +26,10 @@ class Auth extends Controller implements IAuth } - public static function getInstance() + /** + * @return View + */ + public static function getInstance(): View { $className = get_called_class(); if( self::$_instance == null ) @@ -33,6 +39,11 @@ class Auth extends Controller implements IAuth return self::$_instance; } + /** + * @param $login + * @param $password + * @return bool + */ public function auth( $login, $password ) { // TODO: Implement auth($username, $password) method. @@ -41,7 +52,7 @@ class Auth extends Controller implements IAuth if(!array_key_exists('auth', $_SESSION)) { - $user_password = Pdo::query("SELECT DES_DECRYPT(user_pass, '".Config::getInstance()->getConfig()["SECURITY"]["password_hash"]."') AS pass FROM user WHERE user_login = '".$login."';"); + $user_password = Pdo::query("SELECT DES_DECRYPT(user_pass, '".Config::getInstance()->getConfig()[IView::NIBIRU_SECURITY]["password_hash"]."') AS pass FROM user WHERE user_login = '".$login."';"); if( $user_password["pass"] == $password ) { $session_id = session_id(); @@ -103,23 +114,4 @@ class Auth extends Controller implements IAuth { $this->_password = $password; } - - /** - * This should be part of any extended controller - * class in order to implement a page structure - * @return array - */ - public function pageAction() - { - // TODO: Implement pageAction() method. - } - - /** - * This is the part where you can add titles to - * your page navigation. - */ - public function navigationAction() - { - // TODO: Implement navigationAction() method. - } } \ No newline at end of file diff --git a/core/c/controller.php b/core/c/controller.php index 5373046..b53792f 100644 --- a/core/c/controller.php +++ b/core/c/controller.php @@ -25,7 +25,7 @@ class Controller extends View $this->_setConfig(Config::getInstance()->getConfig()); } - public static function getInstance() + public static function getInstance(): View { $className = get_called_class(); if( self::$_instance == null ) diff --git a/core/c/jsonnavigation.php b/core/c/jsonnavigation.php index 9114da3..924be1f 100755 --- a/core/c/jsonnavigation.php +++ b/core/c/jsonnavigation.php @@ -22,7 +22,7 @@ class JsonNavigation extends Config private static $_name = false; private static $_section_name = self::NAVIGATION; - public static function getInstance() + public static function getInstance(): JsonNavigation { parent::getInstance(); self::setFileContentString(); @@ -36,7 +36,7 @@ class JsonNavigation extends Config /** * @return string */ - protected static function getSectionName() + protected static function getSectionName(): string { return self::$_section_name; } @@ -44,23 +44,23 @@ class JsonNavigation extends Config /** * @param string $section_name */ - private static function setSectionName( $section_name ) + private static function setSectionName( string $section_name ) { self::$_section_name = $section_name; } - /** - * @return boolean - */ - protected static function getName() + /** + * @return string + */ + protected static function getName(): string { return self::$_name; } - /** - * @param boolean $name - */ - private static function setName( $name ) + /** + * @param $name + */ + private static function setName( string $name ) { self::$_name = $name; } @@ -74,7 +74,7 @@ class JsonNavigation extends Config } /** - * @param null $file_content + * Content String */ private static function setFileContentString( ) { @@ -84,30 +84,31 @@ class JsonNavigation extends Config /** * @return array */ - protected static function getFileContentArray( ) + protected static function getFileContentArray( ): array { return self::$_file_content_array; } /** - * @param array $file_content_array + * will set the file Content array */ private static function setFileContentArray( ) { self::$_file_content_array = file( Settings::SETTINGS_PATH . parent::getInstance()->getConfig()["SETTINGS"][self::getSectionName()] ); } - /** - * @return array - */ - protected static function getNavigation( ) + /** + * @return \RecursiveIteratorIterator + */ + protected static function getNavigation( ): \RecursiveIteratorIterator { return self::$_navigation; } - /** - * @param array $navigation - */ + /** + * Will load the navigation json file to the $_navigation + * variable + */ private static function setNavigation( ) { self::$_navigation = new \RecursiveIteratorIterator( @@ -139,8 +140,9 @@ class JsonNavigation extends Config /** * Loads the navigation from a json file into * the view, making the variables available - */ - public function loadJsonNavigationArray( $name = false ) + * @param string $name + */ + public function loadJsonNavigationArray( string $name = '' ) { if( $name ) { diff --git a/core/c/view.php b/core/c/view.php index d451e5f..404b8c1 100755 --- a/core/c/view.php +++ b/core/c/view.php @@ -12,14 +12,6 @@ class View implements IView { private static $_instance; - const NIBIRU_SETTINGS = "SETTINGS"; - const NIBIRU_URL = "pageurl"; - const NIBIRU_ERROR = "ERROR"; - const NIBIRU_SECURITY = "SECURITY"; - const NIBIRU_ROUTING = "ROUTING"; - const NIBIRU_EMAIL = "EMAIL"; - const NIBIRU_FILE_END = ".tpl"; - private static $smarty = array(); private static $engine = array(); @@ -36,7 +28,10 @@ class View implements IView self::_setEngine(); } - public static function getInstance() + /** + * @return View + */ + public static function getInstance(): View { $className = get_called_class(); if( self::$_instance == null ) @@ -47,7 +42,18 @@ class View implements IView } /** - * @return array + * @param array $varname + */ + public static function assign( $varname = array() ) + { + if(is_array($varname)) + { + Controller::getInstance()->varname( self::getInstance()->getEngine(), $varname ); + } + } + + /** + * @return \Smarty */ public function getEngine(): \Smarty { @@ -68,17 +74,6 @@ class View implements IView self::$engine->assign('debuging', Config::getInstance()->getConfig()[Engine::T_ENGINE]["debugbar"]); } - /** - * @param array $varname - */ - public function assign( $varname = array() ) - { - if(is_array($varname)) - { - Controller::getInstance()->varname( $this->getEngine(), $varname ); - } - } - /** * @param $page */ diff --git a/core/f/form.php b/core/f/form.php index bb8833d..7b46bc8 100644 --- a/core/f/form.php +++ b/core/f/form.php @@ -42,7 +42,7 @@ class Form * @desc is used internaly for assambly only * @param $option */ - private static function assambleOptions( $option ) + private static function assembleOptions( $option ) { if($option == false) { @@ -76,7 +76,7 @@ class Form * @desc is used internally for assambly only * @param $element */ - private static function assamble( $element ) + private static function assemble( $element ) { if( self::getDiv() ) { @@ -174,7 +174,7 @@ class Form self::setDiv( $div ); } self::setElement( new TypeText() ); - self::assamble( self::getElement()->loadElement( $attributes ) ); + self::assemble( self::getElement()->loadElement( $attributes ) ); } /** @@ -188,7 +188,7 @@ class Form self::setDiv( $div ); } self::setElement( new TypeSubmit() ); - self::assamble( self::getElement()->loadElement( $attributes ) ); + self::assemble( self::getElement()->loadElement( $attributes ) ); } /** @@ -202,7 +202,7 @@ class Form self::setDiv( $div ); } self::setElement( new TypeTextarea() ); - self::assamble( self::getElement()->loadElement( $attributes ) ); + self::assemble( self::getElement()->loadElement( $attributes ) ); } /** @@ -217,7 +217,7 @@ class Form self::setDiv( $div ); } self::setElement( new TypeRadio() ); - self::assamble( self::getElement()->loadElement( $attributes ) ); + self::assemble( self::getElement()->loadElement( $attributes ) ); } /** @@ -231,7 +231,7 @@ class Form self::setDiv( $div ); } self::setElement( new TypeCheckbox() ); - self::assamble( self::getElement()->loadElement( $attributes ) ); + self::assemble( self::getElement()->loadElement( $attributes ) ); } /** @@ -245,7 +245,7 @@ class Form self::setDiv( $div ); } self::setElement( new TypePassword() ); - self::assamble( self::getElement()->loadElement( $attributes ) ); + self::assemble( self::getElement()->loadElement( $attributes ) ); } /** @@ -259,7 +259,7 @@ class Form self::setDiv( $div ); } self::setElement( new TypeDate() ); - self::assamble( self::getElement()->loadElement( $attributes ) ); + self::assemble( self::getElement()->loadElement( $attributes ) ); } /** @@ -273,7 +273,7 @@ class Form self::setDiv( $div ); } self::setElement( new TypeEmail() ); - self::assamble( self::getElement()->loadElement( $attributes ) ); + self::assemble( self::getElement()->loadElement( $attributes ) ); } /** @@ -287,7 +287,7 @@ class Form self::setDiv( $div ); } self::setElement( new TypeColor() ); - self::assamble( self::getElement()->loadElement( $attributes ) ); + self::assemble( self::getElement()->loadElement( $attributes ) ); } /** @@ -301,7 +301,7 @@ class Form self::setDiv( $div ); } self::setElement( new TypeDatetime() ); - self::assamble( self::getElement()->loadElement( $attributes ) ); + self::assemble( self::getElement()->loadElement( $attributes ) ); } /** @@ -315,7 +315,7 @@ class Form self::setDiv( $div ); } self::setElement( new TypeFileUpload() ); - self::assamble( self::getElement()->loadElement( $attributes ) ); + self::assemble( self::getElement()->loadElement( $attributes ) ); } /** @@ -329,7 +329,7 @@ class Form self::setDiv( $div ); } self::setElement( new TypeHidden() ); - self::assamble( self::getElement()->loadElement( $attributes ) ); + self::assemble( self::getElement()->loadElement( $attributes ) ); } /** @@ -343,7 +343,7 @@ class Form self::setDiv( $div ); } self::setElement( new TypeImageSubmit() ); - self::assamble( self::getElement()->loadElement( $attrbutes ) ); + self::assemble( self::getElement()->loadElement( $attrbutes ) ); } /** @@ -357,7 +357,7 @@ class Form self::setDiv( $div ); } self::setElement( new TypeNumber() ); - self::assamble( self::getElement()->loadElement( $attributes ) ); + self::assemble( self::getElement()->loadElement( $attributes ) ); } /** @@ -372,7 +372,7 @@ class Form self::setDiv( $div ); } self::setElement( new TypeRange() ); - self::assamble( self::getElement()->loadElement( $attributes ) ); + self::assemble( self::getElement()->loadElement( $attributes ) ); } /** @@ -386,7 +386,7 @@ class Form self::setDiv( $div ); } self::setElement( new TypeReset() ); - self::assamble( self::getElement()->loadElement( $attributes ) ); + self::assemble( self::getElement()->loadElement( $attributes ) ); } /** @@ -400,7 +400,7 @@ class Form self::setDiv( $div ); } self::setElement( new TypeSearch() ); - self::assamble( self::getElement()->loadElement( $attributes ) ); + self::assemble( self::getElement()->loadElement( $attributes ) ); } /** @@ -414,7 +414,7 @@ class Form self::setDiv( $div ); } self::setElement( new TypeTelefon() ); - self::assamble( self::getElement()->loadElement( $attributes ) ); + self::assemble( self::getElement()->loadElement( $attributes ) ); } /** @@ -428,7 +428,7 @@ class Form self::setDiv( $div ); } self::setElement( new TypeUrl() ); - self::assamble( self::getElement()->loadElement( $attributes ) ); + self::assemble( self::getElement()->loadElement( $attributes ) ); } /** @@ -443,8 +443,8 @@ class Form self::setDiv( $div ); } self::setElement( new TypeSelect() ); - self::assamble( self::displaySelect( self::getElement()->loadElement( $attributes ) ) ); - self::assambleOptions( false ); + self::assemble( self::displaySelect( self::getElement()->loadElement( $attributes ) ) ); + self::assembleOptions( false ); } /** @@ -459,7 +459,7 @@ class Form self::setDiv( $div ); } self::setElement( new TypeButton() ); - self::assamble( self::getElement()->loadElement( $attributes ) ); + self::assemble( self::getElement()->loadElement( $attributes ) ); } /** @@ -469,7 +469,7 @@ class Form public static function addSelectOption( $attributes ) { self::setElement( new TypeOption() ); - self::assambleOptions( self::getElement()->loadElement( $attributes ) ); + self::assembleOptions( self::getElement()->loadElement( $attributes ) ); } /** @@ -483,6 +483,6 @@ class Form self::setDiv( $div ); } self::setElement( new TypeLabel() ); - self::assamble( self::getElement()->loadElement( $attributes ) ); + self::assemble( self::getElement()->loadElement( $attributes ) ); } } diff --git a/core/i/view.php b/core/i/view.php index 3d7d34b..416324b 100644 --- a/core/i/view.php +++ b/core/i/view.php @@ -10,5 +10,11 @@ namespace Nibiru; */ interface IView { - + const NIBIRU_SETTINGS = "SETTINGS"; + const NIBIRU_URL = "pageurl"; + const NIBIRU_ERROR = "ERROR"; + const NIBIRU_SECURITY = "SECURITY"; + const NIBIRU_ROUTING = "ROUTING"; + const NIBIRU_EMAIL = "EMAIL"; + const NIBIRU_FILE_END = ".tpl"; } \ No newline at end of file diff --git a/public/img/logos/400dpiLogo.png b/public/img/logos/400dpiLogo.png new file mode 100644 index 0000000..bc41474 Binary files /dev/null and b/public/img/logos/400dpiLogo.png differ diff --git a/public/img/logos/400dpiLogoCropped.png b/public/img/logos/400dpiLogoCropped.png new file mode 100644 index 0000000..e5e0ea6 Binary files /dev/null and b/public/img/logos/400dpiLogoCropped.png differ diff --git a/public/img/logos/FaviconLogo.png b/public/img/logos/FaviconLogo.png new file mode 100644 index 0000000..bd3efa8 Binary files /dev/null and b/public/img/logos/FaviconLogo.png differ diff --git a/public/img/logos/MediumSquareLogo.png b/public/img/logos/MediumSquareLogo.png new file mode 100644 index 0000000..864fe02 Binary files /dev/null and b/public/img/logos/MediumSquareLogo.png differ diff --git a/public/img/logos/SmallLogoBW.png b/public/img/logos/SmallLogoBW.png new file mode 100644 index 0000000..fc05ad7 Binary files /dev/null and b/public/img/logos/SmallLogoBW.png differ