From fedf87f751becf673eabeba269902c5d9c45a01c Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Fri, 11 Jul 2014 20:27:57 +0200 Subject: [PATCH 01/19] Fix the icalendar route for locations --- .../Bundle/CalciferBundle/Controller/LocationController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Hackspace/Bundle/CalciferBundle/Controller/LocationController.php b/src/Hackspace/Bundle/CalciferBundle/Controller/LocationController.php index 32efe75..3151254 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Controller/LocationController.php +++ b/src/Hackspace/Bundle/CalciferBundle/Controller/LocationController.php @@ -79,7 +79,7 @@ class LocationController extends Controller /** * Finds and displays a Event entity. * - * @Route("/{slug}\.ics", name="location_show_ics") + * @Route("/{slug}.ics", name="location_show_ics") * @Method("GET") */ public function showActionICS($slug) From f2bc90c9aea59a1e1574b7045145ffb40a2635c2 Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Sun, 31 Aug 2014 14:26:05 +0200 Subject: [PATCH 02/19] Hide the underline on some of the icons. --- .../Bundle/CalciferBundle/Resources/assets/css/events.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Hackspace/Bundle/CalciferBundle/Resources/assets/css/events.scss b/src/Hackspace/Bundle/CalciferBundle/Resources/assets/css/events.scss index 867884c..0dff5a8 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Resources/assets/css/events.scss +++ b/src/Hackspace/Bundle/CalciferBundle/Resources/assets/css/events.scss @@ -13,6 +13,10 @@ margin-bottom: 0.5rem; } + a i.icon { + text-decoration: none; + } + ul.tags { padding-left: 0; margin: 0; From 405b19b15785e3d8f2ef4a036ee3ecd4a27e2756 Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Wed, 17 Sep 2014 17:06:35 +0200 Subject: [PATCH 03/19] Only show the edit details on the detail page. --- .../CalciferBundle/Resources/views/Event/event_box.html.twig | 2 ++ .../Bundle/CalciferBundle/Resources/views/Event/show.html.twig | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/event_box.html.twig b/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/event_box.html.twig index 84f135a..fbf734a 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/event_box.html.twig +++ b/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/event_box.html.twig @@ -4,10 +4,12 @@ href="{{ path('_show', { 'slug': entity.slug }) }}">{{ entity.summary }} + {% if (detail|default(false)) %}

Bearbeiten

+ {% endif %}

- {{ include('CalciferBundle:Event:event_box.html.twig',{'entity' : entity}) }} + {{ include('CalciferBundle:Event:event_box.html.twig',{'entity' : entity,'detail' : true}) }} {% endblock %} From e8c94262d0dd738aba5198f7e3db721cd3aebd87 Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Wed, 17 Sep 2014 17:37:54 +0200 Subject: [PATCH 04/19] Implemented deletion of events. Fixes #16 --- .../Controller/EventController.php | 37 +++++++++++++++++++ .../Resources/assets/css/events.scss | 2 +- .../Resources/views/Event/delete.html.twig | 29 +++++++++++++++ .../Resources/views/Event/event_box.html.twig | 7 ++++ 4 files changed, 74 insertions(+), 1 deletion(-) create mode 100755 src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/delete.html.twig diff --git a/src/Hackspace/Bundle/CalciferBundle/Controller/EventController.php b/src/Hackspace/Bundle/CalciferBundle/Controller/EventController.php index d23aab5..3c83ff1 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Controller/EventController.php +++ b/src/Hackspace/Bundle/CalciferBundle/Controller/EventController.php @@ -268,4 +268,41 @@ class EventController extends Controller } return $em; } + + /** + * Deletes a Event entity. + * + * @Route("/termine/{slug}/löschen", name="_delete") + * @Method({"GET", "POST"}) + * @Template("CalciferBundle:Event:delete.html.twig") + */ + public function deleteAction(Request $request, $slug) { + /** @var EntityManager $em */ + $em = $this->getDoctrine()->getManager(); + + /** @var EntityRepository $repo */ + $repo = $em->getRepository('CalciferBundle:Event'); + + /** @var Event $entity */ + $entity = $repo->findOneBy(['slug' => $slug]); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find Event entity.'); + } + + + $confirmation = $request->get('confirmation',false); + + if (($request->getMethod() == 'POST') && ($confirmation)) { + $em->remove($entity); + $em->flush(); + + return $this->redirect('/'); + } + + return array( + 'entity' => $entity, + + ); + } } diff --git a/src/Hackspace/Bundle/CalciferBundle/Resources/assets/css/events.scss b/src/Hackspace/Bundle/CalciferBundle/Resources/assets/css/events.scss index 0dff5a8..b109b51 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Resources/assets/css/events.scss +++ b/src/Hackspace/Bundle/CalciferBundle/Resources/assets/css/events.scss @@ -6,7 +6,7 @@ } } - .startdate,.location,.url,.edit { + .startdate,.location,.url,.edit,.delete { display: inline; margin: 0; margin-right: 0.5rem; diff --git a/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/delete.html.twig b/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/delete.html.twig new file mode 100755 index 0000000..66a4061 --- /dev/null +++ b/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/delete.html.twig @@ -0,0 +1,29 @@ +{% extends 'CalciferBundle::layout.html.twig' %} + +{% block css %} + {% stylesheets filter="compass" + "@CalciferBundle/Resources/assets/css/events.scss" %} + + {% endstylesheets %} +{% endblock %} + +{% block javascripts %} + {% javascripts + "@CalciferBundle/Resources/assets/js/events.js" %} + + {% endjavascripts %} +{% endblock %} + +{% block body -%} +

+
+
+
+

Möchtest du die Veranstaltung „{{ entity.summary }}“ zum Datum „{{ entity.startdate.format('Y-m-d H:i') }}“ wirklich löschen?

+ + Nein +
+
+
+
+{% endblock %} \ No newline at end of file diff --git a/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/event_box.html.twig b/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/event_box.html.twig index fbf734a..a74377a 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/event_box.html.twig +++ b/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/event_box.html.twig @@ -9,6 +9,13 @@ Bearbeiten

+ +

+ + + Löschen + +

{% endif %}

From 9562a8d3a3c5a970be5b5236a4ec7eb6e5184902 Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Wed, 17 Sep 2014 17:50:24 +0200 Subject: [PATCH 05/19] Implement copying of events. Fixes #17 --- .../Controller/EventController.php | 29 +++++++++++++++++++ .../Resources/assets/css/events.scss | 2 +- .../Resources/views/Event/edit.html.twig | 6 ++-- .../Resources/views/Event/event_box.html.twig | 11 +++++-- 4 files changed, 41 insertions(+), 7 deletions(-) diff --git a/src/Hackspace/Bundle/CalciferBundle/Controller/EventController.php b/src/Hackspace/Bundle/CalciferBundle/Controller/EventController.php index 3c83ff1..3397192 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Controller/EventController.php +++ b/src/Hackspace/Bundle/CalciferBundle/Controller/EventController.php @@ -305,4 +305,33 @@ class EventController extends Controller ); } + + /** + * Copies a Event entity. + * + * @Route("/termine/{slug}/kopieren", name="_copy") + * @Method("GET") + * @Template("CalciferBundle:Event:new.html.twig") + */ + public function copyAction(Request $request, $slug) { + /** @var EntityManager $em */ + $em = $this->getDoctrine()->getManager(); + + /** @var EntityRepository $repo */ + $repo = $em->getRepository('CalciferBundle:Event'); + + /** @var Event $entity */ + $entity = $repo->findOneBy(['slug' => $slug]); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find Event entity.'); + } + + $entity->id = null; + + return array( + 'entity' => $entity, + + ); + } } diff --git a/src/Hackspace/Bundle/CalciferBundle/Resources/assets/css/events.scss b/src/Hackspace/Bundle/CalciferBundle/Resources/assets/css/events.scss index b109b51..6b615cb 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Resources/assets/css/events.scss +++ b/src/Hackspace/Bundle/CalciferBundle/Resources/assets/css/events.scss @@ -6,7 +6,7 @@ } } - .startdate,.location,.url,.edit,.delete { + .startdate,.location,.url,.action { display: inline; margin: 0; margin-right: 0.5rem; diff --git a/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/edit.html.twig b/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/edit.html.twig index 07d2d67..a004f41 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/edit.html.twig +++ b/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/edit.html.twig @@ -4,8 +4,7 @@ {% stylesheets filter="compass" "@CalciferBundle/Resources/assets/css/jquery.datetimepicker.scss" "@CalciferBundle/Resources/assets/css/events.scss" - "@CalciferBundle/Resources/assets/css/leaflet.scss" - %} + "@CalciferBundle/Resources/assets/css/leaflet.scss" %} {% endstylesheets %} {% endblock %} @@ -14,8 +13,7 @@ {% javascripts "@CalciferBundle/Resources/assets/js/jquery.datetimepicker.js" "@CalciferBundle/Resources/assets/js/events.js" - "@CalciferBundle/Resources/assets/js/leaflet.js" - %} + "@CalciferBundle/Resources/assets/js/leaflet.js" %} {% endjavascripts %} {% endblock %} diff --git a/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/event_box.html.twig b/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/event_box.html.twig index a74377a..f451908 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/event_box.html.twig +++ b/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/event_box.html.twig @@ -5,17 +5,24 @@ {% if (detail|default(false)) %} -

+

Bearbeiten

-

+

Löschen

+ +

+ + + Kopieren + +

{% endif %}

From 9fb6285d6e89120d3341d4b955c3ef721e2949c4 Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Wed, 17 Sep 2014 17:59:00 +0200 Subject: [PATCH 06/19] Fix some whitespace issues. --- .../Resources/views/Event/event_box.html.twig | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/event_box.html.twig b/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/event_box.html.twig index f451908..4a9b99a 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/event_box.html.twig +++ b/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/event_box.html.twig @@ -11,17 +11,11 @@

- - - Löschen - + Löschen

- - - Kopieren - + Kopieren

{% endif %} From d21c818e8477b1c5b158ef52cb10178ad7770e78 Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Sun, 21 Sep 2014 17:49:49 +0200 Subject: [PATCH 07/19] Implemented delete for repeating events. --- .../Controller/RepeatingEventController.php | 36 +++++++++++++++++++ .../views/RepeatingEvent/delete.html.twig | 29 +++++++++++++++ .../views/RepeatingEvent/index.html.twig | 3 +- 3 files changed, 67 insertions(+), 1 deletion(-) create mode 100755 src/Hackspace/Bundle/CalciferBundle/Resources/views/RepeatingEvent/delete.html.twig diff --git a/src/Hackspace/Bundle/CalciferBundle/Controller/RepeatingEventController.php b/src/Hackspace/Bundle/CalciferBundle/Controller/RepeatingEventController.php index db41dca..91f5b65 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Controller/RepeatingEventController.php +++ b/src/Hackspace/Bundle/CalciferBundle/Controller/RepeatingEventController.php @@ -257,6 +257,42 @@ class RepeatingEventController extends Controller $em->flush(); return $entity; + } + /** + * Deletes a Event entity. + * + * @Route("/{slug}/löschen", name="repeating_event_delete") + * @Method({"GET", "POST"}) + * @Template("CalciferBundle:RepeatingEvent:delete.html.twig") + */ + public function deleteAction(Request $request, $slug) { + /** @var EntityManager $em */ + $em = $this->getDoctrine()->getManager(); + + /** @var EntityRepository $repo */ + $repo = $em->getRepository('CalciferBundle:RepeatingEvent'); + + /** @var Event $entity */ + $entity = $repo->findOneBy(['slug' => $slug]); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find Event entity.'); + } + + + $confirmation = $request->get('confirmation',false); + + if (($request->getMethod() == 'POST') && ($confirmation)) { + $em->remove($entity); + $em->flush(); + + return $this->redirect('/'); + } + + return array( + 'entity' => $entity, + + ); } } diff --git a/src/Hackspace/Bundle/CalciferBundle/Resources/views/RepeatingEvent/delete.html.twig b/src/Hackspace/Bundle/CalciferBundle/Resources/views/RepeatingEvent/delete.html.twig new file mode 100755 index 0000000..26d8f37 --- /dev/null +++ b/src/Hackspace/Bundle/CalciferBundle/Resources/views/RepeatingEvent/delete.html.twig @@ -0,0 +1,29 @@ +{% extends 'CalciferBundle::layout.html.twig' %} + +{% block css %} + {% stylesheets filter="compass" + "@CalciferBundle/Resources/assets/css/events.scss" %} + + {% endstylesheets %} +{% endblock %} + +{% block javascripts %} + {% javascripts + "@CalciferBundle/Resources/assets/js/events.js" %} + + {% endjavascripts %} +{% endblock %} + +{% block body -%} +
+
+
+
+

Möchtest du den wiederholenden Termin „{{ entity.summary }}“ wirklich löschen?

+ + Nein +
+
+
+
+{% endblock %} \ 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 ce108c5..0d6a943 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Resources/views/RepeatingEvent/index.html.twig +++ b/src/Hackspace/Bundle/CalciferBundle/Resources/views/RepeatingEvent/index.html.twig @@ -47,7 +47,8 @@ {{ entity.getFormatedRepeatPattern() }} - Bearbeiten + Bearbeiten | + Löschen {% endfor %} From 33b63429efb8c488980cac57b24ca562f23a45d3 Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Sun, 21 Sep 2014 20:01:56 +0200 Subject: [PATCH 08/19] Implement relative startdates *yay* Fixes #18 --- composer.json | 3 +- composer.lock | 119 +++++++++++------- .../Command/GenerateEventsCommand.php | 17 +-- .../Controller/RepeatingEventController.php | 11 ++ .../CalciferBundle/Entity/RepeatingEvent.php | 13 -- .../views/RepeatingEvent/index.html.twig | 2 +- .../repeating_event_form.html.twig | 28 ++--- .../repeating_patterns.html.twig | 37 ++++++ 8 files changed, 148 insertions(+), 82 deletions(-) create mode 100755 src/Hackspace/Bundle/CalciferBundle/Resources/views/RepeatingEvent/repeating_patterns.html.twig 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') }} - {{ entity.getFormatedRepeatPattern() }} + {{ entity.repeating_pattern }} Bearbeiten | diff --git a/src/Hackspace/Bundle/CalciferBundle/Resources/views/RepeatingEvent/repeating_event_form.html.twig b/src/Hackspace/Bundle/CalciferBundle/Resources/views/RepeatingEvent/repeating_event_form.html.twig index c3eb044..c532246 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Resources/views/RepeatingEvent/repeating_event_form.html.twig +++ b/src/Hackspace/Bundle/CalciferBundle/Resources/views/RepeatingEvent/repeating_event_form.html.twig @@ -38,23 +38,23 @@
- + -
-
From 78b20716cd1815cd7c098a6f177794321f08f12a Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Wed, 24 Sep 2014 23:28:38 +0200 Subject: [PATCH 15/19] Update the dependencies --- app/SymfonyRequirements.php | 58 ++++++++++++++-------------- composer.lock | 75 +++++++++++++++++-------------------- 2 files changed, 63 insertions(+), 70 deletions(-) diff --git a/app/SymfonyRequirements.php b/app/SymfonyRequirements.php index 25bc938..56bd35d 100644 --- a/app/SymfonyRequirements.php +++ b/app/SymfonyRequirements.php @@ -41,25 +41,25 @@ class Requirement /** * Constructor that initializes the requirement. * - * @param Boolean $fulfilled Whether the requirement is fulfilled + * @param bool $fulfilled Whether the requirement is fulfilled * @param string $testMessage The message for testing the requirement * @param string $helpHtml The help text formatted in HTML for resolving the problem * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) - * @param Boolean $optional Whether this is only an optional recommendation not a mandatory requirement + * @param bool $optional Whether this is only an optional recommendation not a mandatory requirement */ public function __construct($fulfilled, $testMessage, $helpHtml, $helpText = null, $optional = false) { - $this->fulfilled = (Boolean) $fulfilled; + $this->fulfilled = (bool) $fulfilled; $this->testMessage = (string) $testMessage; $this->helpHtml = (string) $helpHtml; $this->helpText = null === $helpText ? strip_tags($this->helpHtml) : (string) $helpText; - $this->optional = (Boolean) $optional; + $this->optional = (bool) $optional; } /** * Returns whether the requirement is fulfilled. * - * @return Boolean true if fulfilled, otherwise false + * @return bool true if fulfilled, otherwise false */ public function isFulfilled() { @@ -99,7 +99,7 @@ class Requirement /** * Returns whether this is only an optional recommendation and not a mandatory requirement. * - * @return Boolean true if optional, false if mandatory + * @return bool true if optional, false if mandatory */ public function isOptional() { @@ -117,16 +117,16 @@ class PhpIniRequirement extends Requirement /** * Constructor that initializes the requirement. * - * @param string $cfgName The configuration name used for ini_get() - * @param Boolean|callback $evaluation Either a Boolean indicating whether the configuration should evaluate to true or false, + * @param string $cfgName The configuration name used for ini_get() + * @param bool|callback $evaluation Either a boolean indicating whether the configuration should evaluate to true or false, or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement - * @param Boolean $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. + * @param bool $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin. Example: You require a config to be true but PHP later removes this config and defaults it to true internally. - * @param string|null $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived) - * @param string|null $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived) - * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) - * @param Boolean $optional Whether this is only an optional recommendation not a mandatory requirement + * @param string|null $testMessage The message for testing the requirement (when null and $evaluation is a boolean a default message is derived) + * @param string|null $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a boolean a default help is derived) + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + * @param bool $optional Whether this is only an optional recommendation not a mandatory requirement */ public function __construct($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null, $optional = false) { @@ -193,7 +193,7 @@ class RequirementCollection implements IteratorAggregate /** * Adds a mandatory requirement. * - * @param Boolean $fulfilled Whether the requirement is fulfilled + * @param bool $fulfilled Whether the requirement is fulfilled * @param string $testMessage The message for testing the requirement * @param string $helpHtml The help text formatted in HTML for resolving the problem * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) @@ -206,7 +206,7 @@ class RequirementCollection implements IteratorAggregate /** * Adds an optional recommendation. * - * @param Boolean $fulfilled Whether the recommendation is fulfilled + * @param bool $fulfilled Whether the recommendation is fulfilled * @param string $testMessage The message for testing the recommendation * @param string $helpHtml The help text formatted in HTML for resolving the problem * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) @@ -219,15 +219,15 @@ class RequirementCollection implements IteratorAggregate /** * Adds a mandatory requirement in form of a php.ini configuration. * - * @param string $cfgName The configuration name used for ini_get() - * @param Boolean|callback $evaluation Either a Boolean indicating whether the configuration should evaluate to true or false, + * @param string $cfgName The configuration name used for ini_get() + * @param bool|callback $evaluation Either a boolean indicating whether the configuration should evaluate to true or false, or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement - * @param Boolean $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. + * @param bool $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin. Example: You require a config to be true but PHP later removes this config and defaults it to true internally. - * @param string $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived) - * @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived) - * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + * @param string $testMessage The message for testing the requirement (when null and $evaluation is a boolean a default message is derived) + * @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a boolean a default help is derived) + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) */ public function addPhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null) { @@ -237,15 +237,15 @@ class RequirementCollection implements IteratorAggregate /** * Adds an optional recommendation in form of a php.ini configuration. * - * @param string $cfgName The configuration name used for ini_get() - * @param Boolean|callback $evaluation Either a Boolean indicating whether the configuration should evaluate to true or false, + * @param string $cfgName The configuration name used for ini_get() + * @param bool|callback $evaluation Either a boolean indicating whether the configuration should evaluate to true or false, or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement - * @param Boolean $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. + * @param bool $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin. Example: You require a config to be true but PHP later removes this config and defaults it to true internally. - * @param string $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived) - * @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived) - * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + * @param string $testMessage The message for testing the requirement (when null and $evaluation is a boolean a default message is derived) + * @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a boolean a default help is derived) + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) */ public function addPhpIniRecommendation($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null) { @@ -343,7 +343,7 @@ class RequirementCollection implements IteratorAggregate /** * Returns whether a php.ini configuration is not correct. * - * @return Boolean php.ini configuration problem? + * @return bool php.ini configuration problem? */ public function hasPhpIniConfigIssue() { @@ -405,7 +405,7 @@ class SymfonyRequirements extends RequirementCollection $this->addRequirement( is_dir(__DIR__.'/../vendor/composer'), 'Vendor libraries must be installed', - 'Vendor libraries are missing. Install composer following instructions from http://getcomposer.org/. ' . + 'Vendor libraries are missing. Install composer following instructions from http://getcomposer.org/. '. 'Then run "php composer.phar install" to install them.' ); diff --git a/composer.lock b/composer.lock index 0638791..f6c857b 100755 --- a/composer.lock +++ b/composer.lock @@ -66,7 +66,7 @@ { "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "http://jmsyst.com", + "homepage": "https://github.com/schmittjoh", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -203,7 +203,7 @@ { "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "http://jmsyst.com", + "homepage": "https://github.com/schmittjoh", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -279,7 +279,7 @@ { "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "http://jmsyst.com", + "homepage": "https://github.com/schmittjoh", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -541,7 +541,7 @@ { "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "http://jmsyst.com", + "homepage": "https://github.com/schmittjoh", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -595,7 +595,7 @@ { "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "http://jmsyst.com", + "homepage": "https://github.com/schmittjoh", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -667,16 +667,16 @@ }, { "name": "doctrine/orm", - "version": "v2.4.4", + "version": "v2.4.5", "source": { "type": "git", "url": "https://github.com/doctrine/doctrine2.git", - "reference": "fc19c3b53dcd00e6584db40669fdd699c4671f97" + "reference": "c0d3cdbdfbf873871167050ab077e49b1ad02ab0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/doctrine2/zipball/fc19c3b53dcd00e6584db40669fdd699c4671f97", - "reference": "fc19c3b53dcd00e6584db40669fdd699c4671f97", + "url": "https://api.github.com/repos/doctrine/doctrine2/zipball/c0d3cdbdfbf873871167050ab077e49b1ad02ab0", + "reference": "c0d3cdbdfbf873871167050ab077e49b1ad02ab0", "shasum": "" }, "require": { @@ -713,17 +713,6 @@ "MIT" ], "authors": [ - { - "name": "Jonathan 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" @@ -731,6 +720,14 @@ { "name": "Benjamin Eberlei", "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" } ], "description": "Object-Relational-Mapper for PHP", @@ -739,7 +736,7 @@ "database", "orm" ], - "time": "2014-07-11 03:05:53" + "time": "2014-09-22 21:58:51" }, { "name": "enko/ics", @@ -1286,17 +1283,17 @@ }, { "name": "sensio/distribution-bundle", - "version": "v3.0.5", + "version": "v3.0.6", "target-dir": "Sensio/Bundle/DistributionBundle", "source": { "type": "git", "url": "https://github.com/sensiolabs/SensioDistributionBundle.git", - "reference": "ad10123f2532f6e311e583cce203ef368eedc469" + "reference": "e20461e4f8e1afd68f36cf90bdccc06f7aa6a6c2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sensiolabs/SensioDistributionBundle/zipball/ad10123f2532f6e311e583cce203ef368eedc469", - "reference": "ad10123f2532f6e311e583cce203ef368eedc469", + "url": "https://api.github.com/repos/sensiolabs/SensioDistributionBundle/zipball/e20461e4f8e1afd68f36cf90bdccc06f7aa6a6c2", + "reference": "e20461e4f8e1afd68f36cf90bdccc06f7aa6a6c2", "shasum": "" }, "require": { @@ -1335,7 +1332,7 @@ "configuration", "distribution" ], - "time": "2014-08-26 13:14:47" + "time": "2014-09-24 14:47:46" }, { "name": "sensio/framework-extra-bundle", @@ -1554,22 +1551,20 @@ }, { "name": "symfony/icu", - "version": "v1.2.2", + "version": "v1.0.1", "target-dir": "Symfony/Component/Icu", "source": { "type": "git", "url": "https://github.com/symfony/Icu.git", - "reference": "d4d85d6055b87f394d941b45ddd3a9173e1e3d2a" + "reference": "fdba214b1e087c149843bde976263c53ac10c975" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Icu/zipball/d4d85d6055b87f394d941b45ddd3a9173e1e3d2a", - "reference": "d4d85d6055b87f394d941b45ddd3a9173e1e3d2a", + "url": "https://api.github.com/repos/symfony/Icu/zipball/fdba214b1e087c149843bde976263c53ac10c975", + "reference": "fdba214b1e087c149843bde976263c53ac10c975", "shasum": "" }, "require": { - "ext-intl": "*", - "lib-icu": ">=4.4", "php": ">=5.3.3", "symfony/intl": "~2.3" }, @@ -1599,7 +1594,7 @@ "icu", "intl" ], - "time": "2014-07-25 09:58:17" + "time": "2013-10-04 09:12:07" }, { "name": "symfony/monolog-bundle", @@ -1940,17 +1935,17 @@ "packages-dev": [ { "name": "sensio/generator-bundle", - "version": "v2.3.5", + "version": "v2.4.0", "target-dir": "Sensio/Bundle/GeneratorBundle", "source": { "type": "git", "url": "https://github.com/sensiolabs/SensioGeneratorBundle.git", - "reference": "8b7a33aa3d22388443b6de0b0cf184122e9f60d2" + "reference": "d5c0b996a46276d50943a80f95a46b59215a0e68" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sensiolabs/SensioGeneratorBundle/zipball/8b7a33aa3d22388443b6de0b0cf184122e9f60d2", - "reference": "8b7a33aa3d22388443b6de0b0cf184122e9f60d2", + "url": "https://api.github.com/repos/sensiolabs/SensioGeneratorBundle/zipball/d5c0b996a46276d50943a80f95a46b59215a0e68", + "reference": "d5c0b996a46276d50943a80f95a46b59215a0e68", "shasum": "" }, "require": { @@ -1980,13 +1975,11 @@ "authors": [ { "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" + "email": "fabien@symfony.com" } ], "description": "This bundle generates code for you", - "time": "2014-04-28 14:01:06" + "time": "2014-09-22 14:56:14" } ], "aliases": [], From 30474e80ce036b8514f44d6427e0f1d791a5f8cd Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Wed, 24 Sep 2014 23:38:36 +0200 Subject: [PATCH 16/19] Missed the description --- .../Bundle/CalciferBundle/Controller/LocationController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Hackspace/Bundle/CalciferBundle/Controller/LocationController.php b/src/Hackspace/Bundle/CalciferBundle/Controller/LocationController.php index bdf0945..fc07a8c 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Controller/LocationController.php +++ b/src/Hackspace/Bundle/CalciferBundle/Controller/LocationController.php @@ -174,6 +174,7 @@ class LocationController extends Controller $location->streetnumber = $request->get('streetnumber'); $location->zipcode = $request->get('zipcode'); $location->city = $request->get('city'); + $location->description = $request->get('description'); $latlon = $request->get('geocords'); $latlon = explode(',',$latlon); From 80182644bc13bd1af8064f3f12c370c1193946eb Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Thu, 25 Sep 2014 23:18:07 +0200 Subject: [PATCH 17/19] Only use the edit.html.twig template. --- .../Controller/EventController.php | 6 ++-- .../Resources/views/Event/new.html.twig | 34 ------------------- 2 files changed, 3 insertions(+), 37 deletions(-) delete mode 100755 src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/new.html.twig diff --git a/src/Hackspace/Bundle/CalciferBundle/Controller/EventController.php b/src/Hackspace/Bundle/CalciferBundle/Controller/EventController.php index 9792d4c..b999599 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Controller/EventController.php +++ b/src/Hackspace/Bundle/CalciferBundle/Controller/EventController.php @@ -54,7 +54,7 @@ class EventController extends Controller * * @Route("/termine/", name="_create") * @Method("POST") - * @Template("CalciferBundle:Event:new.html.twig") + * @Template("CalciferBundle:Event:edit.html.twig") */ public function createAction(Request $request) { @@ -81,7 +81,7 @@ class EventController extends Controller * * @Route("/termine/neu", name="_new") * @Method("GET") - * @Template() + * @Template("CalciferBundle:Event:edit.html.twig") */ public function newAction() { @@ -314,7 +314,7 @@ class EventController extends Controller * * @Route("/termine/{slug}/kopieren", name="_copy") * @Method("GET") - * @Template("CalciferBundle:Event:new.html.twig") + * @Template("CalciferBundle:Event:edit.html.twig") */ public function copyAction(Request $request, $slug) { /** @var EntityManager $em */ diff --git a/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/new.html.twig b/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/new.html.twig deleted file mode 100755 index a004f41..0000000 --- a/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/new.html.twig +++ /dev/null @@ -1,34 +0,0 @@ -{% extends 'CalciferBundle::layout.html.twig' %} - -{% block css %} - {% stylesheets filter="compass" - "@CalciferBundle/Resources/assets/css/jquery.datetimepicker.scss" - "@CalciferBundle/Resources/assets/css/events.scss" - "@CalciferBundle/Resources/assets/css/leaflet.scss" %} - - {% endstylesheets %} -{% endblock %} - -{% block javascripts %} - {% javascripts - "@CalciferBundle/Resources/assets/js/jquery.datetimepicker.js" - "@CalciferBundle/Resources/assets/js/events.js" - "@CalciferBundle/Resources/assets/js/leaflet.js" %} - - {% endjavascripts %} -{% endblock %} - -{% block body -%} -
-
-

Termin bearbeiten

-
-
- -
-
- {{ include('CalciferBundle:Event:event_form.html.twig',{'entity':entity}) }} -
-
- -{% endblock %} From 0a0fd1e8b034687e6e140490a9efc743b671f83a Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Thu, 25 Sep 2014 23:18:45 +0200 Subject: [PATCH 18/19] Add some basic validation. --- .../Controller/EventController.php | 17 +++++++++++------ .../Bundle/CalciferBundle/Entity/BaseEntity.php | 6 +++++- .../Bundle/CalciferBundle/Entity/Event.php | 14 +++++++++++++- .../Resources/views/Event/event_form.html.twig | 17 ++++++++++++++--- 4 files changed, 43 insertions(+), 11 deletions(-) diff --git a/src/Hackspace/Bundle/CalciferBundle/Controller/EventController.php b/src/Hackspace/Bundle/CalciferBundle/Controller/EventController.php index b999599..78bfb9e 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Controller/EventController.php +++ b/src/Hackspace/Bundle/CalciferBundle/Controller/EventController.php @@ -63,7 +63,8 @@ class EventController extends Controller $em = $this->saveEvent($request, $entity); - if ($entity->isValid()) { + $errors = $entity->isValid(); + if ($errors === true) { $em = $this->getDoctrine()->getManager(); $em->persist($entity); $em->flush(); @@ -73,6 +74,7 @@ class EventController extends Controller return array( 'entity' => $entity, + 'errors' => $errors, ); } @@ -171,7 +173,8 @@ class EventController extends Controller $em = $this->saveEvent($request, $entity); - if ($entity->isValid()) { + $errors = $entity->isValid(); + if ($errors === true) { $em = $this->getDoctrine()->getManager(); $em->persist($entity); $em->flush(); @@ -180,7 +183,8 @@ class EventController extends Controller } return array( - 'entity' => $entity, + 'entity' => $entity, + 'errors' => $errors, ); } @@ -199,8 +203,10 @@ class EventController extends Controller $entity->summary = $request->get('summary'); $entity->url = $request->get('url'); $startdate = $request->get('startdate'); - $startdate = new \DateTime($startdate); - $entity->startdate = $startdate; + if (strlen($startdate) > 0) { + $startdate = new \DateTime($startdate); + $entity->startdate = $startdate; + } $entity->slug = $entity->generateSlug($entity->summary,$em); $enddate = $request->get('enddate'); @@ -267,7 +273,6 @@ class EventController extends Controller $entity->addTag($tag_obj); } } - return $em; } return $em; } diff --git a/src/Hackspace/Bundle/CalciferBundle/Entity/BaseEntity.php b/src/Hackspace/Bundle/CalciferBundle/Entity/BaseEntity.php index a33a608..ba972ee 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Entity/BaseEntity.php +++ b/src/Hackspace/Bundle/CalciferBundle/Entity/BaseEntity.php @@ -56,7 +56,11 @@ abstract class BaseEntity { public function __set($name,$value) { if (property_exists($this,$name)) { - $this->$name = $value; + if ($value == '') { + $this->$name = null; + } else { + $this->$name = $value; + } return $this; } else { throw new \Exception("Property {$name} does not Exists"); diff --git a/src/Hackspace/Bundle/CalciferBundle/Entity/Event.php b/src/Hackspace/Bundle/CalciferBundle/Entity/Event.php index 8a3a791..68104d4 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Entity/Event.php +++ b/src/Hackspace/Bundle/CalciferBundle/Entity/Event.php @@ -3,6 +3,7 @@ namespace Hackspace\Bundle\CalciferBundle\Entity; use Doctrine\ORM\Mapping as ORM; +use Symfony\Component\Validator\Constraints\DateTime; /** * Event @@ -102,7 +103,18 @@ class Event extends BaseEntity } public function isValid() { - return true; + $errors = []; + if (!($this->startdate instanceof \DateTime)) { + $errors['startdate'] = 'Bitte gebe ein Startdatum ein.'; + } + if ((!is_null($this->startdate)) && (!is_null($this->enddate)) && ($this->enddate < $this->startdate)) { + $errors['enddate'] = 'Bitte setze ein Enddatum das nach dem Startdatum ist.'; + } + if (strlen($this->summary) == 0) { + $errors['summary'] = 'Bitte gebe eine Zusammenfassung an.'; + } + + return (count($errors) > 0) ? $errors : true; } public function getFormatedDate() { diff --git a/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/event_form.html.twig b/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/event_form.html.twig index d2f1e82..39ac995 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/event_form.html.twig +++ b/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/event_form.html.twig @@ -1,6 +1,6 @@
-
+
@@ -11,6 +11,9 @@ value="{{ entity.startdate.format('Y-m-d H:i')|default('') }}" placeholder="{{ "now"|date('Y-m-d H:i') }}" class="form-control"> + {% if(errors|default('0') != 0) %} {% if('startdate' in errors|keys) %} +
{{ errors.startdate }}
+ {% endif %}{% endif %} @@ -19,7 +22,7 @@
-
+
@@ -30,10 +33,14 @@ placeholder="{{ "now"|date('Y-m-d H:i') }}" class="form-control"> + {% if(errors|default('0') != 0) %} {% if('enddate' in errors|keys) %} +
{{ errors.enddate }}
+ {% endif %}{% endif %} +
-
+
@@ -45,6 +52,10 @@ maxlength="255" class="form-control"> + {% if(errors|default('0') != 0) %} {% if('summary' in errors|keys) %} +
{{ errors.summary }}
+ {% endif %}{% endif %} +
From fc44a6cb40411e71c0d2302d6fd8baa1d5f4ec3b Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Thu, 25 Sep 2014 23:21:36 +0200 Subject: [PATCH 19/19] Set the enddate for the right entity. Fixes #7 --- .../Bundle/CalciferBundle/Command/GenerateEventsCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Hackspace/Bundle/CalciferBundle/Command/GenerateEventsCommand.php b/src/Hackspace/Bundle/CalciferBundle/Command/GenerateEventsCommand.php index d16fda5..c74573a 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Command/GenerateEventsCommand.php +++ b/src/Hackspace/Bundle/CalciferBundle/Command/GenerateEventsCommand.php @@ -60,7 +60,7 @@ class GenerateEventsCommand extends ContainerAwareCommand /** @var \DateTime $enddate */ $enddate = clone $next_date; $enddate->add($duration); - $entity->enddate = $enddate; + $event->enddate = $enddate; } $event->summary = $entity->summary; $event->description = $entity->description;