Started to work on places 1:n relation
The current class structure might be incapable to solve this efficiently
This commit is contained in:
parent
45d3e09c7e
commit
af506435ac
87
src/site/parts/club/places.php
Normal file
87
src/site/parts/club/places.php
Normal file
@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
// No direct access.
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
class ClubsPartClubPlaces extends ClubsHelperParts
|
||||
{
|
||||
protected function getPartName()
|
||||
{
|
||||
return 'club.places';
|
||||
}
|
||||
|
||||
protected function getEditContent()
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
protected function getEditMarkup()
|
||||
{
|
||||
$ret = '';
|
||||
|
||||
$factory = new CommonClubsModelFactoryClub();
|
||||
$club = $factory->loadById($this->id);
|
||||
|
||||
$offers = $club->getOffers();
|
||||
$first = true;
|
||||
|
||||
foreach($offers as $o)
|
||||
{
|
||||
if(!$first)
|
||||
$ret .= '<br />';
|
||||
|
||||
$checked = $o['valid'] ? ' checked' : '';
|
||||
$ret .= "<input type='checkbox' name='offers[]' value='{$o['offer']->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 .= '<br />';
|
||||
$first = false;
|
||||
|
||||
$ret .= "<span class='icon-$iconCls'></span> ";
|
||||
if($o['valid'])
|
||||
$ret .= '<b>';
|
||||
$ret .= htmlentities($o['offer']->getName());
|
||||
if($o['valid'])
|
||||
$ret .= '</b>';
|
||||
}
|
||||
|
||||
if(!$hasOffers)
|
||||
{
|
||||
// Reset to info string
|
||||
$ret = '<i>Der Verein hat keine Räume eingetragen.</i>';
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
}
|
@ -117,6 +117,12 @@ $clubid = $this->club->getId();
|
||||
<?php else: ?>
|
||||
Der Verein hat keine Angebote festgelegt.
|
||||
<?php endif; ?>
|
||||
<div class='clubs_content_row'>
|
||||
<?php
|
||||
$partHandler = new ClubsPartClubPlaces($clubid);
|
||||
echo $partHandler->getViewPart();
|
||||
?>
|
||||
</div>
|
||||
<div class='clubs_content_row'><a href='<?php echo ""; ?>'><span class='icon-new'></span> Neue Assoziation anlegen</a></div>
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user