Compare commits

..

24 Commits

Author SHA1 Message Date
343395c661 Added some more requirements 2019-05-21 16:06:32 +02:00
16bbb09c8c Created basic structure to use rmtoo 2019-05-21 15:44:05 +02:00
852f110967 Added all modified files to allow branching 2019-05-21 11:15:41 +02:00
6209d1aca6 Removed bug to allow CRU operation, D not yet tested 2019-05-20 14:57:55 +02:00
f4f59dcc81 Removed some bugs in Imlpementation of club's details 2019-05-20 14:55:27 +02:00
5ce47c288d Created basic backend for club view 2019-05-20 14:22:45 +02:00
4dc78c21af Made clubs view in the backend working generally (no CUD) 2019-05-20 13:02:04 +02:00
f8df0c3fc4 Added first association of clubs. Current structure does not allow for joins. 2019-05-17 15:27:03 +02:00
c459e1d332 Basic model of club created according to abstact model 2019-05-17 14:56:29 +02:00
03df8c8f1a Made user class work with abstract classes 2019-05-17 13:14:39 +02:00
17e737b64c First approach to port user classes to abstract MVC classes as well 2019-04-18 15:59:44 +02:00
47c81d3ce9 Removed bugs in models (syntx errors) and changed Position to use abstract classes 2019-04-18 14:45:07 +02:00
6e1326240b Created abstract structures to keep complexity and code redundancy at bay. 2019-04-18 14:31:13 +02:00
4b2dbff104 Started creating abstract model to simplify writing code 2019-04-17 16:41:46 +02:00
893dc754f0 Inserted basic structure for clubs and models 2019-04-17 16:41:28 +02:00
b08b01689f Removed bug in backend of users 2019-04-17 15:04:40 +02:00
22566986a8 Added backend for position of persons 2019-04-17 15:04:24 +02:00
e801770b80 Added debug script to generate database 2019-04-16 16:11:34 +02:00
0bafe438e2 Created structure to access the offers of the clubs 2019-04-16 16:08:11 +02:00
63caca5b80 TODO Datei erstellt 2019-04-16 15:17:00 +02:00
5f91d76147 Benutzer hinzufuegen und loeschen realisiert. 2019-04-16 15:16:24 +02:00
604ac0e84f Bearbeiten des Benutzers im Backend implementiert 2019-04-16 14:47:23 +02:00
8aaf1bf057 Removed a few bugs in the Frontend regarding incompatible data types (inheritance) 2019-04-15 15:47:07 +02:00
9c407e750f Started work on backend with self-written models 2019-04-15 15:40:10 +02:00
70 changed files with 3065 additions and 7 deletions

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<buildpath> <buildpath>
<buildpathentry kind="src" path="src"/> <buildpathentry kind="src" path="src"/>
<buildpathentry external="true" kind="lib" path="/home/private/slt/joomla"/>
<buildpathentry external="true" kind="lib" path="/srv/slt-dev"/> <buildpathentry external="true" kind="lib" path="/srv/slt-dev"/>
<buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/> <buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
</buildpath> </buildpath>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType">
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_DISABLED_BUILDER" value="org.eclipse.texlipse.builder.TexlipseBuilder"/>
<mapAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
</launchConfiguration>

View File

@ -5,6 +5,16 @@
<projects> <projects>
</projects> </projects>
<buildSpec> <buildSpec>
<buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value>&lt;project&gt;/.externalToolBuilders/org.eclipse.texlipse.builder.TexlipseBuilder.launch</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand> <buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name> <name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments> <arguments>
@ -22,6 +32,7 @@
</buildCommand> </buildCommand>
</buildSpec> </buildSpec>
<natures> <natures>
<nature>org.eclipse.texlipse.builder.TexlipseNature</nature>
<nature>org.eclipse.php.core.PHPNature</nature> <nature>org.eclipse.php.core.PHPNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature> <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures> </natures>

9
TODO.md Normal file
View File

@ -0,0 +1,9 @@
# Aufgaben
## Backend
- Bilder fuer Loeschen statt des Textes Del einsetzen
- Optik anpassen mit CSS
## Frontend

2
requirements/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/artifacts/
/.rmtoo_dependencies

63
requirements/Config.yml Normal file
View File

@ -0,0 +1,63 @@
---
global:
modules:
directories:
- .
processing:
analytics:
stop_on_errors: false
requirements:
input:
commit_interval:
begin: FILES
end: FILES
default_language: de_DE
dependency_notation:
- Solved by
directory: requirements
inventors:
- flonatel
- wolf
stakeholders:
- development
- management
- users
topics:
ts_common:
sources:
- - filesystem
- requirements_dirs:
- requirements/model
- requirements
topics_dirs:
- topics
topic_root_node: ReqsDocument
constraints_dirs:
- constraints
testcases_dirs:
- testcases
output:
graph:
- output_filename: artifacts/req-graph1.dot
graph2:
- output_filename: artifacts/req-graph2.dot
html:
- footer: html/footer.html
header: html/header.html
output_directory: artifacts/html
#LatexJinja2:
latex2:
- output_filename: artifacts/reqtopics.tex
#template_path: latex/LatexJinja2
prios:
- output_filename: artifacts/reqsprios.tex
stats_burndown1:
- output_filename: artifacts/stats_burndown.csv
start_date: '2011-05-01'
stats_reqs_cnt:
- output_filename: artifacts/stats_reqs_cnt.csv
stats_sprint_burndown1:
- output_filename: artifacts/stats_sprint_burndown.csv
start_date: '2011-05-01'
version1:
- output_filename: artifacts/reqs-version.txt

69
requirements/Makefile Normal file
View File

