General jQuery based approach in frontend is working.

This commit is contained in:
2019-06-18 16:44:44 +02:00
parent a2eb141d5c
commit a30e5d76a1
7 changed files with 202 additions and 10 deletions

View File

@@ -12,37 +12,60 @@ defined('_JEXEC') or die;
<div class='clubs_row'>
<div class='clubs_title_row'>Name</div>
<div class='clubs_content_row'><?php echo htmlentities($this->me->getName()); ?></div>
<div class='clubs_content_row'>
<a class='clubs-edit' href='index.php?option=com_clubs&view=mypage&layout=parts&mode=edit&type=name'>
<?php echo htmlentities($this->me->getName()); ?>
<span class='icon-apply clubs-hidden edit-icon' style='font-size: 200%; margin-left: 0.75em;'></span>
</a>
</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 class='clubs_content_row'>
<?php echo htmlentities($this->me->getUsername()); ?>
<span class='icon-apply clubs-hidden edit-icon' style='font-size: 200%; margin-left: 0.75em;'></span>
</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 class='clubs_content_row address-field'>
<?php echo nl2br(htmlentities($this->me->getAddress())); ?>
<span class='icon-apply clubs-hidden edit-icon' style='font-size: 200%; margin-left: 0.75em;'></span>
</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 class='clubs_content_row'>
<?php echo htmlentities($this->me->getCity()); ?>
<span class='icon-apply clubs-hidden edit-icon' style='font-size: 200%; margin-left: 0.75em;'></span>
</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 class='clubs_content_row'>
<?php echo htmlentities($this->me->getMail()); ?>
<span class='icon-apply clubs-hidden edit-icon' style='font-size: 200%; margin-left: 0.75em;'></span>
</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 class='clubs_content_row'>
<?php echo $this->me->getPhone() !== null ? htmlentities($this->me->getPhone()) : '<i>nicht angegeben</i>'; ?>
<span class='icon-apply clubs-hidden edit-icon' style='font-size: 200%; margin-left: 0.75em;'></span>
</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 class='clubs_content_row'>
<?php echo $this->me->getMobile() !== null ? htmlentities($this->me->getMobile()) : '<i>nicht angegeben</i>'; ?>
<span class='icon-apply clubs-hidden edit-icon' style='font-size: 200%; margin-left: 0.75em;'></span>
</div>
</div>

View File

@@ -0,0 +1,50 @@
<?php
use Joomla\CMS\Factory;
// No direct access.
defined('_JEXEC') or die;
$input = Factory::getApplication()->input;
$type = $input->get->getCmd('type');
$mode = $input->get->getCmd('mode', 'view');
$auth = new ClubsHelperAuth();
$user = $auth->getCurrentUser();
if($mode === 'edit')
{
echo "<form method='POST' action='index.php?option=com_clubs&task=parts.edit&format=json'>";
switch($type)
{
case 'name':
$partname = 'user.name';
$value = $user->getName();
$value = htmlentities($value);
$content = "<input name='name' value='$value'>";
break;
}
echo "<input type='hidden' name='partname' value='$partname'>";
echo $content;
echo '&nbsp;<a class="clubs-save" href="#"><span class="icon-ok"></span></a>&nbsp;';
echo '<a class="clubs-abort" href="index.php?option=com_clubs&view=mypage&layout=parts&type='.$type.'"><span class="icon-cancel-2"></span></a>';
echo '</form>';
}
elseif ($mode === 'view')
{
switch ($type)
{
case 'name':
$content = htmlentities($user->getName());
$partname = 'name';
break;
}
echo "<a class='clubs-edit' href='index.php?option=com_clubs&view=mypage&layout=parts&mode=edit&type=$partname'>";
echo $content;
echo "<span class='icon-apply clubs-hidden edit-icon' style='font-size: 200%; margin-left: 0.75em;'></span></a>";
}
jexit();

View File

@@ -1,6 +1,9 @@
<?php
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\HTML\HTMLHelper;
// No direct access.
defined('_JEXEC') or die;
@@ -10,13 +13,14 @@ class ClubsViewMyPage extends HtmlView
public function display($tpl = null)
{
$userFactory = new CommonClubsModelFactoryUser();
$users = $userFactory->loadElements();
$this->me = $users[0];
$auth = new ClubsHelperAuth();
$this->me = $auth->getCurrentUser();
$this->clubsPresident = $this->me->getPresidentClubs();
$this->positions = $this->me->getPositions();
HTMLHelper::_('jquery.framework');
Factory::getDocument()->addScript(Uri::base(true) . "components/com_clubs/js/edit.js");
parent::display($tpl);
}
}