Version 0.9.6 beta - added new form elements, also added a nibiru binary in order to create modules and plugins.
This commit is contained in:
0
core/c/auth.php
Normal file → Executable file
0
core/c/auth.php
Normal file → Executable file
17
core/c/autoloader.php
Normal file → Executable file
17
core/c/autoloader.php
Normal file → Executable file
@@ -138,9 +138,22 @@ class Autoloader
|
||||
{
|
||||
foreach (self::getFilesInFoler() as $file)
|
||||
{
|
||||
$required[] = $file;
|
||||
require_once $file;
|
||||
if(!strstr($file, self::PLUGINS_FOLDER))
|
||||
{
|
||||
$required[] = $file;
|
||||
require_once $file;
|
||||
}
|
||||
else
|
||||
{
|
||||
$plugins[] = $file;
|
||||
}
|
||||
}
|
||||
foreach($plugins as $plugin)
|
||||
{
|
||||
$required[] = $plugin;
|
||||
require_once $plugin;
|
||||
}
|
||||
|
||||
if(self::isDebug())
|
||||
{
|
||||
View::getInstance()->assign(
|
||||
|
||||
0
core/c/config.php
Normal file → Executable file
0
core/c/config.php
Normal file → Executable file
19
core/c/controller.php
Normal file → Executable file
19
core/c/controller.php
Normal file → Executable file
@@ -25,9 +25,10 @@ class Controller extends View
|
||||
protected function __construct()
|
||||
{
|
||||
$this->_setConfig(Config::getInstance()->getConfig());
|
||||
$this->_setController();
|
||||
}
|
||||
|
||||
public static function getInstance(): View
|
||||
public static function getInstance(): View|Controller
|
||||
{
|
||||
$className = get_called_class();
|
||||
if( self::$_instance == null )
|
||||
@@ -54,19 +55,29 @@ class Controller extends View
|
||||
}
|
||||
|
||||
/**
|
||||
* @desc will return the current controller name
|
||||
* @return string
|
||||
*/
|
||||
public function getController()
|
||||
public function getController(): string
|
||||
{
|
||||
return $this->_controller;
|
||||
}
|
||||
|
||||
/**
|
||||
* @desc will set the current controller name
|
||||
* @param string $controller
|
||||
*/
|
||||
protected function setController( $controller )
|
||||
protected function _setController( string $controller = "" )
|
||||
{
|
||||
$this->_controller = $controller;
|
||||
if($controller!="")
|
||||
{
|
||||
$this->_controller = $controller;
|
||||
}
|
||||
else
|
||||
{
|
||||
$url = explode("/", $_SERVER['REQUEST_URI']);
|
||||
$this->_controller = $url[1];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
0
core/c/debug.php
Normal file → Executable file
0
core/c/debug.php
Normal file → Executable file
0
core/c/dispatcher.php
Normal file → Executable file
0
core/c/dispatcher.php
Normal file → Executable file
0
core/c/display.php
Normal file → Executable file
0
core/c/display.php
Normal file → Executable file
0
core/c/engine.php
Normal file → Executable file
0
core/c/engine.php
Normal file → Executable file
0
core/c/form.php
Normal file → Executable file
0
core/c/form.php
Normal file → Executable file
@@ -67,6 +67,7 @@ class FormAttributes
|
||||
$this->_element = str_replace(' maxlength="MAXLENGTH"', '', $this->_element);
|
||||
$this->_element = str_replace(' min="MIN"', '', $this->_element);
|
||||
$this->_element = str_replace(' max="MAX"', '', $this->_element);
|
||||
$this->_element = str_replace(' href="HREF"', '', $this->_element);
|
||||
$this->_element = str_replace(' step="STEP"', '', $this->_element);
|
||||
$this->_element = str_replace(' tabindex="TABINDEX"', '', $this->_element);
|
||||
$this->_element = str_replace(' SPEECH', '', $this->_element);
|
||||
@@ -88,6 +89,7 @@ class FormAttributes
|
||||
$this->_element = str_replace(' CHECKED', '', $this->_element);
|
||||
$this->_element = str_replace(' VALUE', '', $this->_element);
|
||||
$this->_element = str_replace(' PATTERN', '', $this->_element);
|
||||
$this->_element = str_replace('ANY', '', $this->_element);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -137,61 +137,43 @@ class JsonNavigation extends Config
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the navigation from a json file into
|
||||
* the view, making the variables available
|
||||
/**
|
||||
* Loads the navigation from a json file into
|
||||
* the view, making the variables available
|
||||
* @param string $name
|
||||
*/
|
||||
public function loadJsonNavigationArray( string $name = '' )
|
||||
{
|
||||
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::getSectionName())
|
||||
{
|
||||
$keys = array_keys($value);
|
||||
for($i=0; sizeof($keys)>$i;$i++)
|
||||
{
|
||||
if(array_key_exists('link', $value[$keys[$i]]))
|
||||
{
|
||||
self::$_navigation_array[] = array(
|
||||
'title' => $keys[$i],
|
||||
'icon' => $value[$keys[$i]]["icon"],
|
||||
'link' => $value[$keys[$i]]["link"],
|
||||
'tooltip' => $value[$keys[$i]]["tooltip"],
|
||||
'footer' => $value[$keys[$i]]['footer']
|
||||
);
|
||||
}
|
||||
elseif(array_key_exists('onclick', $value[$keys[$i]]))
|
||||
{
|
||||
self::$_navigation_array[] = array(
|
||||
'title' => $keys[$i],
|
||||
'icon' => $value[$keys[$i]]["icon"],
|
||||
'tooltip' => $value[$keys[$i]]["tooltip"],
|
||||
'onclick' => $value[$keys[$i]]["onclick"],
|
||||
'footer' => $value[$keys[$i]]['footer']
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if( $name )
|
||||
{
|
||||
View::getInstance()->getEngine()->assignGlobal(self::getName(), self::$_navigation_array);
|
||||
}
|
||||
else
|
||||
{
|
||||
View::getInstance()->getEngine()->assignGlobal("navigationJson", self::$_navigation_array);
|
||||
}
|
||||
}
|
||||
public function loadJsonNavigationArray( string $name = 'navigation' )
|
||||
{
|
||||
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::getSectionName())
|
||||
{
|
||||
$keys = array_keys($value);
|
||||
for($i=0; sizeof($keys)>$i;$i++)
|
||||
{
|
||||
$fields = [];
|
||||
$fieldKeys=array_keys($value[$keys[$i]]);
|
||||
$fields['title']=$keys[$i];
|
||||
|
||||
foreach ($fieldKeys as $fieldKey)
|
||||
{
|
||||
if(array_key_exists($fieldKey, $value[$keys[$i]]))
|
||||
{
|
||||
$fields[$fieldKey]=$value[$keys[$i]][$fieldKey];
|
||||
}
|
||||
}
|
||||
self::$_navigation_array[] = $fields;
|
||||
}
|
||||
}
|
||||
}
|
||||
View::getInstance()->getEngine()->assignGlobal(self::getName(), self::$_navigation_array);
|
||||
}
|
||||
}
|
||||
14
core/c/model.php
Normal file → Executable file
14
core/c/model.php
Normal file → Executable file
@@ -78,6 +78,7 @@ class Model extends Table
|
||||
$numItems = count($tablefields);
|
||||
$i = 0;
|
||||
$fieldarray = "";
|
||||
$parameters = "";
|
||||
foreach($this->getTables()[$table] as $field)
|
||||
{
|
||||
if( $i==0 )
|
||||
@@ -87,15 +88,25 @@ class Model extends Table
|
||||
|
||||
if( ++$i === $numItems )
|
||||
{
|
||||
$parameters .= "private $".$field.";\n\t";
|
||||
$setters .= "public function _set".str_replace('_', '', ucfirst($field))."($".$field.")\n\t{\n\t\t\$this->".$field." = $".$field.";\n\t}\n\n\t";
|
||||
$getters .= "public function get".str_replace('_', '', ucfirst($field))."()\n\t{\n\t\treturn \$this->".$field.";\n\t}\n\n\t";
|
||||
$fieldarray .= "\t\t\t\t\t\t\t\t'" . $field . "' => '" . $field . "'"."\n\t\t\t\t\t\t)";
|
||||
}
|
||||
else
|
||||
{
|
||||
$parameters .= "private $".$field.";\n\t";
|
||||
$setters .= "public function _set".str_replace('_', '', ucfirst($field))."($".$field.")\n\t{\n\t\t\$this->".$field." = $".$field.";\n\t}\n\n\t";
|
||||
$getters .= "public function get".str_replace('_', '', ucfirst($field))."()\n\t{\n\t\treturn \$this->".$field.";\n\t}\n\n\t";
|
||||
$fieldarray .= "\t\t\t\t\t\t\t\t'" . $field . "' => '" . $field . "',\n";
|
||||
}
|
||||
|
||||
}
|
||||
$template = str_replace('[FIELDARRAY]', $fieldarray, $this->getModelTemplate());
|
||||
|
||||
$template = str_replace('[CLASSPARAMETERS]', $parameters, $this->getModelTemplate());
|
||||
$template = str_replace('[FIELDARRAY]', $fieldarray, $template);
|
||||
$template = str_replace('[SETTERS]', $setters, $template);
|
||||
$template = str_replace('[GETTERS]', $getters, $template);
|
||||
$template = str_replace('[TABLE]', $table, $template);
|
||||
$template = str_replace('[CLASSNAME]', ucfirst($classname), $template);
|
||||
$template = str_replace('[FOLDERNAME]', ucfirst($this->getFolderNamespace()), $template);
|
||||
@@ -119,7 +130,6 @@ class Model extends Table
|
||||
$template = str_replace('[ADAPTER]', self::ADAPTER_MYSQL, $template);
|
||||
$template = str_replace('[CONNECTOR]', self::ADAPTER_PDO, $template);
|
||||
}
|
||||
|
||||
if(Config::getInstance()->getConfig()[self::CONFIG_SECTION][self::DB_OVERWRITE_MODELS])
|
||||
{
|
||||
file_put_contents($this->getFolderOut() . '/' . $classname . self::PHP_FILE_ENDING, $template);
|
||||
|
||||
7
core/c/nibiru.php
Normal file
7
core/c/nibiru.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
namespace Nibiru;
|
||||
|
||||
class Nibiru
|
||||
{
|
||||
//TODO: Generator Class in order to generate Modules fast
|
||||
}
|
||||
0
core/c/pdo.php
Normal file → Executable file
0
core/c/pdo.php
Normal file → Executable file
0
core/c/postgresql.php
Normal file → Executable file
0
core/c/postgresql.php
Normal file → Executable file
0
core/c/psql.php
Normal file → Executable file
0
core/c/psql.php
Normal file → Executable file
0
core/c/registry.php
Normal file → Executable file
0
core/c/registry.php
Normal file → Executable file
@@ -70,7 +70,7 @@ class Router extends Config
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getRoutes()
|
||||
public static function getRoutes()
|
||||
{
|
||||
return self::$_routes;
|
||||
}
|
||||
|
||||
0
core/c/settings.php
Normal file → Executable file
0
core/c/settings.php
Normal file → Executable file
0
core/c/table.php
Normal file → Executable file
0
core/c/table.php
Normal file → Executable file
0
core/c/typecheckbox.php
Normal file → Executable file
0
core/c/typecheckbox.php
Normal file → Executable file
39
core/c/typecloseany.php
Executable file
39
core/c/typecloseany.php
Executable file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
namespace Nibiru\Form;
|
||||
use Nibiru\Adapter;
|
||||
/**
|
||||
* Copyright 2020 Nibiru Framework
|
||||
* Licence: BSD 4-Old License
|
||||
* Author: Stephan Kasdorf
|
||||
* File: typeclosediv.php
|
||||
* Date: 05.09.20
|
||||
*/
|
||||
class TypeCloseAny extends FormAttributes implements IForm
|
||||
{
|
||||
private $_attributes = array(
|
||||
self::FORM_VALUE => '',
|
||||
self::FORM_ATTRIBUTE_ID => '',
|
||||
self::FORM_ATTRIBUTE_CLASS => '',
|
||||
self::FORM_ATTRIBUTE_ANY => ''
|
||||
);
|
||||
|
||||
/**
|
||||
* @param $attributes
|
||||
* @return mixed
|
||||
*/
|
||||
public function loadElement($attributes)
|
||||
{
|
||||
parent::__construct( $this->_attributes );
|
||||
$this->_setElement();
|
||||
$this->_setAttributes( self::loadAttributeValues( $attributes ) );
|
||||
return $this->getElement();
|
||||
}
|
||||
|
||||
/**
|
||||
* just a closing div element
|
||||
*/
|
||||
private function _setElement( )
|
||||
{
|
||||
$this->_element = '</ANY>' . "\n";
|
||||
}
|
||||
}
|
||||
0
core/c/typeclosediv.php
Normal file → Executable file
0
core/c/typeclosediv.php
Normal file → Executable file
0
core/c/typecolor.php
Normal file → Executable file
0
core/c/typecolor.php
Normal file → Executable file
0
core/c/typedate.php
Normal file → Executable file
0
core/c/typedate.php
Normal file → Executable file
0
core/c/typedatetime.php
Normal file → Executable file
0
core/c/typedatetime.php
Normal file → Executable file
0
core/c/typeemail.php
Normal file → Executable file
0
core/c/typeemail.php
Normal file → Executable file
0
core/c/typefileupload.php
Normal file → Executable file
0
core/c/typefileupload.php
Normal file → Executable file
0
core/c/typehidden.php
Normal file → Executable file
0
core/c/typehidden.php
Normal file → Executable file
0
core/c/typeimagesubmit.php
Normal file → Executable file
0
core/c/typeimagesubmit.php
Normal file → Executable file
0
core/c/typenumber.php
Normal file → Executable file
0
core/c/typenumber.php
Normal file → Executable file
40
core/c/typeopenany.php
Executable file
40
core/c/typeopenany.php
Executable file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
namespace Nibiru\Form;
|
||||
use Nibiru\Adapter;
|
||||
/**
|
||||
* Copyright 2020 Nibiru Framework
|
||||
* Licence: BSD 4-Old License
|
||||
* Author: Stephan Kasdorf
|
||||
* File: typeopendiv.php
|
||||
* Date: 05.09.20
|
||||
*/
|
||||
class TypeOpenAny extends FormAttributes implements IForm
|
||||
{
|
||||
private $_attributes = array(
|
||||
self::FORM_VALUE => '',
|
||||
self::FORM_ATTRIBUTE_ID => '',
|
||||
self::FORM_ATTRIBUTE_CLASS => '',
|
||||
self::FORM_ATTRIBUTE_ANY => '',
|
||||
self::FORM_ATTRIBUTE_HREF => ''
|
||||
);
|
||||
|
||||
/**
|
||||
* @param $attributes
|
||||
* @return mixed
|
||||
*/
|
||||
public function loadElement($attributes)
|
||||
{
|
||||
parent::__construct( $this->_attributes );
|
||||
$this->_setElement();
|
||||
$this->_setAttributes( self::loadAttributeValues( $attributes ) );
|
||||
return $this->getElement();
|
||||
}
|
||||
|
||||
/**
|
||||
* just the opening div element
|
||||
*/
|
||||
private function _setElement( )
|
||||
{
|
||||
$this->_element = '<ANY href="HREF" ID CLASS>' . 'VALUE' . "\n";
|
||||
}
|
||||
}
|
||||
0
core/c/typeopendiv.php
Normal file → Executable file
0
core/c/typeopendiv.php
Normal file → Executable file
0
core/c/typeoption.php
Normal file → Executable file
0
core/c/typeoption.php
Normal file → Executable file
0
core/c/typepassword.php
Normal file → Executable file
0
core/c/typepassword.php
Normal file → Executable file
0
core/c/typeradio.php
Normal file → Executable file
0
core/c/typeradio.php
Normal file → Executable file
0
core/c/typerange.php
Normal file → Executable file
0
core/c/typerange.php
Normal file → Executable file
0
core/c/typereset.php
Normal file → Executable file
0
core/c/typereset.php
Normal file → Executable file
0
core/c/typesearch.php
Normal file → Executable file
0
core/c/typesearch.php
Normal file → Executable file
0
core/c/typeselect.php
Normal file → Executable file
0
core/c/typeselect.php
Normal file → Executable file
0
core/c/typesubmit.php
Normal file → Executable file
0
core/c/typesubmit.php
Normal file → Executable file
0
core/c/typetelefon.php
Normal file → Executable file
0
core/c/typetelefon.php
Normal file → Executable file
0
core/c/typetext.php
Normal file → Executable file
0
core/c/typetext.php
Normal file → Executable file
0
core/c/typetextarea.php
Normal file → Executable file
0
core/c/typetextarea.php
Normal file → Executable file
0
core/c/typeurl.php
Normal file → Executable file
0
core/c/typeurl.php
Normal file → Executable file
@@ -2,7 +2,9 @@
|
||||
namespace Nibiru\Factory;
|
||||
use Nibiru\Form\TypeButton;
|
||||
use Nibiru\Form\TypeCheckbox;
|
||||
use Nibiru\Form\TypeCloseAny;
|
||||
use Nibiru\Form\TypeCloseDiv;
|
||||
use Nibiru\Form\TypeCloseSpan;
|
||||
use Nibiru\Form\TypeColor;
|
||||
use Nibiru\Form\TypeDatetime;
|
||||
use Nibiru\Form\TypeEmail;
|
||||
@@ -11,7 +13,9 @@ use Nibiru\Form\TypeHidden;
|
||||
use Nibiru\Form\TypeImageSubmit;
|
||||
use Nibiru\Form\TypeLabel;
|
||||
use Nibiru\Form\TypeNumber;
|
||||
use Nibiru\Form\TypeOpenAny;
|
||||
use Nibiru\Form\TypeOpenDiv;
|
||||
use Nibiru\Form\TypeOpenSpan;
|
||||
use Nibiru\Form\TypeOption;
|
||||
use Nibiru\Form\TypePassword;
|
||||
use Nibiru\Form\TypeRadio;
|
||||
@@ -506,4 +510,25 @@ class Form
|
||||
self::setElement( new TypeCloseDiv() );
|
||||
self::assemble( self::getElement()->loadElement( false ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @desc adds an opening span to the form element
|
||||
* @param $attributes
|
||||
* @return void
|
||||
*/
|
||||
public static function addOpenAny( $attributes )
|
||||
{
|
||||
self::setElement( new TypeOpenAny() );
|
||||
self::assemble( self::getElement()->loadElement( $attributes ));
|
||||
}
|
||||
|
||||
/**
|
||||
* @desc adds a closing span to the form element
|
||||
* @return void
|
||||
*/
|
||||
public static function addCloseAny( $attributes )
|
||||
{
|
||||
self::setElement( new TypeCloseAny() );
|
||||
self::assemble( self::getElement()->loadElement( $attributes ));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,6 +83,8 @@ require_once __DIR__ . '/c/typeurl.php';
|
||||
require_once __DIR__ . '/c/typelabel.php';
|
||||
require_once __DIR__ . '/c/typeopendiv.php';
|
||||
require_once __DIR__ . '/c/typeclosediv.php';
|
||||
require_once __DIR__ . '/c/typeopenany.php';
|
||||
require_once __DIR__ . '/c/typecloseany.php';
|
||||
require_once __DIR__ . '/i/view.php';
|
||||
require_once __DIR__ . '/c/view.php';
|
||||
require_once __DIR__ . '/i/controller.php';
|
||||
|
||||
0
core/i/auth.php
Normal file → Executable file
0
core/i/auth.php
Normal file → Executable file
0
core/i/controller.php
Normal file → Executable file
0
core/i/controller.php
Normal file → Executable file
0
core/i/db.php
Normal file → Executable file
0
core/i/db.php
Normal file → Executable file
0
core/i/engine.php
Normal file → Executable file
0
core/i/engine.php
Normal file → Executable file
2
core/i/form.php
Normal file → Executable file
2
core/i/form.php
Normal file → Executable file
@@ -50,6 +50,8 @@ interface IForm
|
||||
const FORM_ATTRIBUTE_TABINDEX = 'tabindex';
|
||||
const FORM_ATTRIBUTE_DISABLED = 'disabled';
|
||||
const FORM_ATTRIBUTE_PATTERN = 'pattern';
|
||||
const FORM_ATTRIBUTE_ANY = 'any';
|
||||
const FORM_ATTRIBUTE_HREF = 'href';
|
||||
|
||||
/**
|
||||
* @desc loads the current Form element to the form
|
||||
|
||||
0
core/i/mysql.php
Normal file → Executable file
0
core/i/mysql.php
Normal file → Executable file
0
core/i/pdo.php
Normal file → Executable file
0
core/i/pdo.php
Normal file → Executable file
0
core/i/postgresql.php
Normal file → Executable file
0
core/i/postgresql.php
Normal file → Executable file
0
core/i/psql.php
Normal file → Executable file
0
core/i/psql.php
Normal file → Executable file
0
core/i/view.php
Normal file → Executable file
0
core/i/view.php
Normal file → Executable file
0
core/t/messages.php
Normal file → Executable file
0
core/t/messages.php
Normal file → Executable file
Reference in New Issue
Block a user