Inserted data into frontend from models for some views
This commit is contained in:
parent
759f04d34f
commit
5179ea9de5
@ -125,6 +125,11 @@ class CommonClubsModelUser extends AbstractCommonClubsModel
|
|||||||
return $this->fetchAssociatedElements(new CommonClubsModelFactoryUserassoc(), 'userid');
|
return $this->fetchAssociatedElements(new CommonClubsModelFactoryUserassoc(), 'userid');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPresidentClubs()
|
||||||
|
{
|
||||||
|
return $this->fetchAssociatedElements(new CommonClubsModelFactoryClub(), 'president');
|
||||||
|
}
|
||||||
|
|
||||||
public function isPasswordSuitable($password)
|
public function isPasswordSuitable($password)
|
||||||
{
|
{
|
||||||
if(strlen($password) < 8)
|
if(strlen($password) < 8)
|
||||||
|
@ -1,46 +1,61 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Joomla\CMS\Router\Route;
|
||||||
|
|
||||||
// No direct access.
|
// No direct access.
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<h1><?php echo $this->clubname; ?></h1>
|
<h1><?php echo htmlentities($this->club->getName()); ?></h1>
|
||||||
|
|
||||||
<div class='clubs_row'>
|
<div class='clubs_row'>
|
||||||
<div class='clubs_title_row'>Adresse</div>
|
<div class='clubs_title_row'>Adresse</div>
|
||||||
<div class='clubs_content_row'><?php echo nl2br(htmlentities($this->address)); ?></div>
|
<div class='clubs_content_row'><?php echo nl2br(htmlentities($this->club->getAddress())); ?></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class='clubs_row'>
|
<div class='clubs_row'>
|
||||||
<div class='clubs_title_row'>Internet</div>
|
<div class='clubs_title_row'>Stadt</div>
|
||||||
<div class='clubs_content_row'><?php echo htmlentities($this->internet); ?></div>
|
<div class='clubs_content_row'><?php echo htmlentities($this->club->getCity()); ?></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class='clubs_row'>
|
<div class='clubs_row'>
|
||||||
<div class='clubs_title_row'>Kontaktperson</div>
|
<div class='clubs_title_row'>Homepage</div>
|
||||||
<div class='clubs_content_row'><?php echo htmlentities($this->contactperson); ?></div>
|
<div class='clubs_content_row'><a href='<?php echo htmlentities($this->club->getHomepage()); ?>' target='_blank'><?php echo htmlentities($this->club->getHomepage()); ?></a></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class='clubs_row'>
|
<div class='clubs_row'>
|
||||||
<div class='clubs_title_row'>Mail-Adresse</div>
|
<div class='clubs_title_row'>Mail-Adresse</div>
|
||||||
<div class='clubs_content_row'><a href='mailto:<?php echo htmlentities($this->email); ?>'><?php echo htmlentities($this->email); ?></a></div>
|
<div class='clubs_content_row'><a href='mailto:<?php echo htmlentities($this->club->getMail()); ?>'><?php echo htmlentities($this->club->getMail()); ?></a></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class='clubs_row'>
|
<div class='clubs_row'>
|
||||||
<div class='clubs_title_row'>Telefon</div>
|
<div class='clubs_title_row'>IBAN / BIC</div>
|
||||||
<div class='clubs_content_row'><?php echo htmlentities($this->phone); ?></div>
|
<div class='clubs_content_row'><?php echo htmlentities($this->club->getIban()); ?> / <?php echo htmlentities($this->club->getBic()); ?></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class='clubs_row'>
|
||||||
|
<div class='clubs_title_row'>Gemeinnützigkeit</div>
|
||||||
|
<div class='clubs_content_row'><span class='icon-<?php echo $this->club->isCharitable() ? 'ok' : 'cancel'; ?>'></span> Der Verein ist <?php echo $this->club->isCharitable() ? '' : '<b>nicht</b>'; ?> gemeinnützig.</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--<div class='clubs_row'>
|
||||||
|
<div class='clubs_title_row'>Telefon</div>
|
||||||
|
<div class='clubs_content_row'><?php echo htmlentities('$this->phone'); ?></div>
|
||||||
|
</div>-->
|
||||||
|
|
||||||
<div class='clubs_row'>
|
<div class='clubs_row'>
|
||||||
<div class='clubs_title_row'>Angebote</div>
|
<div class='clubs_title_row'>Angebote</div>
|
||||||
<div class='clubs_content_row'>
|
<div class='clubs_content_row'>
|
||||||
<?php if($this->hasOptions):
|
<?php if($this->hasOffers):
|
||||||
|
|
||||||
// Put all options there
|
// Put all options there
|
||||||
foreach($this->options as $k=>$v):
|
foreach($this->club->getOffers() as $o):
|
||||||
?>
|
?>
|
||||||
<input type="checkbox" disabled="disabled" <?php if(isset($v)) echo 'checked="checked"'; ?>> <?php echo htmlentities($k); ?><br />
|
<span class='icon-<?php echo $o['valid'] ? 'ok' : 'cancel-2'; ?>'></span>
|
||||||
|
<?php if($o['valid']) echo '<b>'; ?>
|
||||||
|
<?php echo htmlentities($o['offer']->getName()); ?><br />
|
||||||
|
<?php if($o['valid']) echo '</b>'; ?>
|
||||||
<?php
|
<?php
|
||||||
endforeach;
|
endforeach;
|
||||||
|
|
||||||
@ -52,47 +67,54 @@ endif; ?>
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if(count($this->trainingPlaces) > 0): ?>
|
<?php if(count($this->club->getPlaces()) > 0): ?>
|
||||||
<div class='clubs_row'>
|
<div class='clubs_row'>
|
||||||
<div class='clubs_title_row'>Räumlichkeiten</div>
|
<div class='clubs_title_row'>Räumlichkeiten</div>
|
||||||
<?php foreach($this->trainingPlaces as $p): ?>
|
<?php foreach($this->club->getPlaces() as $p): ?>
|
||||||
<div class='clubs_content_row'>
|
<div class='clubs_content_row'>
|
||||||
<?php echo htmlentities($p['name']); ?><br />
|
<b><?php echo htmlentities($p->getName()); ?></b><br />
|
||||||
<?php echo htmlentities($p['street']); ?><br />
|
<i>Adresse</i>
|
||||||
<?php echo htmlentities($p['plz'] . " " . $p['city']); ?>
|
<?php //echo nl2br(htmlentities($p->getAddress())); ?>
|
||||||
</div>
|
<?php echo $p->getArea() === null ? '' : '<br />Fläche: ' . htmlentities($p->getArea()) . 'qm'; ?>
|
||||||
|
</div>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
<div class='clubs_content_row'><a href='<?php echo ""; ?>'><span class='icon-new'></span> Neue Assoziation anlegen</a></div>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if(count($this->persons) > 0) : ?>
|
<div class='clubs_row'>
|
||||||
|
<div class='clubs_title_row'>Präsident</div>
|
||||||
|
<div class='clubs_content_row'>
|
||||||
|
<a href='<?php echo Route::_("index.php?view=user&userid={$this->club->getPresident()->getId()}"); ?>'>
|
||||||
|
<?php echo htmlentities("{$this->club->getPresident()->getName()} ({$this->club->getPresident()->getCity()})"); ?>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if(count($this->club->getUsers()) > 0) : ?>
|
||||||
<div class='clubs_row'>
|
<div class='clubs_row'>
|
||||||
<div class='clubs_title_row'>Assoziierte Personen</div>
|
<div class='clubs_title_row'>Assoziierte Personen</div>
|
||||||
<div class='clubs_content_row'>
|
<div class='clubs_content_row'>
|
||||||
<ul>
|
<ul>
|
||||||
<?php foreach($this->persons as $p): ?>
|
<?php foreach($this->club->getUsers() as $uassoc): ?>
|
||||||
<li>
|
<li>
|
||||||
<a href='?option=com_clubs&view=user&id=<?php echo $p['id']; ?>'><?php echo htmlentities($p['name']); ?></a>:
|
<a href='?option=com_clubs&view=user&id=<?php echo $uassoc->getUser()->getId(); ?>'>
|
||||||
<?php echo htmlentities($p['position']); ?>
|
<?php echo htmlentities($uassoc->getUser()->getName()); ?>
|
||||||
<?php if ($p['modify']) echo ' (Club-Admin)'; ?>
|
</a>:
|
||||||
<?php if($this->canModify): ?>
|
<?php echo htmlentities($uassoc->getPosition()->getName()); ?>
|
||||||
<a href='?option=com_clubs&view=clubassoc&assoc=<?php echo $p['assoc']; ?>'>Ändern</a>
|
<?php if ($uassoc->isAdmin()) echo ' (Club-Admin)'; ?>
|
||||||
<a href='?option=com_clubs&task=club.delassoc&assoc=<?php echo $p['assoc']; ?>'>Löschen</a>
|
<!--<?php //if($this->canModify): ?>
|
||||||
<?php endif; ?>
|
<a href='?option=com_clubs&view=clubassoc&assoc=<?php //echo $p['assoc']; ?>'>Ändern</a>
|
||||||
</li>
|
<a href='?option=com_clubs&task=club.delassoc&assoc=<?php //echo $p['assoc']; ?>'>Löschen</a>-->
|
||||||
<?php endforeach; ?>
|
<?php //endif; ?>
|
||||||
|
</li>
|
||||||
|
<?php endforeach; ?>
|
||||||
</ul>
|
</ul>
|
||||||
<?php if($this->canModify): ?>
|
<?php //if($this->canModify): ?>
|
||||||
<a href='<?php echo $this->urlNewPerson; ?>'>Neue Assoziation anlegen</a>
|
<a href='<?php echo ""; ?>'><span class='icon-new'></span> Neue Assoziation anlegen</a>
|
||||||
<?php endif; ?>
|
<?php //endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if($this->canModify): ?>
|
|
||||||
<div class='clubs_row'>
|
|
||||||
<a href="?option=com_clubs&view=clubdata&clubid=<?php echo $this->clubid; ?>">Stammdaten anpassen</a><br />
|
|
||||||
<a href="?option=com_clubs&view=clubplaces&clubid=<?php echo $this->clubid; ?>">Räumlichkeiten anpassen</a><br />
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Joomla\CMS\MVC\View\HtmlView;
|
|
||||||
use Joomla\CMS\Factory;
|
use Joomla\CMS\Factory;
|
||||||
use Joomla\CMS\Uri\Uri;
|
use Joomla\CMS\MVC\View\HtmlView;
|
||||||
|
|
||||||
// No direct access.
|
// No direct access.
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
@ -12,47 +11,19 @@ class ClubsViewClub extends HtmlView
|
|||||||
|
|
||||||
public function display($tpl = null)
|
public function display($tpl = null)
|
||||||
{
|
{
|
||||||
// FIXME Insert code from DB
|
$input = Factory::getApplication()->input;
|
||||||
$this->clubid = 43;
|
$id = $input->getInt('clubid', -1);
|
||||||
$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";
|
|
||||||
|
|
||||||
$this->options = array("Step" => NULL, "JMD" => 1, "Divers." => NULL);
|
$clubFactory = new CommonClubsModelFactoryClub();
|
||||||
$this->hasOptions = false;
|
$this->club = $clubFactory->loadById($id);
|
||||||
foreach($this->options as $o)
|
|
||||||
if(isset($o))
|
$this->hasOffers = false;
|
||||||
|
foreach($this->club->getOffers() as $o)
|
||||||
|
if($o['valid'])
|
||||||
{
|
{
|
||||||
$this->hasOptions = true;
|
$this->hasOffers = true;
|
||||||
break;
|
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=<?php echo urlencode('{"clubid":' . $this->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);
|
parent::display($tpl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,3 +8,22 @@ defined('_JEXEC') or die;
|
|||||||
<pre>
|
<pre>
|
||||||
Ort Verein Adresse Ansprechpartner Email
|
Ort Verein Adresse Ansprechpartner Email
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
<table width='100%'>
|
||||||
|
<tr>
|
||||||
|
<th>Ort</th>
|
||||||
|
<th>Verein</th>
|
||||||
|
<th>Adresse</th>
|
||||||
|
<th>Vorsitzener</th>
|
||||||
|
<th>E-Mail-Adresse</th>
|
||||||
|
</tr>
|
||||||
|
<?php foreach ($this->clubs as $club): ?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo htmlentities($club->getCity()); ?></td>
|
||||||
|
<td><?php echo htmlentities($club->getName()); ?></td>
|
||||||
|
<td><?php echo nl2br(htmlentities($club->getAddress())); ?></td>
|
||||||
|
<td><?php echo htmlentities($club->getPresident()->getName()); ?></td>
|
||||||
|
<td><a href='mailto:<?php echo htmlentities($club->getMail()); ?>'><?php echo htmlentities($club->getMail()); ?></a></td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</table>
|
||||||
|
6
src/site/views/clubs/tmpl/default.xml
Normal file
6
src/site/views/clubs/tmpl/default.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<metadata>
|
||||||
|
<layout title="Liste der Vereine">
|
||||||
|
<message>Liste aller aktiven Vereine des Verbands</message>
|
||||||
|
</layout>
|
||||||
|
</metadata>
|
@ -7,4 +7,12 @@ defined('_JEXEC') or die;
|
|||||||
|
|
||||||
class ClubsViewClubs extends HtmlView
|
class ClubsViewClubs extends HtmlView
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public function display($tpl = null)
|
||||||
|
{
|
||||||
|
$clubFactory = new CommonClubsModelFactoryClub();
|
||||||
|
$this->clubs = $clubFactory->loadElements();
|
||||||
|
|
||||||
|
parent::display($tpl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Joomla\CMS\Router\Route;
|
||||||
|
|
||||||
// No direct access.
|
// No direct access.
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
@ -48,11 +50,17 @@ defined('_JEXEC') or die;
|
|||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
/*foreach ($this->me->getPositions() as $userassoc) {
|
foreach ($this->clubsPresident as $pc):
|
||||||
?>
|
$link = Route::_("index.php?view=club&clubid={$pc->getId()}");
|
||||||
<li><a href='?option=com_clubs&view=club&clubid=<?php echo $c['id']; ?>'><?php echo htmlentities($c['name']); ?></a></li>
|
|
||||||
<?php
|
|
||||||
}*/
|
|
||||||
?>
|
?>
|
||||||
</ul>
|
<li><a href='<?php echo $link; ?>'>Vorsitzender im Verein "<?php echo htmlentities($pc->getName()); ?>"</a></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
|
||||||
|
<?php foreach ($this->positions as $pos):
|
||||||
|
$link = Route::_("index.php?view=club&clubid={$pos->getClub()->getId()}");
|
||||||
|
?>
|
||||||
|
<li><a href='<?php echo $link; ?>'><?php echo htmlentities($pos->getPosition()->getName()); ?> im Verein "<?php echo htmlentities($pos->getClub()->getName()); ?>"</a></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
@ -10,25 +10,13 @@ class ClubsViewMyPage extends HtmlView
|
|||||||
|
|
||||||
public function display($tpl = null)
|
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();
|
$userFactory = new CommonClubsModelFactoryUser();
|
||||||
$users = $userFactory->loadElements();
|
$users = $userFactory->loadElements();
|
||||||
$this->me = $users[0];
|
$this->me = $users[0];
|
||||||
|
|
||||||
|
$this->clubsPresident = $this->me->getPresidentClubs();
|
||||||
|
$this->positions = $this->me->getPositions();
|
||||||
|
|
||||||
parent::display($tpl);
|
parent::display($tpl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user