--- a/classes/bfw/Configuration.php
+++ b/classes/bfw/Configuration.php
@@ -32,6 +32,8 @@
}
/**
+ * Standard Konfiguration für den Logger
+ *
* @return array
*/
public static function bfw_loggerConfiguration() {
@@ -51,6 +53,8 @@
}
/**
+ * Standard Konfiguration für den PDO-Treiber
+ *
* @return array
*/
public static function getDataSourceProperties() {
--- a/classes/bfw/core/Model.php
+++ b/classes/bfw/core/Model.php
@@ -7,6 +7,8 @@
namespace bfw\core;
+use bfw\entities\TGroup;
+use bfw\entities\TUser;
use Logger;
/**
@@ -16,7 +18,49 @@
class Model {
protected $logger;
+ /**
+ * @var TUser
+ */
+ private $user;
+
+ /**
+ * @var TGroup
+ */
+ private $group;
+
public function __construct() {
$this->logger = Logger::getLogger(get_class($this));
+
+ $this->user = new TUser();
+ $this->group = new TGroup();
+ }
+
+
+ /**
+ * @return TUser
+ */
+ public function getUser() {
+ return $this->user;
+ }
+
+ /**
+ * @return TGroup
+ */
+ public function getGroup() {
+ return $this->group;
+ }
+
+ /**
+ * @return Entity[]
+ */
+ public function getUsers() {
+ return $this->user->findAll(false);
+ }
+
+ /**
+ * @return Entity[]
+ */
+ public function getGroups() {
+ return $this->group->findAll(false);
}
}
\ No newline at end of file
rename from classes/bfw/entities/TView.php
rename to classes/bfw/core/ReadonlyEntity.php
--- a/classes/bfw/entities/TView.php
+++ b/classes/bfw/core/ReadonlyEntity.php
@@ -5,19 +5,17 @@
*
*/
-namespace bfw\entities;
-
-use bfw\core\Entity;
+namespace bfw\core;
/**
- * Class TView
+ * Class ReadonlyView
*
* @method string getId()
*/
-class TView extends Entity {
+class ReadonlyEntity extends Entity {
/**
- * Nur Get-Methoden im View
+ * Nur Get-Methoden in dieser Entity
*
* @param $methodName
* @param null $params
--- a/classes/bfw/core/View.php
+++ b/classes/bfw/core/View.php
@@ -7,8 +7,6 @@
namespace bfw\core;
-use bfw\entities\TGroup;
-use bfw\entities\TUser;
use Smarty;
require_once 'library/smarty/libs/Smarty.class.php';
@@ -78,25 +76,26 @@
* @param string $layout
*/
public function display($layout = 'layout.tpl') {
- $user = new TUser();
- $group = new TGroup();
-
$request = $this->controller->getRequest();
- if ($request->getKey('isLoggedIn')) {
- $user->find($request->getKey('user_id'));
- }
-
$controller = $this->controller;
$response = $controller->getResponse();
$this->assign('response', $response);
+ $this->assign('request', $request);
+
+ $model = $controller->getModel();
+ $user = $model->getUser();
+ $group = $model->getGroup();
+
+ if ($request->getKey('isLoggedIn')) {
+ $user->find($request->getKey('user_id'));
+ }
+
$this->assign('user', $user);
$this->assign('group', $group);
- $this->assign('request', $request);
-
try {
self::$tpl->display($layout);
} catch (SmartyException $se) {
--- a/classes/bfw/mvc/model/benutzerverwaltung/DataModel.php
+++ b/classes/bfw/mvc/model/benutzerverwaltung/DataModel.php
@@ -7,54 +7,8 @@
namespace bfw\mvc\model\benutzerverwaltung;
-use bfw\core\Entity;
use bfw\core\Model;
-use bfw\entities\TGroup;
-use bfw\entities\TUser;
class DataModel extends Model {
- /**
- * @var TUser
- */
- private $user;
-
- /**
- * @var TGroup
- */
- private $group;
-
- public function __construct() {
- $this->user = new TUser();
- $this->group = new TGroup();
- }
-
- /**
- * @return TUser
- */
- public function getUser() {
- return $this->user;
- }
-
- /**
- * @return TGroup
- */
- public function getGroup() {
- return $this->group;
- }
-
- /**
- * @return Entity[]
- */
- public function getUsers() {
- return $this->user->findAll();
- }
-
- /**
- * @return Entity[]
- */
- public function getGroups() {
- return $this->group->findAll();
- }
-
}
\ No newline at end of file
--- a/classes/bfw/mvc/model/dokumentation/DataModel.php
+++ b/classes/bfw/mvc/model/dokumentation/DataModel.php
@@ -7,36 +7,8 @@
namespace bfw\mvc\model\dokumentation;
-use bfw\core\Entity;
use bfw\core\Model;
-use bfw\entities\TGroup;
-use bfw\entities\TUser;
class DataModel extends Model {
- private $user;
- private $group;
-
- /**
- * Model constructor.
- */
- public function __construct() {
- $this->user = new TUser();
- $this->group = new TGroup();
- }
-
- /**
- * @return Entity[]
- */
- public function getUsers() {
- return $this->user->findAll();
- }
-
- /**
- * @return Entity[]
- */
- public function getGroups() {
- return $this->group->findAll();
- }
-
}
\ No newline at end of file
--- a/classes/bfw/mvc/model/error/DataModel.php
+++ b/classes/bfw/mvc/model/error/DataModel.php
@@ -7,36 +7,8 @@
namespace bfw\mvc\model\error;
-use bfw\core\Entity;
use bfw\core\Model;
-use bfw\entities\TGroup;
-use bfw\entities\TUser;
class DataModel extends Model {
- private $user;
- private $group;
-
- /**
- * Model constructor.
- */
- public function __construct() {
- $this->user = new TUser();
- $this->group = new TGroup();
- }
-
- /**
- * @return Entity[]
- */
- public function getUsers() {
- return $this->user->findAll();
- }
-
- /**
- * @return Entity[]
- */
- public function getGroups() {
- return $this->group->findAll();
- }
-
}
\ No newline at end of file
--- a/classes/bfw/mvc/model/home/DataModel.php
+++ b/classes/bfw/mvc/model/home/DataModel.php
@@ -7,36 +7,8 @@
namespace bfw\mvc\model\home;
-use bfw\core\Entity;
use bfw\core\Model;
-use bfw\entities\TGroup;
-use bfw\entities\TUser;
class DataModel extends Model {
- private $user;
- private $group;
-
- /**
- * Model constructor.
- */
- public function __construct() {
- $this->user = new TUser();
- $this->group = new TGroup();
- }
-
- /**
- * @return Entity[]
- */
- public function getUsers() {
- return $this->user->findAll();
- }
-
- /**
- * @return Entity[]
- */
- public function getGroups() {
- return $this->group->findAll();
- }
-
}
\ No newline at end of file