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:
@@ -10,12 +10,7 @@ namespace Nibiru;
|
||||
*/
|
||||
interface IController
|
||||
{
|
||||
/**
|
||||
* @desc start name for the current Controller
|
||||
* request search value for the Controller
|
||||
*/
|
||||
const START_CONTROLLER_NAME = "index";
|
||||
const CONTROLLER_REQUEST_NAME = "controller";
|
||||
|
||||
/**
|
||||
* This should be part of any extended controller
|
||||
@@ -31,23 +26,4 @@ interface IController
|
||||
|
||||
public function navigationAction();
|
||||
|
||||
/**
|
||||
* Here you can add any form data for handling in your
|
||||
* controller
|
||||
*
|
||||
* @param bool $action
|
||||
* @param string $name
|
||||
* @param string $type
|
||||
* @param bool $labeled
|
||||
* @param array $data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function formAction( $action = false, $name = <<<NAME
|
||||
NAME
|
||||
, $type = <<<METHOD
|
||||
METHOD
|
||||
, $labeled = false , $data = array()
|
||||
);
|
||||
|
||||
}
|
||||
52
core/i/db.php
Normal file
52
core/i/db.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
namespace Nibiru;
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: kasdorf
|
||||
* Date: 10.11.17
|
||||
* Time: 09:06
|
||||
*/
|
||||
|
||||
interface IDb
|
||||
{
|
||||
/**
|
||||
* @desc Has to select a given Rowset by the index ID of the table
|
||||
* @param bool $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function selectRowsetById( $id = false );
|
||||
|
||||
/**
|
||||
* @desc inserts a rowset into the table, by the given nextInsertIndex return
|
||||
* value for the table
|
||||
* @param bool $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function insertRowsetById( $rowset = array(), $id = false );
|
||||
|
||||
/**
|
||||
* @desc in order to have a page navigation a dataset should also be selectable
|
||||
* by a min and max value, result limitation
|
||||
* @param bool $min
|
||||
* @param bool $max
|
||||
* @return mixed
|
||||
*/
|
||||
public function selectDatasetByMinMax( $min = false, $max = false );
|
||||
|
||||
/**
|
||||
* @desc insert a given array by a format into the table of the database
|
||||
* @param array $dataset
|
||||
* @return mixed
|
||||
*/
|
||||
public function insertArrayIntoTable( $dataset = array() );
|
||||
|
||||
/**
|
||||
* @desc beacause there is no autoindex this has to be part of every database model
|
||||
* class, so the next index is always correctly set
|
||||
* @return mixed
|
||||
*/
|
||||
public function nextInsertIndex();
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,44 +1,38 @@
|
||||
<?php
|
||||
namespace Nibiru;
|
||||
|
||||
namespace Nibiru\Form;
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: stephan
|
||||
* Date: 24.01.17
|
||||
* Time: 10:20
|
||||
* User: mithril
|
||||
* Date: 26.01.18
|
||||
* Time: 20:59
|
||||
*/
|
||||
|
||||
interface IForm
|
||||
{
|
||||
/**
|
||||
* @desc Basic Form template
|
||||
*/
|
||||
const TYPE_FORM = "<form action=\"{action}\" method=\"{type}\" name=\"{name}\">" . "\n" . "{fields}" . "\n" . "<input type='submit' value='speichern'>\t\t" . "</form>" . "\n";
|
||||
const TYPE_FORM_FIELDSET = "<form action=\"{action}\" method=\"{type}\" name=\"{name}\">"."\n"."<fieldset><label>{flname}</label>" . "\n" . "{fields}" . "\n" . "<input type='submit' value='speichern'>" . "\t\t" . "</fieldset>"."\n"."</form>" . "\n";
|
||||
/**
|
||||
* @desc add the form action in order to set the path
|
||||
* for the controller
|
||||
* @param $action
|
||||
* @desc Constant Form attributes
|
||||
*/
|
||||
const FORM_NAME = 'name';
|
||||
const FORM_VALUE = 'value';
|
||||
const FORM_METHOD = 'method';
|
||||
const FORM_METHOD_TYPE = array('post', 'get');
|
||||
const FORM_ACTION = 'action';
|
||||
const FORM_TARGET = 'target';
|
||||
const FORM_TARGET_TYPE = array('_blank', '_self', '_parent', '_top');
|
||||
const FORM_TYPE_TEXT = 'text';
|
||||
const FORM_TYPE_SUBMIT = 'submit';
|
||||
const FORM_TYPE_BUTTON = 'button';
|
||||
const FORM_ATTRIBUTE_ROWS = 'rows';
|
||||
const FORM_ATTRIBUTE_COLS = 'cols';
|
||||
const FORM_ATTRIBUTE_SPEECH = 'speech';
|
||||
const FORM_ATTRIBUTE_SRC = 'src';
|
||||
const FORM_ATTRIBUTE_ALT = 'alt';
|
||||
const FORM_ATTRIBUTE_ID = 'id';
|
||||
|
||||
/**
|
||||
* @desc loads the current Form element to the form
|
||||
* @param $element
|
||||
* @return mixed
|
||||
*/
|
||||
public static function setFormAction($action);
|
||||
|
||||
/**
|
||||
* @desc set the form type, two types (post, get)
|
||||
* @param $type
|
||||
* @return mixed
|
||||
*/
|
||||
public static function setFormType($type);
|
||||
|
||||
/**
|
||||
* @desc set the name for the form
|
||||
* @param $name
|
||||
* @return mixed
|
||||
*/
|
||||
public static function setFormName($name);
|
||||
|
||||
/**
|
||||
* @desc display the form data on the html layout
|
||||
* @return mixed
|
||||
*/
|
||||
public function displayForm();
|
||||
public function loadElement( $attributes );
|
||||
}
|
||||
Reference in New Issue
Block a user