@ -0,0 +1,69 @@
.PHONY: all
.PHONY: all_html
all: artifacts/requirements.pdf artifacts/req-graph1.png \
artifacts/req-graph2.png all_html
# Adding new files (especially requirements) can not automatically
# handled. The 'force' target tries to handle this.
.PHONY: force
force:
rm .rmtoo_dependencies
${MAKE} all
#
# This is the way the rmtoo must be called.
# (The RMTOO_CALL variable is set in the setenv.sh script)
# You can override the default Config.py file by setting
# the RMTOO_CONFIG variable from the command line.
# ie:
# make RMTOO_CONFIG=YourConfig.json
#
RMTOO_CALL ?= rmtoo
RMTOO_CONFIG=Config.yml
RMTOO_CONTRIB_DIR ?= /usr/share/rmtoo
CALL_RMTOO=${RMTOO_CALL} -y file://${RMTOO_CONFIG}
#
# Dependency handling
# The file .rmtoo_dependencies is created by rmtoo itself.
#
include .rmtoo_dependencies
all_html: ${OUTPUT_HTML}
# And how to make the dependencies
.rmtoo_dependencies:
${CALL_RMTOO} \
--create-makefile-dependencies=.rmtoo_dependencies
artifacts/req-graph1.png: artifacts/req-graph1.dot
unflatten -l 23 artifacts/req-graph1.dot | \
dot -Tpng -o artifacts/req-graph1.png
artifacts/req-graph2.png: artifacts/req-graph2.dot
dot -Tpng -o artifacts/req-graph2.png artifacts/req-graph2.dot
# Two calls are needed: one for the requirments converting and one for
# backlog creation.
artifacts/requirements.pdf: ${REQS_LATEX2} latex/requirements.tex
# (cd artifacts && \
# gnuplot ${RMTOO_CONTRIB_DIR}/contrib/gnuplot_stats_reqs_cnt.inc && \
# epstopdf stats_reqs_cnt.eps)
# (cd artifacts && \
# gnuplot ${RMTOO_CONTRIB_DIR}/contrib/gnuplot_stats_burndown.inc && \
# epstopdf stats_burndown.eps)
# (cd artifacts && \
# gnuplot ${RMTOO_CONTRIB_DIR}/contrib/gnuplot_stats_sprint_burndown.inc && \
# epstopdf stats_sprint_burndown.eps)
(cd artifacts && pdflatex ../latex/requirements.tex; \
pdflatex ../latex/requirements.tex; \
pdflatex ../latex/requirements.tex)
.PHONY: clean
clean:
rm -fr artifacts/html
rm -f artifacts/* \
add_data.py*
rm -fr debian/rmtoo build

View File

@ -0,0 +1,8 @@
<hr/>
<span class="footer_text"><p>This document is part of the rmtoo
requirements documentation and was generated
by <a href="http://rmtoo.gnu4u.org">rmtoo</a> itself.</p>
<p>rmtoo is copyright 2010 by flonatel. rmtoo is distributed under
GPL V3.</p></span>
</body>
</html>

View File

@ -0,0 +1,167 @@
<!DOCTYPE html>
<html>
<head>
<title>rmtoo</title>
<meta name="generator" content="rmtoo">
<style type="text/css">
<!--
h1, h2, h3 {
font-family:sans;
}
a:link, a:visited, a:active, a:hover {
text-decoration:none;
font-weight:bold;
color:#407cbf;
}
.fltext {
font-family:sans;
}
.footer_text {
font-family:sans;
font-size:small;
}
.requirment_end {
background-image:url(../trenner01.png);
margin:0px;
padding:0px;
height:2px;
}
.dlt_description {
font-family:sans;
font-size:medium;
font-weight:bold;
}
.dlv_description {
font-family:sans;
font-size:medium;
}
.dlt_rationale {
font-family:sans;
font-weight:bold;
}
.dlv_rationale {
font-family:sans;
}
.dlt_note {
font-family:sans;
font-size:small;
font-weight:bold;
}
.dlv_note {
font-family:sans;
font-size:small;
}
.dlt_depends_on {
font-family:sans;
font-size:small;
font-weight:bold;
}
.dlv_depends_on {
font-family:sans;
font-size:small;
}
.dlt_dependent {
font-family:sans;
font-size:small;
font-weight:bold;
}
.dlv_dependent {
font-family:sans;
font-size:small;
}
.dlt_id {
font-family:sans;
font-size:small;
font-weight:bold;
}
.dlv_id {
font-family:sans;
font-size:small;
}
.dlt_priority {
font-family:sans;
font-size:small;
font-weight:bold;
}
.dlv_priority {
font-family:sans;
font-size:small;
}
.dlt_owner {
font-family:sans;
font-size:small;
font-weight:bold;
}
.dlv_owner {
font-family:sans;
font-size:small;
}
.dlt_invented_on {
font-family:sans;
font-size:small;
font-weight:bold;
}
.dlv_invented_on {
font-family:sans;
font-size:small;
}
.dlt_invented_by {
font-family:sans;
font-size:small;
font-weight:bold;
}
.dlv_invented_by {
font-family:sans;
font-size:small;
}
.dlt_status {
font-family:sans;
font-size:small;
font-weight:bold;
}
.dlv_status {
font-family:sans;
font-size:small;
}
.dlt_class {
font-family:sans;
font-size:small;
font-weight:bold;
}
.dlv_class {
font-family:sans;
font-size:small;
}
-->
</style>
</head>
<body>

Binary file not shown.

After

Width:  |  Height:  |  Size: 627 B

View File

@ -0,0 +1,80 @@
\documentclass{report}
\usepackage[ngerman]{babel}
\usepackage{longtable}
\usepackage{graphicx}
% When latex aborts with
% pdfTeX error (ext4): \pdfendlink ended up in different nesting level than \pd
% fstartlink.
% Comment that line with draft out and inpect the errornous page
\usepackage[pdfauthor={flonatel},%
%draft,%
pdftitle={Requirment for project},%
pdfsubject={Requirment description for project},%
pdfkeywords={placeholder for some keywords},%
pagebackref=true,%
pdftex, bookmarks=true, colorlinks=true]{hyperref}
\usepackage[a4paper]{geometry}
\usepackage[titles]{tocloft}
\usepackage{fancyhdr}
\setlength{\cftsubsecnumwidth}{4em}
\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\fancyhead[L]{\rightmark}
\fancyfoot[R]{\thepage}
% \fancyfoot[L]{Version \input{../artifacts/reqs-version.txt}}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
\parindent0em
\begin{document}
\thispagestyle{empty}
\mbox{}
\vfill
{\LARGE\textbf{Requirements for project}}
\vfill
{\Large\textbf{written by You}}
\vfill
09. October 2010
\vfill
% Requirements Version: \input{../artifacts/reqs-version.txt}
\vfill
\newpage
\tableofcontents
\newpage
\chapter{Status}
\input{../artifacts/reqsprios.tex}
\input{../artifacts/reqtopics.tex}
% \chapter{Statistics}
% \section{Burndown diagram for Sprint}
% \includegraphics{../artifacts/stats_sprint_burndown.pdf}
%
% \section{Burndown diagram for Project}
% \includegraphics{../artifacts/stats_burndown.pdf}
%
% \section{Requirements Count Statistics}
% \includegraphics{../artifacts/stats_reqs_cnt.pdf}
\end{document}

12
requirements/req.template Normal file
View File

@ -0,0 +1,12 @@
Name: projectdfg
Type: requirement | design decision
Invented on:
Invented by: wolf
Owner: development | management | users
Description:
Rationale:
Status: not done
#Solved by:
#Priority:
#Effort estimation: 5
#Topic:

View File

@ -0,0 +1,13 @@
Name: Definition Abstractes DB Objekt
Type: design decision
Invented on: 2019-05-21
Invented by: wolf
Owner: development
Description: Jedes Objekt in der Datenbank wird durch ein
Objekt in der Sprache repräsentiert.
Rationale:
Status: not done
Solved by: adbo-id adbo-simple adbo-lists
#Priority:
#Effort estimation: 5
Topic: model

View File

@ -0,0 +1,13 @@
Name: Objekt-ID
Type: design decision
Invented on: 2019-05-21
Invented by: wolf
Owner: development
Description: Jedes Objekt der Datenbank hat einen eindeutigen Schlüssel
genannt \emph{id}.
Rationale:
Status: not done
#Solved by:
#Priority:
#Effort estimation: 5
Topic: model

View File

@ -0,0 +1,13 @@
Name: Listen im Objekt
Type: design decision
Invented on: 2019-05-21
Invented by: wolf
Owner: development
Description: 1:n Beziehungen können vom gemeinsamen
Objekt aus abgefragt werden mittels Funktionsaufrufen.
Rationale:
Status: not done
#Solved by:
#Priority:
#Effort estimation: 5
Topic: model

View File

@ -0,0 +1,15 @@
Name: n:m-Beziehungen
Type: design decision
Invented on: 2019-05-21
Invented by: wolf
Owner: development
Description: n:m Beziehugen werden wie 1:n-Beziehungen im
Objektbaum abgebildet. Im Unterschied zu einfachen Listen
muss allerdings eine Liste bei beiden Objekten erstellt werden,
so dass eine Navigation möglich ist.
Rationale:
Status: not done
#Solved by:
#Priority:
#Effort estimation: 5
Topic: model

View File

@ -0,0 +1,14 @@
Name: Assoziative Listen
Type: design decision
Invented on: 2019-05-21
Invented by: wolf
Owner: development
Description: Relationen der Kardinalität 1:n werden als
Objekte einer separaten Tabelle mit einem Fremdschlüssel
abgelegt.
Rationale:
Status: not done
Solved by: adbo-lists-attribs adbo-lists-lists
#Priority:
#Effort estimation: 5
Topic: model

View File

@ -0,0 +1,15 @@
Name: Triviale Attibute im Objekt
Type: design decision
Invented on: 2019-05-21
Invented by: wolf
Owner: development
Description: Einfache Attribute im Sinne einer 1:1 Beziehung
werden direkt im Objekt gespeichert. Dazu werden die Daten
in einer innerhalb der Klassenhierarchie sichtbaren Eigenschaft
\emph{values} abgelegt als assoziatives Array.
Rationale:
Status: not done
#Solved by:
#Priority:
#Effort estimation: 5
Topic: model

View File

@ -0,0 +1,13 @@
Name: Einfache Objektstruktur
Type: design decision
Invented on: 2019-05-21
Invented by: wolf
Owner: development
Description: Einfache Attribute eines Objekts werden als Spalten
in der DB-Tabelle abgespeichert.
Rationale:
Status: not done
Solved by: adbo-simple-attribs
#Priority:
#Effort estimation: 5
Topic: model

View File

@ -0,0 +1,13 @@
Name: Aufrufe cachen
Type: design decision
Invented on: 2019-05-21
Invented by: wolf
Owner: development
Description: DB-Aufrufe sollen soweit es möglich ist,
zwischengespeichert werden.
Rationale:
Status: not done
#Solved by:
#Priority:
#Effort estimation: 5
Topic: model

View File

@ -0,0 +1,13 @@
Name: Anbindung der SQL
Type: design decision
Invented on: 2019-05-21
Invented by: wolf
Owner: development
Description: Die Daten in der Datenbank müssen durch einfache
Funktionsaufrufe abrufbar sein.
Rationale:
Status: not done
Solved by: abstract-object cache
#Priority:
Effort estimation: 0
Topic: model

View File

@ -0,0 +1,12 @@
Name: projectdfg
Type: master requirement
Invented on: 2010-10-09
Invented by: flonatel
Owner: development
Description: \textsl{project} \textbf{must} exists.
Rationale: The world needs a good, usable and free \textsl{project}.
Status: not done
Solved by: sql-interface
Priority: development:10
Effort estimation: 5
Topic: ReqsDocument

View File

@ -0,0 +1,4 @@
Name: project
Text: This is placeholder for some introductional text.
IncludeRequirements: full
SubTopic: model

View File

@ -0,0 +1,3 @@
Name: Datenbank-Modelle
Text: Abhängigkeiten der Model-Klassen
IncludeRequirements: full

24
sql/init2.sql Normal file
View File

@ -0,0 +1,24 @@
CREATE TABLE `dev_club_keys` (
`privkey` text NOT NULL,
`publickey` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `dev_club_users` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`user` varchar(30) NOT NULL,
`password` varchar(150) DEFAULT NULL,
`name` varchar(255) NOT NULL,
`address` tinytext NOT NULL,
`city` varchar(50) NOT NULL,
`mail` varchar(100) NOT NULL,
`phone` varchar(50) DEFAULT NULL,
`mobile` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `dev_club_offers` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

76
sql/init3.sql Normal file
View File

@ -0,0 +1,76 @@
CREATE TABLE `dev_club_keys` (
`privkey` text NOT NULL,
`publickey` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `dev_club_users` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`user` varchar(30) NOT NULL,
`password` varchar(150) DEFAULT NULL,
`name` varchar(255) NOT NULL,
`address` tinytext NOT NULL,
`city` varchar(50) NOT NULL,
`mail` varchar(100) NOT NULL,
`phone` varchar(50) DEFAULT NULL,
`mobile` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `dev_club_offers` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `dev_club_positions` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `dev_club_clubs` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`address` tinytext NOT NULL,
`city` varchar(50) NOT NULL,
`homepage` varchar(100) NULL,
`mail` varchar(100) NOT NULL,
`iban` char(34) NOT NULL,
`bic` char(11) NOT NULL,
`charitable` tinyint(1) NOT NULL,
`president` int(10) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `dev_club_offer_assocs` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`clubid` int(10) NOT NULL,
`offerid` int(10) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `dev_club_places` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`clubid` int(10) NOT NULL,
`name` varchar(100) NOT NULL,
`address` tinytext NOT NULL,
`area` int(10) NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `dev_club_user_assocs` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`clubid` int(10) NOT NULL,
`userid` int(10) NOT NULL,
`positionid` int(10) NOT NULL,
`admin` tinyint(1) NOT NULL DEFAULT 0,
`state` enum('regular', 'vacant', 'temporary') NOT NULL DEFAULT 'vacant',
`address` tinytext DEFAULT NULL,
`mail` varchar(100) DEFAULT NULL,
`phone` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -0,0 +1,212 @@
<?php
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Router\Route;
// No direct access.
defined('_JEXEC') or die;
abstract class AbstractClubsController extends BaseController
{
protected abstract function getNameOfElement();
protected function getModelName()
{
return $this->getNameOfElement();
}
protected function getNameOfView()
{
return strtolower($this->getNameOfElement());
}
protected abstract function getDataMapping();
function new()
{
$obj = call_user_func(array('Clubs' . $this->getNameOfElement(), 'create' . $this->getNameOfElement()));
// Fetch the posted data
$values = $this->loadData();
$this->filterPreCheck($values);
// Check the input data
$error = ! $this->checkDataIsValid($values, true, Null);
$view = $this->getNameOfView();
if($error)
{
$urldata = $this->packData($values);
$this->setRedirect(Route::_("index.php?option=com_clubs&view={$view}&id=new&data={$urldata}", false));
return;
}
$this->applyData($obj, $values);
// Do the actual work
$obj->save();
$this->setRedirect(Route::_("index.php?option=com_clubs&view={$view}s", false));
}
function change()
{
$app = Factory::getApplication();
$input = $app->input;
$id = (int) $input->post->getInt('id');
$obj = call_user_func(array('Clubs' . $this->getNameOfElement(), 'load' . $this->getNameOfElement()), (int) $id);
// Fetch the posted data
$values = $this->loadData();
$this->filterPreCheck($values);
// Check the input data
$error = ! $this->checkDataIsValid($values, false, $obj);
$view = $this->getNameOfView();
if($error)
{
$urldata = $this->packData($values);
$this->setRedirect(Route::_("index.php?option=com_clubs&view={$view}&id={$id}&data={$urldata}", false));
return;
}
$this->applyData($obj, $values);
// Do the actual work
$obj->save();
$this->setRedirect(Route::_("index.php?option=com_clubs&view={$view}s", false));
}
protected function loadData()
{
$values = array();
$input = Factory::getApplication()->input->post;
foreach($this->getDataMapping() as $m => $f)
{
$filter = (isset($f['filter'])) ? $f['filter'] : 'string';
$values[$m] = $input->get($m, null, $filter);
}
return $values;
}
protected function filterPreCheck(&$values){}
protected function checkDataIsValid($values, bool $isNew, $obj)
{
$error = false;
// Check existence of the required fields
foreach ($this->getDataMapping() as $m => $v)
{
if(! isset($v['required']) || ! $v['required'])
continue;
// Field is required
if(! $this->fieldValid($m, $values[$m], $v))
{
$fname = (isset($v['name'])) ? $v['name'] : $m;
Factory::getApplication()->enqueueMessage("Das Feld $fname ist obligatorisch.", 'error');
$error = true;
}
}
return ! $error;
}
protected function fieldValid($name, $value, $options)
{
if(empty($value))
return false;
if(isset($options['filter']))
{
switch($options['filter'])
{
case 'string':
if(empty(trim($value)))
return false;
}
}
return true;
}
private function packData($values)
{
// FIXME Multiple bugs: filtering not working as expected and Mapping msut be checked
$this->filterPrePacking($values);
$data = array();
foreach($this->getDataMapping() as $m => $i)
{
if(isset($values[$m]))
$data[$m] = $values[$m];
}
$json = json_encode($data);
return urlencode($json);
}
protected function filterPrePacking(&$values){}
public function applyData($obj, $values)
{
$this->applyDataToObject($obj, $values, $this->getDataMapping());
}
protected function applyDataToObject($obj, $values, $mapping)
{
foreach($mapping as $m => $v)
{
$functionName = $this->getSetterMethodName($m, $v);
if($functionName === null)
{
continue;
}
if(isset($v['skip_null_check']))
$value = $values[$m];
else
$value = (isset($values[$m]) && strlen($values[$m]) > 0) ? $values[$m] : null;
$obj->$functionName($value);
}
}
private function getSetterMethodName($m, $options)
{
if(array_key_exists('setter', $options))
return $options['setter'];
$firstChar = substr($m, 0, 1);
$restChars = substr($m, 1);
return 'set' . strtoupper($firstChar) . $restChars;
}
function delete()
{
$app = Factory::getApplication();
$id = $app->input->get->getInt('id');
$name = $this->getNameOfElement();
$app->enqueueMessage("Removal of $name with id $id.");
$className = 'Clubs' . $this->getModelName();
$functionName = 'load' . $this->getModelName();
$element = call_user_func(array($className, $functionName), $id);
$element->delete();
$view = $this->getNameOfView();
$this->setRedirect(Route::_("index.php?option=com_clubs&view={$view}s", false));
}
}

View File

@ -0,0 +1,207 @@
<?php
// No direct access.
use Joomla\CMS\Factory;
defined('_JEXEC') or die;
abstract class AbstractClubsModel
{
protected $id;
/**
* @return int
*/
public function getId()
{
return $this->id;
}
protected abstract function getDataMappings();
protected abstract function getTableName();
protected function loadData(array $data)
{
$this->id = $data['id'];
foreach($this->getDataMappings() as $m)
$this->$m = $data[$m];
}
protected static function loadElements(string $tableName, string $className, $where = null)
{
$dbo = Factory::getDbo();
$q = $dbo->getQuery(true);
$q->select('*')
->from($tableName);
if(isset($where))
{
$q->where($where);
}
$dbo->setQuery($q);
$dbo->execute();
$list = $dbo->loadAssocList();
$ret = array();
foreach($list as $row)
{
$obj = new $className();
$obj->loadData($row);
$ret[] = $obj;
}
return $ret;
}
/**
* @param int $id
* @throws Exception
* @return ClubsOffer
*/
protected static function loadElement(int $id, string $tableName, string $className)
{
$dbo = Factory::getDbo();
$q = $dbo->getQuery(true);
$q->select('*')->from($tableName);
$q->where('id=' . (int) $id);
$dbo->setQuery($q);
$dbo->execute();
$row = $dbo->loadAssoc();
if($row == null)
{
throw new Exception("No object of class $className found.");
// TODO
}
$obj = new $className();
$obj->loadData($row);
$obj->loadCustomData($row);
return $obj;
}
protected function loadCustomData($assoc)
{}
public function save()
{
if($this->id === 'new')
$this->insertElement();
else
$this->updateElement();
}
private function insertElement()
{
if(! $this->isDataValid())
throw new Exception('Data is invalid');
$dbo = Factory::getDbo();
$q = $dbo->getQuery(true);
$mappings = $this->getDataMappings();
$values = $this->getDataValues($mappings, $q);
$q->insert($this->getTableName())
->columns(array_map(array($q, 'qn'), $mappings))
->values(join(',', $values))
;
$dbo->transactionStart();
$dbo->setQuery($q);
$dbo->execute();
$this->id = $dbo->insertid();
$dbo->transactionCommit();
}
private function updateElement()
{
if(! $this->isDataValid())
throw new Exception('Data is invalid');
$dbo = Factory::getDbo();
$q = $dbo->getQuery(true);
$mapping = $this->getDataMappings();
$values = $this->getDataValues($mapping, $q);
$q->update($this->getTableName());
foreach($mapping as $m)
$q->set($q->qn($m) . '=' . $values[$m]);
$q->where("id=". (int) $this->id);
$dbo->setQuery($q);
$dbo->execute();
}
private function getDataValues($mapping, $q)
{
$rawValues = array();
foreach($mapping as $m)
$rawValues[$m] = $this->$m;
$this->filter($rawValues);
$quotedValues = array();
foreach($mapping as $m)
{
if(is_bool($rawValues[$m]))
$quotedValues[$m] = $rawValues[$m] ? 'TRUE' : 'FALSE';
else if(is_numeric($rawValues[$m]))
$quotedValues[$m] = $rawValues[$m];
else
$quotedValues[$m] = $q->q($rawValues[$m]);
}
$this->postQuoteFilter($quotedValues);
return $quotedValues;
}
protected function prepareDelete($dbo){}
public function delete()
{
if($this->id === 'new')
return;
$dbo = Factory::getDbo();
$this->prepareDelete($dbo);
$q = $dbo->getQuery(true);
$q->delete($this->getTableName())
->where('id=' . (int) $this->id);
$dbo->setQuery($q);
$dbo->execute();
}
protected function getRequiredDataMappings()
{
return $this->getDataMappings();
}
protected function isDataValid()
{
foreach($this->getRequiredDataMappings() as $m)
{
if(!isset($this->$m) || is_null($this->$m) || $this->$m === null)
return false;
}
return true;
}
protected function filter(&$values){}
protected function postQuoteFilter(&$values){}
}

