+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+namespace Chill\EventBundle\Repository;
+
+use Doctrine\ORM\EntityRepository;
+
+/**
+ * Class EventRepository
+ *
+ * @package Chill\EventBundle\Repository
+ * @author Mathieu Jaumotte jaum_mathieu@collectifs.net
+ */
+class EventRepository extends EntityRepository
+{
+
+}
diff --git a/Resources/config/doctrine/Event.orm.yml b/Resources/config/doctrine/Event.orm.yml
index 7dabeb880..bb0237c3f 100644
--- a/Resources/config/doctrine/Event.orm.yml
+++ b/Resources/config/doctrine/Event.orm.yml
@@ -1,6 +1,7 @@
Chill\EventBundle\Entity\Event:
type: entity
table: chill_event_event
+ repositoryClass: Chill\EventBundle\Repository\EventRepository
id:
id:
type: integer
diff --git a/Resources/config/routing/event.yml b/Resources/config/routing/event.yml
index 20580c37a..4271c6d49 100644
--- a/Resources/config/routing/event.yml
+++ b/Resources/config/routing/event.yml
@@ -39,3 +39,4 @@ chill_event__event_update:
chill_event__list_by_person:
path: /{person_id}/list
defaults: { _controller: "ChillEventBundle:Event:listByPerson" }
+ methods: [ GET ]
diff --git a/Resources/config/services/forms.yml b/Resources/config/services/forms.yml
index 90981d31b..1ad542dd1 100644
--- a/Resources/config/services/forms.yml
+++ b/Resources/config/services/forms.yml
@@ -46,3 +46,13 @@ services:
- "@chill.main.helper.translatable_string"
tags:
- { name: form.type }
+
+ Chill\EventBundle\Form\Type\PickSubscriptionType:
+ arguments:
+ $eventRepository: "@chill_event.repository.event"
+ $tokenStorage: "@security.token_storage"
+ $authorizationHelper: "@chill.main.security.authorization.helper"
+ $urlGenerator: '@Symfony\Component\Routing\Generator\UrlGeneratorInterface'
+ $translator: '@Symfony\Component\Translation\TranslatorInterface'
+ tags:
+ - { name: form.type }
diff --git a/Resources/config/services/repositories.yml b/Resources/config/services/repositories.yml
index d27130bcd..ca050ed4b 100644
--- a/Resources/config/services/repositories.yml
+++ b/Resources/config/services/repositories.yml
@@ -1,6 +1,7 @@
services:
+
chill_event.repository.event:
- class: Doctrine\ORM\EntityRepository
+ class: Chill\EventBundle\Repository\EventRepository
factory: ['@doctrine.orm.entity_manager', getRepository]
arguments:
- 'Chill\EventBundle\Entity\Event'
@@ -15,4 +16,4 @@ services:
class: Doctrine\ORM\EntityRepository
factory: ['@doctrine.orm.entity_manager', getRepository]
arguments:
- - 'Chill\EventBundle\Entity\Status'
\ No newline at end of file
+ - 'Chill\EventBundle\Entity\Status'
diff --git a/Resources/translations/messages.fr.yml b/Resources/translations/messages.fr.yml
index 68860c593..2bfc74ac9 100644
--- a/Resources/translations/messages.fr.yml
+++ b/Resources/translations/messages.fr.yml
@@ -66,3 +66,6 @@ past: passé
futur: futur
'subscribed by %user% to event "%event%" (%event_type%)': inscrit par %user% à l'événement "%event%" (%event_type%)
Show the event: Voir l'événement
+
+Subscribe an event: Ajouter un événement
+Pick an event: Choisir un événement
\ No newline at end of file
diff --git a/Resources/views/Event/listByPerson.html.twig b/Resources/views/Event/listByPerson.html.twig
index 9d9fd7079..b8ae0b326 100644
--- a/Resources/views/Event/listByPerson.html.twig
+++ b/Resources/views/Event/listByPerson.html.twig
@@ -95,6 +95,7 @@
{% endfor %}
+
@@ -102,8 +103,12 @@
{{ chill_pagination(paginator) }}
{% endif %}
-{#
-{{ dump() }}
-#}
+
+ {{ form_start(form_add_participation_by_event) }}
+ {{ form_widget(form_add_participation_by_event.event_id, { 'attr' : { 'style' : 'width: 25em; display:inline-block; ' } } ) }}
+ {{ form_widget(form_add_participation_by_event.submit, { 'attr' : { 'class' : 'sc-button bt-create' } } ) }}
+ {{ form_rest(form_add_participation_by_event) }}
+ {{ form_end(form_add_participation_by_event) }}
+
{% endblock %}
\ No newline at end of file
diff --git a/Search/EventSearch.php b/Search/EventSearch.php
index 4fc5fc19a..bd87b5ad5 100644
--- a/Search/EventSearch.php
+++ b/Search/EventSearch.php
@@ -3,6 +3,7 @@
namespace Chill\EventBundle\Search;
+use Chill\EventBundle\Entity\Event;
use Chill\MainBundle\Search\AbstractSearch;
use Doctrine\ORM\EntityRepository;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
@@ -101,7 +102,8 @@ class EventSearch extends AbstractSearch
$total = $this->count($terms);
$paginator = $this->paginationFactory->create($total);
- return $this->templating->render('ChillEventBundle:Event:list.html.twig',
+ if ($format === 'html') {
+ return $this->templating->render('ChillEventBundle:Event:list.html.twig',
array(
'events' => $this->search($terms, $start, $limit, $options),
'pattern' => $this->recomposePattern($terms, $this->getAvailableTerms(), $terms['_domain']),
@@ -111,6 +113,23 @@ class EventSearch extends AbstractSearch
'paginator' => $paginator,
'search_name' => self::NAME
));
+ }
+ else if ($format === 'json') {
+ $results = [];
+ $search = $this->search($terms, $start, $limit, $options);
+ foreach ($search as $item) {
+ $results[] = [
+ 'id' => $item->getId(),
+ 'text' => $item->getDate()->format('d-m-Y, H:i'). ' → ' .$item->getName()
+ ];
+ }
+ return [
+ 'results' => $results,
+ 'pagination' => [
+ 'more' => $paginator->hasNextPage()
+ ]
+ ];
+ }
}
protected function getAvailableTerms()
@@ -207,8 +226,6 @@ class EventSearch extends AbstractSearch
$qb->andWhere($where);
}
-
-
return $qb;
}
}