Compare commits

..

No commits in common. "dev/backend" and "master" have entirely different histories.

21 changed files with 10 additions and 643 deletions

View File

@ -1,18 +1,5 @@
<?php
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Factory;
// No direct access.
defined('_JEXEC') or die;
$controller = BaseController::getInstance("Clubs");
$input = Factory::getApplication()->input;
$task = $input->getCmd("task", "display");
$view = $input->getCmd('view', 'users');
$input->set('view', $view);
$controller->execute($task);
$controller->redirect();

View File

@ -8,13 +8,4 @@ defined('_JEXEC') or die;
class ClubsController extends BaseController
{
protected $default_view = 'users';
public function display($cachable = false, $urlparams = array())
{
$this->input->get('view', $this->default_view);
parent::display($cachable, $urlparams);
}
}

View File

@ -1,11 +0,0 @@
<?php
use Joomla\CMS\MVC\Controller\FormController;
// No direct access.
defined('_JEXEC') or die;
class ClubsControllerUser extends FormController
{
}

View File

@ -1,18 +0,0 @@
<?php
use Joomla\CMS\MVC\Controller\AdminController;
// No direct access.
defined('_JEXEC') or die;
class ClubsControllerUsers extends AdminController
{
public function getModel($name = 'User', $prefix = 'ClubsModel', $config = array('ignore_request' => true))
{
$model = parent::getModel($name, $prefix, $config);
return $model;
}
}

View File

@ -1,76 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<form
addrulepath='/administrator/components/com_clubs/models/rules'
>
<fieldset>
<field
name="id"
type="hidden"
/>
<field
name="user"
type="text"
label="Benutzername"
size="40"
class="inputbox validate-clubusername"
required='true'
validate='clubusername'
message='Benutzername bereits vergeben'
default=""
/>
<field
name="name"
type="text"
label="Bürgerlicher Name"
size="40"
class="inputbox"
required='true'
default=""
/>
<field
name="address"
type="textarea"
label="Adresse"
size="40"
class="inputbox"
required='true'
default=""
/>
<field
name="city"
type="text"
label="Stadt"
size="40"
class="inputbox"
required='true'
default=""
/>
<field
name="mail"
type="text"
label="E-Mail-Adresse"
size="40"
class="inputbox"
required='true'
validate='email'
default=""
/>
<field
name="phone"
type="text"
label="Telefon-Nr."
size="40"
class="inputbox"
default=""
/>
<field
name="mobile"
type="text"
label="Handy-Nr."
size="40"
class="inputbox"
default=""
/>
</fieldset>
</form>

View File

@ -1,96 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<form
addrulepath='/administrator/components/com_clubs/models/rules'
>
<fieldset>
<field
name="id"
type="hidden"
/>
<field
name="user"
type="text"
label="Benutzername"
size="40"
class="inputbox validate-clubusername"
required='true'
validate='clubusername'
message='Benutzername bereits vergeben'
default=""
/>
<field
name="password"
type="password"
label="Passwort"
size="40"
class="inputbox"
required='true'
default=""
/>
<field
name="password-confirm"
type="password"
label="Passwort wiederholen"
size="40"
class="inputbox"
required='true'
validate='equals' field='password-main'
message='Passwoerter stimmen nicht ueberein'
default=""
/>
<field
name="name"
type="text"
label="Bürgerlicher Name"
size="40"
class="inputbox"
required='true'
default=""
/>
<field
name="address"
type="textarea"
label="Adresse"
size="40"
class="inputbox"
required='true'
default=""
/>
<field
name="city"
type="text"
label="Stadt"
size="40"
class="inputbox"
required='true'
default=""
/>
<field
name="mail"
type="text"
label="E-Mail-Adresse"
size="40"
class="inputbox"
required='true'
validate='email'
default=""
/>
<field
name="phone"
type="text"
label="Telefon-Nr."
size="40"
class="inputbox"
default=""
/>
<field
name="mobile"
type="text"
label="Handy-Nr."
size="40"
class="inputbox"
default=""
/>
</fieldset>
</form>

View File

@ -1,41 +0,0 @@
<?php
use Joomla\CMS\Factory;
use Joomla\CMS\Form\Form;
use Joomla\CMS\Form\FormRule;
use Joomla\Registry\Registry;
// No direct access.
defined('_JEXEC') or die;
class JFormRuleClubUserName extends FormRule
{
public function test(\SimpleXMLElement $element, $value, $group = null, Registry $input = null, Form $form = null)
{
// Get the database object and a new query object.
$db = Factory::getDbo();
$query = $db->getQuery(true);
// Build the query.
$query->select('COUNT(*)')
->from('#__club_users')
->where('user = ' . $db->quote($value));
// Get the extra field check attribute.
$userId = $input->get('id');
$query->where($db->quoteName('id') . ' <> ' . (int) $userId);
// Set and query the database.
$db->setQuery($query);
$duplicate = (bool) $db->loadResult();
if ($duplicate)
{
return false;
}
return true;
}
}