View File

@ -0,0 +1,177 @@
<?php
// No direct access.
use Joomla\CMS\Factory;
defined('_JEXEC') or die;
abstract class AbstractClubsModelFactory
{
protected $tableName;
protected $className;
public function __construct($tableName, $className)
{
$this->tableName = $tableName;
$this->className = $className;
}
/**
*
* @param JDatabaseDriver $dbo
* @return array
*/
protected function getJoins($dbo)
{
/*
* Desired structure:
* array, ech element describing one join type.
* Each element of the array is a assosiated array describing the join:
* - Name of the table (must not be main)
* - Table alias
* - Type of the join (inner, left, right, outer), default is inner
* - Condition as a string (might need escaping)
* - Columns to be inserted in the join, defaults to *
* example:
* $ret = array();
* $ret[] = array(
* 'name' => '#__table_name',
* 'alias' => 't1',
* 'type' => 'right',
* 'on' => 'main.extid = t1.id'
* 'select' => array('id','name')
* );
* return $ret;
*/
return array();
}
/**
*
* @param JDatabaseDriver $dbo
* @param JDatabaseQuery $q
*/
private function insertJoinRelations($dbo, $q)
{
$joins = $this->getJoins($dbo);
foreach($joins as $j)
{
if(is_null($j['name']))
throw new Exception('No name was given in the join.');
if(is_null($j['alias']))
throw new Exception('No alisas was given in the join.');
$jstr = $dbo->qn($j['name'], $j['alias']);
if(is_null($j['on']))
throw new Exception('No on clause was provided.');
$jstr .= " ON {$j['on']}";
if(is_null($j['type']))
$j['type'] = 'inner';
switch($j['type'])
{
case 'inner':
$q->innerJoin($jstr);
break;
case 'outer':
$q->outerJoin($jstr);
break;
case 'left':
$q->leftJoin($jstr);
break;
case 'right':
$q->rightJoin($jstr);
break;
default:
throw new Exception("Type of join unknown: {$j['type']}.");
}
$this->addJoinSelectColumns($j, $q);
}
}
/**
*
* @param array $j
* @param JDatabaseQuery $q
*/
private function addJoinSelectColumns($j, $q)
{
// TODO Quote names
if(is_null($j['select']))
$j['select'] = '*';
if(is_array($j['select']))
{
array_map(function(&$str) use ($j) {
$str = "{$j['alias']}.$str";
}, $j['select']);
}
else
{
$q->select("{$j['alias']}.{$j['select']}");
}
}
public function loadElement(int $id)
{
$condition = "id = $id";
return $this->loadFirstElement($condition);
}
public function loadFirstElement($condition)
{
$objs = $this->loadElements($condition);
if(sizeof($objs) == 0)
{
throw new Exception("No object of class {$this->className} found.");
// TODO
}
return $objs[0];
}
public function loadElements($condition = null)
{
$dbo = Factory::getDbo();
$q = $dbo->getQuery(true);
$q->select('main.*')->from($this->tableName, 'main');
$this->insertJoinRelations($dbo, $q);
if(isset($condition))
{
$q->where($condition);
}
$dbo->setQuery($q);
$dbo->execute();
$list = $dbo->loadAssocList();
$ret = array();
foreach($list as $row)
{
$ret[] = $this->createElement($row);
}
return $ret;
}
protected function createElement($row)
{
$obj = new $this->className();
$obj->loadData($row);
$obj->loadCustomData($row);
return $obj;
}
}

