Frontend started to implement first page with databse in use

This commit is contained in:
Christian Wolf 2019-06-14 15:51:40 +02:00
parent 52a5ebea3a
commit 759f04d34f
8 changed files with 91 additions and 26 deletions

View File

@ -8,6 +8,7 @@ abstract class AbstractCommonClubsModelColumn
protected $alias;
protected $column;
/**
* @var AbstractCommonClubsControllerMapping
*/

View File

@ -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;
}
}

View File

@ -1,6 +1,7 @@
<?php
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Factory;
// No direct access.
@ -21,7 +22,7 @@ class ClubsController extends BaseController
{
if($this->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

View File

@ -1,16 +0,0 @@
<?php
// No direct access.
defined('_JEXEC') or die;
?>
<ul>
<?php
foreach ($this->clubs as $c) {
?>
<li><a href='?option=com_clubs&view=club&clubid=<?php echo $c['id']; ?>'><?php echo htmlentities($c['name']); ?></a></li>
<?php
}
?>
</ul>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="Eigene Vereine">
<message>Diese Seite erlaubt den Zugriff auf alle Vereine, mit denen ein Benutzer assoziiert ist.</message>
</layout>
</metadata>

View File

@ -0,0 +1,58 @@
<?php
// No direct access.
defined('_JEXEC') or die;
?>
<h2>Meine Seite</h2>
<h3>Stammdaten</h3>
<div class='clubs_row'>
<div class='clubs_title_row'>Name</div>
<div class='clubs_content_row'><?php echo htmlentities($this->me->getName()); ?></div>
</div>
<div class='clubs_row'>
<div class='clubs_title_row'>Benutzer-Alias</div>
<div class='clubs_content_row'><?php echo htmlentities($this->me->getUsername()); ?></div>
</div>
<div class='clubs_row'>
<div class='clubs_title_row'>Adresse</div>
<div class='clubs_content_row'><?php echo nl2br(htmlentities($this->me->getAddress())); ?></div>
</div>
<div class='clubs_row'>
<div class='clubs_title_row'>Stadt</div>
<div class='clubs_content_row'><?php echo htmlentities($this->me->getCity()); ?></div>
</div>
<div class='clubs_row'>
<div class='clubs_title_row'>E-Mail-Adresse</div>
<div class='clubs_content_row'><?php echo htmlentities($this->me->getMail()); ?></div>
</div>
<div class='clubs_row'>
<div class='clubs_title_row'>Telefon-Nr.</div>
<div class='clubs_content_row'><?php echo $this->me->getPhone() !== null ? htmlentities($this->me->getPhone()) : '<i>nicht angegeben</i>'; ?></div>
</div>
<div class='clubs_row'>
<div class='clubs_title_row'>Handy-Nr.</div>
<div class='clubs_content_row'><?php echo $this->me->getMobile() !== null ? htmlentities($this->me->getMobile()) : '<i>nicht angegeben</i>'; ?></div>
</div>
<h3>Meine Vereine</h3>
<ul>
<?php
/*foreach ($this->me->getPositions() as $userassoc) {
?>
<li><a href='?option=com_clubs&view=club&clubid=<?php echo $c['id']; ?>'><?php echo htmlentities($c['name']); ?></a></li>
<?php
}*/
?>
</ul>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="Eigene Seite">
<message>Diese Seite erlaubt den Zugriff auf die eigene Seite eines Benutzers.</message>
</layout>
</metadata>

View File

@ -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);
}
}