Compare commits
27 Commits
v0.0.1
...
dev/fronte
| Author | SHA1 | Date | |
|---|---|---|---|
| 5e82187518 | |||
| e112b8ee6c | |||
| 2bdf581ba1 | |||
| b61df340e8 | |||
| 2da8da6b37 | |||
| af506435ac | |||
| 45d3e09c7e | |||
| 3f96022176 | |||
| 7dae1d826e | |||
| 9dbe6112dd | |||
| 55b44d9b6f | |||
| e89aac01a3 | |||
| 5743219a1c | |||
| 4f33fb8a8d | |||
| 0048f63990 | |||
| 20c5c9d147 | |||
| 7f019dd740 | |||
| a30e5d76a1 | |||
| a2eb141d5c | |||
| 1d1bde1a8d | |||
| 5179ea9de5 | |||
| 759f04d34f | |||
| 52a5ebea3a | |||
| 7411516c5b | |||
| 3d9d244b65 | |||
| c6708a2e1c | |||
| dff733699f |
242
sql/init4.sql
Normal file
242
sql/init4.sql
Normal file
@@ -0,0 +1,242 @@
|
||||
-- MySQL dump 10.17 Distrib 10.3.15-MariaDB, for Linux (x86_64)
|
||||
--
|
||||
-- Host: localhost Database: slt
|
||||
-- ------------------------------------------------------
|
||||
-- Server version 10.3.15-MariaDB
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8mb4 */;
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
|
||||
--
|
||||
-- Table structure for table `dev_club_clubs`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `dev_club_clubs`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = 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) DEFAULT 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 AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `dev_club_clubs`
|
||||
--
|
||||
|
||||
LOCK TABLES `dev_club_clubs` WRITE;
|
||||
/*!40000 ALTER TABLE `dev_club_clubs` DISABLE KEYS */;
|
||||
INSERT INTO `dev_club_clubs` VALUES (1,'myclub','asb\r\nasdfsf','timbuktu','https://tanzen-slt.de/','foo@bar','de','gev',0,5),(2,'Test3','sdfgj\r\ndfg',';lkjgf','df','jk@erkdfgj','kjh','l;kj',1,5);
|
||||
/*!40000 ALTER TABLE `dev_club_clubs` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `dev_club_keys`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `dev_club_keys`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `dev_club_keys` (
|
||||
`privkey` text NOT NULL,
|
||||
`publickey` text NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `dev_club_keys`
|
||||
--
|
||||
|
||||
LOCK TABLES `dev_club_keys` WRITE;
|
||||
/*!40000 ALTER TABLE `dev_club_keys` DISABLE KEYS */;
|
||||
INSERT INTO `dev_club_keys` VALUES ('-----BEGIN PRIVATE KEY-----\nMIIEwAIBADANBgkqhkiG9w0BAQEFAASCBKowggSmAgEAAoIBAQDvZHhLHHqmfnnP\noj5Y7AtS0UvEN8XLzNdHj/0nHBVHrXDMNul8phbCaevuaXcYTZvb9JBTAO019Bnu\nCoj6KFrk0Cw/zcVgVHryguNCr2DeLaxAXyArfkKNZPuG/kTw1mxE6ebeR886JVU0\nfQpIi3zDGAHpXxaKO7EttnvQK8NRd4h5O5EI6dCnmMn/8xY/d5G7AsZKuAxq01ZB\nmmUrkRKrQtBTwUeJWhtfT+XjOa1n1FVIwmqz4O2sqbfm0pa6PX0BNT0CUp0RI1wN\nGmF6bh/WkQ8h3jmTamzZ2cQUwDnL7ByAJqexJrrPacRbE6EotCGODjuBXDSy02PJ\nZk0fThZpAgMBAAECggEBANJaU0WU8cUo73pekzBpwY11MYFqjJiHF0ffo0/hYmWI\nZsxbGBGak/cjQdhNvgOR9nlxTfxRnR7CrqI3iaNfIHdc4PTzqBL8SMid8HohRxoT\nwf8SV19AY9SAvnAhL4z8rUhky6PYL6RlN5iWoxmZz/hSOSPKlTDEQOztI6CJQ+hp\nUFEiOLq/TSWB1DYEu6qAQRyI5wcC1QMo+zB/zBwIuM3DsB2f6Xtj86kXzU/bGeDj\nNLbsCuhRbFyMgvcJ3z6KQTvREZOGkeF22HA+ZVH7bWf00PqCEjq2I/XFHZGK61X4\nWLgNOUmVZSmGv2Kd9UJaC8VffkBnrV3XFN1n97gcP4ECgYEA/Joaw3VrbWpKsquf\nMiTuMJVyvcV9fmVhWhPNuioCwWwBx2mjGz/texd/67KNWPr7r1IGCIBnYfs3Dy+k\nOo+lAWT7oaec24dH4vjiljWrvFvZXmkpTa6j8RSqhhIVTUFSnXBkvxkEzcnUMbxK\n6A4gdggSfcMpeo3DmjGqNWTXlbkCgYEA8pzgD2VFEYq4/fgDhxKeoWSt1UPJtPxT\n4iYPXWKGdWLsEKg36oYiRXSTdan5aRwiZUXpDoFJU8vVCfmdVb2qpwPp66LwYFax\nAYuA3aPTi9npT4nDOBygVGSTY0TsxmL5asndyxl99OdoskLmS3N2UzeWMy7prRTt\nWZL7uWnU3jECgYEA+8EHLYkIcXs/SYV823gtIKTCP9rlsSSPezxDjOgz6NyhhUKG\nejEjmcuZBarl7ynt0BU6yBxZbTD39h2wW2EwvgwMMlggIDda8R7GjZieOdN89/ht\nXuvQnwTO02KQcnfJQ/pxnnfr7sHZx1v3eAIkXh67dzYcT/WcXkBjeGWx65kCgYEA\n0WU8rY0GU+GbUPfic45Kg5nVvx/G1AKEk8etszf6PQ6oGKhXun8SzUeUjhWqQmIZ\n/badM/u6QizHLtjWRs5wn73tA4eaWEv6cg7ppmJjj20AxbltWNy8NJqp6x/uDDwY\ncWbRmx3hbKLd5h1/jteU5LYxWPPAk7ZgNNN7l8gUBcECgYEAzVVKQ5dn58iHkH1i\nB3UUnTrqPD/cn7WigcWn7A6vpxqbGARkAyIXV/xqLoD8pX1G7JhqFKArC+UJzUuC\n6hgL1Hq+OJXTaN2NzcvQaIvLzsOWQebFtNfFxi0tzAE0t2/JfuFxeam0WZunaNgg\nAabygognDdEZW9HBvCydJ5N8e+s=\n-----END PRIVATE KEY-----\n','-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA72R4Sxx6pn55z6I+WOwL\nUtFLxDfFy8zXR4/9JxwVR61wzDbpfKYWwmnr7ml3GE2b2/SQUwDtNfQZ7gqI+iha\n5NAsP83FYFR68oLjQq9g3i2sQF8gK35CjWT7hv5E8NZsROnm3kfPOiVVNH0KSIt8\nwxgB6V8WijuxLbZ70CvDUXeIeTuRCOnQp5jJ//MWP3eRuwLGSrgMatNWQZplK5ES\nq0LQU8FHiVobX0/l4zmtZ9RVSMJqs+DtrKm35tKWuj19ATU9AlKdESNcDRphem4f\n1pEPId45k2ps2dnEFMA5y+wcgCansSa6z2nEWxOhKLQhjg47gVw0stNjyWZNH04W\naQIDAQAB\n-----END PUBLIC KEY-----\n');
|
||||
/*!40000 ALTER TABLE `dev_club_keys` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `dev_club_offer_assocs`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `dev_club_offer_assocs`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = 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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `dev_club_offer_assocs`
|
||||
--
|
||||
|
||||
LOCK TABLES `dev_club_offer_assocs` WRITE;
|
||||
/*!40000 ALTER TABLE `dev_club_offer_assocs` DISABLE KEYS */;
|
||||
/*!40000 ALTER TABLE `dev_club_offer_assocs` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `dev_club_offers`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `dev_club_offers`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `dev_club_offers` (
|
||||
`id` int(10) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(100) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `dev_club_offers`
|
||||
--
|
||||
|
||||
LOCK TABLES `dev_club_offers` WRITE;
|
||||
/*!40000 ALTER TABLE `dev_club_offers` DISABLE KEYS */;
|
||||
INSERT INTO `dev_club_offers` VALUES (1,'Test'),(2,'Trest2'),(4,'Test4');
|
||||
/*!40000 ALTER TABLE `dev_club_offers` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `dev_club_places`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `dev_club_places`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = 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) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `dev_club_places`
|
||||
--
|
||||
|
||||
LOCK TABLES `dev_club_places` WRITE;
|
||||
/*!40000 ALTER TABLE `dev_club_places` DISABLE KEYS */;
|
||||
INSERT INTO `dev_club_places` VALUES (1,1,'abc','Adresse',NULL),(2,1,'foo2 with new Name','',NULL),(3,2,'foo3','',NULL),(6,1,'MyName','',NULL),(7,1,'MyName','',NULL);
|
||||
/*!40000 ALTER TABLE `dev_club_places` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `dev_club_positions`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `dev_club_positions`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `dev_club_positions` (
|
||||
`id` int(10) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(100) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `dev_club_positions`
|
||||
--
|
||||
|
||||
LOCK TABLES `dev_club_positions` WRITE;
|
||||
/*!40000 ALTER TABLE `dev_club_positions` DISABLE KEYS */;
|
||||
INSERT INTO `dev_club_positions` VALUES (1,'Test');
|
||||
/*!40000 ALTER TABLE `dev_club_positions` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `dev_club_user_assocs`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `dev_club_user_assocs`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = 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;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `dev_club_user_assocs`
|
||||
--
|
||||
|
||||
LOCK TABLES `dev_club_user_assocs` WRITE;
|
||||
/*!40000 ALTER TABLE `dev_club_user_assocs` DISABLE KEYS */;
|
||||
/*!40000 ALTER TABLE `dev_club_user_assocs` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `dev_club_users`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `dev_club_users`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = 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 AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `dev_club_users`
|
||||
--
|
||||
|
||||
LOCK TABLES `dev_club_users` WRITE;
|
||||
/*!40000 ALTER TABLE `dev_club_users` DISABLE KEYS */;
|
||||
INSERT INTO `dev_club_users` VALUES (1,'chris','$2y$10$2/aeOfLlLwFx7JYXpaAOH.CG0ZtvkzTuK6nojvSIuOYlTbSd07CqC','Christian Wolf','Adresse','Saarbrücken','Mail',NULL,NULL),(5,'foo','$2y$10$GmdIKINBKFAsU0Zd4.KavO.o5b8zzEQGRgNFFVxrWGhSnUhyQ9Jki','Max Mustermann','Eine Adresse','Vöklingen','me@web.de','','4'),(7,'foo2','$2y$10$aaR2fjhA4s3DqId8NLBtH.1IaJSoc1cmIj2DSUYkWRTDsSKwBAQUO','sdfg','sdf','dfg','dfg','','');
|
||||
/*!40000 ALTER TABLE `dev_club_users` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2019-05-31 14:22:49
|
||||
8
sql/init4.tables
Normal file
8
sql/init4.tables
Normal file
@@ -0,0 +1,8 @@
|
||||
dev_club_clubs
|
||||
dev_club_keys
|
||||
dev_club_offer_assocs
|
||||
dev_club_offers
|
||||
dev_club_places
|
||||
dev_club_positions
|
||||
dev_club_user_assocs
|
||||
dev_club_users
|
||||
@@ -8,6 +8,7 @@ defined('_JEXEC') or die;
|
||||
|
||||
JLoader::discover('Clubs', JPATH_ROOT . '/administrator/components/com_clubs/mymodels');
|
||||
JLoader::registerPrefix('AbstractClubs', JPATH_ROOT . '/administrator/components/com_clubs/abstract');
|
||||
|
||||
JLoader::registerPrefix('AbstractCommonClubs', JPATH_ROOT . '/administrator/components/com_clubs/common/abstract');
|
||||
JLoader::registerPrefix('CommonClubsModel', JPATH_ROOT . '/administrator/components/com_clubs/common/models');
|
||||
JLoader::registerPrefix('CommonClubsControllerMapping', JPATH_ROOT . '/administrator/components/com_clubs/common/controllermappings');
|
||||
|
||||
@@ -8,6 +8,7 @@ abstract class AbstractCommonClubsModelColumn
|
||||
|
||||
protected $alias;
|
||||
protected $column;
|
||||
|
||||
/**
|
||||
* @var AbstractCommonClubsControllerMapping
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
|
||||
// No direct access.
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
@@ -16,46 +18,91 @@ class CommonClubsModelClub extends AbstractCommonClubsModel
|
||||
return $this->getValues()['name'];
|
||||
}
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
$this->setValue('name', $name);
|
||||
}
|
||||
|
||||
public function getAddress()
|
||||
{
|
||||
return $this->getValues()['address'];
|
||||
}
|
||||
|
||||
public function setAddress($address)
|
||||
{
|
||||
$this->setValue('address', $address);
|
||||
}
|
||||
|
||||
public function getCity()
|
||||
{
|
||||
return $this->getValues()['city'];
|
||||
}
|
||||
|
||||
public function setCity($city)
|
||||
{
|
||||
$this->setValue('city', $city);
|
||||
}
|
||||
|
||||
public function getHomepage()
|
||||
{
|
||||
return $this->getValues()['homepage'];
|
||||
}
|
||||
|
||||
public function setHomepage($homepage)
|
||||
{
|
||||
$this->setValue('homepage', $homepage);
|
||||
}
|
||||
|
||||
public function getMail()
|
||||
{
|
||||
return $this->getValues()['mail'];
|
||||
}
|
||||
|
||||
public function setMail($mail)
|
||||
{
|
||||
$this->setValue('mail', $mail);
|
||||
}
|
||||
|
||||
public function getIban()
|
||||
{
|
||||
return $this->getValues()['iban'];
|
||||
}
|
||||
|
||||
public function setIban($iban)
|
||||
{
|
||||
$this->setValue('iban', $iban);
|
||||
}
|
||||
|
||||
public function getBic()
|
||||
{
|
||||
return $this->getValues()['bic'];
|
||||
}
|
||||
|
||||
public function setBic($bic)
|
||||
{
|
||||
$this->setValue('bic', $bic);
|
||||
}
|
||||
|
||||
public function isCharitable()
|
||||
{
|
||||
return $this->getValues()['charitable'];
|
||||
}
|
||||
|
||||
public function setCharitable($charitable)
|
||||
{
|
||||
$this->setValue('charitable', $charitable);
|
||||
}
|
||||
|
||||
public function getPresident()
|
||||
{
|
||||
return $this->getValues()['president'];
|
||||
}
|
||||
|
||||
public function setPresident($user)
|
||||
{
|
||||
$this->setValue('president', $user);
|
||||
}
|
||||
|
||||
public function getPlaces()
|
||||
{
|
||||
return $this->fetchAssociatedElements(new CommonClubsModelFactoryPlace(), 'clubid');
|
||||
@@ -102,6 +149,9 @@ class CommonClubsModelClub extends AbstractCommonClubsModel
|
||||
*/
|
||||
public function setOfferIds($ids)
|
||||
{
|
||||
if(empty($ids))
|
||||
$ids = array();
|
||||
|
||||
$dbo = $this->getFactory()->loadById($this->getId());
|
||||
$currentOffersAssocs = $dbo->getOfferAssocs();
|
||||
$currentIds = array_map(function($obj){
|
||||
@@ -114,6 +164,11 @@ class CommonClubsModelClub extends AbstractCommonClubsModel
|
||||
$offerAssocFactory = new CommonClubsModelFactoryOfferassoc();
|
||||
$offerFactory = new CommonClubsModelFactoryOffer();
|
||||
|
||||
$db = Factory::getDbo();
|
||||
$db->transactionStart(true);
|
||||
|
||||
try
|
||||
{
|
||||
foreach($delIds as $id)
|
||||
{
|
||||
$delId = (int) $id;
|
||||
@@ -131,6 +186,14 @@ class CommonClubsModelClub extends AbstractCommonClubsModel
|
||||
$o->save();
|
||||
}
|
||||
}
|
||||
catch (Exception $ex)
|
||||
{
|
||||
$db->transactionRollback(true);
|
||||
throw $ex;
|
||||
}
|
||||
|
||||
$db->transactionCommit(true);
|
||||
}
|
||||
|
||||
public function getUsers()
|
||||
{
|
||||
|
||||
@@ -10,6 +10,7 @@ class CommonClubsModelFactoryPlace extends AbstractCommonClubsModelFactory
|
||||
return array(
|
||||
new CommonClubsModelColumnString('name', new CommonClubsControllerMappingString('Bezeichnung')),
|
||||
new CommonClubsModelColumnRef('club', 'CommonClubsModelClub', 'clubid', new CommonClubsControllerMappingRef('Club', new CommonClubsModelFactoryClub())),
|
||||
new CommonClubsModelColumnString('address', new CommonClubsControllerMappingString('Adresse')),
|
||||
new CommonClubsModelColumnInt('area', new CommonClubsControllerMappingInt('Fläche', false))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,11 @@ class CommonClubsModelPlace extends AbstractCommonClubsModel
|
||||
return $this->getValues()['area'];
|
||||
}
|
||||
|
||||
public function getAddress()
|
||||
{
|
||||
return $this->getValues()['address'];
|
||||
}
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
$this->setValue('name', $name);
|
||||
@@ -40,4 +45,9 @@ class CommonClubsModelPlace extends AbstractCommonClubsModel
|
||||
$this->setValue('club', $club);
|
||||
}
|
||||
|
||||
public function setAddress($address)
|
||||
{
|
||||
$this->setValue('address', $address);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -125,6 +125,11 @@ class CommonClubsModelUser extends AbstractCommonClubsModel
|
||||
return $this->fetchAssociatedElements(new CommonClubsModelFactoryUserassoc(), 'userid');
|
||||
}
|
||||
|
||||
public function getPresidentClubs()
|
||||
{
|
||||
return $this->fetchAssociatedElements(new CommonClubsModelFactoryClub(), 'president');
|
||||
}
|
||||
|
||||
public function isPasswordSuitable($password)
|
||||
{
|
||||
if(strlen($password) < 8)
|
||||
@@ -201,5 +206,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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
|
||||
jQuery(function($){
|
||||
$('#mya').click(function()
|
||||
{
|
||||
//alert("a");
|
||||
console.log("a");
|
||||
});
|
||||
});
|
||||
@@ -12,12 +12,12 @@ defined('_JEXEC') or die;
|
||||
<h2>Stammdaten</h2>
|
||||
<table>
|
||||
<tr>
|
||||
<td>Bezeichnung</td>
|
||||
<td>Clubname</td>
|
||||
<td><input type='text' name='name' value='<?php echo htmlentities($this->object->getName()); ?>'></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Adresse</td>
|
||||
<td>Vollständige postalische Adresse</td>
|
||||
<td>
|
||||
<textarea name='address' rows='5'><?php echo htmlentities($this->object->getAddress()); ?></textarea>
|
||||
</td>
|
||||
|
||||
@@ -21,7 +21,7 @@ class ClubsViewClub extends AbstractClubsViewSingle
|
||||
|
||||
JHtmlJquery::framework();
|
||||
Factory::getDocument()->addScript('components/com_clubs/res/club/club.js');
|
||||
Factory::getDocument()->addStyleSheet('components/com_clubs/res/club/admin-club.css');
|
||||
Factory::getDocument()->addStyleSheet('components/com_clubs/res/admin-club.css');
|
||||
|
||||
// $this->
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ defined('_JEXEC') or die;
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Adresse (optional): </td>
|
||||
<td>Postalische Adresse (optional): </td>
|
||||
<td>
|
||||
<textarea name='address' rows='4'><?php echo $this->assoc->getAddress(); ?></textarea>
|
||||
</td>
|
||||
|
||||
@@ -28,7 +28,7 @@ defined('_JEXEC') or die;
|
||||
<td><input type='text' name='name' value='<?php echo htmlentities($this->object->getName()); ?>'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Adresse</td>
|
||||
<td>Vollständige postalische Adresse</td>
|
||||
<td>
|
||||
<textarea rows="4" name='address'><?php echo (htmlentities($this->object->getAddress())); ?></textarea>
|
||||
</tr>
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
<folder>js</folder>
|
||||
<folder>models</folder>
|
||||
<folder>views</folder>
|
||||
<folder>parts</folder>
|
||||
</files>
|
||||
|
||||
<!--Sollte, Sollten unterschiedliche Sprachen genutzt werden, ist hier der richtige Platz um diese zu installieren-->
|
||||
|
||||
@@ -7,8 +7,16 @@ use Joomla\CMS\Factory;
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
JLoader::discover('Clubs', JPATH_ROOT . '/administrator/components/com_clubs/mymodels');
|
||||
|
||||
JLoader::registerPrefix('ClubsHelper', JPATH_ROOT . '/components/com_clubs/helpers');
|
||||
JLoader::registerPrefix('ClubsPart', JPATH_ROOT . '/components/com_clubs/parts');
|
||||
|
||||
JLoader::registerPrefix('AbstractClubs', JPATH_ROOT . '/administrator/components/com_clubs/abstract');
|
||||
|
||||
JLoader::registerPrefix('AbstractCommonClubs', JPATH_ROOT . '/administrator/components/com_clubs/common/abstract');
|
||||
JLoader::registerPrefix('CommonClubsModel', JPATH_ROOT . '/administrator/components/com_clubs/common/models');
|
||||
JLoader::registerPrefix('CommonClubsControllerMapping', JPATH_ROOT . '/administrator/components/com_clubs/common/controllermappings');
|
||||
|
||||
$controller = BaseController::getInstance("Clubs");
|
||||
$input = Factory::getApplication()->input;
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Joomla\CMS\MVC\Controller\BaseController;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
use Joomla\CMS\Factory;
|
||||
|
||||
// No direct access.
|
||||
defined('_JEXEC') or die;
|
||||
@@ -10,11 +12,56 @@ class ClubsController extends BaseController
|
||||
|
||||
public function display($cachable = false, $params = array())
|
||||
{
|
||||
$auth = new ClubsHelperAuth();
|
||||
|
||||
$app = Factory::getApplication();
|
||||
$view = $app->input->getCmd('view');
|
||||
|
||||
// Most of the pages can only be viewd as a logged-in user
|
||||
if($auth->isValidUserLoggedIn())
|
||||
{
|
||||
if($this->isUrlAllowed($view))
|
||||
{
|
||||
$this->doDisplay($cachable, $params);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// User is not allowed to see the site, give useful information
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($view === 'login' || $view === 'publicclubs')
|
||||
{
|
||||
$this->doDisplay($cachable, $params);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// User needs to login in order to see the site
|
||||
$this->redirectToLogin();
|
||||
}
|
||||
}
|
||||
|
||||
$this->redirectToLogin();
|
||||
}
|
||||
|
||||
private function doDisplay($cachable, $params)
|
||||
{
|
||||
Factory::getDocument()->addStyleSheet(Uri::base(true) . "components/com_clubs/css/clubs.css");
|
||||
parent::display($cachable, $params);
|
||||
}
|
||||
|
||||
public function foo()
|
||||
private function redirectToLogin()
|
||||
{
|
||||
echo "dsfh";
|
||||
// XXX Attach URL to forward later
|
||||
$this->setRedirect('index.php?opion=com_clubs&view=login');
|
||||
}
|
||||
|
||||
private function isUrlAllowed($view)
|
||||
{
|
||||
// FIXME Insert ACLs checking here
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,6 @@ use Joomla\CMS\Factory;
|
||||
// No direct access.
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
JLoader::register("ClubsHelperAuth", JPATH_ROOT . "/components/com_clubs/helpers/auth.php");
|
||||
|
||||
class ClubsControllerLogin extends BaseController
|
||||
{
|
||||
public function login()
|
||||
|
||||
458
src/site/controllers/parts.json.php
Normal file
458
src/site/controllers/parts.json.php
Normal file
@@ -0,0 +1,458 @@
|
||||
<?php
|
||||
|
||||
use Joomla\CMS\MVC\Controller\BaseController;
|
||||
use Joomla\CMS\Response\JsonResponse;
|
||||
use Joomla\CMS\Factory;
|
||||
|
||||
// No direct access.
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
abstract class UserException extends Exception {}
|
||||
class InvalidUserDataException extends UserException {}
|
||||
|
||||
abstract class AbstractClubsHelperController
|
||||
{
|
||||
|
||||
private $fcnNames;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->fcnNames = array();
|
||||
$this->registerAll();
|
||||
}
|
||||
|
||||
abstract protected function registerAll();
|
||||
|
||||
protected function registerFcn($fcnName, $methodName)
|
||||
{
|
||||
$this->fcnNames[$fcnName] = $methodName;
|
||||
}
|
||||
|
||||
public function handle($fcnName, $user, $post)
|
||||
{
|
||||
if(empty($this->fcnNames[$fcnName]))
|
||||
throw new Exception();
|
||||
|
||||
$method = $this->fcnNames[$fcnName];
|
||||
$this->$method($user, $post);
|
||||
}
|
||||
|
||||
protected function checkLen($value, $len, $msg)
|
||||
{
|
||||
if(strlen($value) < $len)
|
||||
throw new InvalidUserDataException($msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class ClubsHelperControllerUser extends AbstractClubsHelperController
|
||||
{
|
||||
/**
|
||||
* @param string $fcnName
|
||||
* @param CommonClubsModelUser $user
|
||||
* @param JInput $post
|
||||
* @throws Exception
|
||||
* @return string
|
||||
*/
|
||||
public function parse($fcnName, $user, $post)
|
||||
{
|
||||
switch($fcnName)
|
||||
{
|
||||
case 'name':
|
||||
$this->editName($user, $post);
|
||||
break;
|
||||
case 'username':
|
||||
$this->editUsername($user, $post);
|
||||
break;
|
||||
case 'address':
|
||||
$this->editAddress($user, $post);
|
||||
break;
|
||||
case 'city':
|
||||
$this->editCity($user, $post);
|
||||
break;
|
||||
case 'mail':
|
||||
$this->editMail($user, $post);
|
||||
break;
|
||||
case 'phone':
|
||||
$this->editPhone($user, $post);
|
||||
break;
|
||||
case 'mobile':
|
||||
$this->editMobile($user, $post);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
return "index.php?option=com_clubs&view=part&type=user.$fcnName";
|
||||
}
|
||||
|
||||
|
||||
protected function registerAll()
|
||||
{
|
||||
$this->registerFcn('name', 'editName');
|
||||
$this->registerFcn('username', 'editUsername');
|
||||
$this->registerFcn('address', 'editAddress');
|
||||
$this->registerFcn('city', 'editCity');
|
||||
$this->registerFcn('mail', 'editMail');
|
||||
$this->registerFcn('phone', 'editPhone');
|
||||
$this->registerFcn('mobile', 'editMobile');
|
||||
}
|
||||
|
||||
protected function editName($user, $post)
|
||||
{
|
||||
$name = trim($post->getString('value'));
|
||||
$this->checkLen($name, 5, "Der Name muss mindestens 5 Zeichen lang sein.");
|
||||
|
||||
$user->setName($name);
|
||||
$user->save();
|
||||
}
|
||||
|
||||
protected function editUsername($user, $post)
|
||||
{
|
||||
$username = $post->getString('value');
|
||||
$validator = new ClubsHelperValidator();
|
||||
$res = $validator->validateUsername($user, $username);
|
||||
$this->checkLen($username, 5, 'Der Benutzername muss mindestens 5 Zeichen lang sein.');
|
||||
|
||||
switch($res)
|
||||
{
|
||||
case ClubsHelperValidator::USERNAME_VALID:
|
||||
$user->setUsername($username);
|
||||
$user->save();
|
||||
return;
|
||||
|
||||
case ClubsHelperValidator::USERNAME_NOT_FREE:
|
||||
throw new InvalidUserDataException('Der Benutzername ist bereits vergeben.');
|
||||
|
||||
case ClubsHelperValidator::USERNAME_NOT_OK:
|
||||
throw new InvalidUserDataException('Der Benutzername ist nicht korrekt formaitert. Er muss mit einem Buchstaben beginnen.');
|
||||
|
||||
default:
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
|
||||
protected function editAddress($user, $post)
|
||||
{
|
||||
$address = trim($post->getString('value'));
|
||||
$this->checkLen($address, 10, 'Die Adresse muss mindestens 10 Zeichen lang sein.');
|
||||
|
||||
$validator = new ClubsHelperValidator();
|
||||
$addr = '';
|
||||
$valid = $validator->validateAddress($address, $addr);
|
||||
|
||||
if(! $valid)
|
||||
throw new InvalidUserDataException('Die Adresse muss mindestens aus 2 Zeilen bestehen.');
|
||||
|
||||
$user->setAddress($addr);
|
||||
$user->save();
|
||||
}
|
||||
|
||||
protected function editCity($user, $post)
|
||||
{
|
||||
$city = trim($post->getString('value'));
|
||||
$this->checkLen($city, 4, 'Die Stadt muss aus mindestens 4 Zeichen bestehen.');
|
||||
|
||||
$user->setCity($city);
|
||||
$user->save();
|
||||
}
|
||||
|
||||
protected function editMail($user, $post)
|
||||
{
|
||||
$mail = trim($post->getString('value'));
|
||||
$this->checkLen($mail, 8, "Die Mail-Adresse muss aus mindestens 8 Zeichen bestehen.");
|
||||
$validator = new ClubsHelperValidator();
|
||||
if(! $validator->validateMail($mail))
|
||||
throw new InvalidUserDataException('Die Mail-Adresse hat kein gültiges Format.');
|
||||
|
||||
$user->setMail($mail);
|
||||
$user->save();
|
||||
}
|
||||
|
||||
protected function editPhone($user, $post)
|
||||
{
|
||||
$phone = trim($post->getString('value'));
|
||||
|
||||
if(strlen($phone) == 0)
|
||||
{
|
||||
$user->setPhone(null);
|
||||
$user->save();
|
||||
return;
|
||||
}
|
||||
|
||||
$validator = new ClubsHelperValidator();
|
||||
$phonePlain = '';
|
||||
$phoneDigits = '';
|
||||
$valid = $validator->validatePhoneNumber($phone, $phonePlain, $phoneDigits);
|
||||
|
||||
$this->checkLen($phoneDigits, 6, 'Die Telefonnummer muss mindestens 6 Ziffern umfassen.');
|
||||
if(! $valid)
|
||||
throw new InvalidUserDataException('Keine gültige Telefonnummer gegeben. Erlaubte Zeichen sind 0-9, -, + und Leerzeichen. Bitte Vorwahl mit angeben.');
|
||||
|
||||
$user->setPhone($phonePlain);
|
||||
$user->save();
|
||||
}
|
||||
|
||||
protected function editMobile($user, $post)
|
||||
{
|
||||
$mobile = trim($post->getString('value'));
|
||||
|
||||
if(strlen($mobile) == 0)
|
||||
{
|
||||
$user->setMobile(null);
|
||||
$user->save();
|
||||
return;
|
||||
}
|
||||
|
||||
$validator = new ClubsHelperValidator();
|
||||
$mobilePlain = '';
|
||||
$mobileDigits = '';
|
||||
$valid = $validator->validatePhoneNumber($mobile, $mobilePlain, $mobileDigits);
|
||||
|
||||
$this->checkLen($mobileDigits, 6, 'Die Handynummer muss mindestens 6 Ziffern umfassen.');
|
||||
if(! $valid)
|
||||
throw new InvalidUserDataException('Keine gültige Handynummer gegeben. Erlaubte Zeichen sind 0-9, -, + und Leerzeichen. Bitte Vorwahl mit angeben.');
|
||||
|
||||
$user->setMobile($mobilePlain);
|
||||
$user->save();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class ClubsHelperControllerClub extends AbstractClubsHelperController
|
||||
{
|
||||
|
||||
private $id;
|
||||
/**
|
||||
* @var CommonClubsModelClub
|
||||
*/
|
||||
private $club;
|
||||
|
||||
public function __construct($id)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->id = $id;
|
||||
|
||||
$factory = new CommonClubsModelFactoryClub();
|
||||
$this->club = $factory->loadById($id, false);
|
||||
}
|
||||
|
||||
protected function registerAll()
|
||||
{
|
||||
$this->registerFcn('name', 'editName');
|
||||
$this->registerFcn('address', 'editAddress');
|
||||
$this->registerFcn('city', 'editCity');
|
||||
$this->registerFcn('homepage', 'editHomepage');
|
||||
$this->registerFcn('mail', 'editMail');
|
||||
$this->registerFcn('iban', 'editIban');
|
||||
$this->registerFcn('bic', 'editBic');
|
||||
$this->registerFcn('offers', 'editOffers');
|
||||
$this->registerFcn('place', 'editPlace');
|
||||
}
|
||||
|
||||
protected function editName($user, $post)
|
||||
{
|
||||
$name = trim($post->getString('value'));
|
||||
$this->checkLen($name, 6, 'Der Name des Vereins muss mindestens 6 Zeichen lang sein.');
|
||||
|
||||
// TODO ACL needed
|
||||
|
||||
$this->club->setName($name);
|
||||
$this->club->save();
|
||||
}
|
||||
|
||||
protected function editAddress($user, $post)
|
||||
{
|
||||
$address = trim($post->getString('value'));
|
||||
$this->checkLen($address, 10, 'Die Adresse muss mindestens 10 Zeichen lang sein.');
|
||||
|
||||
$validator = new ClubsHelperValidator();
|
||||
$addr = '';
|
||||
$valid = $validator->validateAddress($address, $addr);
|
||||
|
||||
if(! $valid)
|
||||
throw new InvalidUserDataException('Die Adresse muss mindestens aus 2 Zeilen bestehen.');
|
||||
|
||||
// TODO ACL needed
|
||||
|
||||
$this->club->setAddress($addr);
|
||||
$this->club->save();
|
||||
}
|
||||
|
||||
protected function editCity($user, $post)
|
||||
{
|
||||
$city = trim($post->getString('value'));
|
||||
$this->checkLen($city, 4, 'Die Stadt muss aus mindestens 4 Zeichen bestehen.');
|
||||
|
||||
// TODO ACL needed
|
||||
|
||||
$this->club->setCity($city);
|
||||
$this->club->save();
|
||||
}
|
||||
|
||||
protected function editHomepage($user, $post)
|
||||
{
|
||||
$homepage = trim($post->getString('value'));
|
||||
$validator = new ClubsHelperValidator();
|
||||
if(!$validator->validateHomepage($homepage))
|
||||
throw new InvalidUserDataException('Die URL muss mit "http(s)://domain.tld" beginnen.');
|
||||
|
||||
// TODO ACL needed
|
||||
|
||||
$this->club->setHomepage($homepage);
|
||||
$this->club->save();
|
||||
}
|
||||
|
||||
protected function editMail($user, $post)
|
||||
{
|
||||
$mail = trim($post->getString('value'));
|
||||
$this->checkLen($mail, 8, "Die Mail-Adresse muss aus mindestens 8 Zeichen bestehen.");
|
||||
|
||||
$validator = new ClubsHelperValidator();
|
||||
if(! $validator->validateMail($mail))
|
||||
throw new InvalidUserDataException('Die Mail-Adresse hat kein gültiges Format.');
|
||||
|
||||
$this->club->setMail($mail);
|
||||
$this->club->save();
|
||||
}
|
||||
|
||||
protected function editIban($user, $post)
|
||||
{
|
||||
$iban = trim($post->getString('value'));
|
||||
$this->checkLen($iban, 10, 'Die IBAN muss aus mindestens 10 Zeichen bestehen.');
|
||||
|
||||
$validator = new ClubsHelperValidator();
|
||||
$formattedIban = null;
|
||||
if(! $validator->validateIban($iban, $formattedIban))
|
||||
throw new InvalidUserDataException('Die IBAN ist nicht korrekt.');
|
||||
|
||||
// TODO ACL needed
|
||||
|
||||
$this->club->setIban($iban);
|
||||
$this->club->save();
|
||||
}
|
||||
|
||||
protected function editBic($user, $post)
|
||||
{
|
||||
$bic = trim($post->getString('value'));
|
||||
$this->checkLen($bic, 6, 'Die BIC muss aus mindestens 6 Zeichen bestehen.');
|
||||
|
||||
// TODO ACL needed
|
||||
|
||||
$this->club->setBic($bic);
|
||||
$this->club->save();
|
||||
}
|
||||
|
||||
protected function editOffers($user, $post)
|
||||
{
|
||||
$ids = $post->getInt('offers');
|
||||
|
||||
// TODO ACL needed
|
||||
|
||||
try
|
||||
{
|
||||
$this->club->setOfferIds($ids);
|
||||
}
|
||||
catch(ElementNotFoundException $ex)
|
||||
{
|
||||
throw new InvalidUserDataException('Es gab ein Problem mit der Eingabe. Bitte Seite neu laden und Daten erneut eintragen.');
|
||||
}
|
||||
}
|
||||
|
||||
protected function editPlace($user, $post)
|
||||
{
|
||||
$factory = new CommonClubsModelFactoryPlace();
|
||||
$place = $factory->loadById($this->id);
|
||||
|
||||
$name = trim($post->getString('name'));
|
||||
$address = $post->getString('address');
|
||||
$area = $post->getInt('area');
|
||||
|
||||
$validator = new ClubsHelperValidator();
|
||||
|
||||
$this->checkLen($name, 5, "Der Name des Saals muss mindestens aus 5 Zeichen bestehen.");
|
||||
|
||||
$this->checkLen($address, 10, 'Die Adresse muss mindestens 10 Zeichen lang sein.');
|
||||
$addr = '';
|
||||
if(!$validator->validateAddress($address, $addr))
|
||||
{
|
||||
throw new InvalidUserDataException('Die Adresse muss mindestens aus 2 Zeilen bestehen.');
|
||||
}
|
||||
|
||||
if($area < 0)
|
||||
throw new InvalidUserDataException('Die Fläche darf nicht negativ sein.');
|
||||
if($area == 0)
|
||||
$area = null;
|
||||
if($area > 2500)
|
||||
throw new InvalidUserDataException('Die Fläche erscheint zu groß zu sein. Wenden Sie sich bitte ggf an den Support.');
|
||||
|
||||
// TODO ACL needed
|
||||
|
||||
$place->setName($name);
|
||||
$place->setAddress($addr);
|
||||
$place->setArea($area);
|
||||
$place->save();
|
||||
}
|
||||
}
|
||||
|
||||
class ClubsControllerParts extends BaseController
|
||||
{
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$auth = new ClubsHelperAuth();
|
||||
$user = $auth->getCurrentUser();
|
||||
$app = Factory::getApplication();
|
||||
$post = $app->input->post;
|
||||
|
||||
try
|
||||
{
|
||||
$ret = $this->callMethod($user, $post);
|
||||
echo new JsonResponse($ret);
|
||||
}
|
||||
catch(UserException $e)
|
||||
{
|
||||
echo new JsonResponse($e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CommonClubsModelUser $user
|
||||
* @param JInput $post
|
||||
*/
|
||||
private function callMethod($user, $post)
|
||||
{
|
||||
$partname = $post->getCmd('partname');
|
||||
|
||||
if(! preg_match('/.*\..*/', $partname))
|
||||
throw new Exception();
|
||||
|
||||
list($objname, $fcnName) = explode('.', $partname, 2);
|
||||
|
||||
switch($objname)
|
||||
{
|
||||
case 'user':
|
||||
$obj = new ClubsHelperControllerUser();
|
||||
$obj->handle($fcnName, $user, $post);
|
||||
break;
|
||||
|
||||
case 'club':
|
||||
$clubid = $post->getInt('id', -1);
|
||||
$obj = new ClubsHelperControllerClub($clubid);
|
||||
$obj->handle($fcnName, $user, $post); // TODO User!?!?!
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
$id = (int) $post->getInt('id', -1);
|
||||
$addId = '';
|
||||
if($id != -1)
|
||||
$addId = "&id=$id";
|
||||
|
||||
return "index.php?option=com_clubs&view=part&type=$partname$addId";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,6 +5,12 @@
|
||||
padding-left: 2em;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
h1 > .clubs_content_row
|
||||
{
|
||||
padding-left: 0px;
|
||||
}
|
||||
|
||||
.clubs_title_row
|
||||
{
|
||||
font-weight: bold;
|
||||
@@ -29,3 +35,40 @@ table.clubs > tbody > tr > th
|
||||
{
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.address-field
|
||||
{
|
||||
line-height: 120%;
|
||||
}
|
||||
|
||||
.clubs_content_row .clubs-hidden,
|
||||
h1 .clubs-hidden,
|
||||
.clubs-hidden
|
||||
{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.clubs_content_row:hover > a > .edit-icon,
|
||||
.clubs_content_row > div:hover > a > .edit-icon,
|
||||
h1:hover > a > .edit-icon
|
||||
{
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
form.clubs-part, form.clubs-part > input
|
||||
{
|
||||
margin: 0pt;
|
||||
}
|
||||
|
||||
form.clubs-part
|
||||
{
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
div.clubs-address
|
||||
{
|
||||
line-height: 135%;
|
||||
margin: 5px 0px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,23 @@ defined('_JEXEC') or die;
|
||||
class ClubsHelperAuth
|
||||
{
|
||||
|
||||
public function isValidUserLoggedIn()
|
||||
{
|
||||
// FIXME
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return CommonClubsModelUser
|
||||
*/
|
||||
public function getCurrentUser()
|
||||
{
|
||||
// FIXME This must be implemented
|
||||
$userFactory = new CommonClubsModelFactoryUser();
|
||||
$users = $userFactory->loadElements();
|
||||
return $users[0];
|
||||
}
|
||||
|
||||
public function checkUser($user, $pwd)
|
||||
{
|
||||
$userModel = BaseDatabaseModel::getInstance("user", "ClubsModel");
|
||||
|
||||
27
src/site/helpers/part/textarea.php
Normal file
27
src/site/helpers/part/textarea.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
// No direct access.
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
abstract class ClubsHelperPartTextarea extends ClubsHelperParts
|
||||
{
|
||||
|
||||
protected function additionalParams()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
protected function getEditMarkup()
|
||||
{
|
||||
$ret = '<textarea name="value"';
|
||||
$additional = $this->additionalParams();
|
||||
if($additional !== null)
|
||||
$ret .= " $additional";
|
||||
$ret .= '>';
|
||||
$ret .= $this->getEditContent();
|
||||
$ret .= '</textarea>';
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
}
|
||||
18
src/site/helpers/part/textfield.php
Normal file
18
src/site/helpers/part/textfield.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
// No direct access.
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
abstract class ClubsHelperPartTextfield extends ClubsHelperParts
|
||||
{
|
||||
|
||||
protected function getEditMarkup()
|
||||
{
|
||||
$ret = '<input type="text" name="value" value="';
|
||||
$ret .= $this->getEditContent();
|
||||
$ret .= '">';
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
}
|
||||
87
src/site/helpers/parts.php
Normal file
87
src/site/helpers/parts.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
// No direct access.
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
abstract class ClubsHelperParts
|
||||
{
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
abstract protected function getPartName();
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
public function __construct($id = null)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getEditPart()
|
||||
{
|
||||
$partname = $this->getPartName();
|
||||
|
||||
$ret = "<form method='POST' action='index.php?option=com_clubs&task=parts.edit&format=json' class='clubs-part'>";
|
||||
$ret .= "<input type='hidden' name='partname' value='$partname'>";
|
||||
if(isset($this->id))
|
||||
$ret .= "<input type='hidden' name='id' value='{$this->id}'>";
|
||||
$ret .= $this->getEditMarkup();
|
||||
$ret .= ' <a class="clubs-save" href="#"><span class="icon-ok"></span></a> ';
|
||||
$idPart = '';
|
||||
if(isset($this->id))
|
||||
$idPart = "&id=" . $this->id;
|
||||
$ret .= '<a class="clubs-abort" href="index.php?option=com_clubs&view=part&type='.$partname.$idPart.'"><span class="icon-cancel-2"></span></a>';
|
||||
$ret .= '</form>';
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
abstract protected function getEditMarkup();
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
abstract protected function getEditContent();
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function getViewContent()
|
||||
{
|
||||
$content = $this->getEditContent();
|
||||
if(empty($content))
|
||||
{
|
||||
return '<i>Kein Wert wurde vergeben</i>';
|
||||
}
|
||||
else
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getViewPart()
|
||||
{
|
||||
$idPart = '';
|
||||
if(isset($this->id))
|
||||
$idPart = "&id={$this->id}";
|
||||
|
||||
$ret = "<a class='clubs-edit' href='index.php?option=com_clubs&view=part&mode=edit&type=" . $this->getPartName(). "$idPart'>";
|
||||
$ret .= $this->getViewContent();
|
||||
$ret .= "<span class='icon-apply clubs-hidden edit-icon' style='font-size: {$this->getEditSymbolSize()}; margin-left: 0.75em; margin-right: 0.4em; '></span></a>";
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
protected function getEditSymbolSize()
|
||||
{
|
||||
return '120%';
|
||||
}
|
||||
}
|
||||
72
src/site/helpers/validator.php
Normal file
72
src/site/helpers/validator.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
// No direct access.
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
class ClubsHelperValidator
|
||||
{
|
||||
|
||||
public function validatePhoneNumber($number, &$cleanedNumber, &$plainDigits = null)
|
||||
{
|
||||
if($plainDigits !== null)
|
||||
$plainDigits = preg_replace('/[^+0-9]/', '', $number);
|
||||
|
||||
$cleanedNumber = preg_replace('/[^-+ 0-9]/', '', $number);
|
||||
|
||||
$validNational = preg_match('/^0[0-9 -]+$/', $cleanedNumber);
|
||||
$validInternational = preg_match('/^\+[0-9 -]+$/', $cleanedNumber);
|
||||
|
||||
return ($validNational || $validInternational);
|
||||
}
|
||||
|
||||
|
||||
const USERNAME_VALID = 0;
|
||||
const USERNAME_NOT_FREE = 1;
|
||||
const USERNAME_NOT_OK = 2;
|
||||
/**
|
||||
* @param CommonClubsModelUser $user
|
||||
* @param string $username
|
||||
*/
|
||||
public function validateUsername($user, &$username)
|
||||
{
|
||||
// Remove false chars
|
||||
$username = preg_replace('/[^a-zA-Z0-9!@#$%^&*()[]{}_+=\/\\?-]/', '', $username);
|
||||
|
||||
// Ensure start with an alphabetic char
|
||||
if(! preg_match('/^[a-zA-Z]/', $username))
|
||||
return self::USERNAME_NOT_OK;
|
||||
|
||||
if(! $user->isUsernameFree($username))
|
||||
return self::USERNAME_NOT_FREE;
|
||||
|
||||
return self::USERNAME_VALID;
|
||||
}
|
||||
|
||||
public function validateAddress($address, &$addr = null)
|
||||
{
|
||||
$parts = array_filter(explode("\n", str_replace("\r", "\n", $address)));
|
||||
if(count($parts) < 2)
|
||||
return false;
|
||||
|
||||
if($addr !== null)
|
||||
$addr = join("\n", $parts);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function validateHomepage($address)
|
||||
{
|
||||
return preg_match('@^https?://[a-zA-Z0-9].*\.[a-zA-Z0-9]{2,}@', $address);
|
||||
}
|
||||
|
||||
public function validateMail($mail)
|
||||
{
|
||||
return preg_match('/..*@..*\...*/', $mail);
|
||||
}
|
||||
|
||||
public function validateIban($iban, &$formattedIban)
|
||||
{
|
||||
return true; // FIXME Implement useful tests
|
||||
}
|
||||
|
||||
}
|
||||
51
src/site/js/edit.js
Normal file
51
src/site/js/edit.js
Normal file
@@ -0,0 +1,51 @@
|
||||
|
||||
jQuery(function($){
|
||||
|
||||
$(document).on('click', 'a.clubs-edit', function(ev){
|
||||
ev.preventDefault();
|
||||
var myA = $(this);
|
||||
$.get(ev.currentTarget.href, function(d){
|
||||
myA.replaceWith(d);
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', 'a.clubs-abort', function(ev){
|
||||
ev.preventDefault();
|
||||
var form = $(this).parent();
|
||||
$.get(this.href, function(d){
|
||||
form.replaceWith(d);
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', 'a.clubs-save', function(ev){
|
||||
ev.preventDefault();
|
||||
var form = $(this).parent();
|
||||
$.post(form.attr('action'), form.serializeArray(), function(d){
|
||||
if(d.success) {
|
||||
$.get(d.data, function(d2){
|
||||
form.replaceWith(d2);
|
||||
});
|
||||
} else {
|
||||
alert(d.message);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('submit', 'form.clubs-part', function(ev){
|
||||
ev.preventDefault();
|
||||
$('a.clubs-save', this).click();
|
||||
});
|
||||
|
||||
$('#clubs_add_place').click(function(ev){
|
||||
ev.preventDefault();
|
||||
|
||||
var last = $('.clubs_place:last');
|
||||
var newElement = last.clone();
|
||||
$('*', newElement).remove();
|
||||
newElement.insertAfter(last);
|
||||
|
||||
$.get('index.php?option=com_clubs&view=part&mode=edit&type=club.place&id=new', function(data){
|
||||
newElement.html(data);
|
||||
});
|
||||
});
|
||||
});
|
||||
31
src/site/parts/club/address.php
Normal file
31
src/site/parts/club/address.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
// No direct access.
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
class ClubsPartClubAddress extends ClubsHelperPartTextarea
|
||||
{
|
||||
protected function getPartName()
|
||||
{
|
||||
return 'club.address';
|
||||
}
|
||||
|
||||
protected function getEditContent()
|
||||
{
|
||||
$clubFactory = new CommonClubsModelFactoryClub();
|
||||
$club = $clubFactory->loadById($this->id);
|
||||
|
||||
return htmlentities($club->getAddress());
|
||||
}
|
||||
|
||||
protected function getViewContent()
|
||||
{
|
||||
return nl2br(parent::getViewContent());
|
||||
}
|
||||
|
||||
protected function additionalParams()
|
||||
{
|
||||
return 'rows="4"';
|
||||
}
|
||||
|
||||
}
|
||||
21
src/site/parts/club/bic.php
Normal file
21
src/site/parts/club/bic.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
// No direct access.
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
class ClubsPartClubBic extends ClubsHelperPartTextfield
|
||||
{
|
||||
protected function getPartName()
|
||||
{
|
||||
return 'club.bic';
|
||||
}
|
||||
|
||||
protected function getEditContent()
|
||||
{
|
||||
$clubFactory = new CommonClubsModelFactoryClub();
|
||||
$club = $clubFactory->loadById($this->id);
|
||||
|
||||
return htmlentities($club->getBic());
|
||||
}
|
||||
|
||||
}
|
||||
21
src/site/parts/club/city.php
Normal file
21
src/site/parts/club/city.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
// No direct access.
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
class ClubsPartClubCity extends ClubsHelperPartTextfield
|
||||
{
|
||||
protected function getPartName()
|
||||
{
|
||||
return 'club.city';
|
||||
}
|
||||
|
||||
protected function getEditContent()
|
||||
{
|
||||
$clubFactory = new CommonClubsModelFactoryClub();
|
||||
$club = $clubFactory->loadById($this->id);
|
||||
|
||||
return htmlentities($club->getCity());
|
||||
}
|
||||
|
||||
}
|
||||
21
src/site/parts/club/homepage.php
Normal file
21
src/site/parts/club/homepage.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
// No direct access.
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
class ClubsPartClubHomepage extends ClubsHelperPartTextfield
|
||||
{
|
||||
protected function getPartName()
|
||||
{
|
||||
return 'club.homepage';
|
||||
}
|
||||
|
||||
protected function getEditContent()
|
||||
{
|
||||
$clubFactory = new CommonClubsModelFactoryClub();
|
||||
$club = $clubFactory->loadById($this->id);
|
||||
|
||||
return htmlentities($club->getHomepage());
|
||||
}
|
||||
|
||||
}
|
||||
21
src/site/parts/club/iban.php
Normal file
21
src/site/parts/club/iban.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
// No direct access.
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
class ClubsPartClubIban extends ClubsHelperPartTextfield
|
||||
{
|
||||
protected function getPartName()
|
||||
{
|
||||
return 'club.iban';
|
||||
}
|
||||
|
||||
protected function getEditContent()
|
||||
{
|
||||
$clubFactory = new CommonClubsModelFactoryClub();
|
||||
$club = $clubFactory->loadById($this->id);
|
||||
|
||||
return htmlentities($club->getIban());
|
||||
}
|
||||
|
||||
}
|
||||
21
src/site/parts/club/mail.php
Normal file
21
src/site/parts/club/mail.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
// No direct access.
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
class ClubsPartClubMail extends ClubsHelperPartTextfield
|
||||
{
|
||||
protected function getPartName()
|
||||
{
|
||||
return 'club.mail';
|
||||
}
|
||||
|
||||
protected function getEditContent()
|
||||
{
|
||||
$clubFactory = new CommonClubsModelFactoryClub();
|
||||
$club = $clubFactory->loadById($this->id);
|
||||
|
||||
return htmlentities($club->getMail());
|
||||
}
|
||||
|
||||
}
|
||||
26
src/site/parts/club/name.php
Normal file
26
src/site/parts/club/name.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
// No direct access.
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
class ClubsPartClubName extends ClubsHelperPartTextfield
|
||||
{
|
||||
protected function getPartName()
|
||||
{
|
||||
return 'club.name';
|
||||
}
|
||||
|
||||
protected function getEditContent()
|
||||
{
|
||||
$clubFactory = new CommonClubsModelFactoryClub();
|
||||
$club = $clubFactory->loadById($this->id);
|
||||
|
||||
return htmlentities($club->getName());
|
||||
}
|
||||
|
||||
protected function getEditSymbolSize()
|
||||
{
|
||||
return '100%';
|
||||
}
|
||||
|
||||
}
|
||||
87
src/site/parts/club/offers.php
Normal file
87
src/site/parts/club/offers.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
// No direct access.
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
class ClubsPartClubOffers extends ClubsHelperParts
|
||||
{
|
||||
protected function getPartName()
|
||||
{
|
||||
return 'club.offers';
|
||||
}
|
||||
|
||||
protected function getEditContent()
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
protected function getEditMarkup()
|
||||
{
|
||||
$ret = '';
|
||||
|
||||
$factory = new CommonClubsModelFactoryClub();
|
||||
$club = $factory->loadById($this->id);
|
||||
|
||||
$offers = $club->getOffers();
|
||||
$first = true;
|
||||
|
||||
foreach($offers as $o)
|
||||
{
|
||||
if(!$first)
|
||||
$ret .= '<br />';
|
||||
|
||||
$checked = $o['valid'] ? ' checked' : '';
|
||||
$ret .= "<input type='checkbox' name='offers[]' value='{$o['offer']->getId()}'$checked>";
|
||||
$ret .= htmlentities($o['offer']->getName());
|
||||
|
||||
$first = false;
|
||||
}
|
||||
|
||||
return $ret;
|
||||
|
||||
}
|
||||
|
||||
protected function getViewContent()
|
||||
{
|
||||
$ret = '';
|
||||
|
||||
$factory = new CommonClubsModelFactoryClub();
|
||||
$club = $factory->loadById($this->id);
|
||||
|
||||
$offers = $club->getOffers();
|
||||
$hasOffers = false;
|
||||
$first = true;
|
||||
|
||||
foreach($offers as $o)
|
||||
{
|
||||
if($o['valid'])
|
||||
{
|
||||
$iconCls = 'ok';
|
||||
$hasOffers = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$iconCls = 'cancel-2';
|
||||
}
|
||||
|
||||
if(!$first)
|
||||
$ret .= '<br />';
|
||||
$first = false;
|
||||
|
||||
$ret .= "<span class='icon-$iconCls'></span> ";
|
||||
if($o['valid'])
|
||||
$ret .= '<b>';
|
||||
$ret .= htmlentities($o['offer']->getName());
|
||||
if($o['valid'])
|
||||
$ret .= '</b>';
|
||||
}
|
||||
|
||||
if(!$hasOffers)
|
||||
{
|
||||
// Reset to info string
|
||||
$ret = '<i>Der Verein hat keine Angebote festgelegt.</i>';
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
73
src/site/parts/club/place.php
Normal file
73
src/site/parts/club/place.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
// No direct access.
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
class ClubsPartClubPlace extends ClubsHelperParts
|
||||
{
|
||||
|
||||
protected function getPartName()
|
||||
{
|
||||
return 'club.place';
|
||||
}
|
||||
|
||||
protected function getEditContent()
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
protected function getEditMarkup()
|
||||
{
|
||||
$factory = new CommonClubsModelFactoryPlace();
|
||||
$place = $factory->loadById($this->id, false);
|
||||
if($place === null)
|
||||
$place = $factory->createNew();
|
||||
|
||||
$content = ob_get_contents();
|
||||
ob_clean();
|
||||
|
||||
try
|
||||
{
|
||||
?>
|
||||
<div>Name:</div>
|
||||
<div><input type="text" name='name' value='<?php echo htmlentities($place->getName()); ?>'></div>
|
||||
<div>Adresse:</div>
|
||||
<div><textarea rows="4" name='address'><?php echo htmlentities($place->getAddress()); ?></textarea></div>
|
||||
<div>Fläche:</div>
|
||||
<div><input type='text' name='area' value='<?php echo $place->getArea(); ?>'> qm</div>
|
||||
<?php
|
||||
}
|
||||
finally
|
||||
{
|
||||
$ret = ob_get_contents();
|
||||
ob_clean();
|
||||
echo $content;
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
protected function getViewContent()
|
||||
{
|
||||
$factory = new CommonClubsModelFactoryPlace();
|
||||
$place = $factory->loadById($this->id);
|
||||
|
||||
$ret = '<b>';
|
||||
$ret .= htmlentities($place->getName());
|
||||
$ret .= '</b><br />';
|
||||
|
||||
$ret .= '<div class="clubs-address"><i>';
|
||||
$ret .= nl2br(htmlentities($place->getAddress()));
|
||||
$ret .= '</i></div>';
|
||||
|
||||
$area = $place->getArea();
|
||||
if($area !== null)
|
||||
{
|
||||
$ret .= '<br />Fläche: ';
|
||||
$ret .= htmlentities($area);
|
||||
$ret .= ' qm';
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
31
src/site/parts/user/address.php
Normal file
31
src/site/parts/user/address.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
// No direct access.
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
class ClubsPartUserAddress extends ClubsHelperPartTextarea
|
||||
{
|
||||
protected function getPartName()
|
||||
{
|
||||
return 'user.address';
|
||||
}
|
||||
|
||||
protected function getEditContent()
|
||||
{
|
||||
$auth = new ClubsHelperAuth();
|
||||
$user = $auth->getCurrentUser();
|
||||
|
||||
return htmlentities($user->getAddress());
|
||||
}
|
||||
|
||||
protected function getViewContent()
|
||||
{
|
||||
return nl2br(parent::getViewContent());
|
||||
}
|
||||
|
||||
protected function additionalParams()
|
||||
{
|
||||
return 'rows="4"';
|
||||
}
|
||||
|
||||
}
|
||||
21
src/site/parts/user/city.php
Normal file
21
src/site/parts/user/city.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
// No direct access.
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
class ClubsPartUserCity extends ClubsHelperPartTextfield
|
||||
{
|
||||
protected function getPartName()
|
||||
{
|
||||
return 'user.city';
|
||||
}
|
||||
|
||||
protected function getEditContent()
|
||||
{
|
||||
$auth = new ClubsHelperAuth();
|
||||
$user = $auth->getCurrentUser();
|
||||
|
||||
return htmlentities($user->getCity());
|
||||
}
|
||||
|
||||
}
|
||||
21
src/site/parts/user/mail.php
Normal file
21
src/site/parts/user/mail.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
// No direct access.
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
class ClubsPartUserMail extends ClubsHelperPartTextfield
|
||||
{
|
||||
protected function getPartName()
|
||||
{
|
||||
return 'user.mail';
|
||||
}
|
||||
|
||||
protected function getEditContent()
|
||||
{
|
||||
$auth = new ClubsHelperAuth();
|
||||
$user = $auth->getCurrentUser();
|
||||
|
||||
return htmlentities($user->getMail());
|
||||
}
|
||||
|
||||
}
|
||||
21
src/site/parts/user/mobile.php
Normal file
21
src/site/parts/user/mobile.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
// No direct access.
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
class ClubsPartUserMobile extends ClubsHelperPartTextfield
|
||||
{
|
||||
protected function getPartName()
|
||||
{
|
||||
return 'user.mobile';
|
||||
}
|
||||
|
||||
protected function getEditContent()
|
||||
{
|
||||
$auth = new ClubsHelperAuth();
|
||||
$user = $auth->getCurrentUser();
|
||||
|
||||
return htmlentities($user->getMobile());
|
||||
}
|
||||
|
||||
}
|
||||
21
src/site/parts/user/name.php
Normal file
21
src/site/parts/user/name.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
// No direct access.
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
class ClubsPartUserName extends ClubsHelperPartTextfield
|
||||
{
|
||||
protected function getPartName()
|
||||
{
|
||||
return 'user.name';
|
||||
}
|
||||
|
||||
protected function getEditContent()
|
||||
{
|
||||
$auth = new ClubsHelperAuth();
|
||||
$user = $auth->getCurrentUser();
|
||||
|
||||
return htmlentities($user->getName());
|
||||
}
|
||||
|
||||
}
|
||||
21
src/site/parts/user/phone.php
Normal file
21
src/site/parts/user/phone.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
// No direct access.
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
class ClubsPartUserPhone extends ClubsHelperPartTextfield
|
||||
{
|
||||
protected function getPartName()
|
||||
{
|
||||
return 'user.phone';
|
||||
}
|
||||
|
||||
protected function getEditContent()
|
||||
{
|
||||
$auth = new ClubsHelperAuth();
|
||||
$user = $auth->getCurrentUser();
|
||||
|
||||
return htmlentities($user->getPhone());
|
||||
}
|
||||
|
||||
}
|
||||
21
src/site/parts/user/username.php
Normal file
21
src/site/parts/user/username.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
// No direct access.
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
class ClubsPartUserUsername extends ClubsHelperPartTextfield
|
||||
{
|
||||
protected function getPartName()
|
||||
{
|
||||
return 'user.username';
|
||||
}
|
||||
|
||||
protected function getEditContent()
|
||||
{
|
||||
$auth = new ClubsHelperAuth();
|
||||
$user = $auth->getCurrentUser();
|
||||
|
||||
return htmlentities($user->getUsername());
|
||||
}
|
||||
|
||||
}
|
||||
34
src/site/route.php
Normal file
34
src/site/route.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Joomla\CMS\Component\Router\RouterInterface;
|
||||
|
||||
// No direct access.
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
class ClubsRouter implements RouterInterface
|
||||
{
|
||||
public function build(&$query)
|
||||
{
|
||||
$ret = array();
|
||||
// $ret[] = $query['Itemid'];
|
||||
if(isset($query['view']))
|
||||
{
|
||||
$ret[] = $query['view'];
|
||||
unset($query['view']);
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function parse(&$segments)
|
||||
{
|
||||
$ret = array();
|
||||
//$ret['itemid'] = $segments[0];
|
||||
$ret['view'] = $segments[0];
|
||||
return $ret;
|
||||
}
|
||||
public function preprocess($query)
|
||||
{
|
||||
return $query;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,98 +1,156 @@
|
||||
<?php
|
||||
|
||||
use Joomla\CMS\Router\Route;
|
||||
|
||||
// No direct access.
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
$clubid = $this->club->getId();
|
||||
|
||||
?>
|
||||
|
||||
<h1><?php echo $this->clubname; ?></h1>
|
||||
<h1><span class='clubs_content_row'><?php
|
||||
// echo htmlentities($this->club->getName());
|
||||
$partHandler = new ClubsPartClubName($clubid);
|
||||
echo $partHandler->getViewPart();
|
||||
?></span></h1>
|
||||
|
||||
<div class='clubs_row'>
|
||||
<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
|
||||
$partHandler = new ClubsPartClubAddress($clubid);
|
||||
echo $partHandler->getViewPart();
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='clubs_row'>
|
||||
<div class='clubs_title_row'>Internet</div>
|
||||
<div class='clubs_content_row'><?php echo htmlentities($this->internet); ?></div>
|
||||
<div class='clubs_title_row'>Stadt</div>
|
||||
<div class='clubs_content_row'>
|
||||
<?php
|
||||
$partHandler = new ClubsPartClubCity($clubid);
|
||||
echo $partHandler->getViewPart();
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='clubs_row'>
|
||||
<div class='clubs_title_row'>Kontaktperson</div>
|
||||
<div class='clubs_content_row'><?php echo htmlentities($this->contactperson); ?></div>
|
||||
<div class='clubs_title_row'>Homepage</div>
|
||||
<div class='clubs_content_row'>
|
||||
<?php
|
||||
$partHandler = new ClubsPartClubHomepage($clubid);
|
||||
echo $partHandler->getViewPart();
|
||||
?><!-- <a href='<?php echo htmlentities($this->club->getHomepage()); ?>' target='_blank'><?php echo htmlentities($this->club->getHomepage()); ?></a>-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='clubs_row'>
|
||||
<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'>
|
||||
<?php
|
||||
$partHandler = new ClubsPartClubMail($clubid);
|
||||
echo $partHandler->getViewPart();
|
||||
?>
|
||||
<!--
|
||||
<a href='mailto:<?php echo htmlentities($this->club->getMail()); ?>'><?php echo htmlentities($this->club->getMail()); ?></a>
|
||||
-->
|
||||
</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 class='clubs_title_row'>IBAN / BIC</div>
|
||||
<div class='clubs_content_row' style='display: flex;'>
|
||||
<div style='flex: 1 0 0;'>
|
||||
<?php
|
||||
$partHandler = new ClubsPartClubIban($clubid);
|
||||
echo $partHandler->getViewPart();
|
||||
// echo htmlentities($this->club->getIban());
|
||||
?>
|
||||
</div>
|
||||
<span style='margin: 0px 0.75em'>/</span>
|
||||
<div style='flex: 1 0 0;'>
|
||||
<?php
|
||||
$partHandler = new ClubsPartClubBic($clubid);
|
||||
echo $partHandler->getViewPart();
|
||||
// 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_title_row'>Angebote</div>
|
||||
<div class='clubs_content_row'>
|
||||
<?php if($this->hasOptions):
|
||||
|
||||
// Put all options there
|
||||
foreach($this->options as $k=>$v):
|
||||
?>
|
||||
<input type="checkbox" disabled="disabled" <?php if(isset($v)) echo 'checked="checked"'; ?>> <?php echo htmlentities($k); ?><br />
|
||||
<?php
|
||||
endforeach;
|
||||
|
||||
else:
|
||||
|
||||
// No options specified in the database
|
||||
?>Der Verein hat keine Angebote festgelegt.<?php
|
||||
endif; ?>
|
||||
$partHandler = new ClubsPartClubOffers($clubid);
|
||||
echo $partHandler->getViewPart();
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if(count($this->trainingPlaces) > 0): ?>
|
||||
<div class='clubs_row'>
|
||||
<div class='clubs_title_row'>Räumlichkeiten</div>
|
||||
<?php foreach($this->trainingPlaces as $p): ?>
|
||||
<div class='clubs_content_row'>
|
||||
<?php echo htmlentities($p['name']); ?><br />
|
||||
<?php echo htmlentities($p['street']); ?><br />
|
||||
<?php echo htmlentities($p['plz'] . " " . $p['city']); ?>
|
||||
<?php
|
||||
foreach($this->club->getPlaces() as $p)
|
||||
{
|
||||
$partHandler = new ClubsPartClubPlace($p->getId());
|
||||
echo "<div class='clubs_content_row clubs_place'>";
|
||||
echo $partHandler->getViewPart();
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
<div class='message-empty <?php echo count($this->club->getPlaces()) == 0 ? '' : 'clubs-hidden'; ?>'>Der Verein hat keine Angebote festgelegt.</div>
|
||||
<div class='clubs_content_row'><a id='clubs_add_place' href='<?php echo ""; ?>'><span class='icon-new'></span> Neue Assoziation anlegen</a></div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?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_title_row'>Assoziierte Personen</div>
|
||||
<div class='clubs_content_row'>
|
||||
<ul>
|
||||
<?php foreach($this->persons as $p): ?>
|
||||
<?php foreach($this->club->getUsers() as $uassoc): ?>
|
||||
<li>
|
||||
<a href='?option=com_clubs&view=user&id=<?php echo $p['id']; ?>'><?php echo htmlentities($p['name']); ?></a>:
|
||||
<?php echo htmlentities($p['position']); ?>
|
||||
<?php if ($p['modify']) echo ' (Club-Admin)'; ?>
|
||||
<?php if($this->canModify): ?>
|
||||
<a href='?option=com_clubs&view=clubassoc&assoc=<?php echo $p['assoc']; ?>'>Ändern</a>
|
||||
<a href='?option=com_clubs&task=club.delassoc&assoc=<?php echo $p['assoc']; ?>'>Löschen</a>
|
||||
<?php endif; ?>
|
||||
<a href='?option=com_clubs&view=user&id=<?php echo $uassoc->getUser()->getId(); ?>'>
|
||||
<?php echo htmlentities($uassoc->getUser()->getName()); ?>
|
||||
</a>:
|
||||
<?php echo htmlentities($uassoc->getPosition()->getName()); ?>
|
||||
<?php if ($uassoc->isAdmin()) echo ' (Club-Admin)'; ?>
|
||||
<!--<?php //if($this->canModify): ?>
|
||||
<a href='?option=com_clubs&view=clubassoc&assoc=<?php //echo $p['assoc']; ?>'>Ändern</a>
|
||||
<a href='?option=com_clubs&task=club.delassoc&assoc=<?php //echo $p['assoc']; ?>'>Löschen</a>-->
|
||||
<?php //endif; ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php if($this->canModify): ?>
|
||||
<a href='<?php echo $this->urlNewPerson; ?>'>Neue Assoziation anlegen</a>
|
||||
<?php endif; ?>
|
||||
<?php //if($this->canModify): ?>
|
||||
<a href='<?php echo ""; ?>'><span class='icon-new'></span> Neue Assoziation anlegen</a>
|
||||
<?php //endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?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,7 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Joomla\CMS\MVC\View\HtmlView;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\MVC\View\HtmlView;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
|
||||
// No direct access.
|
||||
@@ -12,46 +13,21 @@ class ClubsViewClub extends HtmlView
|
||||
|
||||
public function display($tpl = null)
|
||||
{
|
||||
// FIXME Insert code from DB
|
||||
$this->clubid = 43;
|
||||
$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";
|
||||
$input = Factory::getApplication()->input;
|
||||
$id = $input->getInt('clubid', -1);
|
||||
|
||||
$this->options = array("Step" => NULL, "JMD" => 1, "Divers." => NULL);
|
||||
$this->hasOptions = false;
|
||||
foreach($this->options as $o)
|
||||
if(isset($o))
|
||||
$clubFactory = new CommonClubsModelFactoryClub();
|
||||
$this->club = $clubFactory->loadById($id);
|
||||
|
||||
$this->hasOffers = false;
|
||||
foreach($this->club->getOffers() as $o)
|
||||
if($o['valid'])
|
||||
{
|
||||
$this->hasOptions = true;
|
||||
$this->hasOffers = true;
|
||||
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");
|
||||
HTMLHelper::_('jquery.framework');
|
||||
Factory::getDocument()->addScript(Uri::base(true) . "components/com_clubs/js/edit.js");
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
@@ -8,3 +8,22 @@ defined('_JEXEC') or die;
|
||||
<pre>
|
||||
Ort Verein Adresse Ansprechpartner Email
|
||||
</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
|
||||
{
|
||||
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$clubFactory = new CommonClubsModelFactoryClub();
|
||||
$this->clubs = $clubFactory->loadElements();
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
}
|
||||
|
||||
6
src/site/views/login/tmpl/default.xml
Normal file
6
src/site/views/login/tmpl/default.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<metadata>
|
||||
<layout title="Login">
|
||||
<message>Seite, um sich öffentlich einzuloggen in den Bereich des Portals</message>
|
||||
</layout>
|
||||
</metadata>
|
||||
6
src/site/views/login/tmpl/logout.xml
Normal file
6
src/site/views/login/tmpl/logout.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<metadata>
|
||||
<layout title="Logout">
|
||||
<message>Seite, um sich aus dem Portal auszuloggen</message>
|
||||
</layout>
|
||||
</metadata>
|
||||
@@ -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>
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Joomla\CMS\MVC\View\HtmlView;
|
||||
|
||||
// No direct access.
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
class ClubsViewMyClubs extends HtmlView
|
||||
{
|
||||
|
||||
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;
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
}
|
||||
101
src/site/views/mypage/tmpl/default.php
Normal file
101
src/site/views/mypage/tmpl/default.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
use Joomla\CMS\Router\Route;
|
||||
|
||||
// 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
|
||||
$partHandler = new ClubsPartUserName();
|
||||
echo $partHandler->getViewPart();
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='clubs_row'>
|
||||
<div class='clubs_title_row'>Benutzer-Alias</div>
|
||||
<div class='clubs_content_row'>
|
||||
<?php
|
||||
$partHandler = new ClubsPartUserUsername();
|
||||
echo $partHandler->getViewPart();
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='clubs_row'>
|
||||
<div class='clubs_title_row'>Adresse</div>
|
||||
<div class='clubs_content_row address-field'>
|
||||
<?php
|
||||
$partHandler = new ClubsPartUserAddress();
|
||||
echo $partHandler->getViewPart();
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='clubs_row'>
|
||||
<div class='clubs_title_row'>Stadt</div>
|
||||
<div class='clubs_content_row'>
|
||||
<?php
|
||||
$partHandler = new ClubsPartUserCity();
|
||||
echo $partHandler->getViewPart();
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='clubs_row'>
|
||||
<div class='clubs_title_row'>E-Mail-Adresse</div>
|
||||
<div class='clubs_content_row'>
|
||||
<?php
|
||||
$partHandler = new ClubsPartUserMail();
|
||||
echo $partHandler->getViewPart();
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='clubs_row'>
|
||||
<div class='clubs_title_row'>Telefon-Nr.</div>
|
||||
<div class='clubs_content_row'>
|
||||
<?php
|
||||
$partHandler = new ClubsPartUserPhone();
|
||||
echo $partHandler->getViewPart();
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='clubs_row'>
|
||||
<div class='clubs_title_row'>Handy-Nr.</div>
|
||||
<div class='clubs_content_row'>
|
||||
<?php
|
||||
$partHandler = new ClubsPartUserMobile();
|
||||
echo $partHandler->getViewPart();
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<h3>Meine Vereine</h3>
|
||||
|
||||
<ul>
|
||||
|
||||
<?php
|
||||
foreach ($this->clubsPresident as $pc):
|
||||
$link = Route::_("index.php?view=club&clubid={$pc->getId()}");
|
||||
?>
|
||||
<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>
|
||||
6
src/site/views/mypage/tmpl/default.xml
Normal file
6
src/site/views/mypage/tmpl/default.xml
Normal 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>
|
||||
26
src/site/views/mypage/view.html.php
Normal file
26
src/site/views/mypage/view.html.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?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;
|
||||
|
||||
class ClubsViewMyPage extends HtmlView
|
||||
{
|
||||
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$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);
|
||||
}
|
||||
}
|
||||
114
src/site/views/part/view.html.php
Normal file
114
src/site/views/part/view.html.php
Normal file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\MVC\View\HtmlView;
|
||||
|
||||
// No direct access.
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
class ClubsViewPart extends HtmlView
|
||||
{
|
||||
|
||||
public function display($tpl = null)
|
||||
{
|
||||
// TODO ACLs prüfen?
|
||||
|
||||
$app = Factory::getApplication();
|
||||
$input = $app->input;
|
||||
|
||||
$mode = $input->get->getCmd('mode', 'view');
|
||||
$type = $input->get->getCmd('type');
|
||||
|
||||
$id = (int) $input->get->getInt('id', -1);
|
||||
if($id == -1)
|
||||
$id = null;
|
||||
|
||||
$parthandler = $this->getPart($type, $id);
|
||||
|
||||
if($mode === 'view')
|
||||
$this->view($parthandler);
|
||||
else
|
||||
$this->edit($parthandler);
|
||||
|
||||
jexit();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ClubsHelperParts $parthandler
|
||||
*/
|
||||
private function view($parthandler)
|
||||
{
|
||||
echo $parthandler->getViewPart();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ClubsHelperParts $parthandler
|
||||
*/
|
||||
private function edit($parthandler)
|
||||
{
|
||||
echo $parthandler->getEditPart();
|
||||
}
|
||||
|
||||
private function getPart($type, $id)
|
||||
{
|
||||
if(! preg_match('/.*\..*/', $type))
|
||||
throw new Exception();
|
||||
|
||||
list($obj, $fcn) = explode('.', $type, 2);
|
||||
switch($obj)
|
||||
{
|
||||
case 'user':
|
||||
switch($fcn)
|
||||
{
|
||||
case 'name':
|
||||
return new ClubsPartUserName();
|
||||
case 'username':
|
||||
return new ClubsPartUserUsername();
|
||||
case 'address':
|
||||
return new ClubsPartUserAddress();
|
||||
case 'city':
|
||||
return new ClubsPartUserCity();
|
||||
case 'mail':
|
||||
return new ClubsPartUserMail();
|
||||
case 'phone':
|
||||
return new ClubsPartUserPhone();
|
||||
case 'mobile':
|
||||
return new ClubsPartUserMobile();
|
||||
|
||||
default:
|
||||
throw new Exception('Internal Error');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'club':
|
||||
switch($fcn)
|
||||
{
|
||||
case 'name':
|
||||
return new ClubsPartClubName($id);
|
||||
case 'address':
|
||||
return new ClubsPartClubAddress($id);
|
||||
case 'city':
|
||||
return new ClubsPartClubCity($id);
|
||||
case 'homepage':
|
||||
return new ClubsPartClubHomepage($id);
|
||||
case 'mail':
|
||||
return new ClubsPartClubMail($id);
|
||||
case 'iban':
|
||||
return new ClubsPartClubIban($id);
|
||||
case 'bic':
|
||||
return new ClubsPartClubBic($id);
|
||||
case 'offers':
|
||||
return new ClubsPartClubOffers($id);
|
||||
case 'place':
|
||||
return new ClubsPartClubPlace($id);
|
||||
|
||||
default:
|
||||
throw new Exception('Internal Error');
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Exception("Internal Error");
|
||||
}
|
||||
}
|
||||
}
|
||||
6
src/site/views/userpwd/tmpl/default.xml
Normal file
6
src/site/views/userpwd/tmpl/default.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<metadata>
|
||||
<layout title="Passwort ändern">
|
||||
<message>Erlaubt den eingeloggten Benutzern das eigene Passwort anzupassen</message>
|
||||
</layout>
|
||||
</metadata>
|
||||
Reference in New Issue
Block a user