--- a/classes/bfw/Configuration.php
+++ b/classes/bfw/Configuration.php
@@ -65,7 +65,6 @@
'username' => 'bfw',
'password' => 'bfw',
),
-
'mysql' => array(
'dsn' => 'mysql:host=localhost;dbname=bfw',
'config' => array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'),
@@ -76,4 +75,5 @@
return $dataSources['mysql'];
}
+
}
--- a/classes/bfw/Dispatcher.php
+++ b/classes/bfw/Dispatcher.php
@@ -12,6 +12,7 @@
use ReflectionException;
class Dispatcher {
+
private $request;
public function __construct() {
@@ -68,4 +69,4 @@
return $controller->$action();
}
-}
\ No newline at end of file
+}
--- a/classes/bfw/Request.php
+++ b/classes/bfw/Request.php
@@ -13,6 +13,7 @@
* Class Request
*/
class Request {
+
protected $logger = null;
public function __construct() {
@@ -258,4 +259,5 @@
return $value;
}
-}
\ No newline at end of file
+
+}
--- a/classes/bfw/Response.php
+++ b/classes/bfw/Response.php
@@ -8,6 +8,7 @@
namespace bfw;
class Response {
+
private $headers;
private $statusCode;
@@ -41,4 +42,4 @@
return '';
}
-}
\ No newline at end of file
+}
--- a/classes/bfw/core/Controller.php
+++ b/classes/bfw/core/Controller.php
@@ -15,19 +15,24 @@
*
*/
abstract class Controller {
+
protected $logger;
+
/**
* @var Model
*/
private $model;
+
/**
* @var Request
*/
private $request;
+
/**
* @var Response
*/
private $response;
+
/**
* @var View
*/
@@ -130,4 +135,4 @@
* @return mixed
*/
abstract public function index();
-}
\ No newline at end of file
+}
--- a/classes/bfw/core/Model.php
+++ b/classes/bfw/core/Model.php
@@ -16,6 +16,7 @@
*
*/
class Model {
+
protected $logger;
/**
@@ -35,7 +36,6 @@
$this->group = new TGroup();
}
-
/**
* @return TUser
*/
@@ -63,4 +63,5 @@
public function getGroups() {
return $this->group->findAll();
}
-}
\ No newline at end of file
+
+}
--- a/classes/bfw/core/ReadonlyEntity.php
+++ b/classes/bfw/core/ReadonlyEntity.php
@@ -54,4 +54,5 @@
public function persist() {
return false;
}
-}
\ No newline at end of file
+
+}
--- a/classes/bfw/core/View.php
+++ b/classes/bfw/core/View.php
@@ -12,16 +12,19 @@
require_once 'library/smarty/libs/Smarty.class.php';
class View {
+
/**
* Statische Referenz auf die reale Template Engine, hier Smarty
*
* @var Smarty
*/
private static $tpl = null;
+
/**
* @var Model
*/
private $model;
+
/**
* @var Controller
*/
@@ -78,6 +81,7 @@
* <b>Anzeige der komplett gerenderten Seite mit dem Layout $layout</b>
*
* @param string $layout
+ * @return int
*/
public function display($layout = 'layout.tpl') {
$request = $this->controller->getRequest();
--- a/classes/bfw/database/DBInterface.php
+++ b/classes/bfw/database/DBInterface.php
@@ -8,13 +8,14 @@
namespace bfw\database;
interface DBInterface {
+ /* fetch methods */
- /* fetch methods */
public function fetch($table, $cond);
public function fetchAll($table, $cond);
/* find methoden */
+
public function find($table, $id);
public function findAll($table, $initial_id);
@@ -24,9 +25,11 @@
function findAllByField($table, $field, $value);
/* Abfrage Methoden */
+
public function query($sql);
/* Persistence Methods */
+
public function persist($table, $array);
public function store($table, $id, $array);
@@ -34,5 +37,6 @@
public function delete($table, $id);
/* PK Management */
+
public function getLastInsertedId();
-}
\ No newline at end of file
+}
--- a/classes/bfw/database/Database.php
+++ b/classes/bfw/database/Database.php
@@ -13,8 +13,10 @@
use PDOException;
class Database implements DBInterface {
+
private static $handle = null;
private $logger;
+
/**
* @var PDO
*/
@@ -200,7 +202,7 @@
$this->logger->info(sprintf('%s(%s, %d) ', __METHOD__, $table, $id));
$stmt = $this->pdo->prepare(
- sprintf('
+ sprintf('
SELECT
*
FROM
@@ -209,7 +211,7 @@
id = :id
LIMIT 1
', $table
- ));
+ ));
$stmt->bindParam(':id', $id);
@@ -230,7 +232,7 @@
$this->logger->info(sprintf('%s(%s, %d) ', __METHOD__, $table, $initial_id));
$stmt = $this->pdo->prepare(
- sprintf('
+ sprintf('
SELECT
*
FROM
@@ -239,7 +241,7 @@
id > :id
ORDER BY ID ASC
', $table
- ));
+ ));
$stmt->bindParam(':id', $initial_id);
@@ -260,7 +262,7 @@
$this->logger->info(sprintf('%s(%s, %s, %s) ', __METHOD__, $table, $field, $value));
$stmt = $this->pdo->prepare(
- sprintf('
+ sprintf('
SELECT
*
FROM
@@ -269,7 +271,7 @@
%s = :value
LIMIT 1
', $table, $field
- ));
+ ));
$stmt->bindParam(':value', $value);
@@ -290,7 +292,7 @@
$this->logger->info(sprintf('%s(%s, %s, %s) ', __METHOD__, $table, $field, $value));
$stmt = $this->pdo->prepare(
- sprintf('
+ sprintf('
SELECT
*
FROM
@@ -298,7 +300,7 @@
WHERE
%s = :value
', $table, $field
- ));
+ ));
$stmt->bindParam(':value', $value);
@@ -417,4 +419,5 @@
public function getLastError() {
return $this->pdo->errorCode();
}
+
}
--- a/classes/bfw/entities/TGroup.php
+++ b/classes/bfw/entities/TGroup.php
@@ -16,6 +16,7 @@
* @mthod setName($param)
*/
class TGroup extends Entity {
+
const SYSTEM = 1;
const ADMIN = 2;
@@ -36,4 +37,4 @@
return $this->db->findByField('t_group', 'name', $name);
}
-}
\ No newline at end of file
+}
--- a/classes/bfw/entities/TUser.php
+++ b/classes/bfw/entities/TUser.php
@@ -24,6 +24,7 @@
* @method setLastname()
*/
class TUser extends Entity {
+
const SYSTEM = 1;
public function __construct() {
@@ -71,4 +72,4 @@
return sprintf("%s, %s", $user->getLastname(), $user->getFirstname());
}
-}
\ No newline at end of file
+}
--- a/classes/bfw/mvc/controller/BenutzerverwaltungController.php
+++ b/classes/bfw/mvc/controller/BenutzerverwaltungController.php
@@ -134,4 +134,5 @@
$this->getView()->display();
}
+
}
--- a/classes/bfw/mvc/controller/DokumentationController.php
+++ b/classes/bfw/mvc/controller/DokumentationController.php
@@ -27,4 +27,5 @@
$this->getView()->display();
}
-}
\ No newline at end of file
+
+}
--- a/classes/bfw/mvc/controller/HomeController.php
+++ b/classes/bfw/mvc/controller/HomeController.php
@@ -10,6 +10,7 @@
use bfw\core\Controller;
class HomeController extends Controller {
+
/**
* HomeController constructor.
*
@@ -26,4 +27,4 @@
$this->getView()->display();
}
-}
\ No newline at end of file
+}
--- a/classes/bfw/mvc/model/benutzerverwaltung/DataModel.php
+++ b/classes/bfw/mvc/model/benutzerverwaltung/DataModel.php
@@ -10,5 +10,5 @@
use bfw\core\Model;
class DataModel extends Model {
-
-}
\ No newline at end of file
+
+}
--- a/classes/bfw/mvc/model/dokumentation/DataModel.php
+++ b/classes/bfw/mvc/model/dokumentation/DataModel.php
@@ -10,5 +10,5 @@
use bfw\core\Model;
class DataModel extends Model {
-
-}
\ No newline at end of file
+
+}
--- a/classes/bfw/mvc/model/error/DataModel.php
+++ b/classes/bfw/mvc/model/error/DataModel.php
@@ -10,5 +10,5 @@
use bfw\core\Model;
class DataModel extends Model {
-
-}
\ No newline at end of file
+
+}
--- a/classes/bfw/mvc/model/home/DataModel.php
+++ b/classes/bfw/mvc/model/home/DataModel.php
@@ -10,5 +10,5 @@
use bfw\core\Model;
class DataModel extends Model {
-
-}
\ No newline at end of file
+
+}
--- a/classes/bfw/mvc/view/header.tpl
+++ b/classes/bfw/mvc/view/header.tpl
@@ -30,10 +30,10 @@
{if $request->getKey('isLoggedIn')}
<li><a href="/benutzerverwaltung/meinprofil/">{$user->getFirstname()} {$user->getLastname()}</a></li>
<li><a href="/benutzerverwaltung/abmelden/">abmelden</a></li>
- {else}
+ {else}
<li><a href="/benutzerverwaltung/anmelden/">anmelden</a></li>
<li><a href="/benutzerverwaltung/registrieren/">registrieren</a></li>
- {/if}
+ {/if}
</ul>
</div>
</div>
--- a/classes/bfw/mvc/view/layout.tpl
+++ b/classes/bfw/mvc/view/layout.tpl
@@ -1,33 +1,33 @@
<!DOCTYPE html>
<html lang="de">
-<head>
- <meta charset="utf-8"/>
- <title>BFW Demo Page</title>
+ <head>
+ <meta charset="utf-8"/>
+ <title>BFW Demo Page</title>
- <link href="/js/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
+ <link href="/js/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
- <link href="/css/main.css" rel="stylesheet" type="text/css"/>
+ <link href="/css/main.css" rel="stylesheet" type="text/css"/>
- <script type="text/javascript" src="/js/jquery-1.11.3.min.js"></script>
- <script type="text/javascript" src="/js/bootstrap/bootstrap.js"></script>
+ <script type="text/javascript" src="/js/jquery-1.11.3.min.js"></script>
+ <script type="text/javascript" src="/js/bootstrap/bootstrap.js"></script>
- <script type="text/javascript" src="//tinymce.cachefly.net/4.2/tinymce.min.js"></script>
- <script type="text/javascript" src="/js/main.js"></script>
-</head>
-<body>
-<div id="page">
- {include file="header.tpl"}
- <div class="content">
- {include file="{$controller}/{$action}.tpl"}
- </div>
+ <script type="text/javascript" src="//tinymce.cachefly.net/4.2/tinymce.min.js"></script>
+ <script type="text/javascript" src="/js/main.js"></script>
+ </head>
+ <body>
+ <div id="page">
+ {include file="header.tpl"}
+ <div class="content">
+ {include file="{$controller}/{$action}.tpl"}
+ </div>
- <div class="footer-area">
- <div class="footer">
- {include file="footer.tpl"}
- </div>
+ <div class="footer-area">
+ <div class="footer">
+ {include file="footer.tpl"}
+ </div>
- <br class="clearfix"/>
- </div>
-</div>
-</body>
+ <br class="clearfix"/>
+ </div>
+ </div>
+ </body>
</html>
--- a/config/config.php
+++ b/config/config.php
@@ -3,7 +3,6 @@
/**
* Konfigurationsbereich des Bröker Frameworks
*/
-
define('BFW_PATH', dirname(dirname(__FILE__)));
require_once BFW_PATH . '/classes/bfw/Configuration.php';
@@ -14,4 +13,4 @@
// Session Handling
session_name('bfw-id');
-session_start();
\ No newline at end of file
+session_start();