View File

@ -1,91 +0,0 @@
<?php
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Model\AdminModel;
use Joomla\CMS\Table\Table;
// No direct access.
defined('_JEXEC') or die;
class ClubsModelUser extends AdminModel
{
public function getTable($type = 'User', $prefix = 'ClubsTable', $config = array())
{
return Table::getInstance($type, $prefix, $config);
}
public function getFormNewUser($data = [], $loadData = true)
{
$form = $this->loadForm(
'com_clubs.newuser',
'newuser',
array(
'control' => 'jform',
'load_data' => $loadData
)
);
if (empty($form))
{
return false;
}
return $form;
}
public function getFormChangeUser($data = [], $loadData = true)
{
$form = $this->loadForm(
'com_clubs.changeuser',
'changeuser',
array(
'control' => 'jform',
'load_data' => $loadData
)
);
if (empty($form))
{
return false;
}
return $form;
}
protected function loadFormData()
{
// Check the session for previously entered form data.
$data = Factory::getApplication()->getUserState(
'com_clubs.edit.user.data',
array()
);
if (empty($data))
{
$data = $this->getItem();
}
return $data;
}
protected function prepareTable($table)
{
/* define which columns can have NULL values */
$defnull = array('phone', 'mobile');
foreach ($defnull as $val)
/* define the rules when the value is set NULL */
if (!strlen($table->$val))
$table->$val = NULL;
if(isset($table->password))
{
}
}
function getForm($data = [], $loadData = true)
{}
}

View File

@ -1,22 +0,0 @@
<?php
use Joomla\CMS\MVC\Model\ListModel;
// No direct access.
defined('_JEXEC') or die;
class ClubsModelUsers extends ListModel
{
public function getListQuery()
{
$db = $this->getDbo();
$q = $db->getQuery(true);
$q->select('*')
->from('#__club_users');
return $q;
}
}

View File

@ -1,21 +0,0 @@
<?php
use Joomla\CMS\Table\Table;
// No direct access.
defined('_JEXEC') or die;
class ClubsTableUser extends Table
{
function __construct(&$db)
{
parent::__construct('#__club_users', 'id', $db);
}
public function store($updateNulls = false)
{
return parent::store(true);
}
}

View File

@ -1,26 +0,0 @@
<?php
// No direct access.
defined('_JEXEC') or die;
?>
<form action="<?php echo JRoute::_('index.php?option=com_clubs&layout=edit&id=' . (int) $this->item->id); ?>" method="post" name="adminForm" id="adminForm">
<div class="form-horizontal">
<fieldset class="adminform">
<legend><?php echo JText::_('COM_HELLOWORLD_HELLOWORLD_DETAILS'); ?></legend>
<div class="row-fluid">
<div class="span6">
<?php foreach ($this->form->getFieldset() as $field): ?>
<div class="control-group">
<div class="control-label"><?php echo $field->label; ?></div>
<div class="controls"><?php echo $field->input; ?></div>
</div>
<?php endforeach; ?>
</div>
</div>
</fieldset>
</div>
<input type="hidden" name="task" value="helloworld.edit" />
<?php echo JHtml::_('form.token'); ?>
</form>

View File

@ -1,61 +0,0 @@
<?php
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Toolbar\ToolbarHelper;
// No direct access.
defined('_JEXEC') or die;
class ClubsViewUser extends HtmlView
{
public function display($tpl = null)
{
// Get the Data
$this->item = $this->get('Item');
$isNew = ($this->item->id == 0);
if($isNew)
$this->form = $this->get('FormNewUser');
else
$this->form = $this->get('FormChangeUser');
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseError(500, implode('<br />', $errors));
return false;
}
// Set the toolbar
$this->addToolBar($isNew);
// Display the template
parent::display($tpl);
}
protected function addToolBar($isNew)
{
$input = Factory::getApplication()->input;
// Hide Joomla Administrator Main menu
$input->set('hidemainmenu', true);
if ($isNew)
{
$title = 'Benutzer hinzuf&uuml;gen';
}
else
{
$title = 'Benutzer bearbeiten';
}
ToolbarHelper::title($title, 'user');
ToolbarHelper::save('user.save');
ToolbarHelper::cancel('user.cancel', $isNew ? 'JTOOLBAR_CANCEL' : 'JTOOLBAR_CLOSE');
}
}

View File

