Compare commits
22 Commits
dev/self-b
...
dev/api-de
| Author | SHA1 | Date | |
|---|---|---|---|
| e22d3972a7 | |||
| 4cfd461036 | |||
| 3c7354b8a6 | |||
| 6eee6a4fe6 | |||
| 5e82187518 | |||
| e112b8ee6c | |||
| 2bdf581ba1 | |||
| b61df340e8 | |||
| 2da8da6b37 | |||
| af506435ac | |||
| 45d3e09c7e | |||
| 3f96022176 | |||
| 7dae1d826e | |||
| 9dbe6112dd | |||
| 55b44d9b6f | |||
| e89aac01a3 | |||
| 5743219a1c | |||
| 4f33fb8a8d | |||
| 0048f63990 | |||
| 20c5c9d147 | |||
| 7f019dd740 | |||
| a30e5d76a1 |
4
api/api Fragen zum Design.md
Normal file
4
api/api Fragen zum Design.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
# Offene Fragen zum Design
|
||||||
|
|
||||||
|
- Sollen mehrere gleiche Vorstaende auf einer Position zulaessig sein (mehrere stellv. Jugenwarte)?
|
||||||
1301
api/openapi.yaml
Normal file
1301
api/openapi.yaml
Normal file
File diff suppressed because it is too large
Load Diff
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
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
|
||||||
// No direct access.
|
// No direct access.
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
@@ -16,46 +18,91 @@ class CommonClubsModelClub extends AbstractCommonClubsModel
|
|||||||
return $this->getValues()['name'];
|
return $this->getValues()['name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setName($name)
|
||||||
|
{
|
||||||
|
$this->setValue('name', $name);
|
||||||
|
}
|
||||||
|
|
||||||
public function getAddress()
|
public function getAddress()
|
||||||
{
|
{
|
||||||
return $this->getValues()['address'];
|
return $this->getValues()['address'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setAddress($address)
|
||||||
|
{
|
||||||
|
$this->setValue('address', $address);
|
||||||
|
}
|
||||||
|
|
||||||
public function getCity()
|
public function getCity()
|
||||||
{
|
{
|
||||||
return $this->getValues()['city'];
|
return $this->getValues()['city'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setCity($city)
|
||||||
|
{
|
||||||
|
$this->setValue('city', $city);
|
||||||
|
}
|
||||||
|
|
||||||
public function getHomepage()
|
public function getHomepage()
|
||||||
{
|
{
|
||||||
return $this->getValues()['homepage'];
|
return $this->getValues()['homepage'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setHomepage($homepage)
|
||||||
|
{
|
||||||
|
$this->setValue('homepage', $homepage);
|
||||||
|
}
|
||||||
|
|
||||||
public function getMail()
|
public function getMail()
|
||||||
{
|
{
|
||||||
return $this->getValues()['mail'];
|
return $this->getValues()['mail'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setMail($mail)
|
||||||
|
{
|
||||||
|
$this->setValue('mail', $mail);
|
||||||
|
}
|
||||||
|
|
||||||
public function getIban()
|
public function getIban()
|
||||||
{
|
{
|
||||||
return $this->getValues()['iban'];
|
return $this->getValues()['iban'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setIban($iban)
|
||||||
|
{
|
||||||
|
$this->setValue('iban', $iban);
|
||||||
|
}
|
||||||
|
|
||||||
public function getBic()
|
public function getBic()
|
||||||
{
|
{
|
||||||
return $this->getValues()['bic'];
|
return $this->getValues()['bic'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setBic($bic)
|
||||||
|
{
|
||||||
|
$this->setValue('bic', $bic);
|
||||||
|
}
|
||||||
|
|
||||||
public function isCharitable()
|
public function isCharitable()
|
||||||
{
|
{
|
||||||
return $this->getValues()['charitable'];
|
return $this->getValues()['charitable'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setCharitable($charitable)
|
||||||
|
{
|
||||||
|
$this->setValue('charitable', $charitable);
|
||||||
|
}
|
||||||
|
|
||||||
public function getPresident()
|
public function getPresident()
|
||||||
{
|
{
|
||||||
return $this->getValues()['president'];
|
return $this->getValues()['president'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setPresident($user)
|
||||||
|
{
|
||||||
|
$this->setValue('president', $user);
|
||||||
|
}
|
||||||
|
|
||||||
public function getPlaces()
|
public function getPlaces()
|
||||||
{
|
{
|
||||||
return $this->fetchAssociatedElements(new CommonClubsModelFactoryPlace(), 'clubid');
|
return $this->fetchAssociatedElements(new CommonClubsModelFactoryPlace(), 'clubid');
|
||||||
@@ -117,22 +164,35 @@ class CommonClubsModelClub extends AbstractCommonClubsModel
|
|||||||
$offerAssocFactory = new CommonClubsModelFactoryOfferassoc();
|
$offerAssocFactory = new CommonClubsModelFactoryOfferassoc();
|
||||||
$offerFactory = new CommonClubsModelFactoryOffer();
|
$offerFactory = new CommonClubsModelFactoryOffer();
|
||||||
|
|
||||||
foreach($delIds as $id)
|
$db = Factory::getDbo();
|
||||||
|
$db->transactionStart(true);
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
$delId = (int) $id;
|
foreach($delIds as $id)
|
||||||
$delObjs = $offerAssocFactory->loadElements("clubid = {$this->getId()} AND offerid = $delId");
|
{
|
||||||
foreach($delObjs as $o)
|
$delId = (int) $id;
|
||||||
$o->delete();
|
$delObjs = $offerAssocFactory->loadElements("clubid = {$this->getId()} AND offerid = $delId");
|
||||||
|
foreach($delObjs as $o)
|
||||||
|
$o->delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($newIds as $id)
|
||||||
|
{
|
||||||
|
$newId = (int) $id;
|
||||||
|
$o = $offerAssocFactory->createNew();
|
||||||
|
$o->setOffer($offerFactory->loadById($newId));
|
||||||
|
$o->setClub($this);
|
||||||
|
$o->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception $ex)
|
||||||
|
{
|
||||||
|
$db->transactionRollback(true);
|
||||||
|
throw $ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($newIds as $id)
|
$db->transactionCommit(true);
|
||||||
{
|
|
||||||
$newId = (int) $id;
|
|
||||||
$o = $offerAssocFactory->createNew();
|
|
||||||
$o->setOffer($offerFactory->loadById($newId));
|
|
||||||
$o->setClub($this);
|
|
||||||
$o->save();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUsers()
|
public function getUsers()
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ class CommonClubsModelFactoryPlace extends AbstractCommonClubsModelFactory
|
|||||||
return array(
|
return array(
|
||||||
new CommonClubsModelColumnString('name', new CommonClubsControllerMappingString('Bezeichnung')),
|
new CommonClubsModelColumnString('name', new CommonClubsControllerMappingString('Bezeichnung')),
|
||||||
new CommonClubsModelColumnRef('club', 'CommonClubsModelClub', 'clubid', new CommonClubsControllerMappingRef('Club', new CommonClubsModelFactoryClub())),
|
new CommonClubsModelColumnRef('club', 'CommonClubsModelClub', 'clubid', new CommonClubsControllerMappingRef('Club', new CommonClubsModelFactoryClub())),
|
||||||
|
new CommonClubsModelColumnString('address', new CommonClubsControllerMappingString('Adresse')),
|
||||||
new CommonClubsModelColumnInt('area', new CommonClubsControllerMappingInt('Fläche', false))
|
new CommonClubsModelColumnInt('area', new CommonClubsControllerMappingInt('Fläche', false))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,11 @@ class CommonClubsModelPlace extends AbstractCommonClubsModel
|
|||||||
return $this->getValues()['area'];
|
return $this->getValues()['area'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getAddress()
|
||||||
|
{
|
||||||
|
return $this->getValues()['address'];
|
||||||
|
}
|
||||||
|
|
||||||
public function setName($name)
|
public function setName($name)
|
||||||
{
|
{
|
||||||
$this->setValue('name', $name);
|
$this->setValue('name', $name);
|
||||||
@@ -40,4 +45,9 @@ class CommonClubsModelPlace extends AbstractCommonClubsModel
|
|||||||
$this->setValue('club', $club);
|
$this->setValue('club', $club);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setAddress($address)
|
||||||
|
{
|
||||||
|
$this->setValue('address', $address);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -35,6 +35,7 @@
|
|||||||
<folder>js</folder>
|
<folder>js</folder>
|
||||||
<folder>models</folder>
|
<folder>models</folder>
|
||||||
<folder>views</folder>
|
<folder>views</folder>
|
||||||
|
<folder>parts</folder>
|
||||||
</files>
|
</files>
|
||||||
|
|
||||||
<!--Sollte, Sollten unterschiedliche Sprachen genutzt werden, ist hier der richtige Platz um diese zu installieren-->
|
<!--Sollte, Sollten unterschiedliche Sprachen genutzt werden, ist hier der richtige Platz um diese zu installieren-->
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ defined('_JEXEC') or die;
|
|||||||
|
|
||||||
JLoader::discover('Clubs', JPATH_ROOT . '/administrator/components/com_clubs/mymodels');
|
JLoader::discover('Clubs', JPATH_ROOT . '/administrator/components/com_clubs/mymodels');
|
||||||
|
|
||||||
JLoader::register("ClubsHelperAuth", JPATH_ROOT . "/components/com_clubs/helpers/auth.php");
|
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('AbstractClubs', JPATH_ROOT . '/administrator/components/com_clubs/abstract');
|
||||||
|
|
||||||
|
|||||||
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;
|
padding-left: 2em;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
h1 > .clubs_content_row
|
||||||
|
{
|
||||||
|
padding-left: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
.clubs_title_row
|
.clubs_title_row
|
||||||
{
|
{
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
@@ -29,3 +35,40 @@ table.clubs > tbody > tr > th
|
|||||||
{
|
{
|
||||||
display: none !important;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,17 @@ class ClubsHelperAuth
|
|||||||
return true;
|
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)
|
public function checkUser($user, $pwd)
|
||||||
{
|
{
|
||||||
$userModel = BaseDatabaseModel::getInstance("user", "ClubsModel");
|
$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());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -5,39 +5,88 @@ use Joomla\CMS\Router\Route;
|
|||||||
// No direct access.
|
// No direct access.
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
$clubid = $this->club->getId();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<h1><?php echo htmlentities($this->club->getName()); ?></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_row'>
|
||||||
<div class='clubs_title_row'>Adresse</div>
|
<div class='clubs_title_row'>Adresse</div>
|
||||||
<div class='clubs_content_row'><?php echo nl2br(htmlentities($this->club->getAddress())); ?></div>
|
<div class='clubs_content_row'>
|
||||||
|
<?php
|
||||||
|
$partHandler = new ClubsPartClubAddress($clubid);
|
||||||
|
echo $partHandler->getViewPart();
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class='clubs_row'>
|
<div class='clubs_row'>
|
||||||
<div class='clubs_title_row'>Stadt</div>
|
<div class='clubs_title_row'>Stadt</div>
|
||||||
<div class='clubs_content_row'><?php echo htmlentities($this->club->getCity()); ?></div>
|
<div class='clubs_content_row'>
|
||||||
|
<?php
|
||||||
|
$partHandler = new ClubsPartClubCity($clubid);
|
||||||
|
echo $partHandler->getViewPart();
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class='clubs_row'>
|
<div class='clubs_row'>
|
||||||
<div class='clubs_title_row'>Homepage</div>
|
<div class='clubs_title_row'>Homepage</div>
|
||||||
<div class='clubs_content_row'><a href='<?php echo htmlentities($this->club->getHomepage()); ?>' target='_blank'><?php echo htmlentities($this->club->getHomepage()); ?></a></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>
|
||||||
|
|
||||||
<div class='clubs_row'>
|
<div class='clubs_row'>
|
||||||
<div class='clubs_title_row'>Mail-Adresse</div>
|
<div class='clubs_title_row'>Mail-Adresse</div>
|
||||||
<div class='clubs_content_row'><a href='mailto:<?php echo htmlentities($this->club->getMail()); ?>'><?php echo htmlentities($this->club->getMail()); ?></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>
|
||||||
|
|
||||||
<div class='clubs_row'>
|
<div class='clubs_row'>
|
||||||
<div class='clubs_title_row'>IBAN / BIC</div>
|
<div class='clubs_title_row'>IBAN / BIC</div>
|
||||||
<div class='clubs_content_row'><?php echo htmlentities($this->club->getIban()); ?> / <?php echo htmlentities($this->club->getBic()); ?></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>
|
||||||
|
|
||||||
|
<!--
|
||||||
<div class='clubs_row'>
|
<div class='clubs_row'>
|
||||||
<div class='clubs_title_row'>Gemeinnützigkeit</div>
|
<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 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>
|
||||||
|
-->
|
||||||
|
|
||||||
<!--<div class='clubs_row'>
|
<!--<div class='clubs_row'>
|
||||||
<div class='clubs_title_row'>Telefon</div>
|
<div class='clubs_title_row'>Telefon</div>
|
||||||
@@ -47,40 +96,27 @@ defined('_JEXEC') or die;
|
|||||||
<div class='clubs_row'>
|
<div class='clubs_row'>
|
||||||
<div class='clubs_title_row'>Angebote</div>
|
<div class='clubs_title_row'>Angebote</div>
|
||||||
<div class='clubs_content_row'>
|
<div class='clubs_content_row'>
|
||||||
<?php if($this->hasOffers):
|
<?php
|
||||||
|
$partHandler = new ClubsPartClubOffers($clubid);
|
||||||
// Put all options there
|
echo $partHandler->getViewPart();
|
||||||
foreach($this->club->getOffers() as $o):
|
?>
|
||||||
?>
|
|
||||||
<span class='icon-<?php echo $o['valid'] ? 'ok' : 'cancel-2'; ?>'></span>
|
|
||||||
<?php if($o['valid']) echo '<b>'; ?>
|
|
||||||
<?php echo htmlentities($o['offer']->getName()); ?><br />
|
|
||||||
<?php if($o['valid']) echo '</b>'; ?>
|
|
||||||
<?php
|
|
||||||
endforeach;
|
|
||||||
|
|
||||||
else:
|
|
||||||
|
|
||||||
// No options specified in the database
|
|
||||||
?>Der Verein hat keine Angebote festgelegt.<?php
|
|
||||||
endif; ?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if(count($this->club->getPlaces()) > 0): ?>
|
|
||||||
<div class='clubs_row'>
|
<div class='clubs_row'>
|
||||||
<div class='clubs_title_row'>Räumlichkeiten</div>
|
<div class='clubs_title_row'>Räumlichkeiten</div>
|
||||||
<?php foreach($this->club->getPlaces() as $p): ?>
|
<?php
|
||||||
<div class='clubs_content_row'>
|
foreach($this->club->getPlaces() as $p)
|
||||||
<b><?php echo htmlentities($p->getName()); ?></b><br />
|
{
|
||||||
<i>Adresse</i>
|
$partHandler = new ClubsPartClubPlace($p->getId());
|
||||||
<?php //echo nl2br(htmlentities($p->getAddress())); ?>
|
echo "<div class='clubs_content_row clubs_place'>";
|
||||||
<?php echo $p->getArea() === null ? '' : '<br />Fläche: ' . htmlentities($p->getArea()) . 'qm'; ?>
|
echo $partHandler->getViewPart();
|
||||||
</div>
|
echo '</div>';
|
||||||
<?php endforeach; ?>
|
}
|
||||||
<div class='clubs_content_row'><a href='<?php echo ""; ?>'><span class='icon-new'></span> Neue Assoziation anlegen</a></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>
|
</div>
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<div class='clubs_row'>
|
<div class='clubs_row'>
|
||||||
<div class='clubs_title_row'>Präsident</div>
|
<div class='clubs_title_row'>Präsident</div>
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Joomla\CMS\Factory;
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\HTML\HTMLHelper;
|
||||||
use Joomla\CMS\MVC\View\HtmlView;
|
use Joomla\CMS\MVC\View\HtmlView;
|
||||||
|
use Joomla\CMS\Uri\Uri;
|
||||||
|
|
||||||
// No direct access.
|
// No direct access.
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
@@ -24,6 +26,9 @@ class ClubsViewClub extends HtmlView
|
|||||||
$this->hasOffers = true;
|
$this->hasOffers = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
HTMLHelper::_('jquery.framework');
|
||||||
|
Factory::getDocument()->addScript(Uri::base(true) . "components/com_clubs/js/edit.js");
|
||||||
|
|
||||||
parent::display($tpl);
|
parent::display($tpl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,37 +12,72 @@ defined('_JEXEC') or die;
|
|||||||
|
|
||||||
<div class='clubs_row'>
|
<div class='clubs_row'>
|
||||||
<div class='clubs_title_row'>Name</div>
|
<div class='clubs_title_row'>Name</div>
|
||||||
<div class='clubs_content_row'><?php echo htmlentities($this->me->getName()); ?></div>
|
<div class='clubs_content_row'>
|
||||||
|
<?php
|
||||||
|
$partHandler = new ClubsPartUserName();
|
||||||
|
echo $partHandler->getViewPart();
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class='clubs_row'>
|
<div class='clubs_row'>
|
||||||
<div class='clubs_title_row'>Benutzer-Alias</div>
|
<div class='clubs_title_row'>Benutzer-Alias</div>
|
||||||
<div class='clubs_content_row'><?php echo htmlentities($this->me->getUsername()); ?></div>
|
<div class='clubs_content_row'>
|
||||||
|
<?php
|
||||||
|
$partHandler = new ClubsPartUserUsername();
|
||||||
|
echo $partHandler->getViewPart();
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class='clubs_row'>
|
<div class='clubs_row'>
|
||||||
<div class='clubs_title_row'>Adresse</div>
|
<div class='clubs_title_row'>Adresse</div>
|
||||||
<div class='clubs_content_row'><?php echo nl2br(htmlentities($this->me->getAddress())); ?></div>
|
<div class='clubs_content_row address-field'>
|
||||||
|
<?php
|
||||||
|
$partHandler = new ClubsPartUserAddress();
|
||||||
|
echo $partHandler->getViewPart();
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class='clubs_row'>
|
<div class='clubs_row'>
|
||||||
<div class='clubs_title_row'>Stadt</div>
|
<div class='clubs_title_row'>Stadt</div>
|
||||||
<div class='clubs_content_row'><?php echo htmlentities($this->me->getCity()); ?></div>
|
<div class='clubs_content_row'>
|
||||||
|
<?php
|
||||||
|
$partHandler = new ClubsPartUserCity();
|
||||||
|
echo $partHandler->getViewPart();
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class='clubs_row'>
|
<div class='clubs_row'>
|
||||||
<div class='clubs_title_row'>E-Mail-Adresse</div>
|
<div class='clubs_title_row'>E-Mail-Adresse</div>
|
||||||
<div class='clubs_content_row'><?php echo htmlentities($this->me->getMail()); ?></div>
|
<div class='clubs_content_row'>
|
||||||
|
<?php
|
||||||
|
$partHandler = new ClubsPartUserMail();
|
||||||
|
echo $partHandler->getViewPart();
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class='clubs_row'>
|
<div class='clubs_row'>
|
||||||
<div class='clubs_title_row'>Telefon-Nr.</div>
|
<div class='clubs_title_row'>Telefon-Nr.</div>
|
||||||
<div class='clubs_content_row'><?php echo $this->me->getPhone() !== null ? htmlentities($this->me->getPhone()) : '<i>nicht angegeben</i>'; ?></div>
|
<div class='clubs_content_row'>
|
||||||
|
<?php
|
||||||
|
$partHandler = new ClubsPartUserPhone();
|
||||||
|
echo $partHandler->getViewPart();
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class='clubs_row'>
|
<div class='clubs_row'>
|
||||||
<div class='clubs_title_row'>Handy-Nr.</div>
|
<div class='clubs_title_row'>Handy-Nr.</div>
|
||||||
<div class='clubs_content_row'><?php echo $this->me->getMobile() !== null ? htmlentities($this->me->getMobile()) : '<i>nicht angegeben</i>'; ?></div>
|
<div class='clubs_content_row'>
|
||||||
|
<?php
|
||||||
|
$partHandler = new ClubsPartUserMobile();
|
||||||
|
echo $partHandler->getViewPart();
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
use Joomla\CMS\MVC\View\HtmlView;
|
use Joomla\CMS\MVC\View\HtmlView;
|
||||||
|
use Joomla\CMS\Uri\Uri;
|
||||||
|
use Joomla\CMS\HTML\HTMLHelper;
|
||||||
|
|
||||||
// No direct access.
|
// No direct access.
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
@@ -10,13 +13,14 @@ class ClubsViewMyPage extends HtmlView
|
|||||||
|
|
||||||
public function display($tpl = null)
|
public function display($tpl = null)
|
||||||
{
|
{
|
||||||
$userFactory = new CommonClubsModelFactoryUser();
|
$auth = new ClubsHelperAuth();
|
||||||
$users = $userFactory->loadElements();
|
$this->me = $auth->getCurrentUser();
|
||||||
$this->me = $users[0];
|
|
||||||
|
|
||||||
$this->clubsPresident = $this->me->getPresidentClubs();
|
$this->clubsPresident = $this->me->getPresidentClubs();
|
||||||
$this->positions = $this->me->getPositions();
|
$this->positions = $this->me->getPositions();
|
||||||
|
|
||||||
|
HTMLHelper::_('jquery.framework');
|
||||||
|
Factory::getDocument()->addScript(Uri::base(true) . "components/com_clubs/js/edit.js");
|
||||||
parent::display($tpl);
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user