VERSION UPDATE: beta 0.6.0 see the readme.md document
This commit is contained in:
17
README.md
17
README.md
@@ -1,6 +1,6 @@
|
||||
# Nibiru
|
||||
### Rapid Prototyping PHP Framework
|
||||
Version 0.4.0 beta
|
||||
Version 0.6.0 beta
|
||||
## Introduction
|
||||
|
||||
<div style="word-spacing: 2px; letter-spacing: 0.1px; font-size: 12px; margin-bottom: 15px;">Nibiru is a rapid prototyping framework written in PHP and based on the MVC design pattern. Now one may say that writing <br>
|
||||
@@ -67,8 +67,7 @@ Engine Implementation.</div>
|
||||
<li>The Database access can now be implemented anywhere in your application by adding the namespace to your database accessing Logic:<br>use Nibiru\Factory\Db;</li>
|
||||
</ul>
|
||||
</div>
|
||||
<h1>Previous version</h1>
|
||||
<h1>Version 0.3.5 beta 14.03.2018</h1>
|
||||
<p>Version 0.3.5 beta 14.03.2018</p>
|
||||
<ul>
|
||||
<li>Bugfix on the Router, now the currentPage will be returned correctly.</li>
|
||||
<li>Update for the database adapter, a detailed instruction on how to use it will be within the soon comming documentation</li>
|
||||
@@ -77,7 +76,7 @@ Engine Implementation.</div>
|
||||
<li>Minor bugfixing</li>
|
||||
</ul>
|
||||
|
||||
<h1>Update</h1>
|
||||
<h1>Previous version</h1>
|
||||
<p>Version 0.4.0 beta 28.08.2018</p>
|
||||
<ul>
|
||||
<li>Minor update concerning the autoloading class in the core, now it is also possible to give a loading order through the configuration</li>
|
||||
@@ -86,5 +85,15 @@ Engine Implementation.</div>
|
||||
<li>Update for multidatabase support, see the documentation on http://www.nibiru-framework.com</li>
|
||||
</ul>
|
||||
|
||||
<h1>Update</h1>
|
||||
<p>Version 0.5.0 beta 05.12.2018</p>
|
||||
<ul>
|
||||
<li>Added a Pagination to the core it now can be used like in the template file Example, the class just needs to be extended by the module that should have a pageination (e.g. a Blog Module)</li>
|
||||
<li>Some extensions for the Routing option, in order to parmeterize the url.</li>
|
||||
<li>Name fixing.</li>
|
||||
<li>Added an additional attribute for the navigation, so the navigation position can be set to footer.</li>
|
||||
<li>A soap extension will not be part of the system anymore, since that is just a bad habit, so this will be replaced with a REST api.</li>
|
||||
</ul>
|
||||
|
||||
<div style="word-spacing: 2px; letter-spacing: 0.1px; font-size: 15px; margin-bottom: 15px;">The start is done, have success with PHP prototyping, and always remember to have fun!</div>
|
||||
Author: Stephan Kasdorf<br><br>
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"navigation" :
|
||||
{
|
||||
"Home": { "link": "/", "tooltip": "Home", "icon": "icon icon-home" }
|
||||
"Home": { "link": "/", "tooltip": "Home", "icon": "icon icon-home", "footer": "false" }
|
||||
}
|
||||
}
|
||||
16
application/view/templates/pageination.tpl
Executable file
16
application/view/templates/pageination.tpl
Executable file
@@ -0,0 +1,16 @@
|
||||
<!-- This file is just for an idea of the integration concerning a pagination -->
|
||||
<div class="pagination">
|
||||
<ul>
|
||||
<li class="prev"><a href="{$pagination.paginationPath}{$pagination.previous}"><i class="pe-7s-angle-left pe-2x"></i></a></li>
|
||||
{foreach item=page from=$pagination key="key"}
|
||||
{if $key|@is_numeric}
|
||||
{if $page.page==$pagination.current}
|
||||
<li class="active"><a href="{$pagination.paginationPath}{$page.page}">{$page.page}</a></li>
|
||||
{else}
|
||||
<li><a href="{$pagination.paginationPath}{$page.page}">{$page.page}</a></li>
|
||||
{/if}
|
||||
{/if}
|
||||
{/foreach}
|
||||
<li class="next"><a href="{$pagination.paginationPath}{$pagination.next}"><i class="pe-7s-angle-right pe-2x"></i></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
323
core/a/pageination.php
Executable file
323
core/a/pageination.php
Executable file
@@ -0,0 +1,323 @@
|
||||
<?php
|
||||
namespace Nibiru;
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mithril
|
||||
* Date: 15.09.18
|
||||
* Time: 03:16
|
||||
*/
|
||||
|
||||
abstract class Pageination implements IPageination
|
||||
{
|
||||
use Attributes\Pageination;
|
||||
|
||||
private static $_table = false;
|
||||
private static $_current_page_content = array();
|
||||
private static $_current_number = 0;
|
||||
private static $_next_page_number = +1;
|
||||
private static $_previous_page_number = -1;
|
||||
private static $_max_pages = 0;
|
||||
private static $_entries_per_page = 5;
|
||||
private static $_page_entry_index = array();
|
||||
private static $_max_page_entries = 0;
|
||||
private static $_uri_pagination_path = '';
|
||||
|
||||
private static function setUriPaginationPath()
|
||||
{
|
||||
self::$_uri_pagination_path = '/' . Router::getInstance()->currentPage() . '/' . Controller::getInstance()->getRequest()['_action'] . '/';
|
||||
}
|
||||
|
||||
private static function getUriPaginationPath()
|
||||
{
|
||||
return self::$_uri_pagination_path;
|
||||
}
|
||||
|
||||
private static function loadPaginationToTemplate()
|
||||
{
|
||||
$pagination = array(
|
||||
'current' => self::getCurrentNumber(),
|
||||
'next' => self::getNextPageNumber(),
|
||||
'previous' => self::getPreviousPageNumber(),
|
||||
'paginationPath' => self::getUriPaginationPath()
|
||||
);
|
||||
for($i=0;$i<self::getMaxPages();$i++)
|
||||
{
|
||||
$pagination[]['page'] = $i+1;
|
||||
}
|
||||
Controller::getInstance()->varname(View::getInstance()->getEngine(), array('pagination' => $pagination));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
private static function getMaxPageEntries()
|
||||
{
|
||||
return self::$_max_page_entries;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $max_page_entries
|
||||
*/
|
||||
private static function setMaxPageEntries( $max_page_entries )
|
||||
{
|
||||
self::$_max_page_entries = $max_page_entries;
|
||||
}
|
||||
|
||||
private static function currentPageEntryLimit( )
|
||||
{
|
||||
return self::getPageEntryIndex()[self::getCurrentNumber()];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
private static function getPageEntryIndex( )
|
||||
{
|
||||
return self::$_page_entry_index;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $page_entry_index
|
||||
*/
|
||||
private static function setPageEntryIndex( )
|
||||
{
|
||||
$PagesWithFullEntriesIndex = floor(self::getMaxPageEntries()/self::getEntriesPerPage());
|
||||
$limit = array();
|
||||
for($i=1; $i<$PagesWithFullEntriesIndex+1; $i++)
|
||||
{
|
||||
if(!array_key_exists($i-1, $limit))
|
||||
{
|
||||
$limit[$i] = array(
|
||||
'start' => 0,
|
||||
'end' => self::getEntriesPerPage()
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(array_key_exists($i, $limit))
|
||||
{
|
||||
if(array_key_exists('start', $limit[$i]))
|
||||
{
|
||||
$start = $limit[$i]['start'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$start = self::PAGE_ITERATION;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$start = self::PAGE_ITERATION;
|
||||
}
|
||||
$limit[$i] = array(
|
||||
'end' => self::getEntriesPerPage(),
|
||||
'start' => $start + self::getEntriesPerPage()
|
||||
);
|
||||
}
|
||||
}
|
||||
$fullEntriesOnPages = $PagesWithFullEntriesIndex*self::getEntriesPerPage();
|
||||
if($fullEntriesOnPages<self::getMaxPageEntries())
|
||||
{
|
||||
$lastPageEntries = self::getMaxPageEntries()-($PagesWithFullEntriesIndex*self::getEntriesPerPage());
|
||||
$limit[$i] = array(
|
||||
'start' => $limit[$i-1]['start'] + self::getEntriesPerPage(),
|
||||
'end' => $lastPageEntries
|
||||
);
|
||||
}
|
||||
self::$_page_entry_index = $limit;
|
||||
self::setUriPaginationPath();
|
||||
self::loadPaginationToTemplate();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
private static function getEntriesPerPage()
|
||||
{
|
||||
return self::$_entries_per_page;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $entries_per_page
|
||||
*/
|
||||
private static function setEntriesPerPage( )
|
||||
{
|
||||
self::$_entries_per_page = Config::getInstance()->getConfig()[View::NIBIRU_SETTINGS]['entriesperpage'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public static function getMaxPages( )
|
||||
{
|
||||
return self::$_max_pages;
|
||||
}
|
||||
|
||||
/**
|
||||
* @desc if you have deactivated pages you can set a filter here
|
||||
* @param string $where
|
||||
*/
|
||||
private static function setMaxPages( $where = '' )
|
||||
{
|
||||
$tableinfo = self::getTable()->loadAllTableFieldNames();
|
||||
self::setMaxPageEntries( self::getTable()->loadTableRowCount( $tableinfo[0], $where ));
|
||||
self::$_max_pages = ceil(self::getMaxPageEntries()/self::getEntriesPerPage());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
private static function getTable( )
|
||||
{
|
||||
return self::$_table;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean $table
|
||||
*/
|
||||
public static function setTable( Adapter\IDb $table, $where = '' )
|
||||
{
|
||||
if(is_object( $table ))
|
||||
{
|
||||
self::setEntriesPerPage();
|
||||
self::$_table = $table;
|
||||
self::setMaxPages( $where );
|
||||
self::setPageEntryIndex();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected static function pageContent()
|
||||
{
|
||||
return self::$_current_page_content;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $current_page_content
|
||||
*/
|
||||
protected static function setCurrentPageContent( )
|
||||
{
|
||||
self::$_current_page_content = array();
|
||||
|
||||
$sortOrderIndex = 0;
|
||||
for($i=0; sizeof( self::getTable()->loadAllTableFieldNames() ) > $i; $i++)
|
||||
{
|
||||
if( self::getTable()->loadAllTableFieldNames()[$i] == 'time' )
|
||||
{
|
||||
$sortOrderIndex = $i;
|
||||
}
|
||||
}
|
||||
self::$_current_page_content = self::getTable()->loadTableAsArray( self::currentPageEntryLimit(), ' ORDER BY ' . self::getTable()->loadAllTableFieldNames()[$sortOrderIndex] . ' DESC ' );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
protected static function getCurrentNumber()
|
||||
{
|
||||
return self::$_current_number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @desc the skip param is for using the pagination on a class that
|
||||
* is also used without the pagination, so in order to avoid the
|
||||
* settings not to work, it is possible to skip the currentNumber
|
||||
* setup.
|
||||
* @param int $current_number
|
||||
*/
|
||||
protected static function setCurrentNumber( )
|
||||
{
|
||||
try {
|
||||
$page = false;
|
||||
$uri = explode('/', $_SERVER['REQUEST_URI']);
|
||||
foreach ($uri as $uripart)
|
||||
{
|
||||
if($page)
|
||||
{
|
||||
if(is_numeric($uripart))
|
||||
{
|
||||
self::$_current_number = $uripart;
|
||||
Controller::getInstance()->varname(View::getInstance()->getEngine(), array('pagenumber' => self::getCurrentNumber()));
|
||||
$page = false;
|
||||
self::setNextPageNumber();
|
||||
self::setPreviousPageNumber();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new \Exception('ERROR: the pagenumber has to be a nummeric value!');
|
||||
}
|
||||
}
|
||||
if($uripart == 'page')
|
||||
{
|
||||
$page = true;
|
||||
}
|
||||
}
|
||||
if(self::getCurrentNumber() == self::CURRENT_PAGE)
|
||||
{
|
||||
throw new \Exception('ERROR: URL parameter [page] is missing, please check your class and add the parameter!');
|
||||
}
|
||||
self::setNextPageNumber();
|
||||
self::setPreviousPageNumber();
|
||||
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
echo '<pre>';
|
||||
print_r( $e->getMessage() );
|
||||
echo '</pre>';
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
protected static function getNextPageNumber()
|
||||
{
|
||||
return self::$_next_page_number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $next_page_number
|
||||
*/
|
||||
protected static function setNextPageNumber( )
|
||||
{
|
||||
$next_number = self::getCurrentNumber() + self::PAGE_ITERATION;
|
||||
|
||||
if($next_number>self::getMaxPages())
|
||||
{
|
||||
self::$_next_page_number = self::getCurrentNumber();
|
||||
}
|
||||
else
|
||||
{
|
||||
self::$_next_page_number = self::getCurrentNumber() + self::PAGE_ITERATION;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public static function getPreviousPageNumber()
|
||||
{
|
||||
return self::$_previous_page_number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $previous_page_number
|
||||
*/
|
||||
public static function setPreviousPageNumber( )
|
||||
{
|
||||
$prev_number = self::getCurrentNumber() - self::PAGE_ITERATION;
|
||||
|
||||
if($prev_number<self::PAGE_ITERATION)
|
||||
{
|
||||
self::$_previous_page_number = self::PAGE_ITERATION;
|
||||
}
|
||||
else
|
||||
{
|
||||
self::$_previous_page_number = $prev_number;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -166,7 +166,8 @@ class JsonNavigation extends Config
|
||||
'title' => $keys[$i],
|
||||
'icon' => $value[$keys[$i]]["icon"],
|
||||
'link' => $value[$keys[$i]]["link"],
|
||||
'tooltip' => $value[$keys[$i]]["tooltip"]
|
||||
'tooltip' => $value[$keys[$i]]["tooltip"],
|
||||
'footer' => $value[$keys[$i]]['footer']
|
||||
);
|
||||
}
|
||||
elseif(array_key_exists('onclick', $value[$keys[$i]]))
|
||||
@@ -175,7 +176,8 @@ class JsonNavigation extends Config
|
||||
'title' => $keys[$i],
|
||||
'icon' => $value[$keys[$i]]["icon"],
|
||||
'tooltip' => $value[$keys[$i]]["tooltip"],
|
||||
'onclick' => $value[$keys[$i]]["onclick"]
|
||||
'onclick' => $value[$keys[$i]]["onclick"],
|
||||
'footer' => $value[$keys[$i]]['footer']
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -43,6 +43,17 @@ final class Pdo extends Mysql implements IPdo
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function queryString( $string = self::PLACE_NO_QUERY )
|
||||
{
|
||||
$query = parent::getInstance( self::getSettingsSection() )->getConn()->query( $string );
|
||||
return $query->fetchAll();
|
||||
}
|
||||
|
||||
public static function selectDatasetByFieldAndValue($tablename = self::PLACE_TABLE_NAME, $fieldAndValue = array() )
|
||||
{
|
||||
$result = parent::getInstance( self::getSettingsSection() )->getConn()->query("SELECT * FROM " . $tablename . " WHERE " . $fieldAndValue['name'] . " = '" . $fieldAndValue['value'] . "';");
|
||||
@@ -124,13 +135,34 @@ final class Pdo extends Mysql implements IPdo
|
||||
// TODO: Implement getLastInsertedID() method.
|
||||
}
|
||||
|
||||
public static function fetchTableAsArray( $tablename = self::PLACE_TABLE_NAME )
|
||||
{
|
||||
$statement = parent::getInstance( self::getSettingsSection() )->getConn()->query('SElECT * FROM ' . $tablename);
|
||||
$statement->execute();
|
||||
$result = $statement->fetchAll( \PDO::FETCH_ASSOC );
|
||||
return $result;
|
||||
}
|
||||
public static function fetchTableAsArray( $tablename = self::PLACE_TABLE_NAME, $limit = self::PLACE_QUERY_LIMIT, $order = self::PLACE_SORT_ORDER )
|
||||
{
|
||||
if($limit != self::PLACE_QUERY_LIMIT)
|
||||
{
|
||||
if( $order == self::PLACE_SORT_ORDER )
|
||||
{
|
||||
$order = "";
|
||||
}
|
||||
if(is_array($limit))
|
||||
{
|
||||
if(array_key_exists('start', $limit))
|
||||
{
|
||||
$statement = parent::getInstance( self::getSettingsSection() )->getConn()->query('SELECT * FROM ' . $tablename . $order . ' LIMIT ' . $limit['start'] . ', ' . $limit['end'] . ';' );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$statement = parent::getInstance( self::getSettingsSection() )->getConn()->query('SElECT * FROM ' . $tablename . $order . ' LIMIT ' . $limit . ';');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$statement = parent::getInstance( self::getSettingsSection() )->getConn()->query('SElECT * FROM ' . $tablename);
|
||||
}
|
||||
$statement->execute();
|
||||
$result = $statement->fetchAll( \PDO::FETCH_ASSOC );
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @desc will insert the array with fieldnames into the database, if the last parameter is set it should be a string containing the
|
||||
|
||||
@@ -17,6 +17,7 @@ class Router extends Config
|
||||
private static $_cur_page;
|
||||
private static $_routes = array();
|
||||
private static $_action;
|
||||
private static $_page_params = array();
|
||||
|
||||
protected function __construct()
|
||||
{
|
||||
@@ -95,6 +96,7 @@ class Router extends Config
|
||||
*/
|
||||
private static function setAction( $action )
|
||||
{
|
||||
self::$_action = $action;
|
||||
$_REQUEST['_action'] = $action;
|
||||
}
|
||||
|
||||
@@ -114,17 +116,24 @@ class Router extends Config
|
||||
}
|
||||
|
||||
public function tplName($ending = false)
|
||||
{
|
||||
self::setCurPage();
|
||||
if($ending)
|
||||
{
|
||||
return self::getCurPage() . ".tpl";
|
||||
}
|
||||
else
|
||||
{
|
||||
return self::getCurPage();
|
||||
}
|
||||
}
|
||||
{
|
||||
preg_match('/\/'.self::getCurPage().'\//', $_SERVER['REQUEST_URI'], $matches);
|
||||
if(!array_key_exists(0, $matches))
|
||||
{
|
||||
self::setCurPage();
|
||||
}
|
||||
if($ending)
|
||||
{
|
||||
self::setPageParams( $_SERVER["REQUEST_URI"] );
|
||||
return self::getCurPage() . ".tpl";
|
||||
}
|
||||
else
|
||||
{
|
||||
self::setPageParams( $_SERVER["REQUEST_URI"] );
|
||||
return self::getCurPage();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
@@ -134,34 +143,113 @@ class Router extends Config
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $cur_page
|
||||
*/
|
||||
private static function setCurPage( )
|
||||
{
|
||||
if( self::getCurRoute() == null )
|
||||
{
|
||||
$uri_parts = explode('/', $_SERVER["REQUEST_URI"]);
|
||||
if(is_array($uri_parts))
|
||||
{
|
||||
if($uri_parts[1] == "")
|
||||
{
|
||||
self::$_cur_page = "index";
|
||||
}
|
||||
else
|
||||
{
|
||||
self::$_cur_page = $uri_parts[1];
|
||||
if(array_key_exists(2, $uri_parts))
|
||||
{
|
||||
self::setAction($uri_parts[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
self::$_cur_page = self::getCurRoute();
|
||||
}
|
||||
}
|
||||
* @desc sets the current page route in the router
|
||||
*/
|
||||
private static function setCurPage( )
|
||||
{
|
||||
$params = false;
|
||||
$uri_parts = explode('/', $_SERVER["REQUEST_URI"]);
|
||||
if(is_array($uri_parts))
|
||||
{
|
||||
if($uri_parts[1] == "")
|
||||
{
|
||||
self::$_cur_page = "index";
|
||||
}
|
||||
else
|
||||
{
|
||||
self::$_cur_page = $uri_parts[1];
|
||||
if(array_key_exists(2, $uri_parts))
|
||||
{
|
||||
self::setAction($uri_parts[2]);
|
||||
$params = true;
|
||||
}
|
||||
}
|
||||
if($params)
|
||||
{
|
||||
self::setPageParams( $uri_parts );
|
||||
}
|
||||
}
|
||||
if( self::getCurRoute() != null )
|
||||
{
|
||||
self::$_cur_page = self::getCurRoute();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @desc will get the current page parameters concerning url parts
|
||||
* e.g. Controller/Action/Param
|
||||
* @return array
|
||||
*/
|
||||
public function getPageParams()
|
||||
{
|
||||
return self::$_page_params;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $page_params
|
||||
*/
|
||||
private static function setPageParams( $uri_parts )
|
||||
{
|
||||
$skip = false;
|
||||
if(is_array($uri_parts))
|
||||
{
|
||||
for($i=2;sizeof($uri_parts)>$i;$i++)
|
||||
{
|
||||
if(is_string($uri_parts[$i]))
|
||||
{
|
||||
if(array_key_exists($i+1, $uri_parts))
|
||||
{
|
||||
if(!is_numeric($uri_parts[$i]))
|
||||
{
|
||||
foreach(self::getRoutes()['route'] as $routing)
|
||||
{
|
||||
if(stristr($routing, '/' . self::getCurPage() . '/'.self::getAction().'/'))
|
||||
{
|
||||
preg_match('/\{(.*?)\}/', $routing, $matches);
|
||||
preg_match('/\/' . self::getCurPage() . '\/' . self::getAction() . '\/\d+/', $_SERVER["REQUEST_URI"], $routematch);
|
||||
if(is_array($routematch))
|
||||
{
|
||||
if(array_key_exists(0, $routematch))
|
||||
{
|
||||
$param_key = $matches[1];
|
||||
$param = $routematch[0];
|
||||
if(is_string($param_key))
|
||||
{
|
||||
if(!$skip && !array_key_exists($param_key, $_REQUEST[$uri_parts[$i]] ))
|
||||
{
|
||||
preg_match('|\d+|', $param, $digit);
|
||||
$_REQUEST[$uri_parts[$i]] = array($param_key => $digit[0]);
|
||||
$skip = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($skip)
|
||||
{
|
||||
if(!array_key_exists($uri_parts[$i], $_REQUEST))
|
||||
{
|
||||
$_REQUEST[$uri_parts[$i]] = $uri_parts[$i + 1];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!array_key_exists($uri_parts[$i], $_REQUEST))
|
||||
{
|
||||
$_REQUEST[$uri_parts[$i]] = $uri_parts[$i + 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self::$_page_params = $_REQUEST;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array with all the information about the current page
|
||||
|
||||
@@ -67,7 +67,7 @@ class Settings
|
||||
}
|
||||
elseif(file_exists('../' . self::SETTINGS_PATH . $current_settings_file))
|
||||
{
|
||||
if($env==config::CLI_SYSTEM)
|
||||
if($env==Config::CLI_SYSTEM)
|
||||
{
|
||||
if(self::$_is_db_connection)
|
||||
{
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: skasdorf
|
||||
* Date: 16.06.17
|
||||
* Time: 10:52
|
||||
*/
|
||||
|
||||
namespace Nibiru;
|
||||
|
||||
|
||||
class Soap implements ISoap
|
||||
{
|
||||
|
||||
}
|
||||
@@ -15,6 +15,7 @@ if(session_status() == PHP_SESSION_NONE)
|
||||
* @desc Nibiru framework functionality
|
||||
*/
|
||||
require_once __DIR__ . '/t/messages.php';
|
||||
require_once __DIR__ . '/t/pageination.php';
|
||||
require_once __DIR__ . '/c/settings.php';
|
||||
require_once __DIR__ . '/c/config.php';
|
||||
require_once __DIR__ . '/c/router.php';
|
||||
@@ -32,9 +33,11 @@ require_once __DIR__ . '/c/odbc.php';
|
||||
require_once __DIR__ . '/i/postgres.php';
|
||||
require_once __DIR__ . '/c/postgres.php';
|
||||
require_once __DIR__ . '/i/db.php';
|
||||
require_once __DIR__ . '/i/pageination.php';
|
||||
require_once __DIR__ . '/a/mysql.db.php';
|
||||
require_once __DIR__ . '/a/postgres.db.php';
|
||||
require_once __DIR__ . '/f/db.php';
|
||||
require_once __DIR__ . '/a/pageination.php';
|
||||
/**
|
||||
* @desc MVC functionality
|
||||
*/
|
||||
@@ -70,12 +73,10 @@ require_once __DIR__ . '/i/controller.php';
|
||||
require_once __DIR__ . '/c/controller.php';
|
||||
require_once __DIR__ . '/i/view.php';
|
||||
require_once __DIR__ . '/c/view.php';
|
||||
require_once __DIR__ . '/c/json-navigation.php';
|
||||
require_once __DIR__ . '/c/jsonnavigation.php';
|
||||
/**
|
||||
* @desc currently unfinished
|
||||
*/
|
||||
require_once __DIR__ . '/i/soap.php';
|
||||
require_once __DIR__ . '/c/soap.php';
|
||||
require_once __DIR__ . '/i/auth.php';
|
||||
require_once __DIR__ . '/c/auth.php';
|
||||
/**
|
||||
|
||||
@@ -15,6 +15,8 @@ interface IMysql
|
||||
const PLACE_NO_QUERY = "NO QUERY";
|
||||
const NO_ID = false;
|
||||
const PLACE_TABLE_NAME = "NO TABLENAME";
|
||||
const PLACE_QUERY_LIMIT = "NO LIMIT";
|
||||
const PLACE_SORT_ORDER = "NO ORDER";
|
||||
const PLACE_DSN = "NO CONNECTION STRING";
|
||||
const PLACE_USERNAME = "username";
|
||||
const PLACE_PASSWORD = "password";
|
||||
|
||||
30
core/i/pageination.php
Executable file
30
core/i/pageination.php
Executable file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
namespace Nibiru;
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mithril
|
||||
* Date: 15.09.18
|
||||
* Time: 03:17
|
||||
*/
|
||||
|
||||
interface IPageination
|
||||
{
|
||||
const CURRENT_PAGE = 0;
|
||||
const PAGE_ITERATION = 1;
|
||||
|
||||
/**
|
||||
* @desc All the following methods have to be implemented into the class
|
||||
* constructor of the class that extends pagination
|
||||
*/
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public static function setContentTable();
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public static function loadPageNumber();
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: skasdorf
|
||||
* Date: 16.06.17
|
||||
* Time: 10:44
|
||||
*/
|
||||
|
||||
namespace Nibiru;
|
||||
|
||||
|
||||
interface ISoap
|
||||
{
|
||||
|
||||
}
|
||||
13
core/t/pageination.php
Executable file
13
core/t/pageination.php
Executable file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
namespace Nibiru\Attributes;
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mithril
|
||||
* Date: 15.09.18
|
||||
* Time: 03:17
|
||||
*/
|
||||
|
||||
trait Pageination
|
||||
{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user