@ -1,73 +0,0 @@
<?php
use Joomla\CMS\Router\Route;
// No direct access.
defined('_JEXEC') or die;
?>
<form action='index.php?option=com_clubs&view=users' method="post" id='adminForm' name='adminForm'>
<table class="table table-striped table-hover">
<thead>
<tr>
<th width="1%">Nr.</th>
<th width="2%">
<?php echo JHtmlGrid::checkall(); ?>
</th>
<th width="30%">
Name
</th>
<th width="30%">
Ort
</th>
<th width="10%">
Username
</th>
<th width="2%">
Id
</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="5">
<?php echo $this->pagination->getListFooter(); ?>
</td>
</tr>
</tfoot>
<tbody>
<?php if (!empty($this->users)) : ?>
<?php foreach ($this->users as $i => $row) : ?>
<?php $link = Route::_('index.php?option=com_clubs&task=user.edit&id=' . $row->id); ?>
<tr>
<td>
<?php echo $this->pagination->getRowOffset($i); ?>
</td>
<td>
<?php echo JHtmlGrid::id($i, $row->id); ?>
</td>
<td>
<a href='<?php echo $link; ?>'><?php echo htmlentities($row->name); ?></a>
</td>
<td>
<?php echo htmlentities($row->city); ?>
</td>
<td>
<?php echo htmlentities($row->user); ?>
</td>
<td align="center">
<?php echo $row->id; ?>
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
<input type="hidden" name="task" value=""/>
<input type="hidden" name="boxchecked" value="0"/>
</form>

View File

@ -1,28 +0,0 @@
<?php
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Toolbar\ToolbarHelper;
// No direct access.
defined('_JEXEC') or die;
class ClubsViewUsers extends HtmlView
{
public function display(string $tpl = null)
{
$this->users = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->addToolBar();
parent::display($tpl);
}
private function addToolBar()
{
ToolbarHelper::title('Registrierte Benutzer', 'user');
ToolbarHelper::addNew('user.add');
ToolbarHelper::editList('user.edit');
ToolbarHelper::deleteList('', 'users.delete');
}
}

View File

@ -44,9 +44,9 @@
<administration>
<menu>Vereinsmanagement</menu>
<!--submenu>
<menu link='link' view='v'>Test</menu>
</submenu>-->
<submenu>
<!-- <menu link='link' view='v'>Test</menu> -->
</submenu>
<files from='admin'>
<filename>clubs.php</filename>
<filename>controller.php</filename>

View File

@ -1,7 +1,6 @@
<?php
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Factory;
// No direct access.
defined('_JEXEC') or die;
@ -11,29 +10,11 @@ class ClubsController extends BaseController
public function display($cachable = false, $params = array())
{
$viewName = $this->input->get('view', $this->default_view);
if($this->checkAuth($viewName))
parent::display($cachable, $params);
else
{
Factory::getApplication()->enqueueMessage("Keine Rechte vorhanden. Bitte einloggen.");
$this->setRedirect('?option=com_clubs&view=login');
}
parent::display($cachable, $params);
}
private function checkAuth($viewName)
public function foo()
{
if($viewName === null)
return true;
switch($viewName)
{
case 'login':
return true;
default:
return true; // FIXME
}
echo "dsfh";
}
}

View File

@ -14,14 +14,10 @@
margin: 10px 0px;
}
.clubs_content_row > input.clubs[type="text"],
.clubs_content_row > textarea.clubs,
.clubs_content_row > select.clubs
input.clubs,
textarea.clubs
{
width: 100%;
box-sizing: border-box;
height: auto;
padding: 10px 10px;
}
table.clubs > tbody > tr > th

View File

@ -1,13 +0,0 @@
<?php
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
// No direct access.
defined('_JEXEC') or die;
class ClubsModelSearchPerson extends BaseDatabaseModel
{
}

View File

@ -17,13 +17,7 @@ defined('_JEXEC') or die;
<div class='clubs_row'>
<div class='clubs_title_row'>Funktion im Verein</div>
<div class='clubs_content_row'>
<select name="userFunction" class='clubs'>
<?php foreach($this->functions as $f): ?>
<option value='<?php echo $f['functionid']; ?>' <?php if(isset($f['selected']) && $f['selected']) echo 'selected="selected"'; ?>><?php echo htmlentities($f['name']); ?></option>
<?php endforeach; ?>
</select>
</div>
<div class='clubs_content_row'><?php echo $this->userFunction;?></div>
</div>
<div class='clubs_row'>

View File

@ -27,11 +27,6 @@ class ClubsViewClubAssoc extends HtmlView
$this->mailDedicated = true;
$this->functions = array();
$this->functions[] = array('functionid'=>3, 'name'=>'Vorsitzender', 'selected'=>false);
$this->functions[] = array('functionid'=>4, 'name'=>'2. Vorsitzender', 'selected'=>true);
$this->functions[] = array('functionid'=>5, 'name'=>'Sportwart');
$this->clubname = "Testclub";
$this->address = "Strasse 1\n66123 Ort";
$this->contactperson = "Max Mustermann";
@ -64,7 +59,7 @@ class ClubsViewClubAssoc extends HtmlView
HTMLHelper::_('jquery.framework');
Factory::getDocument()->addStyleSheet(Uri::base(true) . "components/com_clubs/css/clubs.css");
Factory::getDocument()->addScript(Uri::base(true) . "components/com_clubs/views/clubassoc/assoc.js");
Factory::getDocument()->addScript(Uri::base(true) . "components/com_clubs/js/assoc.js");
parent::display($tpl);
}