View File

@ -0,0 +1,86 @@
<?php
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Router\Route;
// No direct access.
defined('_JEXEC') or die;
abstract class AbstractClubsViewSingle extends HtmlView
{
protected $address;
protected $object;
protected $isNew;
private $prepared = FALSE;
public function prepareDisplay()
{
$this->prepared = TRUE;
$input = Factory::getApplication()->input;
$id = $input->get->get('id');
$modelClass = 'Clubs' . $this->getModelName();
$controller = $this->getControllerName();
if($id === 'new')
{
$this->address = Route::_("index.php?option=com_clubs&task={$controller}.new");
$this->object = call_user_func(array($modelClass, 'create' . $this->getModelName()));
$this->isNew = true;
}
else if(is_numeric($id))
{
$this->address = Route::_("index.php?option=com_clubs&task={$controller}.change");
$this->object = call_user_func(array($modelClass, 'load' . $this->getModelName()), (int) $id);
$this->isNew = false;
}
else
throw new Exception('Need an object id.');
if($input->get->get('data', null, 'json') != null)
{
// Restore previous data
$dataurl = $input->get->get('data', null, 'json');
$data = json_decode($dataurl, true);
$controller = $this->getElementController();
$controller->applyData($this->object, $data);
}
}
public function display($tpl = null)
{
if(!$this->prepared)
$this->prepareDisplay();
parent::display($tpl);
}
protected abstract function getViewName();
protected function getControllerName()
{
return $this->getViewName();
}
protected function getModelName()
{
$name = $this->getViewName();
return $this->capitalize($name);
}
private function capitalize($s)
{
$first = substr($s, 0, 1);
$rest = substr($s, 1);
return strtoupper($first) . $rest;
}
protected abstract function getElementController();
}

View File

@ -1,5 +1,18 @@
<?php <?php
// No direct access. // No direct access.
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Controller\BaseController;
defined('_JEXEC') or die; defined('_JEXEC') or die;
JLoader::discover('Clubs', JPATH_ROOT . '/administrator/components/com_clubs/mymodels');
JLoader::registerPrefix('AbstractClubs', JPATH_ROOT . '/administrator/components/com_clubs/abstract');
$controller = BaseController::getInstance("Clubs");
$input = Factory::getApplication()->input;
$task = $input->getCmd("task", "display");
$controller->execute($task);
$controller->redirect();

View File

@ -8,4 +8,5 @@ defined('_JEXEC') or die;
class ClubsController extends BaseController class ClubsController extends BaseController
{ {
protected $default_view = 'users';
} }

View File

@ -0,0 +1,44 @@
<?php
// No direct access.
defined('_JEXEC') or die;
class ClubsControllerClub extends AbstractClubsController
{
protected function getNameOfElement()
{
return 'club';
}
protected function getDataMapping()
{
return array(
// 'name' => array('required'=>true, 'name'=>'Bezeichnung', 'filter'=>'string')
'name' => array('required'=>true, 'name'=>'Club-Name', 'filter'=>'string'),
'address' => array('required'=>true, 'name'=>'Adresse', 'filter'=>'string'),
'city' => array('required'=>true, 'name'=>'Stadt', 'filter'=>'string'),
'homepage' => array('required'=>false, 'name'=>'Homepage', 'filter'=>'string'),
'mail' => array('required'=>true, 'name'=>'E-Mail', 'filter'=>'string'),
'iban' => array('required'=>true, 'name'=>'IBAN', 'filter'=>'string'),
'bic' => array('required'=>true, 'name'=>'BIC', 'filter'=>'string'),
'charitable' => array('skip_null_check'=>True),
'president' => array('required'=>true, 'name'=>'Vorsitzender', 'skip_null_check'=>True, 'setter'=>'setPresidentId')
);
}
protected function filterPreCheck(&$values)
{
if(is_null($values['charitable']))
$values['charitable'] = false;
else
$values['charitable'] = true;
$values['president'] = (int)($values['president']);
}
protected function filterPrePacking(&$values)
{
$values['president'] = $values['president']->getId();
}
}

View File

@ -0,0 +1,23 @@
<?php
// No direct access.
defined('_JEXEC') or die;
class ClubsControllerOffer extends AbstractClubsController
{
protected function getNameOfElement()
{
return 'offer';
}
protected function getDataMapping()
{
return array(
'name' => array('required'=>true, 'name'=>'Bezeichnung', 'filter'=>'string')
);
}
}

View File

@ -0,0 +1,21 @@
<?php
// No direct access.
defined('_JEXEC') or die;
class ClubsControllerPosition extends AbstractClubsController
{
protected function getNameOfElement()
{
return 'position';
}
protected function getDataMapping()
{
return array(
'name'=>array('required'=>true, 'filter'=>'string', 'name'=>'Bezeichung')
);
}
}

View File

