From 5179ea9de51e6c9c2ccdd994fbbb9e315ba57b17 Mon Sep 17 00:00:00 2001 From: Christian Wolf Date: Mon, 17 Jun 2019 13:56:37 +0200 Subject: [PATCH] Inserted data into frontend from models for some views --- src/admin/common/models/user.php | 5 ++ src/site/views/club/tmpl/default.php | 102 +++++++++++++++---------- src/site/views/club/view.html.php | 49 +++--------- src/site/views/clubs/tmpl/default.php | 19 +++++ src/site/views/clubs/tmpl/default.xml | 6 ++ src/site/views/clubs/view.html.php | 8 ++ src/site/views/mypage/tmpl/default.php | 22 ++++-- src/site/views/mypage/view.html.php | 18 +---- 8 files changed, 128 insertions(+), 101 deletions(-) create mode 100644 src/site/views/clubs/tmpl/default.xml diff --git a/src/admin/common/models/user.php b/src/admin/common/models/user.php index 37fa2e8..973d356 100644 --- a/src/admin/common/models/user.php +++ b/src/admin/common/models/user.php @@ -125,6 +125,11 @@ class CommonClubsModelUser extends AbstractCommonClubsModel return $this->fetchAssociatedElements(new CommonClubsModelFactoryUserassoc(), 'userid'); } + public function getPresidentClubs() + { + return $this->fetchAssociatedElements(new CommonClubsModelFactoryClub(), 'president'); + } + public function isPasswordSuitable($password) { if(strlen($password) < 8) diff --git a/src/site/views/club/tmpl/default.php b/src/site/views/club/tmpl/default.php index 58933cc..de7a078 100644 --- a/src/site/views/club/tmpl/default.php +++ b/src/site/views/club/tmpl/default.php @@ -1,46 +1,61 @@ -

clubname; ?>

+

club->getName()); ?>

Adresse
-
address)); ?>
+
club->getAddress())); ?>
-
Internet
-
internet); ?>
+
Stadt
+
club->getCity()); ?>
-
Kontaktperson
-
contactperson); ?>
+
Homepage
+
Mail-Adresse
- +
-
Telefon
-
phone); ?>
+
IBAN / BIC
+
club->getIban()); ?> / club->getBic()); ?>
+
+
Gemeinnützigkeit
+
'> Der Verein ist club->isCharitable() ? '' : 'nicht'; ?> gemeinnützig.
+
+ + +
Angebote
-hasOptions): +hasOffers): // Put all options there - foreach($this->options as $k=>$v): + foreach($this->club->getOffers() as $o): ?> - >
+ '>  + '; ?> + getName()); ?>
+ '; ?>
-trainingPlaces) > 0): ?> +club->getPlaces()) > 0): ?>
Räumlichkeiten
-trainingPlaces as $p): ?> -
-
-
- -
+club->getPlaces() as $p): ?> +
+ getName()); ?>
+ Adresse + getAddress())); ?> + getArea() === null ? '' : '
Fläche: ' . htmlentities($p->getArea()) . 'qm'; ?> +
+
-persons) > 0) : ?> +
+
Präsident
+ +
+ +club->getUsers()) > 0) : ?>
Assoziierte Personen
- canModify): ?> - Neue Assoziation anlegen - + canModify): ?> +   Neue Assoziation anlegen +
-canModify): ?> -
-Stammdaten anpassen
-Räumlichkeiten anpassen
-
- diff --git a/src/site/views/club/view.html.php b/src/site/views/club/view.html.php index 6f0f790..74f1288 100644 --- a/src/site/views/club/view.html.php +++ b/src/site/views/club/view.html.php @@ -1,8 +1,7 @@ clubid = 43; - $this->clubname = "Testclub"; - $this->address = "Strasse 1\n66123 Ort"; - $this->contactperson = "Max Mustermann"; - $this->email = "me@club.de"; - $this->phone = "012345"; - $this->internet = "http://wichtig.de"; + $input = Factory::getApplication()->input; + $id = $input->getInt('clubid', -1); - $this->options = array("Step" => NULL, "JMD" => 1, "Divers." => NULL); - $this->hasOptions = false; - foreach($this->options as $o) - if(isset($o)) + $clubFactory = new CommonClubsModelFactoryClub(); + $this->club = $clubFactory->loadById($id); + + $this->hasOffers = false; + foreach($this->club->getOffers() as $o) + if($o['valid']) { - $this->hasOptions = true; + $this->hasOffers = true; break; } - - $this->trainingPlaces = array(); -// $this->trainingPlaces[] = array('name'=>'Schule', 'street'=>'Straße', 'city'=>'SB', 'plz'=>'12345'); -// $this->trainingPlaces[] = array('name'=>'Schule', 'street'=>'Straße', 'city'=>'SB', 'plz'=>'12345'); - - $this->persons = array(); - $this->persons[] = array('name'=>'Max', 'position'=>'Präsident', 'id'=>3, 'assoc'=>6, 'modify'=>true); - $this->persons[] = array('name'=>'Max', 'position'=>'Präsident', 'id'=>3, 'assoc'=>7, 'modify'=>false); - - $this->canModify = true; - - // ?option=com_clubs&view=searchperson&data=clubid . "}"); - $dataValue = array(); - $dataValue['clubid'] = $this->clubid; - - $dataAbort = array( - 'urlAbort' => (Uri::getInstance()->toString()), - 'urlSelect' => '?option=com_clubs&view=clubassoc&person=%u', - 'data' => json_encode($dataValue) - ); - $this->urlNewPerson = htmlentities("?option=com_clubs&view=searchperson&" . http_build_query($dataAbort)); - - Factory::getDocument()->addStyleSheet(Uri::base(true) . "components/com_clubs/css/clubs.css"); - parent::display($tpl); } } diff --git a/src/site/views/clubs/tmpl/default.php b/src/site/views/clubs/tmpl/default.php index 202495c..b9e6720 100644 --- a/src/site/views/clubs/tmpl/default.php +++ b/src/site/views/clubs/tmpl/default.php @@ -8,3 +8,22 @@ defined('_JEXEC') or die;
 Ort 	Verein 	Adresse 	Ansprechpartner 	Email
 
