diff --git a/composer.json b/composer.json index 4823ea7..610ec33 100755 --- a/composer.json +++ b/composer.json @@ -36,7 +36,8 @@ "enko/ics": "~0.1", "doctrine/migrations": "dev-master", "doctrine/doctrine-migrations-bundle": "dev-master", - "jbroadway/urlify" : "~1.0" + "jbroadway/urlify" : "~1.0", + "enko/relativedateparser" : "v0.2" }, "require-dev": { "sensio/generator-bundle": "~2.3" diff --git a/composer.lock b/composer.lock index d3cb91e..0638791 100755 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "77745a3287830b815f677d20df33b385", + "hash": "ce7476174febffa01f09dfba2d9e3bb5", "packages": [ { "name": "doctrine/annotations", @@ -81,16 +81,16 @@ }, { "name": "doctrine/cache", - "version": "v1.3.0", + "version": "v1.3.1", "source": { "type": "git", "url": "https://github.com/doctrine/cache.git", - "reference": "e16d7adf45664a50fa86f515b6d5e7f670130449" + "reference": "cf483685798a72c93bf4206e3dd6358ea07d64e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/e16d7adf45664a50fa86f515b6d5e7f670130449", - "reference": "e16d7adf45664a50fa86f515b6d5e7f670130449", + "url": "https://api.github.com/repos/doctrine/cache/zipball/cf483685798a72c93bf4206e3dd6358ea07d64e7", + "reference": "cf483685798a72c93bf4206e3dd6358ea07d64e7", "shasum": "" }, "require": { @@ -106,7 +106,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.4.x-dev" } }, "autoload": { @@ -119,17 +119,6 @@ "MIT" ], "authors": [ - { - "name": "Jonathan H. Wage", - "email": "jonwage@gmail.com", - "homepage": "http://www.jwage.com/", - "role": "Creator" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com", - "homepage": "http://www.instaclick.com" - }, { "name": "Roman Borschel", "email": "roman@code-factory.org" @@ -138,11 +127,17 @@ "name": "Benjamin Eberlei", "email": "kontakt@beberlei.de" }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, { "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com", - "homepage": "http://jmsyst.com", - "role": "Developer of wrapped JMSSerializerBundle" + "email": "schmittjoh@gmail.com" } ], "description": "Caching library offering an object-oriented API for many cache backends", @@ -151,7 +146,7 @@ "cache", "caching" ], - "time": "2013-10-25 19:04:14" + "time": "2014-09-17 14:24:04" }, { "name": "doctrine/collections", @@ -798,6 +793,42 @@ ], "time": "2014-07-30 23:43:46" }, + { + "name": "enko/relativedateparser", + "version": "v0.2", + "source": { + "type": "git", + "url": "https://github.com/HackspaceJena/RelativeDateParser.git", + "reference": "0f1e587c652eac6c109c05637da9e6b5328c8564" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/HackspaceJena/RelativeDateParser/zipball/0f1e587c652eac6c109c05637da9e6b5328c8564", + "reference": "0f1e587c652eac6c109c05637da9e6b5328c8564", + "shasum": "" + }, + "require": { + "symfony/config": "~2.5", + "symfony/translation": "~2.5" + }, + "type": "library", + "autoload": { + "psr-0": { + "": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Tim Schumacher", + "email": "tim@bandenkrieg.hacked.jp" + } + ], + "time": "2014-09-21 17:06:28" + }, { "name": "incenteev/composer-parameter-handler", "version": "v2.1.0", @@ -1308,22 +1339,22 @@ }, { "name": "sensio/framework-extra-bundle", - "version": "v3.0.1", + "version": "v3.0.2", "target-dir": "Sensio/Bundle/FrameworkExtraBundle", "source": { "type": "git", "url": "https://github.com/sensiolabs/SensioFrameworkExtraBundle.git", - "reference": "dbc1e5aa830f3bf8063b29102add3c1e476d616e" + "reference": "9b22aaee517e80aad3238ea0328458b6f964066f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sensiolabs/SensioFrameworkExtraBundle/zipball/dbc1e5aa830f3bf8063b29102add3c1e476d616e", - "reference": "dbc1e5aa830f3bf8063b29102add3c1e476d616e", + "url": "https://api.github.com/repos/sensiolabs/SensioFrameworkExtraBundle/zipball/9b22aaee517e80aad3238ea0328458b6f964066f", + "reference": "9b22aaee517e80aad3238ea0328458b6f964066f", "shasum": "" }, "require": { "doctrine/common": "~2.2", - "symfony/framework-bundle": "~2.5" + "symfony/framework-bundle": "~2.3" }, "require-dev": { "symfony/expression-language": "~2.4", @@ -1351,9 +1382,7 @@ "authors": [ { "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" + "email": "fabien@symfony.com" } ], "description": "This bundle provides a way to configure your controllers with annotations", @@ -1361,7 +1390,7 @@ "annotations", "controllers" ], - "time": "2014-05-22 23:27:44" + "time": "2014-09-02 07:11:30" }, { "name": "sensiolabs/security-checker", @@ -1410,16 +1439,16 @@ }, { "name": "swiftmailer/swiftmailer", - "version": "v5.2.1", + "version": "v5.2.2", "source": { "type": "git", "url": "https://github.com/swiftmailer/swiftmailer.git", - "reference": "2b9af56cc676c338d52fca4c657e5bdff73bb7af" + "reference": "e02f71a35436af4bd58a1bd90116089e632e29e1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/2b9af56cc676c338d52fca4c657e5bdff73bb7af", - "reference": "2b9af56cc676c338d52fca4c657e5bdff73bb7af", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/e02f71a35436af4bd58a1bd90116089e632e29e1", + "reference": "e02f71a35436af4bd58a1bd90116089e632e29e1", "shasum": "" }, "require": { @@ -1445,13 +1474,11 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" + "name": "Chris Corbyn" }, { - "name": "Chris Corbyn" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" } ], "description": "Swiftmailer, free feature-rich PHP mailer", @@ -1460,7 +1487,7 @@ "mail", "mailer" ], - "time": "2014-06-13 11:44:54" + "time": "2014-09-20 07:17:36" }, { "name": "symfony/assetic-bundle", @@ -1692,16 +1719,16 @@ }, { "name": "symfony/symfony", - "version": "v2.5.3", + "version": "v2.5.4", "source": { "type": "git", "url": "https://github.com/symfony/symfony.git", - "reference": "f077a238c781f845487a7c81fea8033ccd0e6a02" + "reference": "3a369dddea56596df91977d8c2083e70784852f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/symfony/zipball/f077a238c781f845487a7c81fea8033ccd0e6a02", - "reference": "f077a238c781f845487a7c81fea8033ccd0e6a02", + "url": "https://api.github.com/repos/symfony/symfony/zipball/3a369dddea56596df91977d8c2083e70784852f2", + "reference": "3a369dddea56596df91977d8c2083e70784852f2", "shasum": "" }, "require": { @@ -1759,7 +1786,7 @@ "doctrine/data-fixtures": "1.0.*", "doctrine/dbal": "~2.2", "doctrine/orm": "~2.2,>=2.2.3", - "egulias/email-validator": "1.1.0", + "egulias/email-validator": "~1.2", "ircmaxell/password-compat": "1.0.*", "monolog/monolog": "~1.3", "ocramius/proxy-manager": ">=0.3.1,<0.6-dev", @@ -1802,7 +1829,7 @@ "keywords": [ "framework" ], - "time": "2014-08-06 07:03:01" + "time": "2014-09-03 09:51:48" }, { "name": "twig/extensions", diff --git a/src/Hackspace/Bundle/CalciferBundle/Command/GenerateEventsCommand.php b/src/Hackspace/Bundle/CalciferBundle/Command/GenerateEventsCommand.php index f697a78..d16fda5 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Command/GenerateEventsCommand.php +++ b/src/Hackspace/Bundle/CalciferBundle/Command/GenerateEventsCommand.php @@ -17,6 +17,8 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Validator\Constraints\DateTime; +use enko\RelativeDateParser\RelativeDateParser; class GenerateEventsCommand extends ContainerAwareCommand { @@ -44,18 +46,19 @@ class GenerateEventsCommand extends ContainerAwareCommand $entities = $repo->findAll(); foreach($entities as $entity) { /** @var RepeatingEvent $entity */ - $period = new \DatePeriod($entity->nextdate,new \DateInterval($entity->repeating_pattern),$end); + $next_date = is_null($entity->nextdate) ? new DateTime() : $entity->nextdate; + $parser = new RelativeDateParser($entity->repeating_pattern,$next_date,'de'); $event = null; - foreach($period as $date) { - /** @var \DateTime $date */ - $output->writeln(sprintf("Creating Event %s for %s",$entity->summary,$date->format('Y-m-d H:i'))); + while (($next_date = $parser->getNext()) < $end) { + /** @var \DateTime $next_date */ + $output->writeln(sprintf("Creating Event %s for %s",$entity->summary,$next_date->format('Y-m-d H:i'))); $event = new Event(); $event->location = $entity->location; - $event->startdate = $date; + $event->startdate = $next_date; if ($entity->duration > 0) { $duration = new \DateInterval("PT".$entity->duration.'H'); /** @var \DateTime $enddate */ - $enddate = clone $date; + $enddate = clone $next_date; $enddate->add($duration); $entity->enddate = $enddate; } @@ -72,10 +75,10 @@ class GenerateEventsCommand extends ContainerAwareCommand } $entityManager->persist($event); $entityManager->flush(); + $parser->setNow($next_date); } if (!is_null($event)) { $entity->nextdate = $event->startdate; - $entity->nextdate->add(new \DateInterval($entity->repeating_pattern)); $entityManager->persist($entity); $entityManager->flush(); } diff --git a/src/Hackspace/Bundle/CalciferBundle/Controller/RepeatingEventController.php b/src/Hackspace/Bundle/CalciferBundle/Controller/RepeatingEventController.php index 91f5b65..24f03d5 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Controller/RepeatingEventController.php +++ b/src/Hackspace/Bundle/CalciferBundle/Controller/RepeatingEventController.php @@ -295,4 +295,15 @@ class RepeatingEventController extends Controller ); } + + /** + * Deletes a Event entity. + * + * @Route("/wiederholungsmuster", name="repeating_patterns") + * @Method({"GET", "POST"}) + * @Template("CalciferBundle:RepeatingEvent:repeating_patterns.html.twig") + */ + public function repeatingPatternsHelpAction(Request $request) { + return null; + } } diff --git a/src/Hackspace/Bundle/CalciferBundle/Entity/RepeatingEvent.php b/src/Hackspace/Bundle/CalciferBundle/Entity/RepeatingEvent.php index d7a6bcd..a9ff31c 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Entity/RepeatingEvent.php +++ b/src/Hackspace/Bundle/CalciferBundle/Entity/RepeatingEvent.php @@ -84,17 +84,4 @@ class RepeatingEvent extends BaseEntity * ) */ protected $tags = []; - - public function getFormatedRepeatPattern() { - switch($this->repeating_pattern) { - case 'P7D': - return 'Wöchentlich'; - case 'P14D': - return 'Alle 2 Wochen'; - case 'P1M': - return 'Monatlich'; - default: - return $this->repeating_pattern; - } - } } \ No newline at end of file diff --git a/src/Hackspace/Bundle/CalciferBundle/Resources/views/RepeatingEvent/index.html.twig b/src/Hackspace/Bundle/CalciferBundle/Resources/views/RepeatingEvent/index.html.twig index 0d6a943..12664f7 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Resources/views/RepeatingEvent/index.html.twig +++ b/src/Hackspace/Bundle/CalciferBundle/Resources/views/RepeatingEvent/index.html.twig @@ -44,7 +44,7 @@ {{ entity.nextdate.format('Y-m-d H:i') }}
Es gibt 2 verschiedene Wiederholungsmustertypen. Feste Termine oder Interval Termine.
+Der erste definiert sich dadurch das der Termin immer an einem bestimmten Tag im Monat passieren soll. Das Hackspace-Plenum findet z.B. am Zweiten Freitag des Monats
statt. Die Sicherheitssprechstunde findet immer am Ersten Dienstag des Monats
statt. Anhand dieser Beispiele sollte eigentlich klar sein wie dieses Wiederholungsmuster funktioniert:
An erster stelle definiert man die Woche: Erster, Zweiter, Dritter, Letzter (In manchen Fällen kann Dritter und Letzter auch identisch sein).
+An zweiter stelle definiert man den Wochentag: Montag, Dienstag, Mitwoch usw.
+An letzter Stelle steht noch pro Forma „des Monats“
+Der zweite Wiederholungstyp ist für regelmäßige Termine wie z.B. die Elektrorunde gedacht, die Alle 7 Tage
. Für die Brettspielerei würde man Alle 2 Wochen
schreiben.