@ -0,0 +1,119 @@
<?php
use Joomla\CMS\Factory;
// No direct access.
defined('_JEXEC') or die;
class ClubsControllerUser extends AbstractClubsController
{
private function checkUserName($username, $obj = null)
{
$id = -1;
if(!is_null($obj))
$id = $obj->getId();
return ClubsUser::isUserNameFree($username, $id);
}
protected function getNameOfElement()
{
return 'user';
}
protected function getDataMapping()
{
return array(
'user'=>array('required'=>true, 'name'=>'Benutzername', 'filter'=>'cmd'),
'pwd'=>array('required'=>false, 'name'=>'Passwort', 'filter'=>'string', 'setter'=>'setPassword'),
'pwdConfirm'=>array('required'=>false, 'name'=>'Passwortwiederholung', 'filter'=>'string', 'setter'=>null),
'name'=>array('required'=>true, 'name'=>'Bürgerlicher Name', 'filter'=>'string'),
'address'=>array('required'=>true, 'name'=>'Adresse', 'filter'=>'string'),
'city'=>array('required'=>true, 'name'=>'Stadt', 'filter'=>'string'),
'mail'=>array('required'=>true, 'name'=>'E-Mail', 'filter'=>'string'),
'phone'=>array('required'=>false, 'name'=>'Telefonnummer', 'filter'=>'string'),
'mobile'=>array('required'=>false, 'name'=>'Handynummer', 'filter'=>'string')
);
}
/**
* {@inheritDoc}
* @see AbstractClubsController::checkData()
*/
protected function checkDataIsValid($values, $isNew, $obj)
{
if(! parent::checkDataIsValid($values, $isNew, $obj))
return false;
// TODO Auto-generated method stub
if(isset($values['pwd']) && strlen($values['pwd']) > 0)
{
$pwd = $values['pwd'];
$pwdConfirm = $values['pwdConfirm'];
if(trim($pwd) != trim($pwdConfirm))
{
Factory::getApplication()->enqueueMessage('Die Passwörter stimmen nicht überein.', 'error');
return false;
}
if(! ClubsUser::checkPasswordStrength(trim($pwd)))
{
Factory::getApplication()->enqueueMessage('Das Passwort ist zu schwach.', 'error');
return false;
}
}
else
{
if($isNew)
{
Factory::getApplication()->enqueueMessage('Für einen neuen Benutzer muss ein Passwort vergeben werden.', 'error');
return false;
}
}
if(! $this->checkUserName(trim($values['user']), $obj))
{
Factory::getApplication()->enqueueMessage('Username ' . $$values['user'] . ' ist nicht gültig.', 'error');
return false;
}
return true;
}
/**
* {@inheritDoc}
* @see AbstractClubsController::filterPrePacking()
*/
protected function filterPrePacking(&$values)
{
parent::filterPrePacking($values);
unset($values['pwd']);
unset($values['pwdConfirm']);
}
/**
* {@inheritDoc}
* @see AbstractClubsController::applyData()
*/
public function applyData($obj, $values)
{
// TODO Auto-generated method stub
$mapping = $this->getDataMapping();
if(strlen($values['pwd']) == 0)
{
unset($values['pwd']);
unset($mapping['pwd']);
}
$this->applyDataToObject($obj, $values, $mapping);
}
}

252
src/admin/mymodels/club.php Normal file
View File