+ + + + + + + + + + clubs as $club): ?> + + + + + + + + +
OrtVereinAdresseVorsitzenerE-Mail-Adresse
getCity()); ?>getName()); ?>getAddress())); ?>getPresident()->getName()); ?>getMail()); ?>
diff --git a/src/site/views/clubs/tmpl/default.xml b/src/site/views/clubs/tmpl/default.xml new file mode 100644 index 0000000..cba0508 --- /dev/null +++ b/src/site/views/clubs/tmpl/default.xml @@ -0,0 +1,6 @@ + + + + Liste aller aktiven Vereine des Verbands + + diff --git a/src/site/views/clubs/view.html.php b/src/site/views/clubs/view.html.php index ef2c307..3fa183f 100644 --- a/src/site/views/clubs/view.html.php +++ b/src/site/views/clubs/view.html.php @@ -7,4 +7,12 @@ defined('_JEXEC') or die; class ClubsViewClubs extends HtmlView { + + public function display($tpl = null) + { + $clubFactory = new CommonClubsModelFactoryClub(); + $this->clubs = $clubFactory->loadElements(); + + parent::display($tpl); + } } diff --git a/src/site/views/mypage/tmpl/default.php b/src/site/views/mypage/tmpl/default.php index 6b8d0cf..430a2de 100644 --- a/src/site/views/mypage/tmpl/default.php +++ b/src/site/views/mypage/tmpl/default.php @@ -1,5 +1,7 @@ -me->getPositions() as $userassoc) { - ?> -
  • '>
  • - clubsPresident as $pc): + $link = Route::_("index.php?view=club&clubid={$pc->getId()}"); ?> - \ No newline at end of file +
  • Vorsitzender im Verein "getName()); ?>"
  • + + +positions as $pos): + $link = Route::_("index.php?view=club&clubid={$pos->getClub()->getId()}"); +?> +
  • getPosition()->getName()); ?> im Verein "getClub()->getName()); ?>"
  • + + + diff --git a/src/site/views/mypage/view.html.php b/src/site/views/mypage/view.html.php index 88d4eae..0dba28c 100644 --- a/src/site/views/mypage/view.html.php +++ b/src/site/views/mypage/view.html.php @@ -10,25 +10,13 @@ class ClubsViewMyPage extends HtmlView public function display($tpl = null) { - // FIXME - $this->clubs = array(); - - $c = array(); - $c['name'] = "Ein Test-Club"; - $c['city'] = "Saarbrücken"; - $c['id'] = 2; - $this->clubs[] = $c; - - $c = array(); - $c['name'] = "Ein zweiter Test-Club"; - $c['city'] = "Saarlouis"; - $c['id'] = 4; - $this->clubs[] = $c; - $userFactory = new CommonClubsModelFactoryUser(); $users = $userFactory->loadElements(); $this->me = $users[0]; + $this->clubsPresident = $this->me->getPresidentClubs(); + $this->positions = $this->me->getPositions(); + parent::display($tpl); } }