From af506435acc1a7dbf332875ca0955098b76a48ae Mon Sep 17 00:00:00 2001 From: Christian Wolf Date: Wed, 26 Jun 2019 19:30:34 +0200 Subject: [PATCH] Started to work on places 1:n relation The current class structure might be incapable to solve this efficiently --- src/site/parts/club/places.php | 87 ++++++++++++++++++++++++++++ src/site/views/club/tmpl/default.php | 6 ++ 2 files changed, 93 insertions(+) create mode 100644 src/site/parts/club/places.php diff --git a/src/site/parts/club/places.php b/src/site/parts/club/places.php new file mode 100644 index 0000000..e902267 --- /dev/null +++ b/src/site/parts/club/places.php @@ -0,0 +1,87 @@ +loadById($this->id); + + $offers = $club->getOffers(); + $first = true; + + foreach($offers as $o) + { + if(!$first) + $ret .= '
'; + + $checked = $o['valid'] ? ' checked' : ''; + $ret .= "getId()}'$checked>"; + $ret .= htmlentities($o['offer']->getName()); + + $first = false; + } + + return $ret; + + } + + protected function getViewContent() + { + $ret = ''; + + $factory = new CommonClubsModelFactoryClub(); + $club = $factory->loadById($this->id); + + $offers = $club->getOffers(); + $hasOffers = false; + $first = true; + + foreach($offers as $o) + { + if($o['valid']) + { + $iconCls = 'ok'; + $hasOffers = true; + } + else + { + $iconCls = 'cancel-2'; + } + + if(!$first) + $ret .= '
'; + $first = false; + + $ret .= "  "; + if($o['valid']) + $ret .= ''; + $ret .= htmlentities($o['offer']->getName()); + if($o['valid']) + $ret .= ''; + } + + if(!$hasOffers) + { + // Reset to info string + $ret = 'Der Verein hat keine Räume eingetragen.'; + } + + return $ret; + } +} diff --git a/src/site/views/club/tmpl/default.php b/src/site/views/club/tmpl/default.php index d5dd63b..14ae95f 100644 --- a/src/site/views/club/tmpl/default.php +++ b/src/site/views/club/tmpl/default.php @@ -117,6 +117,12 @@ $clubid = $this->club->getId(); Der Verein hat keine Angebote festgelegt. +
+ getViewPart(); + ?> +
  Neue Assoziation anlegen