@ -0,0 +1,252 @@
<?php
// No direct access.
defined('_JEXEC') or die;
class ClubsClub extends AbstractClubsModel
{
protected $id;
protected $name;
protected $address;
protected $city;
protected $homepage;
protected $mail;
protected $iban;
protected $bic;
protected $charitable;
protected $president;
/**
* @return string
*/
public function getAddress()
{
return $this->address;
}
/**
* @return string
*/
public function getCity()
{
return $this->city;
}
/**
* @return string
*/
public function getHomepage()
{
return $this->homepage;
}
/**
* @return string
*/
public function getMail()
{
return $this->mail;
}
/**
* @return string
*/
public function getIban()
{
return $this->iban;
}
/**
* @return string
*/
public function getBic()
{
return $this->bic;
}
/**
* @return bool
*/
public function isCharitable()
{
return $this->charitable;
}
/**
* @return int
*/
public function getPresidentId()
{
return $this->president->getId();
}
/**
* @return ClubsUser
*/
public function getPresident()
{
return $this->president;
}
/**
* @param string $address
*/
public function setAddress( $address)
{
$this->address = $address;
}
/**
* @param string $city
*/
public function setCity($city)
{
$this->city = $city;
}
/**
* @param string $homapge
*/
public function setHomepage($homapge)
{
$this->homepage = $homapge;
}
/**
* @param string $mail
*/
public function setMail($mail)
{
$this->mail = $mail;
}
/**
* @param string $iban
*/
public function setIban($iban)
{
$this->iban = $iban;
}
/**
* @param string $bic
*/
public function setBic($bic)
{
$this->bic = $bic;
}
/**
* @param bool $charitable
*/
public function setCharitable(bool $charitable)
{
$this->charitable = $charitable;
}
/**
* @param int $presidentId
*/
public function setPresidentId(int $presidentId)
{
$this->president = ClubsUser::loadUser($presidentId);
}
/**
* @param ClubsUser $user
*/
public function setPresident(ClubsUser $user)
{
$this->president = $user;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @param string $name
*/
public function setName($name)
{
$this->name = $name;
}
public static function loadClubs()
{
return self::loadElements(self::tableName, self::className);
}
public static function loadClub($id)
{
return self::loadElement($id, self::tableName, self::className);
}
protected function __construct()
{}
public static function createClub()
{
$club = new ClubsClub();
$club->id = 'new';
return $club;
}
public function getPlaces()
{
return ClubsPlace::loadPlacesOfClub($this->id);
}
public function getOffers()
{
return 0;
}
protected function loadCustomData($assoc)
{
parent::loadCustomData($assoc);
$this->president = ClubsUser::loadUser($assoc['president']);
}
protected function postQuoteFilter(&$values)
{
parent::postQuoteFilter($values);
$values['president'] = $this->president->getId();
}
protected function prepareDelete($dbo)
{}
protected function getDataMappings()
{
return array('name', 'address', 'city', 'homepage', 'mail', 'iban', 'bic', 'charitable', 'president');
}
protected function getRequiredDataMappings()
{
return array('name', 'address', 'city', 'mail', 'iban', 'bic');
}
private const tableName = '#__club_clubs';
private const className = 'ClubsClub';
protected function getTableName()
{
return self::tableName;
}
}

View File

@ -0,0 +1,78 @@
<?php
// No direct access.
defined('_JEXEC') or die;
class ClubsOffer extends AbstractClubsModel
{
protected $name;
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @param string $name
*/
public function setName($name)
{
$this->name = $name;
}
protected function __construct()
{}
private const tableName = '#__club_offers';
private const className = 'ClubsOffer';
public static function getFactory()
{
return new class extends AbstractClubsModelFactory {
public function __construct()
{
parent::__construct($this->tableName, $this->className);
}
protected function getJoins($dbo)
{
$ret = array();
return $ret;
}
};
}
public static function loadOffers()
{
return self::loadElements(self::tableName, self::className);
}
public static function loadOffer(int $id)
{
return self::loadElement($id, self::tableName, self::className);
}
public static function createOffer()
{
$offer = new ClubsOffer();
$offer->id = 'new';
return $offer;
}
protected function getDataMappings()
{
return array('name');
}
protected function getTableName()
{
return self::tableName;
}
}

View File

@ -0,0 +1,78 @@
<?php
// No direct access.
defined('_JEXEC') or die;
class ClubsOfferAssociation extends AbstractClubsModel
{
protected $offerid;
protected $clubid;
public function getOffer()
{
return ClubsOffer::loadOffer($this->offerid);
}
public function getClub()
{
return ClubsClub::loadClub($this->clubid);
}
public function setOffer($offer)
{
$this->offerid = $offer->getId();
}
public function getName()
{
return $this->getOffer()->getName();
}
public function setClub($club)
{
$this->clubid = $club->getId();
}
protected function __construct()
{}
public static function getFactory()
{
return new ClubsOfferAssociationFactory();
}
private const tableName = '#__club_offer_assocs';
private const className = 'ClubsOfferAssociation';
public static function loadOfferAssociationsOfClub($club)
{
$cid = $club->getId();
return self::loadElements(self::tableName, self::className, "clubid = $cid");
// FIXME Use join to make access faster
}
public static function loadOfferAssociation(int $id)
{
return self::loadElement($id, self::tableName, self::className);
}
public static function createOfferAssociation()
{
$offer = new ClubsOfferAssociation();
// $offer->id = 'new';
return $offer;
}
protected function getDataMappings()
{
// return array('name');
}
protected function getTableName()
{
return self::tableName;
}
}

View File

@ -0,0 +1,32 @@
<?php
// No direct access.
defined('_JEXEC') or die;
class ClubsOfferAssociationFactory extends AbstractClubsModelFactory
{
public function __construct()
{
parent::__construct('#__club_offer_assocs', 'ClubsOfferAssociation');
}
protected function getJoins($dbo)
{
$ret = array();
$ret[] = array(
'name' => '#__club_offers',
'alias' => 'offer',
'on' => 'main.offerid = offer.id',
'select' => 'id as offerId'
);
$ret[] = array(
'name' => '#__club_clubs',
'alias' => 'club',
'on' => 'main.clubid = club.id',
'select' => 'id AS clubId'
);
return $ret;
}
}

View File

@ -0,0 +1,113 @@
<?php
// No direct access.
defined('_JEXEC') or die;
class ClubsPlace extends AbstractClubsModel
{
protected $name;
protected $address;
protected $area;
protected $clubid;
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @param string $name
*/
public function setName(string $name)
{
$this->name = $name;
}
/**
* @return string
*/
public function getAddress()
{
return $this->address;
}
/**
* @return string
*/
public function getArea()
{
return $this->area;
}
/**
* @param string $address
*/
public function setAddress(string $address)
{
$this->address = $address;
}
/**
* @param string $area
*/
public function setArea(string $area)
{
$this->area = $area;
}
public function getClub()
{
return ClubsClub::loadClub($this->clubid);
}
public function setClub($club)
{
$this->clubid = $club->getId();
}
protected function __construct()
{}
public static function loadPlaces()
{
return self::loadElements(self::tableName, self::className);
}
public static function loadPlacesOfClub($clubId)
{
return self::loadElements(self::tableName, self::className, "clubid = $clubId");
}
public static function loadPlace(int $id)
{
return self::loadElement($id, self::tableName, self::className);
}
public static function createPlace()
{
$place = new ClubsPlace();
$place->id = 'new';
return $place;
}
protected function getDataMappings()
{
return array('name', 'address', 'area', 'clubid');
}
private const tableName = '#__club_places';
private const className = 'ClubsPlace';
protected function getTableName()
{
return self::tableName;
}
}

View File

@ -0,0 +1,66 @@
<?php
// No direct access.
defined('_JEXEC') or die;
class ClubsPosition extends AbstractClubsModel
{
protected $name;
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @param string $name
*/
public function setName(string $name)
{
$this->name = $name;
}
protected function __construct()
{}
private const tableName = '#__club_positions';
private const className = 'ClubsPosition';
public static function loadPositions()
{
return self::loadElements(self::tableName, self::className);
}
// public static function loadPositions($clubId)
// {
// return self::loadElements(self::tableName, self::className, "clubid = $clubId");
// }
public static function loadPosition(int $id)
{
return self::loadElement($id, self::tableName, self::className);
}
public static function createPosition()
{
$position = new ClubsPosition();
$position->id = 'new';
return $position;
}
protected function getDataMappings()
{
return array('name');
}
protected function getTableName()
{
return self::tableName;
}
}

298
src/admin/mymodels/user.php Normal file
View File

@ -0,0 +1,298 @@
<?php
use Joomla\CMS\Factory;
// No direct access.
defined('_JEXEC') or die;
class UserInvalidException extends Exception
{}
class PasswordInvalidException extends Exception
{}
class ClubsUser extends AbstractClubsModel
{
protected $user;
protected $password;
protected $name;
protected $address;
protected $city;
protected $mail;
protected $phone;
protected $mobile;
/**
* @return string
*/
public function getMail()
{
return $this->mail;
}
/**
* @param string $mail
*/
public function setMail($mail)
{
$this->mail = $mail;
}
/**
* @return string
*/
public function getUser()
{
return $this->user;
}
/**
* @return string
*/
public function getHash()
{
return $this->password;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @return string
*/
public function getAddress()
{
return $this->address;
}
/**
* @return string
*/
public function getCity()
{
return $this->city;
}
/**
* @return string
*/
public function getPhone()
{
return $this->phone;
}
/**
* @return string
*/
public function getMobile()
{
return $this->mobile;
}
/**
* @param string $user
*/
public function setUser($user, bool $force = false)
{
if($this->id === 'new')
$valid = self::isUserNameFree($user);
else
$valid = self::isUserNameFree($user, $this->id);
if(!$force && ! $valid)
throw new UserInvalidException();
$this->user = $user;
}
/**
* @param string $hash
*/
public function setPassword(string $password)
{
if(! $this->checkPasswordStrength($password))
throw new PasswordInvalidException();
$this->password = password_hash($password, PASSWORD_DEFAULT);
}
public function isPasswordValid(string $password)
{
$valid = password_verify($password, $this->password);
if($valid)
{
$this->checkForRehashing($password);
}
return $valid;
}
/**
* @param string $name
*/
public function setName($name)
{
$this->name = $name;
}
/**
* @param string $address
*/
public function setAddress($address)
{
$this->address = $address;
}
/**
* @param string $city
*/
public function setCity($city)
{
$this->city = $city;
}
/**
* @param string $phone
*/
public function setPhone($phone)
{
$this->phone = $phone;
}
/**
* @param string $mobile
*/
public function setMobile($mobile)
{
$this->mobile = $mobile;
}
protected function __construct()
{}
private const tableName = '#__club_users';
private const className = 'ClubsUser';
public static function loadUsers()
{
return self::loadElements(self::tableName, self::className);
}
public static function loadUser(int $id)
{
return self::loadElement($id, self::tableName, self::className);
}
public static function createUser()
{
$user = new ClubsUser();
$user->id = 'new';
return $user;
}
private function updateUser()
{
$dbo = Factory::getDbo();
$q = $dbo->getQuery(true);
$vuser = $q->q($this->user);
$vpassword = $q->q($this->password);
$vname = $q->q($this->name);
$vaddress = $q->q($this->address);
$vcity = $q->q($this->city);
$vmail = $q->q($this->mail);
$vphone = empty($this->phone) ? 'NULL' : $q->q($this->phone);
$vmobile = empty($this->mobile) ? 'NULL' : $q->q($this->mobile);
// FIXME Check null vlaues
$q->update('#__club_users')
->set(array(
"user=$vuser",
"password=$vpassword",
"name=$vname",
"address = $vaddress",
"city=$vcity",
"mail=$vmail",
"phone=$vphone",
"mobile=$vmobile"
))
->where("id=". (int) $this->id)
;
$dbo->setQuery($q);
$dbo->execute();
}
private function checkForRehashing(string $password)
{
if($this->id === 'new')
return;
if(password_needs_rehash($this->password, PASSWORD_DEFAULT) || true)
{
$copy = ClubsUser::loadUser($this->id);
$copy->password = password_hash($password, PASSWORD_DEFAULT);
$copy->save();
// $this->password = password_hash($password, PASSWORD_DEFAULT);
// $dbo = Factory::getDbo();
// $q = $dbo->getQuery(true);
// $q->update(self::tableName)->set('password=' . $q->q($this->password))->where('id=' . (int) $this->id);
// $dbo->setQuery($q);
// $dbo->execute();
}
}
public static function isUserNameFree($username, int $id = -1)
{
$db = Factory::getDbo();
$q = $db->getQuery(true);
$q->select('COUNT(*)')->from(self::tableName)
->where('id <> ' . (int) $id)
->where('user = ' . $q->q($username));
$db->setQuery($q);
$db->execute();
$row = $db->loadRow();
return $row[0] == 0;
}
public static function checkPasswordStrength($pwd)
{
if(strlen($pwd) < 6)
return false;
if(preg_match_all('/[A-Z]/', $pwd) === false)
return false;
if(preg_match_all('/[a-z]/', $pwd) === false)
return false;
if(preg_match_all('/[0-9]/', $pwd) === false)
return false;
return true;
}
protected function getDataMappings()
{
return array('user', 'password', 'name', 'address', 'city', 'mail', 'phone', 'mobile');
}
protected function getRequiredDataMappings()
{
return array('user', 'password', 'name', 'address', 'city', 'mail');
}
protected function getTableName()
{
return self::tableName;
}
}

View File

@ -0,0 +1,87 @@
<?php
// No direct access.
use Joomla\CMS\Router\Route;
defined('_JEXEC') or die;
?>
<form method="post" action="<?php echo $this->address; ?>">
<input type='hidden' name='id' value='<?php echo $this->object->getId(); ?>'>
<table>
<tr>
<td>Bezeichnung</td>
<td><input type='text' name='name' value='<?php echo htmlentities($this->object->getName()); ?>'></td>
</tr>
<tr>
<td>Adresse</td>
<td>
<textarea name='address' rows='5'><?php echo htmlentities($this->object->getAddress()); ?></textarea>
</td>
</tr>
<tr>
<td>Stadt</td>
<td><input type='text' name='city' value='<?php echo htmlentities($this->object->getCity()); ?>'></td>
</tr>
<tr>
<td>Homepage</td>
<td><input type='text' name='homepage' value='<?php echo htmlentities($this->object->getHomepage()); ?>'></td>
</tr>
<tr>
<td>E-Mail</td>
<td><input type='text' name='mail' value='<?php echo htmlentities($this->object->getMail()); ?>'></td>
</tr>
<tr>
<td>IBAN</td>
<td><input type='text' name='iban' value='<?php echo htmlentities($this->object->getIban()); ?>'></td>
</tr>
<tr>
<td>BIC</td>
<td><input type='text' name='bic' value='<?php echo htmlentities($this->object->getBic()); ?>'></td>
</tr>
<tr>
<td>Gemeinn&uuml;tzig</td>
<td><input type='checkbox' name='charitable' value='1' <?php echo $this->object->isCharitable() ? 'checked' : ''; ?>></td>
</tr>
<tr>
<td>Vorsitzende/r</td>
<td>
<select name='president'>
<?php foreach($this->users as $u): ?>
<option value='<?php echo $u->getId(); ?>' <?php if ($this->object->getPresident() !== null && $this->object->getPresident()->getId() == $u->getId()) echo 'selected="selected"'; ?>>
<?php echo htmlentities("{$u->getName()}, {$u->getCity()}"); ?>
</option>
<?php endforeach; ?>
</select>
</td>
</tr>
<?php if(! $this->isNew): ?>
<tr>
<td>Angebote</td>
<td>
<?php foreach($this->offers as $o): ?>
<input type='checkbox' name='offers' value='<?php echo $o['offer']->getId(); ?>' <?php if($o['mark']) echo 'checked="checked"';?>>
<?php echo htmlentities($o['offer']->getName()); ?><br />
<?php endforeach; ?>
</td>
</tr>
<tr>
<td>ID</td>
<td><?php echo $this->object->getId(); ?></td>
</tr>
<?php endif; ?>
</table>
<input type='submit' value='Speichern'> <br /><a href='<?php echo Route::_('index.php?option=com_clubs&view=clubs'); ?>'>Zur&uuml;ck zur &Uuml;bersicht</a>
</form>

View File

@ -0,0 +1,44 @@
<?php
use Joomla\CMS\Toolbar\ToolbarHelper;
// No direct access.
defined('_JEXEC') or die;
JLoader::register("ClubsControllerClub", JPATH_ROOT . "/administrator/components/com_clubs/controllers/club.php");
class ClubsViewClub extends AbstractClubsViewSingle
{
function display($tpl = null)
{
ToolbarHelper::title('Club-Management - Verein');
$this->prepareDisplay();
$this->users = ClubsUser::loadUsers();
if(! $this->isNew)
{
$offers = ClubsOffer::loadOffers();
$currentOffers = $this->object->getOffers();
$this->offers = array_map(function($offer) use ($currentOffers){
$mark = False;
return array('offer'=>$offer, 'mark'=>$mark);
}, $offers);
}
parent::display($tpl);
}
protected function getViewName()
{
return 'club';
}
protected function getElementController()
{
return new ClubsControllerClub();
}
}

View File

@ -0,0 +1,36 @@
<?php
// No direct access.
use Joomla\CMS\Router\Route;
defined('_JEXEC') or die;
?>
<table class='table table-stiped, table-hover'>
<thead>
<tr>
<th width='30%'>Bezeichnung</th>
<th width='25%'>Stadt</th>
<th width='20%'>Homepage</th>
<th width='25%'>E-Mail</th>
<th width='5%'>L&ouml;schen?</th>
<th width='5%'>id</th>
</tr>
</thead>
<?php foreach($this->clubs as $club): ?>
<?php $link = Route::_('index.php?option=com_clubs&view=club&id=' . $club->getId()); ?>
<?php $url = htmlentities($club->getHomepage()); ?>
<?php $mail = htmlentities($club->getMail()); ?>
<tr>
<td><a href='<?php echo $link; ?>'><?php echo htmlentities($club->getName()); ?></a></td>
<td><?php echo htmlentities($club->getCity()); ?></td>
<td><a href='<?php echo $url; ?>' target='_blank'><?php echo $url; ?></a></td>
<td><a href='mailto:<?php echo $mail; ?>'><?php echo $mail; ?></a></td>
<td><!--<a href='<?php echo Route::_('index.php?option=com_clubs&task=club.delete&id=' . $club->getId()); ?>'>Del</a> --></td>
<td><?php echo htmlentities($club->getId()); ?></td>
</tr>
<?php endforeach; ?>
</table>
<div><a href='<?php echo Route::_('index.php?option=com_clubs&view=club&id=new'); ?>'>Neuen Verein anlegen</a></div>

View File

@ -0,0 +1,21 @@
<?php
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Toolbar\ToolbarHelper;
// No direct access.
defined('_JEXEC') or die;
class ClubsViewClubs extends HtmlView
{
function display($tpl = null)
{
// $this->offers = ClubsOffer::loadOffers();
$this->clubs = ClubsClub::loadClubs();
ToolbarHelper::title('Club-Management - Clubs');
parent::display($tpl);
}
}

View File

@ -0,0 +1,27 @@
<?php
// No direct access.
use Joomla\CMS\Router\Route;
defined('_JEXEC') or die;
?>
<form method="post" action="<?php echo $this->address; ?>">
<input type='hidden' name='id' value='<?php echo $this->object->getId(); ?>'>
<table>
<tr>
<td>Bezeichnung</td>
<td><input type='text' name='name' value='<?php echo htmlentities($this->object->getName()); ?>'></td>
</tr>
<?php if(! $this->isNew): ?>
<tr>
<td>ID</td>
<td><?php echo $this->object->getId(); ?></td>
</tr>
<?php endif; ?>
</table>
<input type='submit' value='Speichern'> <br /><a href='<?php echo Route::_('index.php?option=com_clubs&view=offers'); ?>'>Zur&uuml;ck zur &Uuml;bersicht</a>
</form>

View File

@ -0,0 +1,29 @@
<?php
use Joomla\CMS\Toolbar\ToolbarHelper;
// No direct access.
defined('_JEXEC') or die;
JLoader::register("ClubsControllerOffer", JPATH_ROOT . "/administrator/components/com_clubs/controllers/offer.php");
class ClubsViewOffer extends AbstractClubsViewSingle
{
function display($tpl = null)
{
ToolbarHelper::title('Club-Management - Angebot');
parent::display($tpl);
}
protected function getViewName()
{
return 'offer';
}
protected function getElementController()
{
return new ClubsControllerOffer();
}
}

View File

@ -0,0 +1,28 @@
<?php
// No direct access.
use Joomla\CMS\Router\Route;
defined('_JEXEC') or die;
?>
<table class='table table-stiped, table-hover'>
<thead>
<tr>
<th width='30%'>Bezeichnung</th>
<th width='5%'>L&ouml;schen?</th>
<th width='5%'>id</th>
</tr>
</thead>
<?php foreach($this->offers as $offer): ?>
<?php $link = Route::_('index.php?option=com_clubs&view=offer&id=' . $offer->getId()); ?>
<tr>
<td><a href='<?php echo $link; ?>'><?php echo htmlentities($offer->getName()); ?></a></td>
<td><a href='<?php echo Route::_('index.php?option=com_clubs&task=offer.delete&id=' . $offer->getId()); ?>'>Del</a></td>
<td><?php echo htmlentities($offer->getId()); ?></td>
</tr>
<?php endforeach; ?>
</table>
<div><a href='<?php echo Route::_('index.php?option=com_clubs&view=offer&id=new'); ?>'>Neues Angebot anlegen</a></div>

View File

@ -0,0 +1,20 @@
<?php
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Toolbar\ToolbarHelper;
// No direct access.
defined('_JEXEC') or die;
class ClubsViewOffers extends HtmlView
{
function display($tpl = null)
{
$this->offers = ClubsOffer::loadOffers();
ToolbarHelper::title('Club-Management - Angebote');
parent::display($tpl);
}
}

View File

@ -0,0 +1,27 @@
<?php
// No direct access.
use Joomla\CMS\Router\Route;
defined('_JEXEC') or die;
?>
<form method="post" action="<?php echo $this->address; ?>">
<input type='hidden' name='id' value='<?php echo $this->object->getId(); ?>'>
<table>
<tr>
<td>Bezeichnung</td>
<td><input type='text' name='name' value='<?php echo htmlentities($this->object->getName()); ?>'></td>
</tr>
<?php if(! $this->isNew): ?>
<tr>
<td>ID</td>
<td><?php echo $this->object->getId(); ?></td>
</tr>
<?php endif; ?>
</table>
<input type='submit' value='Speichern'> <br /><a href='<?php echo Route::_('index.php?option=com_clubs&view=positions'); ?>'>Zur&uuml;ck zur &Uuml;bersicht</a>
</form>

View File

@ -0,0 +1,27 @@
<?php
use Joomla\CMS\Toolbar\ToolbarHelper;
// No direct access.
defined('_JEXEC') or die;
JLoader::register("ClubsControllerPosition", JPATH_ROOT . "/administrator/components/com_clubs/controllers/position.php");
class ClubsViewPosition extends AbstractClubsViewSingle
{
protected function getViewName()
{
return 'position';
}
protected function getElementController()
{
return new ClubsControllerPosition();
}
function display($tpl = null)
{
ToolbarHelper::title('Club-Management - Position');
parent::display($tpl);
}
}

View File

@ -0,0 +1,28 @@
<?php
// No direct access.
use Joomla\CMS\Router\Route;
defined('_JEXEC') or die;
?>
<table class='table table-stiped, table-hover'>
<thead>
<tr>
<th width='30%'>Bezeichnung</th>
<th width='5%'>L&ouml;schen?</th>
<th width='5%'>id</th>
</tr>
</thead>
<?php foreach($this->positions as $position): ?>
<?php $link = Route::_('index.php?option=com_clubs&view=position&id=' . $position->getId()); ?>
<tr>
<td><a href='<?php echo $link; ?>'><?php echo htmlentities($position->getName()); ?></a></td>
<td><a href='<?php echo Route::_('index.php?option=com_clubs&task=position.delete&id=' . $position->getId()); ?>'>Del</a></td>
<td><?php echo htmlentities($position->getId()); ?></td>
</tr>
<?php endforeach; ?>
</table>
<div><a href='<?php echo Route::_('index.php?option=com_clubs&view=position&id=new'); ?>'>Neuen Posten anlegen</a></div>

View File

@ -0,0 +1,20 @@
<?php
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Toolbar\ToolbarHelper;
// No direct access.
defined('_JEXEC') or die;
class ClubsViewPositions extends HtmlView
{
function display($tpl = null)
{
$this->positions = ClubsPosition::loadPositions();
ToolbarHelper::title('Club-Management - Positionen');
parent::display($tpl);
}
}

View File

@ -0,0 +1,59 @@
<?php
use Joomla\CMS\Router\Route;
// No direct access.
defined('_JEXEC') or die;
?>
<form method="post" action="<?php echo $this->address; ?>">
<input type='hidden' name='id' value='<?php echo $this->user->getId(); ?>'>
<table>
<tr>
<td>Username</td>
<td><input type='text' name='user' value='<?php echo htmlentities($this->user->getUser()); ?>'></td>
</tr>
<tr>
<td>Passwort</td>
<td><input type='password' name='pwd' value=''></td>
</tr>
<tr>
<td>Passwort wiederholen</td>
<td><input type='password' name='pwdConfirm' value=''></td>
</tr>
<tr>
<td>Bürgerlicher Name</td>
<td><input type='text' name='name' value='<?php echo htmlentities($this->user->getName()); ?>'></td>
</tr>
<tr>
<td>Adresse</td>
<td>
<textarea rows="4" name='address'><?php echo (htmlentities($this->user->getAddress())); ?></textarea>
</tr>
<tr>
<td>Stadt</td>
<td><input type='text' name='city' value='<?php echo htmlentities($this->user->getCity()); ?>'></td>
</tr>
<tr>
<td>E-Mail</td>
<td><input type='text' name='mail' value='<?php echo htmlentities($this->user->getMail()); ?>'></td>
</tr>
<tr>
<td>Telefon</td>
<td><input type='text' name='phone' value='<?php echo htmlentities($this->user->getPhone()); ?>'></td>
</tr>
<tr>
<td>Handy</td>
<td><input type='text' name='mobile' value='<?php echo htmlentities($this->user->getMobile()); ?>'></td>
</tr>
<?php if(! $this->isNew): ?>
<tr>
<td>ID</td>
<td><?php echo $this->user->getId(); ?></td>
</tr>
<?php endif; ?>
</table>
<input type='submit' value='Speichern'> <br /><a href='<?php echo Route::_('index.php?option=com_clubs&view=users'); ?>'>Zur&uuml;ck zur &Uuml;bersicht</a>
</form>

View File

@ -0,0 +1,54 @@
<?php
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Router\Route;
// No direct access.
defined('_JEXEC') or die;
class ClubsViewUser extends HtmlView
{
public function display($tpl = null)
{
$input = Factory::getApplication()->input;
$id = $input->get->get('id');
if($id === 'new')
{
$this->address = Route::_('index.php?option=com_clubs&task=user.new');
$this->user = ClubsUser::createUser();
$this->isNew = true;
}
else if(is_numeric($id))
{
$this->address = Route::_('index.php?option=com_clubs&task=user.change');
$this->user = ClubsUser::loadUser((int) $id);
$this->isNew = false;
}
else
throw new Exception('Need a user id.');
if($input->get->get('data', null, 'json') != null)
{
// Restore previous data
$dataurl = $input->get->get('data', null, 'json');
$data = json_decode($dataurl, true);
$this->user->setUser($data['user'], true);
$this->user->setName($data['name']);
$this->user->setAddress($data['address']);
$this->user->setCity($data['city']);
$this->user->setMail($data['mail']);
$this->user->setPhone($data['phone']);
$this->user->setMobile($data['mobile']);
}
ToolbarHelper::title('Club-Management - Person');
parent::display($tpl);
}
}

View File

@ -0,0 +1,35 @@
<?php
use Joomla\CMS\Router\Route;
// No direct access.
defined('_JEXEC') or die;
?>
<table width='100%' class='table table-stiped, table-hover'>
<thead>
<tr>
<th width='15%'>Benutzername</th>
<th width='20%'>Name</th>
<th width='30%'>Ort</th>
<th width='30%'>E-Mail</th>
<th width='5%'>L&ouml;schen?</th>
<th width='5%'>id</th>
</tr>
</thead>
<?php foreach($this->users as $user): ?>
<?php $link = Route::_('index.php?option=com_clubs&view=user&id=' . $user->getId()); ?>
<tr>
<td><a href='<?php echo $link; ?>'><?php echo htmlentities($user->getUser()); ?></a></td>
<td><a href='<?php echo $link; ?>'><?php echo htmlentities($user->getName()); ?></a></td>
<td><?php echo htmlentities($user->getCity()); ?></td>
<td><a href='mailto:<?php echo htmlentities($user->getMail()); ?>'><?php echo htmlentities($user->getMail()); ?></a></td>
<td><a href='<?php echo Route::_('index.php?option=com_clubs&task=user.delete&id=' . $user->getId()); ?>'>Del</a></td>
<td><?php echo htmlentities($user->getId()); ?></td>
</tr>
<?php endforeach; ?>
</table>
<div><a href='<?php echo Route::_('index.php?option=com_clubs&view=user&id=new'); ?>'>Neuen Benutzer anlegen</a></div>

View File

@ -0,0 +1,22 @@
<?php
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Toolbar\ToolbarHelper;
// No direct access.
defined('_JEXEC') or die;
// JLoader::register("ClubsModelUser", JPATH_ROOT . "/administrator/components/com_clubs/models/user.php");
class ClubsViewUsers extends HtmlView
{
function display($tpl = null)
{
$this->users = ClubsUser::loadUsers();
ToolbarHelper::title('Club-Management - Personen', 'user');
parent::display($tpl);
}
}

View File

@ -6,6 +6,9 @@ use Joomla\CMS\Factory;
// No direct access. // No direct access.
defined('_JEXEC') or die; defined('_JEXEC') or die;
JLoader::discover('Clubs', JPATH_ROOT . '/administrator/components/com_clubs/mymodels');
JLoader::registerPrefix('AbstractClubs', JPATH_ROOT . '/administrator/components/com_clubs/abstract');
$controller = BaseController::getInstance("Clubs"); $controller = BaseController::getInstance("Clubs");
$input = Factory::getApplication()->input; $input = Factory::getApplication()->input;

View File

@ -10,7 +10,7 @@ defined('_JEXEC') or die;
class ClubsViewClub extends HtmlView class ClubsViewClub extends HtmlView
{ {
public function display(string $tpl = null) public function display($tpl = null)
{ {
// FIXME Insert code from DB // FIXME Insert code from DB
$this->clubid = 43; $this->clubid = 43;

View File

@ -11,11 +11,12 @@ defined('_JEXEC') or die;
class ClubsViewClubAssoc extends HtmlView class ClubsViewClubAssoc extends HtmlView
{ {
public function display(string $tpl = null) public function display($tpl = null)
{ {
// FIXME Insert code from DB // FIXME Insert code from DB
$inp = Factory::getApplication()->input; $inp = Factory::getApplication()->input;
$this->personId = 34;
$this->userName = 'Max Muster'; $this->userName = 'Max Muster';
$this->userMail = 'Foo@bar.com'; $this->userMail = 'Foo@bar.com';
$this->userPhone = '34'; $this->userPhone = '34';

View File

@ -10,7 +10,7 @@ defined('_JEXEC') or die;
class ClubsViewClubData extends HtmlView class ClubsViewClubData extends HtmlView
{ {
public function display(string $tpl = null) public function display($tpl = null)
{ {
// FIXME Insert code from DB // FIXME Insert code from DB
$this->clubid = 43; $this->clubid = 43;

View File

@ -10,7 +10,7 @@ defined('_JEXEC') or die;
class ClubsViewClubPlace extends HtmlView class ClubsViewClubPlace extends HtmlView
{ {
public function display(string $tpl = null) public function display($tpl = null)
{ {
// FIXME Insert code from DB // FIXME Insert code from DB
$this->clubid = 43; $this->clubid = 43;

View File

@ -10,7 +10,7 @@ defined('_JEXEC') or die;
class ClubsViewClubPlaces extends HtmlView class ClubsViewClubPlaces extends HtmlView
{ {
public function display(string $tpl = null) public function display($tpl = null)
{ {
// FIXME Insert code from DB // FIXME Insert code from DB
$this->clubid = 43; $this->clubid = 43;

View File

@ -10,7 +10,7 @@ defined('_JEXEC') or die;
class ClubsViewSearchPerson extends HtmlView class ClubsViewSearchPerson extends HtmlView
{ {
public function display(string $tpl = null) public function display($tpl = null)
{ {
// FIXME Insert code from DB // FIXME Insert code from DB
$inp = Factory::getApplication()->input; $inp = Factory::getApplication()->input;

View File

@ -9,7 +9,7 @@ defined('_JEXEC') or die;
class ClubsViewUSerdata extends HtmlView class ClubsViewUSerdata extends HtmlView
{ {
public function display(string $tpl = null) public function display($tpl = null)
{ {
Factory::getDocument()->addStyleSheet(Uri::base(true) . 'components/com_clubs/css/clubs.css'); Factory::getDocument()->addStyleSheet(Uri::base(true) . 'components/com_clubs/css/clubs.css');
parent::display($tpl); parent::display($tpl);