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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -22,7 +22,6 @@ class Controller
|
||||
|
||||
protected function __construct()
|
||||
{
|
||||
$this->_setController();
|
||||
$this->_setConfig(Config::getInstance()->getConfig());
|
||||
}
|
||||
|
||||
@@ -63,13 +62,9 @@ class Controller
|
||||
/**
|
||||
* @param string $controller
|
||||
*/
|
||||
private function _setController( )
|
||||
protected function setController( $controller )
|
||||
{
|
||||
if(array_key_exists( IController::CONTROLLER_REQUEST_NAME, $this->getRequest()) )
|
||||
{
|
||||
$this->_setNext( $this->getRequest()[IController::CONTROLLER_REQUEST_NAME] );
|
||||
$this->_controller = $this->getNext();
|
||||
}
|
||||
$this->_controller = $controller;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,7 +32,6 @@ final class Dispatcher
|
||||
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";
|
||||
|
||||
168
core/c/form.php
168
core/c/form.php
@@ -1,169 +1,69 @@
|
||||
<?php
|
||||
namespace Nibiru;
|
||||
namespace Nibiru\Form;
|
||||
use Nibiru\Adapter;
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: stephan
|
||||
* Date: 24.01.17
|
||||
* Time: 15:48
|
||||
* User: mithril
|
||||
* Date: 26.01.18
|
||||
* Time: 20:59
|
||||
*/
|
||||
|
||||
class Form implements IForm
|
||||
{
|
||||
use Messages;
|
||||
/**
|
||||
* @desc class wide parameters
|
||||
* @var
|
||||
*/
|
||||
protected static $_instance;
|
||||
private static $fieldset_name;
|
||||
private static $action;
|
||||
private static $name;
|
||||
private static $type;
|
||||
private static $fields = array();
|
||||
private static $form = self::TYPE_FORM;
|
||||
private $_attributes = array(
|
||||
self::FORM_NAME => '',
|
||||
self::FORM_METHOD => '',
|
||||
self::FORM_ACTION => '',
|
||||
self::FORM_TARGET => ''
|
||||
);
|
||||
|
||||
protected function __construct($action, $name, $type)
|
||||
{
|
||||
try {
|
||||
if($action != "")
|
||||
{
|
||||
self::setFormAction($action);
|
||||
}
|
||||
if($name != "")
|
||||
{
|
||||
self::setFormName($name);
|
||||
}
|
||||
if($type != "")
|
||||
{
|
||||
self::setFormType($type);
|
||||
}
|
||||
} catch (\Exception $e)
|
||||
{
|
||||
Debug::getInstance()->toDebug($e->getMessage());
|
||||
}
|
||||
}
|
||||
private $_element;
|
||||
|
||||
private static function setCurrentForm($form = self::TYPE_FORM)
|
||||
public function loadElement( $attributes )
|
||||
{
|
||||
if(self::getFieldsetName())
|
||||
{
|
||||
self::$form = self::TYPE_FORM_FIELDSET;
|
||||
}
|
||||
else
|
||||
{
|
||||
self::$form = $form;
|
||||
}
|
||||
}
|
||||
|
||||
protected static function getCurrentForm()
|
||||
{
|
||||
return self::$form;
|
||||
$this->_setElement();
|
||||
$this->_setAttributes( $attributes );
|
||||
return $this->getElement();
|
||||
}
|
||||
|
||||
/**
|
||||
* Call this method to get singleton
|
||||
*
|
||||
* @return Form
|
||||
* @return array
|
||||
*/
|
||||
public static function getInstance($action, $name, $type)
|
||||
protected function getAttributes( )
|
||||
{
|
||||
static $instance = null;
|
||||
if ($instance === null)
|
||||
{
|
||||
$instance = new Form($action, $name, $type);
|
||||
}
|
||||
return $instance;
|
||||
return $this->_attributes;
|
||||
}
|
||||
|
||||
public static function setFormAction($action)
|
||||
/**
|
||||
* @param array $attributes
|
||||
*/
|
||||
private function _setAttributes( $attributes )
|
||||
{
|
||||
try{
|
||||
if(is_string($action))
|
||||
{
|
||||
self::setCurrentForm(str_replace("{action}", $action, self::getCurrentForm()));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new \Exception(Messages::msg_error_string());
|
||||
}
|
||||
} catch (\Exception $e)
|
||||
foreach( $attributes as $key=>$entry )
|
||||
{
|
||||
Debug::getInstance()->toDebug($e->getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static function getFormAction()
|
||||
{
|
||||
return self::$action;
|
||||
}
|
||||
|
||||
public static function setFormName($name)
|
||||
{
|
||||
try{
|
||||
if(is_string($name))
|
||||
switch ($key)
|
||||
{
|
||||
self::setCurrentForm(str_replace("{name}", $name, self::getCurrentForm()));
|
||||
case array_key_exists($key, $this->_attributes):
|
||||
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new \Exception(Messages::msg_error_string());
|
||||
}
|
||||
} catch (\Exception $e)
|
||||
{
|
||||
Debug::getInstance()->toDebug($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @desc set the form type corresponding to the HTML5 standard
|
||||
*
|
||||
* @param $type
|
||||
* @return mixed
|
||||
*/
|
||||
public static function setFormType($type)
|
||||
protected function getElement( )
|
||||
{
|
||||
try{
|
||||
if(is_string($type))
|
||||
{
|
||||
self::setCurrentForm(str_replace("{type}", $type, self::getCurrentForm()));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new \Exception(Messages::msg_error_string());
|
||||
}
|
||||
} catch (\Exception $e)
|
||||
{
|
||||
Debug::getInstance()->toDebug($e->getMessage());
|
||||
}
|
||||
return $this->_element;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
protected static function getFieldsetName()
|
||||
{
|
||||
return self::$fieldset_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $fieldset_name
|
||||
*/
|
||||
private static function setFieldsetName( $fieldset_name )
|
||||
{
|
||||
self::$fieldset_name = $fieldset_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @desc output the form with all current fields and values
|
||||
* @param mixed $element
|
||||
*/
|
||||
public function displayForm()
|
||||
private function _setElement( )
|
||||
{
|
||||
// TODO: Implement displayForm() method.
|
||||
$this->_element = '<form action="ACTION" method="METHOD" name="NAME" target="TARGET">' . "\n" . 'FIELDS</form>' . "\n";
|
||||
}
|
||||
|
||||
public function addFieldset($name)
|
||||
{
|
||||
self::setFieldsetName($name);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,7 @@ final class Pdo extends Mysql implements IPdo
|
||||
|
||||
public static function fetchRowInArrayById($tablename = self::PLACE_TABLE_NAME, $id = self::NO_ID )
|
||||
{
|
||||
$result = array();
|
||||
$statement = parent::getInstance()->getConn();
|
||||
$describe = $statement->query('DESC ' . $tablename);
|
||||
$describe->execute();
|
||||
@@ -48,7 +49,8 @@ final class Pdo extends Mysql implements IPdo
|
||||
}
|
||||
$prepare = $statement->prepare("SELECT * FROM " . $tablename . " WHERE " . $id_name . " = :" . $id_name . ";");
|
||||
$prepare->execute($id);
|
||||
$rowset = array_shift($prepare->fetchAll());
|
||||
$fetchAll = $prepare->fetchAll();
|
||||
$rowset = array_shift($fetchAll);
|
||||
|
||||
foreach(array_keys($rowset) as $entry)
|
||||
{
|
||||
|
||||
@@ -16,6 +16,7 @@ class Router extends Config
|
||||
private static $_instance;
|
||||
private static $_cur_page;
|
||||
private static $_routes = array();
|
||||
private static $_action;
|
||||
|
||||
protected function __construct()
|
||||
{
|
||||
@@ -33,8 +34,9 @@ class Router extends Config
|
||||
private static function loadRouting()
|
||||
{
|
||||
Config::setConfig(Config::getInstance()->getEnv());
|
||||
self::$_routing = Config::getInstance()->getConfig()[View::ATM_ROUTING];
|
||||
self::$_routing = Config::getInstance()->getConfig()[View::NIBIRU_ROUTING];
|
||||
self::setRoutes(self::$_routing);
|
||||
self::setCurRoute();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,11 +50,15 @@ class Router extends Config
|
||||
/**
|
||||
* @param mixed $cur_route
|
||||
*/
|
||||
private static function _setCurRoute( )
|
||||
private static function setCurRoute( )
|
||||
{
|
||||
if( Controller::getInstance()->getController() != IController::START_CONTROLLER_NAME )
|
||||
if( self::getCurPage() != IController::START_CONTROLLER_NAME )
|
||||
{
|
||||
self::$_cur_route = Controller::getInstance()->getController();
|
||||
self::$_cur_route = self::getCurPage();
|
||||
if(self::getAction())
|
||||
{
|
||||
self::$_cur_route .= '/' . self::getAction() . '/';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -76,7 +82,21 @@ class Router extends Config
|
||||
self::$_routes = $routes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
protected static function getAction()
|
||||
{
|
||||
return self::$_action;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $action
|
||||
*/
|
||||
private static function setAction( $action )
|
||||
{
|
||||
$_REQUEST['_action'] = $action;
|
||||
}
|
||||
|
||||
public function route()
|
||||
{
|
||||
@@ -118,7 +138,6 @@ class Router extends Config
|
||||
*/
|
||||
private static function setCurPage( )
|
||||
{
|
||||
self::_setCurRoute();
|
||||
if( self::getCurRoute() == null )
|
||||
{
|
||||
$uri_parts = explode('/', $_SERVER["REQUEST_URI"]);
|
||||
@@ -131,6 +150,10 @@ class Router extends Config
|
||||
else
|
||||
{
|
||||
self::$_cur_page = $uri_parts[1];
|
||||
if(array_key_exists(2, $uri_parts))
|
||||
{
|
||||
self::setAction($uri_parts[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -138,7 +161,6 @@ class Router extends Config
|
||||
{
|
||||
self::$_cur_page = self::getCurRoute();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -80,7 +80,7 @@ class Settings
|
||||
}
|
||||
else
|
||||
{
|
||||
self::$_config = parse_ini_file('../' . self::SETTINGS_PATH . $current_settings_file, View::ATM_SETTINGS);
|
||||
self::$_config = parse_ini_file('../' . self::SETTINGS_PATH . $current_settings_file, View::NIBIRU_SETTINGS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
71
core/c/typecheckbox.php
Normal file
71
core/c/typecheckbox.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
namespace Nibiru\Form;
|
||||
use Nibiru\Adapter;
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mithril
|
||||
* Date: 26.01.18
|
||||
* Time: 21:42
|
||||
*/
|
||||
|
||||
class TypeCheckbox implements IForm
|
||||
{
|
||||
private $_attributes = array(
|
||||
self::FORM_NAME => '',
|
||||
self::FORM_VALUE => ''
|
||||
);
|
||||
|
||||
private $_element;
|
||||
|
||||
public function loadElement( $attributes )
|
||||
{
|
||||
$this->_setElement();
|
||||
$this->_setAttributes( $attributes );
|
||||
return $this->getElement();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getAttributes( )
|
||||
{
|
||||
return $this->_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $attributes
|
||||
*/
|
||||
private function _setAttributes( $attributes )
|
||||
{
|
||||
foreach( $attributes as $key=>$entry )
|
||||
{
|
||||
switch ($key)
|
||||
{
|
||||
case array_key_exists($key, $this->_attributes):
|
||||
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getElement( )
|
||||
{
|
||||
return $this->_element;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: Impplement the linebreak optional
|
||||
* @param mixed $element
|
||||
*/
|
||||
private function _setElement( )
|
||||
{
|
||||
$this->_element = '<input type="checkbox" name="NAME" value="VALUE">' . 'VALUE<br>' . "\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
69
core/c/typecolor.php
Normal file
69
core/c/typecolor.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
namespace Nibiru\Form;
|
||||
use Nibiru\Adapter;
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mithril
|
||||
* Date: 26.01.18
|
||||
* Time: 21:42
|
||||
*/
|
||||
|
||||
class TypeColor implements IForm
|
||||
{
|
||||
private $_attributes = array(
|
||||
self::FORM_VALUE => ''
|
||||
);
|
||||
|
||||
private $_element;
|
||||
|
||||
public function loadElement( $attributes )
|
||||
{
|
||||
$this->_setElement();
|
||||
$this->_setAttributes( $attributes );
|
||||
return $this->getElement();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getAttributes( )
|
||||
{
|
||||
return $this->_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $attributes
|
||||
*/
|
||||
private function _setAttributes( $attributes )
|
||||
{
|
||||
foreach( $attributes as $key=>$entry )
|
||||
{
|
||||
switch ($key)
|
||||
{
|
||||
case array_key_exists($key, $this->_attributes):
|
||||
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getElement( )
|
||||
{
|
||||
return $this->_element;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $element
|
||||
*/
|
||||
private function _setElement( )
|
||||
{
|
||||
$this->_element = '<input type="color" name="NAME" value="VALUE">' . "\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
70
core/c/typedate.php
Normal file
70
core/c/typedate.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
namespace Nibiru\Form;
|
||||
use Nibiru\Adapter;
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mithril
|
||||
* Date: 26.01.18
|
||||
* Time: 21:42
|
||||
*/
|
||||
|
||||
class TypeDate implements IForm
|
||||
{
|
||||
private $_attributes = array(
|
||||
self::FORM_VALUE => '',
|
||||
self::FORM_NAME => ''
|
||||
);
|
||||
|
||||
private $_element;
|
||||
|
||||
public function loadElement( $attributes )
|
||||
{
|
||||
$this->_setElement();
|
||||
$this->_setAttributes( $attributes );
|
||||
return $this->getElement();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getAttributes( )
|
||||
{
|
||||
return $this->_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $attributes
|
||||
*/
|
||||
private function _setAttributes( $attributes )
|
||||
{
|
||||
foreach( $attributes as $key=>$entry )
|
||||
{
|
||||
switch ($key)
|
||||
{
|
||||
case array_key_exists($key, $this->_attributes):
|
||||
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getElement( )
|
||||
{
|
||||
return $this->_element;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $element
|
||||
*/
|
||||
private function _setElement( )
|
||||
{
|
||||
$this->_element = '<input type="date" name="NAME" value="VALUE">' . "\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
70
core/c/typedatetime.php
Normal file
70
core/c/typedatetime.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
namespace Nibiru\Form;
|
||||
use Nibiru\Adapter;
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mithril
|
||||
* Date: 26.01.18
|
||||
* Time: 21:42
|
||||
*/
|
||||
|
||||
class TypeDatetime implements IForm
|
||||
{
|
||||
private $_attributes = array(
|
||||
self::FORM_VALUE => '',
|
||||
self::FORM_NAME => ''
|
||||
);
|
||||
|
||||
private $_element;
|
||||
|
||||
public function loadElement( $attributes )
|
||||
{
|
||||
$this->_setElement();
|
||||
$this->_setAttributes( $attributes );
|
||||
return $this->getElement();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getAttributes( )
|
||||
{
|
||||
return $this->_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $attributes
|
||||
*/
|
||||
private function _setAttributes( $attributes )
|
||||
{
|
||||
foreach( $attributes as $key=>$entry )
|
||||
{
|
||||
switch ($key)
|
||||
{
|
||||
case array_key_exists($key, $this->_attributes):
|
||||
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getElement( )
|
||||
{
|
||||
return $this->_element;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $element
|
||||
*/
|
||||
private function _setElement( )
|
||||
{
|
||||
$this->_element = '<input type="datetime-local" name="NAME" value="VALUE">' . "\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
69
core/c/typeemail.php
Normal file
69
core/c/typeemail.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
namespace Nibiru\Form;
|
||||
use Nibiru\Adapter;
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mithril
|
||||
* Date: 26.01.18
|
||||
* Time: 21:42
|
||||
*/
|
||||
|
||||
class TypeEmail implements IForm
|
||||
{
|
||||
private $_attributes = array(
|
||||
self::FORM_NAME => ''
|
||||
);
|
||||
|
||||
private $_element;
|
||||
|
||||
public function loadElement( $attributes )
|
||||
{
|
||||
$this->_setElement();
|
||||
$this->_setAttributes( $attributes );
|
||||
return $this->getElement();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getAttributes( )
|
||||
{
|
||||
return $this->_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $attributes
|
||||
*/
|
||||
private function _setAttributes( $attributes )
|
||||
{
|
||||
foreach( $attributes as $key=>$entry )
|
||||
{
|
||||
switch ($key)
|
||||
{
|
||||
case array_key_exists($key, $this->_attributes):
|
||||
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getElement( )
|
||||
{
|
||||
return $this->_element;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $element
|
||||
*/
|
||||
private function _setElement( )
|
||||
{
|
||||
$this->_element = '<input type="email" name="NAME">' . "\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
70
core/c/typefileupload.php
Normal file
70
core/c/typefileupload.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
namespace Nibiru\Form;
|
||||
use Nibiru\Adapter;
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Stephan Kasdorf
|
||||
* Date: 26.01.18
|
||||
* Time: 21:42
|
||||
*/
|
||||
|
||||
class TypeFileUpload implements IForm
|
||||
{
|
||||
private $_attributes = array(
|
||||
self::FORM_NAME => ''
|
||||
|
||||
);
|
||||
|
||||
private $_element;
|
||||
|
||||
public function loadElement( $attributes )
|
||||
{
|
||||
$this->_setElement();
|
||||
$this->_setAttributes( $attributes );
|
||||
return $this->getElement();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getAttributes( )
|
||||
{
|
||||
return $this->_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $attributes
|
||||
*/
|
||||
private function _setAttributes( $attributes )
|
||||
{
|
||||
foreach( $attributes as $key=>$entry )
|
||||
{
|
||||
switch ($key)
|
||||
{
|
||||
case array_key_exists($key, $this->_attributes):
|
||||
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getElement( )
|
||||
{
|
||||
return $this->_element;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $element
|
||||
*/
|
||||
private function _setElement( )
|
||||
{
|
||||
$this->_element = '<input type="file" name="NAME">' . "\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
71
core/c/typehidden.php
Normal file
71
core/c/typehidden.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
namespace Nibiru\Form;
|
||||
use Nibiru\Adapter;
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mithril
|
||||
* Date: 26.01.18
|
||||
* Time: 21:42
|
||||
*/
|
||||
|
||||
class TypeHidden implements IForm
|
||||
{
|
||||
private $_attributes = array(
|
||||
self::FORM_NAME => '',
|
||||
self::FORM_VALUE => ''
|
||||
|
||||
);
|
||||
|
||||
private $_element;
|
||||
|
||||
public function loadElement( $attributes )
|
||||
{
|
||||
$this->_setElement();
|
||||
$this->_setAttributes( $attributes );
|
||||
return $this->getElement();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getAttributes( )
|
||||
{
|
||||
return $this->_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $attributes
|
||||
*/
|
||||
private function _setAttributes( $attributes )
|
||||
{
|
||||
foreach( $attributes as $key=>$entry )
|
||||
{
|
||||
switch ($key)
|
||||
{
|
||||
case array_key_exists($key, $this->_attributes):
|
||||
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getElement( )
|
||||
{
|
||||
return $this->_element;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $element
|
||||
*/
|
||||
private function _setElement( )
|
||||
{
|
||||
$this->_element = '<input type="hidden" value="VALUE" name="NAME">' . "\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
70
core/c/typeimagesubmit.php
Normal file
70
core/c/typeimagesubmit.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
namespace Nibiru\Form;
|
||||
use Nibiru\Adapter;
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mithril
|
||||
* Date: 26.01.18
|
||||
* Time: 21:42
|
||||
*/
|
||||
|
||||
class TypeImageSubmit implements IForm
|
||||
{
|
||||
private $_attributes = array(
|
||||
self::FORM_ATTRIBUTE_SRC => ''
|
||||
|
||||
);
|
||||
|
||||
private $_element;
|
||||
|
||||
public function loadElement( $attributes )
|
||||
{
|
||||
$this->_setElement();
|
||||
$this->_setAttributes( $attributes );
|
||||
return $this->getElement();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getAttributes( )
|
||||
{
|
||||
return $this->_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $attributes
|
||||
*/
|
||||
private function _setAttributes( $attributes )
|
||||
{
|
||||
foreach( $attributes as $key=>$entry )
|
||||
{
|
||||
switch ($key)
|
||||
{
|
||||
case array_key_exists($key, $this->_attributes):
|
||||
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getElement( )
|
||||
{
|
||||
return $this->_element;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $element
|
||||
*/
|
||||
private function _setElement( )
|
||||
{
|
||||
$this->_element = '<input type="image" src="SRC">' . "\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
70
core/c/typenumber.php
Normal file
70
core/c/typenumber.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
namespace Nibiru\Form;
|
||||
use Nibiru\Adapter;
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mithril
|
||||
* Date: 26.01.18
|
||||
* Time: 21:42
|
||||
*/
|
||||
|
||||
class TypeNumber implements IForm
|
||||
{
|
||||
private $_attributes = array(
|
||||
self::FORM_NAME => '',
|
||||
self::FORM_VALUE => ''
|
||||
);
|
||||
|
||||
private $_element;
|
||||
|
||||
public function loadElement( $attributes )
|
||||
{
|
||||
$this->_setElement();
|
||||
$this->_setAttributes( $attributes );
|
||||
return $this->getElement();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getAttributes( )
|
||||
{
|
||||
return $this->_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $attributes
|
||||
*/
|
||||
private function _setAttributes( $attributes )
|
||||
{
|
||||
foreach( $attributes as $key=>$entry )
|
||||
{
|
||||
switch ($key)
|
||||
{
|
||||
case array_key_exists($key, $this->_attributes):
|
||||
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getElement( )
|
||||
{
|
||||
return $this->_element;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $element
|
||||
*/
|
||||
private function _setElement( )
|
||||
{
|
||||
$this->_element = '<input type="number" name="NAME" value="VALUE">' . "\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
69
core/c/typeoption.php
Normal file
69
core/c/typeoption.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
namespace Nibiru\Form;
|
||||
use Nibiru\Adapter;
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mithril
|
||||
* Date: 26.01.18
|
||||
* Time: 21:42
|
||||
*/
|
||||
|
||||
class TypeOption implements IForm
|
||||
{
|
||||
private $_attributes = array(
|
||||
self::FORM_VALUE => ''
|
||||
);
|
||||
|
||||
private $_element;
|
||||
|
||||
public function loadElement( $attributes )
|
||||
{
|
||||
$this->_setElement();
|
||||
$this->_setAttributes( $attributes );
|
||||
return $this->getElement();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getAttributes( )
|
||||
{
|
||||
return $this->_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $attributes
|
||||
*/
|
||||
private function _setAttributes( $attributes )
|
||||
{
|
||||
foreach( $attributes as $key=>$entry )
|
||||
{
|
||||
switch ($key)
|
||||
{
|
||||
case array_key_exists($key, $this->_attributes):
|
||||
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getElement( )
|
||||
{
|
||||
return $this->_element;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $element
|
||||
*/
|
||||
private function _setElement( )
|
||||
{
|
||||
$this->_element = '<option value="VALUE">VALUE</option>' . "\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
69
core/c/typepassword.php
Normal file
69
core/c/typepassword.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
namespace Nibiru\Form;
|
||||
use Nibiru\Adapter;
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mithril
|
||||
* Date: 26.01.18
|
||||
* Time: 21:42
|
||||
*/
|
||||
|
||||
class TypePassword implements IForm
|
||||
{
|
||||
private $_attributes = array(
|
||||
self::FORM_NAME => ''
|
||||
);
|
||||
|
||||
private $_element;
|
||||
|
||||
public function loadElement( $attributes )
|
||||
{
|
||||
$this->_setElement();
|
||||
$this->_setAttributes( $attributes );
|
||||
return $this->getElement();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getAttributes( )
|
||||
{
|
||||
return $this->_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $attributes
|
||||
*/
|
||||
private function _setAttributes( $attributes )
|
||||
{
|
||||
foreach( $attributes as $key=>$entry )
|
||||
{
|
||||
switch ($key)
|
||||
{
|
||||
case array_key_exists($key, $this->_attributes):
|
||||
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getElement( )
|
||||
{
|
||||
return $this->_element;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $element
|
||||
*/
|
||||
private function _setElement( )
|
||||
{
|
||||
$this->_element = '<input type="password" name="NAME">' . "\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
71
core/c/typeradio.php
Normal file
71
core/c/typeradio.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
namespace Nibiru\Form;
|
||||
use Nibiru\Adapter;
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mithril
|
||||
* Date: 26.01.18
|
||||
* Time: 21:42
|
||||
*/
|
||||
|
||||
class TypeRadio implements IForm
|
||||
{
|
||||
private $_attributes = array(
|
||||
self::FORM_NAME => '',
|
||||
self::FORM_VALUE => ''
|
||||
);
|
||||
|
||||
private $_element;
|
||||
|
||||
public function loadElement( $attributes )
|
||||
{
|
||||
$this->_setElement();
|
||||
$this->_setAttributes( $attributes );
|
||||
return $this->getElement();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getAttributes( )
|
||||
{
|
||||
return $this->_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $attributes
|
||||
*/
|
||||
private function _setAttributes( $attributes )
|
||||
{
|
||||
foreach( $attributes as $key=>$entry )
|
||||
{
|
||||
switch ($key)
|
||||
{
|
||||
case array_key_exists($key, $this->_attributes):
|
||||
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getElement( )
|
||||
{
|
||||
return $this->_element;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: Impplement the linebreak optional
|
||||
* @param mixed $element
|
||||
*/
|
||||
private function _setElement( )
|
||||
{
|
||||
$this->_element = '<input type="radio" name="NAME" value="VALUE">' . 'VALUE<br>' . "\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
70
core/c/typerange.php
Normal file
70
core/c/typerange.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
namespace Nibiru\Form;
|
||||
use Nibiru\Adapter;
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mithril
|
||||
* Date: 26.01.18
|
||||
* Time: 21:42
|
||||
*/
|
||||
|
||||
class TypeRange implements IForm
|
||||
{
|
||||
private $_attributes = array(
|
||||
self::FORM_NAME => '',
|
||||
self::FORM_VALUE => ''
|
||||
);
|
||||
|
||||
private $_element;
|
||||
|
||||
public function loadElement( $attributes )
|
||||
{
|
||||
$this->_setElement();
|
||||
$this->_setAttributes( $attributes );
|
||||
return $this->getElement();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getAttributes( )
|
||||
{
|
||||
return $this->_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $attributes
|
||||
*/
|
||||
private function _setAttributes( $attributes )
|
||||
{
|
||||
foreach( $attributes as $key=>$entry )
|
||||
{
|
||||
switch ($key)
|
||||
{
|
||||
case array_key_exists($key, $this->_attributes):
|
||||
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getElement( )
|
||||
{
|
||||
return $this->_element;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $element
|
||||
*/
|
||||
private function _setElement( )
|
||||
{
|
||||
$this->_element = '<input type="range" name="NAME" value="VALUE">' . "\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
69
core/c/typereset.php
Normal file
69
core/c/typereset.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
namespace Nibiru\Form;
|
||||
use Nibiru\Adapter;
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mithril
|
||||
* Date: 26.01.18
|
||||
* Time: 21:42
|
||||
*/
|
||||
|
||||
class TypeReset implements IForm
|
||||
{
|
||||
private $_attributes = array(
|
||||
self::FORM_VALUE => ''
|
||||
);
|
||||
|
||||
private $_element;
|
||||
|
||||
public function loadElement( $attributes )
|
||||
{
|
||||
$this->_setElement();
|
||||
$this->_setAttributes( $attributes );
|
||||
return $this->getElement();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getAttributes( )
|
||||
{
|
||||
return $this->_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $attributes
|
||||
*/
|
||||
private function _setAttributes( $attributes )
|
||||
{
|
||||
foreach( $attributes as $key=>$entry )
|
||||
{
|
||||
switch ($key)
|
||||
{
|
||||
case array_key_exists($key, $this->_attributes):
|
||||
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getElement( )
|
||||
{
|
||||
return $this->_element;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $element
|
||||
*/
|
||||
private function _setElement( )
|
||||
{
|
||||
$this->_element = '<input type="reset" value="VALUE">' . "\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
69
core/c/typesearch.php
Normal file
69
core/c/typesearch.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
namespace Nibiru\Form;
|
||||
use Nibiru\Adapter;
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mithril
|
||||
* Date: 26.01.18
|
||||
* Time: 21:42
|
||||
*/
|
||||
|
||||
class TypeSearch implements IForm
|
||||
{
|
||||
private $_attributes = array(
|
||||
|
||||
);
|
||||
|
||||
private $_element;
|
||||
|
||||
public function loadElement( $attributes )
|
||||
{
|
||||
$this->_setElement();
|
||||
$this->_setAttributes( $attributes );
|
||||
return $this->getElement();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getAttributes( )
|
||||
{
|
||||
return $this->_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $attributes
|
||||
*/
|
||||
private function _setAttributes( $attributes )
|
||||
{
|
||||
foreach( $attributes as $key=>$entry )
|
||||
{
|
||||
switch ($key)
|
||||
{
|
||||
case array_key_exists($key, $this->_attributes):
|
||||
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getElement( )
|
||||
{
|
||||
return $this->_element;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $element
|
||||
*/
|
||||
private function _setElement( )
|
||||
{
|
||||
$this->_element = '<input type="search">' . "\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
69
core/c/typeselect.php
Normal file
69
core/c/typeselect.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
namespace Nibiru\Form;
|
||||
use Nibiru\Adapter;
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mithril
|
||||
* Date: 26.01.18
|
||||
* Time: 21:42
|
||||
*/
|
||||
|
||||
class TypeSelect implements IForm
|
||||
{
|
||||
private $_attributes = array(
|
||||
self::FORM_NAME => ''
|
||||
);
|
||||
|
||||
private $_element;
|
||||
|
||||
public function loadElement( $attributes )
|
||||
{
|
||||
$this->_setElement();
|
||||
$this->_setAttributes( $attributes );
|
||||
return $this->getElement();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getAttributes( )
|
||||
{
|
||||
return $this->_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $attributes
|
||||
*/
|
||||
private function _setAttributes( $attributes )
|
||||
{
|
||||
foreach( $attributes as $key=>$entry )
|
||||
{
|
||||
switch ($key)
|
||||
{
|
||||
case array_key_exists($key, $this->_attributes):
|
||||
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getElement( )
|
||||
{
|
||||
return $this->_element;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $element
|
||||
*/
|
||||
private function _setElement( )
|
||||
{
|
||||
$this->_element = '<select name="NAME">' . "\n" . 'OPTIONS' . "\n" . '</select>' . "\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
69
core/c/typesubmit.php
Normal file
69
core/c/typesubmit.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
namespace Nibiru\Form;
|
||||
use Nibiru\Adapter;
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mithril
|
||||
* Date: 26.01.18
|
||||
* Time: 21:42
|
||||
*/
|
||||
|
||||
class TypeSubmit implements IForm
|
||||
{
|
||||
private $_attributes = array(
|
||||
self::FORM_VALUE => ''
|
||||
);
|
||||
|
||||
private $_element;
|
||||
|
||||
public function loadElement( $attributes )
|
||||
{
|
||||
$this->_setElement();
|
||||
$this->_setAttributes( $attributes );
|
||||
return $this->getElement();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getAttributes( )
|
||||
{
|
||||
return $this->_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $attributes
|
||||
*/
|
||||
private function _setAttributes( $attributes )
|
||||
{
|
||||
foreach( $attributes as $key=>$entry )
|
||||
{
|
||||
switch ($key)
|
||||
{
|
||||
case array_key_exists($key, $this->_attributes):
|
||||
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getElement( )
|
||||
{
|
||||
return $this->_element;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $element
|
||||
*/
|
||||
private function _setElement( )
|
||||
{
|
||||
$this->_element = '<input type="submit" value="VALUE">' . "\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
70
core/c/typetelefon.php
Normal file
70
core/c/typetelefon.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
namespace Nibiru\Form;
|
||||
use Nibiru\Adapter;
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Stephan Kasdorf
|
||||
* Date: 26.01.18
|
||||
* Time: 21:42
|
||||
*/
|
||||
|
||||
class TypeTelefon implements IForm
|
||||
{
|
||||
private $_attributes = array(
|
||||
self::FORM_NAME => '',
|
||||
self::FORM_VALUE
|
||||
);
|
||||
|
||||
private $_element;
|
||||
|
||||
public function loadElement( $attributes )
|
||||
{
|
||||
$this->_setElement();
|
||||
$this->_setAttributes( $attributes );
|
||||
return $this->getElement();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getAttributes( )
|
||||
{
|
||||
return $this->_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $attributes
|
||||
*/
|
||||
private function _setAttributes( $attributes )
|
||||
{
|
||||
foreach( $attributes as $key=>$entry )
|
||||
{
|
||||
switch ($key)
|
||||
{
|
||||
case array_key_exists($key, $this->_attributes):
|
||||
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getElement( )
|
||||
{
|
||||
return $this->_element;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $element
|
||||
*/
|
||||
private function _setElement( )
|
||||
{
|
||||
$this->_element = '<input type="tel" name="NAME" value="VALUE">' . "\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
79
core/c/typetext.php
Normal file
79
core/c/typetext.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
namespace Nibiru\Form;
|
||||
use Nibiru\Adapter;
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mithril
|
||||
* Date: 26.01.18
|
||||
* Time: 21:42
|
||||
*/
|
||||
|
||||
class TypeText implements IForm
|
||||
{
|
||||
private $_attributes = array(
|
||||
self::FORM_NAME => '',
|
||||
self::FORM_VALUE => '',
|
||||
self::FORM_ATTRIBUTE_SPEECH => ''
|
||||
);
|
||||
|
||||
private $_element;
|
||||
|
||||
public function loadElement( $attributes )
|
||||
{
|
||||
if(!array_key_exists('speech', $attributes))
|
||||
{
|
||||
$attributes['speech'] = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$attributes['speech'] = ' x-webkit-speech';
|
||||
}
|
||||
$this->_setElement();
|
||||
$this->_setAttributes( $attributes );
|
||||
return $this->getElement();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getAttributes( )
|
||||
{
|
||||
return $this->_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $attributes
|
||||
*/
|
||||
private function _setAttributes( $attributes )
|
||||
{
|
||||
foreach( $attributes as $key=>$entry )
|
||||
{
|
||||
switch ($key)
|
||||
{
|
||||
case array_key_exists($key, $this->_attributes):
|
||||
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getElement( )
|
||||
{
|
||||
return $this->_element;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $element
|
||||
*/
|
||||
private function _setElement( )
|
||||
{
|
||||
$this->_element = '<input type="text" name="NAME" value="VALUE"SPEECH>' . "\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
72
core/c/typetextarea.php
Normal file
72
core/c/typetextarea.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
namespace Nibiru\Form;
|
||||
use Nibiru\Adapter;
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mithril
|
||||
* Date: 26.01.18
|
||||
* Time: 21:42
|
||||
*/
|
||||
|
||||
class TypeTextarea implements IForm
|
||||
{
|
||||
private $_attributes = array(
|
||||
self::FORM_ATTRIBUTE_COLS => '',
|
||||
self::FORM_VALUE => '',
|
||||
self::FORM_ATTRIBUTE_ROWS => '',
|
||||
self::FORM_NAME => ''
|
||||
);
|
||||
|
||||
private $_element;
|
||||
|
||||
public function loadElement( $attributes )
|
||||
{
|
||||
$this->_setElement();
|
||||
$this->_setAttributes( $attributes );
|
||||
return $this->getElement();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getAttributes( )
|
||||
{
|
||||
return $this->_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $attributes
|
||||
*/
|
||||
private function _setAttributes( $attributes )
|
||||
{
|
||||
foreach( $attributes as $key=>$entry )
|
||||
{
|
||||
switch ($key)
|
||||
{
|
||||
case array_key_exists($key, $this->_attributes):
|
||||
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getElement( )
|
||||
{
|
||||
return $this->_element;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $element
|
||||
*/
|
||||
private function _setElement( )
|
||||
{
|
||||
$this->_element = '<textarea name="NAME" rows="ROWS" cols="COLS">' . "\n" . "VALUE" . "\n" . '</textarea>' . "\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
69
core/c/typeurl.php
Normal file
69
core/c/typeurl.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
namespace Nibiru\Form;
|
||||
use Nibiru\Adapter;
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mithril
|
||||
* Date: 26.01.18
|
||||
* Time: 21:42
|
||||
*/
|
||||
|
||||
class TypeUrl implements IForm
|
||||
{
|
||||
private $_attributes = array(
|
||||
|
||||
);
|
||||
|
||||
private $_element;
|
||||
|
||||
public function loadElement( $attributes )
|
||||
{
|
||||
$this->_setElement();
|
||||
$this->_setAttributes( $attributes );
|
||||
return $this->getElement();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getAttributes( )
|
||||
{
|
||||
return $this->_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $attributes
|
||||
*/
|
||||
private function _setAttributes( $attributes )
|
||||
{
|
||||
foreach( $attributes as $key=>$entry )
|
||||
{
|
||||
switch ($key)
|
||||
{
|
||||
case array_key_exists($key, $this->_attributes):
|
||||
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getElement( )
|
||||
{
|
||||
return $this->_element;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $element
|
||||
*/
|
||||
private function _setElement( )
|
||||
{
|
||||
$this->_element = '<input type="url">' . "\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -12,9 +12,10 @@ class View extends Controller implements IView
|
||||
{
|
||||
private static $_instance;
|
||||
|
||||
const ATM_SETTINGS = "SETTINGS";
|
||||
const ATM_ROUTING = "ROUTING";
|
||||
const ATM_FILE_END = ".tpl";
|
||||
const NIBIRU_SETTINGS = "SETTINGS";
|
||||
const NIBIRU_SECURITY = "SECURITY";
|
||||
const NIBIRU_ROUTING = "ROUTING";
|
||||
const NIBIRU_FILE_END = ".tpl";
|
||||
|
||||
private static $smarty = array();
|
||||
private static $engine = array();
|
||||
@@ -99,10 +100,10 @@ class View extends Controller implements IView
|
||||
|
||||
public function display( $page )
|
||||
{
|
||||
preg_match_all("/".self::ATM_FILE_END."/", $page, $matches);
|
||||
if(!array_key_exists(self::ATM_FILE_END, array_flip(array_shift($matches))))
|
||||
preg_match_all("/".self::NIBIRU_FILE_END."/", $page, $matches);
|
||||
if(!array_key_exists(self::NIBIRU_FILE_END, array_flip(array_shift($matches))))
|
||||
{
|
||||
$page = str_replace("/", "", $page) . self::ATM_FILE_END;
|
||||
$page = str_replace("/", "", $page) . self::NIBIRU_FILE_END;
|
||||
}
|
||||
Controller::getInstance()->action( $this->getEngine(), $page );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user