From 759f04d34f7e586baf0379858dd45b20fe6ae3bf Mon Sep 17 00:00:00 2001 From: Christian Wolf Date: Fri, 14 Jun 2019 15:51:40 +0200 Subject: [PATCH] Frontend started to implement first page with databse in use --- src/admin/common/abstract/model/column.php | 1 + src/admin/common/models/user.php | 13 ++++- src/site/controller.php | 11 +++- src/site/views/myclubs/tmpl/default.php | 16 ----- src/site/views/myclubs/tmpl/default.xml | 6 -- src/site/views/mypage/tmpl/default.php | 58 +++++++++++++++++++ src/site/views/mypage/tmpl/default.xml | 6 ++ .../views/{myclubs => mypage}/view.html.php | 6 +- 8 files changed, 91 insertions(+), 26 deletions(-) delete mode 100644 src/site/views/myclubs/tmpl/default.php delete mode 100644 src/site/views/myclubs/tmpl/default.xml create mode 100644 src/site/views/mypage/tmpl/default.php create mode 100644 src/site/views/mypage/tmpl/default.xml rename src/site/views/{myclubs => mypage}/view.html.php (75%) diff --git a/src/admin/common/abstract/model/column.php b/src/admin/common/abstract/model/column.php index cfacc87..9d1b27d 100644 --- a/src/admin/common/abstract/model/column.php +++ b/src/admin/common/abstract/model/column.php @@ -8,6 +8,7 @@ abstract class AbstractCommonClubsModelColumn protected $alias; protected $column; + /** * @var AbstractCommonClubsControllerMapping */ diff --git a/src/admin/common/models/user.php b/src/admin/common/models/user.php index 0ad1b5e..37fa2e8 100644 --- a/src/admin/common/models/user.php +++ b/src/admin/common/models/user.php @@ -201,5 +201,16 @@ class CommonClubsModelUser extends AbstractCommonClubsModel return true; } + protected function filterDatabaseRawData($values) + { + if(strlen($values['phone']) == 0) + $values['phone'] = null; + + if(strlen($values['mobile']) == 0) + $values['mobile'] = null; + + return $values; + } + } - \ No newline at end of file + diff --git a/src/site/controller.php b/src/site/controller.php index b61c507..1e979b2 100644 --- a/src/site/controller.php +++ b/src/site/controller.php @@ -1,6 +1,7 @@ isUrlAllowed($view)) { - parent::display($cachable, $params); + $this->doDisplay($cachable, $params); return; } else @@ -33,7 +34,7 @@ class ClubsController extends BaseController { if($view === 'login' || $view === 'publicclubs') { - parent::display($cachable, $params); + $this->doDisplay($cachable, $params); return; } else @@ -46,6 +47,12 @@ class ClubsController extends BaseController $this->redirectToLogin(); } + private function doDisplay($cachable, $params) + { + Factory::getDocument()->addStyleSheet(Uri::base(true) . "components/com_clubs/css/clubs.css"); + parent::display($cachable, $params); + } + private function redirectToLogin() { // XXX Attach URL to forward later diff --git a/src/site/views/myclubs/tmpl/default.php b/src/site/views/myclubs/tmpl/default.php deleted file mode 100644 index 64ccb0c..0000000 --- a/src/site/views/myclubs/tmpl/default.php +++ /dev/null @@ -1,16 +0,0 @@ - - - \ No newline at end of file diff --git a/src/site/views/myclubs/tmpl/default.xml b/src/site/views/myclubs/tmpl/default.xml deleted file mode 100644 index 153a2c0..0000000 --- a/src/site/views/myclubs/tmpl/default.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - Diese Seite erlaubt den Zugriff auf alle Vereine, mit denen ein Benutzer assoziiert ist. - - diff --git a/src/site/views/mypage/tmpl/default.php b/src/site/views/mypage/tmpl/default.php new file mode 100644 index 0000000..6b8d0cf --- /dev/null +++ b/src/site/views/mypage/tmpl/default.php @@ -0,0 +1,58 @@ + +

Meine Seite

+ +

Stammdaten

+ +
+
Name
+
me->getName()); ?>
+
+ +
+
Benutzer-Alias
+
me->getUsername()); ?>
+
+ +
+
Adresse
+
me->getAddress())); ?>
+
+ +
+
Stadt
+
me->getCity()); ?>
+
+ +
+
E-Mail-Adresse
+
me->getMail()); ?>
+
+ +
+
Telefon-Nr.
+
me->getPhone() !== null ? htmlentities($this->me->getPhone()) : 'nicht angegeben'; ?>
+
+ +
+
Handy-Nr.
+
me->getMobile() !== null ? htmlentities($this->me->getMobile()) : 'nicht angegeben'; ?>
+
+ + +

Meine Vereine

+ + \ No newline at end of file diff --git a/src/site/views/mypage/tmpl/default.xml b/src/site/views/mypage/tmpl/default.xml new file mode 100644 index 0000000..959774b --- /dev/null +++ b/src/site/views/mypage/tmpl/default.xml @@ -0,0 +1,6 @@ + + + + Diese Seite erlaubt den Zugriff auf die eigene Seite eines Benutzers. + + diff --git a/src/site/views/myclubs/view.html.php b/src/site/views/mypage/view.html.php similarity index 75% rename from src/site/views/myclubs/view.html.php rename to src/site/views/mypage/view.html.php index eddc2cb..88d4eae 100644 --- a/src/site/views/myclubs/view.html.php +++ b/src/site/views/mypage/view.html.php @@ -5,7 +5,7 @@ use Joomla\CMS\MVC\View\HtmlView; // No direct access. defined('_JEXEC') or die; -class ClubsViewMyClubs extends HtmlView +class ClubsViewMyPage extends HtmlView { public function display($tpl = null) @@ -25,6 +25,10 @@ class ClubsViewMyClubs extends HtmlView $c['id'] = 4; $this->clubs[] = $c; + $userFactory = new CommonClubsModelFactoryUser(); + $users = $userFactory->loadElements(); + $this->me = $users[0]; + parent::display($tpl); } }