# HG changeset patch # User Markus Bröker # Date 1449920184 -3600 # Node ID 29a3e34acf64de97c0f203afa2dbd81d3ea60c11 # Parent 79be7d6a2765dde2b4e56db19412eab29b7c400d Umstellung auf Netbeans: Quellcode mit NB neu formatiert diff --git a/classes/bfw/Configuration.php b/classes/bfw/Configuration.php --- 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']; } + } diff --git a/classes/bfw/Dispatcher.php b/classes/bfw/Dispatcher.php --- 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 +} diff --git a/classes/bfw/Request.php b/classes/bfw/Request.php --- 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 + +} diff --git a/classes/bfw/Response.php b/classes/bfw/Response.php --- 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 +} diff --git a/classes/bfw/core/Controller.php b/classes/bfw/core/Controller.php --- 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 +} diff --git a/classes/bfw/core/Model.php b/classes/bfw/core/Model.php --- 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 + +} diff --git a/classes/bfw/core/ReadonlyEntity.php b/classes/bfw/core/ReadonlyEntity.php --- 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 + +} diff --git a/classes/bfw/core/View.php b/classes/bfw/core/View.php --- 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 @@ * Anzeige der komplett gerenderten Seite mit dem Layout $layout * * @param string $layout + * @return int */ public function display($layout = 'layout.tpl') { $request = $this->controller->getRequest(); diff --git a/classes/bfw/database/DBInterface.php b/classes/bfw/database/DBInterface.php --- 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 +} diff --git a/classes/bfw/database/Database.php b/classes/bfw/database/Database.php --- 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(); } + } diff --git a/classes/bfw/entities/TGroup.php b/classes/bfw/entities/TGroup.php --- 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 +} diff --git a/classes/bfw/entities/TUser.php b/classes/bfw/entities/TUser.php --- 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 +} diff --git a/classes/bfw/mvc/controller/BenutzerverwaltungController.php b/classes/bfw/mvc/controller/BenutzerverwaltungController.php --- a/classes/bfw/mvc/controller/BenutzerverwaltungController.php +++ b/classes/bfw/mvc/controller/BenutzerverwaltungController.php @@ -134,4 +134,5 @@ $this->getView()->display(); } + } diff --git a/classes/bfw/mvc/controller/DokumentationController.php b/classes/bfw/mvc/controller/DokumentationController.php --- 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 + +} diff --git a/classes/bfw/mvc/controller/HomeController.php b/classes/bfw/mvc/controller/HomeController.php --- 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 +} diff --git a/classes/bfw/mvc/model/benutzerverwaltung/DataModel.php b/classes/bfw/mvc/model/benutzerverwaltung/DataModel.php --- 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 + +} diff --git a/classes/bfw/mvc/model/dokumentation/DataModel.php b/classes/bfw/mvc/model/dokumentation/DataModel.php --- 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 + +} diff --git a/classes/bfw/mvc/model/error/DataModel.php b/classes/bfw/mvc/model/error/DataModel.php --- 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 + +} diff --git a/classes/bfw/mvc/model/home/DataModel.php b/classes/bfw/mvc/model/home/DataModel.php --- 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 + +} diff --git a/classes/bfw/mvc/view/header.tpl b/classes/bfw/mvc/view/header.tpl --- a/classes/bfw/mvc/view/header.tpl +++ b/classes/bfw/mvc/view/header.tpl @@ -30,10 +30,10 @@ {if $request->getKey('isLoggedIn')}
  • {$user->getFirstname()} {$user->getLastname()}
  • abmelden
  • - {else} + {else}
  • anmelden
  • registrieren
  • - {/if} + {/if} diff --git a/classes/bfw/mvc/view/layout.tpl b/classes/bfw/mvc/view/layout.tpl --- a/classes/bfw/mvc/view/layout.tpl +++ b/classes/bfw/mvc/view/layout.tpl @@ -1,33 +1,33 @@ - - - BFW Demo Page + + + BFW Demo Page - + - + - - + + - - - - -
    - {include file="header.tpl"} -
    - {include file="{$controller}/{$action}.tpl"} -
    + + + + +
    + {include file="header.tpl"} +
    + {include file="{$controller}/{$action}.tpl"} +
    - - +
    +
    +
    + diff --git a/config/config.php b/config/config.php --- 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();