{% trans %}abus.list.table.no_result{% endtrans %}
+ {% endif %}
+
+
+
+
+{% endblock body %}
\ No newline at end of file
diff --git a/CTRV/CommonBundle/Resources/views/Auth/insufficientAccess.html.twig b/CTRV/CommonBundle/Resources/views/Auth/insufficientAccess.html.twig
new file mode 100644
index 0000000..8c5f00d
--- /dev/null
+++ b/CTRV/CommonBundle/Resources/views/Auth/insufficientAccess.html.twig
@@ -0,0 +1,22 @@
+{% extends "::base.html.twig" %}
+{% import '::macro.html.twig' as forms %}
+
+{% block body %}
+
+
+
+ {% trans %} common.insufficient_right.text {% endtrans %}
+
+
+{% endblock body %}
\ No newline at end of file
diff --git a/CTRV/CommonBundle/Resources/views/Auth/login.html.twig b/CTRV/CommonBundle/Resources/views/Auth/login.html.twig
new file mode 100644
index 0000000..4727616
--- /dev/null
+++ b/CTRV/CommonBundle/Resources/views/Auth/login.html.twig
@@ -0,0 +1,40 @@
+{% extends "::base.html.twig" %}
+{% import '::macro.html.twig' as forms %}
+
+{% block body %}
+
+
+
+
+
+
+
+
+ {% if error %}
+
{{ error.message|trans({},'messages') }}
+ {#
{{ error.message }}
#}
+ {% endif %}
+
+
+{% endblock body %}
\ No newline at end of file
diff --git a/CTRV/CommonBundle/Resources/views/Auth/register.html.twig b/CTRV/CommonBundle/Resources/views/Auth/register.html.twig
new file mode 100644
index 0000000..ebbb8e3
--- /dev/null
+++ b/CTRV/CommonBundle/Resources/views/Auth/register.html.twig
@@ -0,0 +1,11 @@
+{% extends "::base.html.twig" %}
+{% import '::macro.html.twig' as forms %}
+
+
+{% block body %}
+
+
+{% endblock body %}
\ No newline at end of file
diff --git a/CTRV/CommonBundle/Resources/views/City/addCity.html.twig b/CTRV/CommonBundle/Resources/views/City/addCity.html.twig
new file mode 100644
index 0000000..1c07380
--- /dev/null
+++ b/CTRV/CommonBundle/Resources/views/City/addCity.html.twig
@@ -0,0 +1,25 @@
+{% extends "::base.html.twig" %}
+{% import '::macro.html.twig' as forms %}
+
+{% block body %}
+
+
+
+
+ {% include "CTRVCommonBundle::menuCity.html.twig" %}
+
+
+
+
{% trans %}city.form.titleAddCity{% endtrans %}
+
+
+
+
+
+
+
+
+{% endblock body %}
\ No newline at end of file
diff --git a/CTRV/CommonBundle/Resources/views/City/editCity.html.twig b/CTRV/CommonBundle/Resources/views/City/editCity.html.twig
new file mode 100644
index 0000000..f1970fe
--- /dev/null
+++ b/CTRV/CommonBundle/Resources/views/City/editCity.html.twig
@@ -0,0 +1,24 @@
+{% extends "::base.html.twig" %}
+{% import '::macro.html.twig' as forms %}
+
+{% block body %}
+
+
+
+
+ {% include "CTRVCommonBundle::menuCity.html.twig" %}
+
+
+
+
{% trans %}city.form.titleEditCity{% endtrans %}
+
+
+
+
+
+
+
+{% endblock body %}
\ No newline at end of file
diff --git a/CTRV/CommonBundle/Resources/views/City/getAllCities.html.twig b/CTRV/CommonBundle/Resources/views/City/getAllCities.html.twig
new file mode 100644
index 0000000..e747b41
--- /dev/null
+++ b/CTRV/CommonBundle/Resources/views/City/getAllCities.html.twig
@@ -0,0 +1,58 @@
+{% extends "::base.html.twig" %}
+{% import '::macro.html.twig' as forms %}
+
+{% block body %}
+
+
+
+
+ {% include "CTRVCommonBundle::menuCity.html.twig" %}
+
+
{% trans %}city.list.table.no_result{% endtrans %}
+ {% endif %}
+
+
+
+
+
+
+{% endblock body %}
\ No newline at end of file
diff --git a/CTRV/CommonBundle/Resources/views/Comment/eventCommentAbuse.html.twig b/CTRV/CommonBundle/Resources/views/Comment/eventCommentAbuse.html.twig
new file mode 100644
index 0000000..ccf9e00
--- /dev/null
+++ b/CTRV/CommonBundle/Resources/views/Comment/eventCommentAbuse.html.twig
@@ -0,0 +1,65 @@
+{% extends "::base.html.twig" %}
+{% import '::macro.html.twig' as forms %}
+
+{% block body %}
+
+
+
+
+ {% include "CTRVCommonBundle::menuAbus.html.twig" %}
+
+
+ {% endif %}
+ {% endif %}
+
+ {# Afficher les liens avant la page actuelle #}
+ {% for p in range(page-number_page_before_and_after, nb_pages) %}
+ {% if p0 %}
+
+ {% if href_active=='true' %}
+ {{ p }}
+ {% else %}
+ {{ p }}
+ {% endif %}
+
+ {% endif %}
+ {% endfor %}
+
+ {# Afficher le lien de la page actuelle #}
+
{% trans %}utilisateur.list.table.no_result{% endtrans %}
+ {% endif %}
+
+
+
+
+
+
+
+
+{% endblock body %}
\ No newline at end of file
diff --git a/CTRV/CommonBundle/Resources/views/User/rechercherUserResult.html.twig b/CTRV/CommonBundle/Resources/views/User/rechercherUserResult.html.twig
new file mode 100644
index 0000000..f679640
--- /dev/null
+++ b/CTRV/CommonBundle/Resources/views/User/rechercherUserResult.html.twig
@@ -0,0 +1,75 @@
+{% if entities is not empty %}
+
+
+
+
{% trans %}utilisateur.rechercheForm.list.table.login {% endtrans %}
+
{% trans %}utilisateur.rechercheForm.list.table.Noms {% endtrans %}
+
{% trans %}utilisateur.rechercheForm.list.table.Prenoms {% endtrans %}
+
{% trans %}utilisateur.rechercheForm.list.table.address {% endtrans %}
+
{% trans %}utilisateur.rechercheForm.list.table.name {% endtrans %}
+
{% trans %}utilisateur.rechercheForm.list.table.action {% endtrans %}
{% trans %}utilisateur.rechercheForm.list.table.no_result{% endtrans %}
+{% endif %}
+
+
+
\ No newline at end of file
diff --git a/CTRV/CommonBundle/Resources/views/User/statsUser.html.twig b/CTRV/CommonBundle/Resources/views/User/statsUser.html.twig
new file mode 100644
index 0000000..7ce3b6c
--- /dev/null
+++ b/CTRV/CommonBundle/Resources/views/User/statsUser.html.twig
@@ -0,0 +1,26 @@
+{% extends "::base.html.twig" %}
+{% import '::macro.html.twig' as forms %}
+
+{% block body %}
+
+
+
+ {% include "CTRVCommonBundle::menu.html.twig" %}
+
+
+
+
{% trans %}utilisateur.list.titleStat{% endtrans %}
+
+
+
{% trans %}utilisateur.list.titleAllUsers{% endtrans %} : {{ nb_users }}
+
{% trans %}utilisateur.list.titleUsersConnectedNumber{% endtrans %} : {{ nb_connected_users }}
+
+
+
+
{% trans %}utilisateur.list.titleAllUsersCity{% endtrans %} : {{ nb_users_by_city }}
+
{% trans %}utilisateur.list.titleUsersConnectedNumberByCity{% endtrans %} : {{ nb_connected_users_by_city }}
+
+
+
+
+{% endblock body %}
\ No newline at end of file
diff --git a/CTRV/CommonBundle/Resources/views/User/userEdit.html.twig b/CTRV/CommonBundle/Resources/views/User/userEdit.html.twig
new file mode 100644
index 0000000..9eed84b
--- /dev/null
+++ b/CTRV/CommonBundle/Resources/views/User/userEdit.html.twig
@@ -0,0 +1,24 @@
+{% extends "::base.html.twig" %}
+{% import '::macro.html.twig' as forms %}
+
+{% block body %}
+
+
+
+
+ {% include "CTRVCommonBundle::menu.html.twig" %}
+
+
+
+
{% trans %}utilisateur.editForm.titleUserEdit{% endtrans %}
+
+
+
+
+
+
+
+{% endblock body %}
\ No newline at end of file
diff --git a/CTRV/CommonBundle/Resources/views/menu.html.twig b/CTRV/CommonBundle/Resources/views/menu.html.twig
new file mode 100644
index 0000000..ff63336
--- /dev/null
+++ b/CTRV/CommonBundle/Resources/views/menu.html.twig
@@ -0,0 +1,10 @@
+
+
\ No newline at end of file
diff --git a/CTRV/CommonBundle/Resources/views/menuAbus.html.twig b/CTRV/CommonBundle/Resources/views/menuAbus.html.twig
new file mode 100644
index 0000000..3032200
--- /dev/null
+++ b/CTRV/CommonBundle/Resources/views/menuAbus.html.twig
@@ -0,0 +1,9 @@
+
+
\ No newline at end of file
diff --git a/CTRV/CommonBundle/Resources/views/menuCity.html.twig b/CTRV/CommonBundle/Resources/views/menuCity.html.twig
new file mode 100644
index 0000000..a69d4ca
--- /dev/null
+++ b/CTRV/CommonBundle/Resources/views/menuCity.html.twig
@@ -0,0 +1,6 @@
+
+
\ No newline at end of file
diff --git a/CTRV/CommonBundle/Service/AbuseService.php b/CTRV/CommonBundle/Service/AbuseService.php
new file mode 100644
index 0000000..e2e2f37
--- /dev/null
+++ b/CTRV/CommonBundle/Service/AbuseService.php
@@ -0,0 +1,44 @@
+mailer = $mailer;
+ $this->doctrine = $doctrine;
+ $this->em = $doctrine->getEntityManager();
+ $this->service_container = $service_container;
+ $this->templating = $templating;
+ $this->translator = $translator;
+ $this->router = $router;
+ }
+
+ /**
+ * retourne la liste des abus sur les commentaires
+ * @return unknown
+ */
+ public function getAllAbuseNumber($currentCity) {
+ $entities = $this->em->getRepository('CTRVCommonBundle:Abuse')
+ ->getAllAbuseNumber($this->em->getRepository('CTRVCommonBundle:City')->find($currentCity->getId()));
+ return $entities;
+ }
+
+
+}
diff --git a/CTRV/CommonBundle/Service/AccessDeniedService.php b/CTRV/CommonBundle/Service/AccessDeniedService.php
new file mode 100644
index 0000000..8f18af6
--- /dev/null
+++ b/CTRV/CommonBundle/Service/AccessDeniedService.php
@@ -0,0 +1,27 @@
+isXmlHttpRequest()) {
+ $response = new Response(json_encode(array('status' => 'protected')));
+ return $response;
+ }
+ else {
+ return new RedirectResponse($this->router->generate('home'));
+ }
+ }
+
+}
diff --git a/CTRV/CommonBundle/Service/CityService.php b/CTRV/CommonBundle/Service/CityService.php
new file mode 100644
index 0000000..47014b1
--- /dev/null
+++ b/CTRV/CommonBundle/Service/CityService.php
@@ -0,0 +1,32 @@
+mailer = $mailer;
+ $this->doctrine = $doctrine;
+ $this->em = $doctrine->getEntityManager();
+ $this->service_container = $service_container;
+ $this->templating = $templating;
+ $this->translator = $translator;
+ }
+
+}
diff --git a/CTRV/CommonBundle/Service/CommentService.php b/CTRV/CommonBundle/Service/CommentService.php
new file mode 100644
index 0000000..6f22fc2
--- /dev/null
+++ b/CTRV/CommonBundle/Service/CommentService.php
@@ -0,0 +1,81 @@
+mailer = $mailer;
+ $this->doctrine = $doctrine;
+ $this->em = $doctrine->getEntityManager();
+ $this->service_container = $service_container;
+ $this->templating = $templating;
+ $this->translator = $translator;
+ }
+
+ /**
+ * Retourne les commentaires des agendas de la ville spécifié
+ */
+ public function getAgendaComment ($currentCity) {
+
+ $entities = $this->em->getRepository('CTRVCommonBundle:Comment')
+ ->getAgendaComment($this->em->getRepository('CTRVCommonBundle:City')->find($currentCity->getId()));
+ return $entities;
+ }
+
+ /**
+ * Retourne les commentaires des événements de la ville spécifié
+ */
+ public function getEventComment ($currentCity) {
+
+ $entities = $this->em->getRepository('CTRVCommonBundle:Comment')
+ ->getEventComment($this->em->getRepository('CTRVCommonBundle:City')->find($currentCity->getId()));
+ return $entities;
+ }
+
+ /**
+ * Retourne les commentaires des places de la ville spécifié
+ */
+ public function getPlaceComment ($currentCity) {
+
+ $entities = $this->em->getRepository('CTRVCommonBundle:Comment')
+ ->getPlaceComment($this->em->getRepository('CTRVCommonBundle:City')->find($currentCity->getId()));
+ return $entities;
+ }
+
+ /**
+ * retourne la liste des abus sur les commentaires
+ * @return unknown
+ */
+ public function getEventCommentAbuse($currentCity) {
+ $entities = $this->em->getRepository('CTRVCommonBundle:Comment')
+ ->getEventCommentAbuse($this->em->getRepository('CTRVCommonBundle:City')->find($currentCity->getId()));
+ return $entities;
+ }
+ /**
+ * retourne la liste des abus sur les commentaires des places
+ * @return unknown
+ */
+ public function getPlaceCommentAbuse($currentCity) {
+ $entities = $this->em->getRepository('CTRVCommonBundle:Comment')
+ ->getPlaceCommentAbuse($this->em->getRepository('CTRVCommonBundle:City')->find($currentCity->getId()));
+ return $entities;
+ }
+
+
+}
diff --git a/CTRV/CommonBundle/Service/CommonService.php b/CTRV/CommonBundle/Service/CommonService.php
new file mode 100644
index 0000000..771d674
--- /dev/null
+++ b/CTRV/CommonBundle/Service/CommonService.php
@@ -0,0 +1,31 @@
+mailer = $mailer;
+ $this->doctrine = $doctrine;
+ $this->em = $doctrine->getEntityManager();
+ $this->service_container = $service_container;
+ $this->templating = $templating;
+ $this->translator = $translator;
+ $this->router = $router;
+ }
+
+}
diff --git a/CTRV/CommonBundle/Service/MyPasswordEncoder.php b/CTRV/CommonBundle/Service/MyPasswordEncoder.php
new file mode 100644
index 0000000..5fbddfb
--- /dev/null
+++ b/CTRV/CommonBundle/Service/MyPasswordEncoder.php
@@ -0,0 +1,26 @@
+encodePassword($raw, $salt);
+ }
+
+}
diff --git a/CTRV/CommonBundle/Service/SessionService.php b/CTRV/CommonBundle/Service/SessionService.php
new file mode 100644
index 0000000..f119385
--- /dev/null
+++ b/CTRV/CommonBundle/Service/SessionService.php
@@ -0,0 +1,39 @@
+session = $session;
+ $this->doctrine = $doctrine;
+ $this->service_container = $service_container;
+ $this->em = $doctrine->getEntityManager();
+ $this->translator = $translator;
+ }
+
+ public function getCity() {
+ return $this->session->get('city');
+ }
+
+ public function setCity($city) {
+ $this->session->remove('city');
+ $this->session->set('city', $city);
+ }
+
+}
diff --git a/CTRV/CommonBundle/Service/UserService.php b/CTRV/CommonBundle/Service/UserService.php
new file mode 100644
index 0000000..efe7e4a
--- /dev/null
+++ b/CTRV/CommonBundle/Service/UserService.php
@@ -0,0 +1,78 @@
+mailer = $mailer;
+ $this->doctrine = $doctrine;
+ $this->em = $doctrine->getEntityManager();
+ $this->service_container = $service_container;
+ $this->templating = $templating;
+ $this->translator = $translator;
+ }
+
+ /**
+ * Retourne la liste des utilisateurs de la ville courante
+ * @param unknown_type $currentCity
+ */
+ public function getUsersByCity($currentCity) {
+ return $this->em->getRepository('CTRVCommonBundle:User')
+ ->getUsersByCity($this->em->getRepository('CTRVCommonBundle:City')->find($currentCity->getId()));
+ }
+
+ /**
+ * retourne le nombre d'utilisateurs de la ville courante
+ * @param unknown_type $currentCity
+ * @return unknown
+ */
+ public function getAllUsersNumberByCity ($currentCity) {
+ $userNumber = $this->em->getRepository('CTRVCommonBundle:User')
+ ->getAllUsersNumberByCity($this->em->getRepository('CTRVCommonBundle:City')->find($currentCity->getId()));
+ return $userNumber;
+ }
+
+ /**
+ * retourne le nombre d'utlisateur connectés
+ */
+ public function getUsersConnectedNumber() {
+ $userConnectedNumber = $this->em->getRepository('CTRVCommonBundle:ConnectedUsers')->getUsersConnectedNumber();
+ return $userConnectedNumber;
+ }
+
+ /**
+ * retourne le nombre d'utilisateurs connectés de la ville courante
+ * @param unknown_type $currentCity
+ */
+public function getUsersConnectedNumberByCity($currentCity) {
+ $entities = $this->em->getRepository('CTRVCommonBundle:ConnectedUsers')
+ ->getUsersConnectedNumberByCity($this->em->getRepository('CTRVCommonBundle:City')->find($currentCity->getId()));
+ return $entities;
+ }
+
+ /**
+ * retourne le nomber total d'utilisateurs
+ * @return unknown
+ */
+ public function getAllUsersNumber() {
+ $userNumber = $this->em->getRepository('CTRVCommonBundle:User')->getAllUsersNumber();
+ return $userNumber;
+ }
+
+}
diff --git a/CTRV/EventBundle/CTRVEventBundle.php b/CTRV/EventBundle/CTRVEventBundle.php
new file mode 100644
index 0000000..19ae704
--- /dev/null
+++ b/CTRV/EventBundle/CTRVEventBundle.php
@@ -0,0 +1,9 @@
+get("session_service")->getCity();
+ $city = $this->getDoctrine()->getEntityManager()->getRepository('CTRVCommonBundle:City')->find($currentCity->getId());
+
+ if ($currentCity == null) {
+ $this->get('session')->getFlashBag()->add('error', $this->get('translator')->trans('session.city.not_found'));
+ $this->redirect($this->generateUrl("home"));
+ }
+
+ $page = intval ($this->getRequest()->get("page",1));
+
+ //pagination
+ $nb_entities = $eventComments = $this->getDoctrine()->getRepository('CTRVCommonBundle:Comment')->getEventCommentNumber($city);
+ $nb_entities_page = Constants::eventsComment_number_per_page;
+ $nb_pages = ceil($nb_entities/$nb_entities_page);
+ $offset = ($page-1) * $nb_entities_page;
+
+ $eventComments = $this->getDoctrine()->getRepository('CTRVCommonBundle:Comment')->getEventComment($city, $offset, $nb_entities_page);
+
+ return array (
+ 'entities' => $eventComments,
+ 'nb_pages' => $nb_pages,
+ 'page' => $page,
+ 'nb_entities' => $nb_entities
+ );
+ }
+ /**
+ * Charge les commentaires des agendas
+ * @Route("/agendaComment", name="agendaComment")
+ * @Template()
+ */
+ public function loadAgendaCommentAction () {
+
+ $currentCity = $this->get("session_service")->getCity();
+ $city = $this->getDoctrine()->getEntityManager()->getRepository('CTRVCommonBundle:City')->find($currentCity->getId());
+
+ if ($currentCity == null) {
+ $this->get('session')->getFlashBag()->add('error', $this->get('translator')->trans('session.city.not_found'));
+ $this->redirect($this->generateUrl("home"));
+ }
+
+ $page = intval ($this->getRequest()->get("page",1));
+
+ //pagination
+ $nb_entities = $agendaComments = $this->getDoctrine()->getRepository('CTRVCommonBundle:Comment')->getAgendaCommentNumber($city);
+ $nb_entities_page = Constants::agendasComment_number_per_page;
+ $nb_pages = ceil($nb_entities/$nb_entities_page);
+ $offset = ($page-1) * $nb_entities_page;
+
+ $agendaComments = $this->getDoctrine()->getRepository('CTRVCommonBundle:Comment')->getAgendaComment($city, $offset, $nb_entities_page);
+
+ return array (
+ 'entities' => $agendaComments,
+ 'nb_pages' => $nb_pages,
+ 'page' => $page,
+ 'nb_entities' => $nb_entities
+ );
+ }
+
+
+
+}
diff --git a/CTRV/EventBundle/Controller/EventController.php b/CTRV/EventBundle/Controller/EventController.php
new file mode 100644
index 0000000..35adff1
--- /dev/null
+++ b/CTRV/EventBundle/Controller/EventController.php
@@ -0,0 +1,391 @@
+get("session_service")->getCity();
+ $city = $this->getDoctrine()->getEntityManager()->getRepository('CTRVCommonBundle:City')->find($currentCity->getId());
+
+ if ($currentCity == null) {
+ $this->get('session')->getFlashBag()->add('error', $this->get('translator')->trans('session.city.not_found'));
+ $this->redirect($this->generateUrl("home"));
+ }
+
+ $page = intval ($this->getRequest()->get("page",1));
+
+ //pagination
+ $nb_entities = $events = $this->getDoctrine()->getRepository('CTRVEventBundle:Event')->getEventNumber($city);
+ $nb_entities_page = Constants::events_number_per_page;
+ $nb_pages = ceil($nb_entities/$nb_entities_page);
+ $offset = ($page-1) * $nb_entities_page;
+
+ $events = $this->getDoctrine()->getRepository('CTRVEventBundle:Event')->getEvent($city, $offset, $nb_entities_page);
+
+ return array (
+ 'entities' => $events,
+ 'nb_pages' => $nb_pages,
+ 'page' => $page,
+ 'nb_entities' => $nb_entities,
+ 'city'=>$city
+ );
+
+
+ }
+
+ /**
+ * Charge tous les événements ayant des mis à jour proposés de la ville courante
+ * @Route("/eventUpdated", name="eventUpdated")
+ * @Template()
+ */
+ public function loadEventUpdatedAction () {
+
+ $currentCity = $this->get("session_service")->getCity();
+ $city = $this->getDoctrine()->getEntityManager()->getRepository('CTRVCommonBundle:City')->find($currentCity->getId());
+
+ if ($currentCity == null) {
+ $this->get('session')->getFlashBag()->add('error', $this->get('translator')->trans('session.city.not_found'));
+ $this->redirect($this->generateUrl("home"));
+ }
+
+ $page = intval ($this->getRequest()->get("page",1));
+
+ //pagination
+ $nb_entities = $this->getDoctrine()->getRepository('CTRVEventBundle:Event')->getEventUpdatedByCityNumber($city);
+ $nb_entities_page = Constants::events_number_per_page;
+ $nb_pages = ceil($nb_entities/$nb_entities_page);
+ $offset = ($page-1) * $nb_entities_page;
+ //On récupére l'ensemble des événements ayant des mis à jour proposés par ville
+ $eventsUpdatedByCity = $this->getDoctrine()->getRepository('CTRVEventBundle:Event')->getEventUpdatedByCity($city, $offset, $nb_entities_page );
+
+ // on crée un tableau
+ $tab = array();
+ // On récupére le nombre de mis à jour pour chaque event pour le placer dans le tableau
+ foreach ($eventsUpdatedByCity as $entity) {
+ $tab[$entity->getId()] = $this->getDoctrine()->getRepository('CTRVEventBundle:Event')->getUpdatePerEventNumber($entity);
+
+ }
+
+ return array (
+ 'update_per_event'=>$tab,
+ 'entities' => $eventsUpdatedByCity,
+ 'nb_pages' => $nb_pages,
+ 'page' => $page,
+ 'nb_entities' => $nb_entities,
+ 'city'=> $city
+ );
+
+ }
+
+ /**
+ * Charge tous les mis à jour proposés de l'événement spécifié de la ville courante
+ * @Route("/updatePerEvent/{id}", name="updatePerEvent") //requirements={"id" = "\d+"}
+ * @Template()
+ */
+ public function loadUpdatePerEventAction ($id) {
+ $em = $this->getDoctrine()->getManager();
+ $entity = $em->getRepository('CTRVEventBundle:Event')->find($id);
+ $currentCity = $this->get("session_service")->getCity();
+ $city = $this->getDoctrine()->getEntityManager()->getRepository('CTRVCommonBundle:City')->find($currentCity->getId());
+
+ if ($currentCity == null) {
+ $this->get('session')->getFlashBag()->add('error', $this->get('translator')->trans('session.city.not_found'));
+ $this->redirect($this->generateUrl("home"));
+ }
+
+ $page = intval ($this->getRequest()->get("page",1));
+
+ //pagination
+
+ $nb_entities = $this->getDoctrine()->getRepository('CTRVEventBundle:UpdatedEvent')->getUpdatePerEventNumber($entity, $city);
+ $nb_entities_page = Constants::events_number_per_page;
+ $nb_pages = ceil($nb_entities/$nb_entities_page);
+ $offset = ($page-1) * $nb_entities_page;
+ $update_per_event = $this->getDoctrine()->getRepository('CTRVEventBundle:UpdatedEvent')->getUpdatePerEvent($entity,$city, $offset, $nb_entities_page);
+ $currentEventWithUpdateProposed = $this->getDoctrine()->getRepository('CTRVEventBundle:Event')->getcurrentEventWithUpdateProposed($entity ,$city, $offset, $nb_entities_page);
+
+ return array (
+ 'entities' => $update_per_event,
+ 'nb_pages' => $nb_pages,
+ 'page' => $page,
+ 'nb_entities' => $nb_entities,
+ 'events'=> $currentEventWithUpdateProposed,
+ 'city'=>$city
+ );
+
+
+ }
+
+ /**
+ * Valider un mis à jour d'événement
+ *
+ * @Route("/validate/{id}", name="validateEventUpdated" ) //requirements={"id" = "\d+"}
+ * @Template()
+ */
+ public function validateEventUpdatedAction ($id) {
+ $em = $this->getDoctrine()->getManager();
+ $entity = $em->getRepository('CTRVEventBundle:UpdatedEvent')->find($id);
+ $em->persist($entity);
+ $em->flush();
+
+ return $this->redirect($this->generateUrl("eventUpdated"));
+ }
+
+
+ /**
+ * Charge tous les événements passés de la ville courante
+ * @Route("/eventPassed", name="eventPassed")
+ * @Template()
+ */
+ public function loadEventPassedAction () {
+
+ $currentCity = $this->get("session_service")->getCity();
+ $city = $this->getDoctrine()->getEntityManager()->getRepository('CTRVCommonBundle:City')->find($currentCity->getId());
+
+ if ($currentCity == null) {
+ $this->get('session')->getFlashBag()->add('error', $this->get('translator')->trans('session.city.not_found'));
+ $this->redirect($this->generateUrl("home"));
+ }
+
+ $page = intval ($this->getRequest()->get("page",1));
+
+ //pagination
+ $nb_entities = $events = $this->getDoctrine()->getRepository('CTRVEventBundle:Event')->getEventPassedNumber($city);
+ $nb_entities_page = Constants::events_number_per_page;
+ $nb_pages = ceil($nb_entities/$nb_entities_page);
+ $offset = ($page-1) * $nb_entities_page;
+
+ $events = $this->getDoctrine()->getRepository('CTRVEventBundle:Event')->getEventPassed($city, $offset, $nb_entities_page);
+
+ return array (
+ 'entities' => $events,
+ 'nb_pages' => $nb_pages,
+ 'page' => $page,
+ 'nb_entities' => $nb_entities,
+ 'city'=>$city
+ );
+
+
+ }
+
+ /**
+ * Charge tous les agendas en cours de la ville courante
+ * @Route("/listagenda", name="agenda")
+ * @Template()
+ */
+ public function loadAgendaAction () {
+
+ $currentCity = $this->get("session_service")->getCity();
+ $city = $this->getDoctrine()->getEntityManager()->getRepository('CTRVCommonBundle:City')->find($currentCity->getId());
+
+ if ($currentCity == null) {
+ $this->get('session')->getFlashBag()->add('error', $this->get('translator')->trans('session.city.not_found'));
+ $this->redirect($this->generateUrl("home"));
+ }
+ $date = date(gmdate("Y-m-d H:i:s"));
+ $page = intval ($this->getRequest()->get("page",1));
+
+ //pagination
+ $nb_entities = $agendas = $this->getDoctrine()->getRepository('CTRVEventBundle:Event')->getCurrentAgendaNumber($city, $date);
+ $nb_entities_page = Constants::agendas_number_per_page;
+ $nb_pages = ceil($nb_entities/$nb_entities_page);
+ $offset = ($page-1) * $nb_entities_page;
+
+ $agendas = $this->getDoctrine()->getRepository('CTRVEventBundle:Event')->getCurrentAgenda($city, $offset, $nb_entities_page, $date);
+
+ return array (
+ 'entities' => $agendas,
+ 'nb_pages' => $nb_pages,
+ 'page' => $page,
+ 'nb_entities' => $nb_entities,
+ 'city'=>$city
+ );
+ }
+
+
+ /**
+ * Charge tous les agendas passés de la ville courante
+ * @Route("/passedAgenda", name="passedAgenda")
+ * @Template()
+ */
+ public function loadPassedAgendaAction () {
+
+ $currentCity = $this->get("session_service")->getCity();
+ $city = $this->getDoctrine()->getEntityManager()->getRepository('CTRVCommonBundle:City')->find($currentCity->getId());
+
+ if ($currentCity == null) {
+ $this->get('session')->getFlashBag()->add('error', $this->get('translator')->trans('session.city.not_found'));
+ $this->redirect($this->generateUrl("home"));
+ }
+ $date = date(gmdate("Y-m-d H:i:s"));
+ $page = intval ($this->getRequest()->get("page",1));
+
+ //pagination
+ $nb_entities = $agendas = $this->getDoctrine()->getRepository('CTRVEventBundle:Event')->getPassedAgendaNumber($city, $date);
+ $nb_entities_page = Constants::agendas_number_per_page;
+ $nb_pages = ceil($nb_entities/$nb_entities_page);
+ $offset = ($page-1) * $nb_entities_page;
+
+ $agendas = $this->getDoctrine()->getRepository('CTRVEventBundle:Event')->getPassedAgenda($city, $offset, $nb_entities_page, $date);
+
+ return array (
+ 'entities' => $agendas,
+ 'nb_pages' => $nb_pages,
+ 'page' => $page,
+ 'nb_entities' => $nb_entities,
+ 'city'=>$city
+ );
+ }
+
+
+ /**
+ * ajouter un type d'évenement
+ * @Route("/ajouter",name="ajouter_evenement")
+ * @Template()
+ */
+ public function addEventTypeAction () {
+ $em = $this->getDoctrine()->getEntityManager();
+ $form = $this->createForm(new EventTypeType(),new EventType());
+ // On vérifie qu'elle est de type POST
+ if ($this->getRequest()->getMethod() == 'POST') {
+ // On fait le lien Requête <-> Formulaire
+ $form->bind($this->getRequest());
+ // On vérifie que les valeurs rentrées sont correctes
+ if ($form->isValid()) {
+ // On l'enregistre notre objet $placeType dans la base de données
+ $eventType = $form->getData();
+ $em->persist($eventType);
+ $em->flush();
+ return $this->redirect($this->generateUrl("loadTypeEvents"));
+ }
+ }
+
+
+ return array('form'=>$form->createView());
+
+ }
+ /**
+ * modifier un type d'evenment
+ * @Route("/modifier/{id}",name="modifier_evenement")
+ * @Template()
+ */
+ public function updateEventTypeAction(EventType $eventType) {
+ $form = $this->createForm(new EventTypeType, $eventType);
+ $request=$this->getRequest();
+ // On vérifie qu'elle est de type POST
+ if ($this->getRequest()->getMethod() == 'POST') {
+ // On fait le lien Requête <-> Formulaire
+ $form->bind($this->getRequest());
+ // On vérifie que les valeurs rentrées sont correctes
+ if ($form->isValid()) {
+ // On enregistre notre objet $placeType dans la base de données
+ $em = $this->getDoctrine()->getEntityManager();
+ $em->persist($eventType);
+ $em->flush();
+ // on redirige vers les types de place
+ return $this->redirect($this->generateUrl("loadTypeEvents"));
+ }
+
+ }
+
+ return array(
+ 'eventType'=> $eventType,
+ 'form'=>$form->createView());
+
+ }
+ /**
+ * Charge les type d'évenement
+ * @Route("/loadTypeEvents", name="loadTypeEvents")
+ * @Template()
+ */
+ public function loadTypeEventsAction () {
+
+ $currentCity = $this->get("session_service")->getCity();
+ $city = $this->getDoctrine()->getEntityManager()->getRepository('CTRVCommonBundle:City')->find($currentCity->getId());
+
+ if ($currentCity == null) {
+ $this->get('session')->getFlashBag()->add('error', $this->get('translator')->trans('session.city.not_found'));
+ $this->redirect($this->generateUrl("home"));
+ }
+
+ $page = intval ($this->getRequest()->get("page",1));
+
+ //pagination
+ $nb_entities = $typeEvents = $this->getDoctrine()->getRepository('CTRVEventBundle:EventType')->getTypeEventsNumber();
+ $nb_entities_page = Constants::eventsComment_number_per_page;
+ $nb_pages = ceil($nb_entities/$nb_entities_page);
+ $offset = ($page-1) * $nb_entities_page;
+
+ $typeEvents = $this->getDoctrine()->getRepository('CTRVEventBundle:EventType')->getTypeEvents($offset, $nb_entities_page);
+
+ return array (
+ 'entities' => $typeEvents,
+ 'nb_pages' => $nb_pages,
+ 'page' => $page,
+ 'nb_entities' => $nb_entities
+ );
+
+ }
+
+
+
+ /**
+ * Deletes an Event entity.
+ *
+ * @Route("/{id}/delete", name="event_delete" ) //requirements={"id" = "\d+"}
+ * @Method("POST")
+ * @Template()
+ */
+ public function deleteAction($id) {
+ $em = $this->getDoctrine()->getManager();
+ $entity = $em->getRepository('CTRVEventBundle:Event')->find($id);
+
+ $em->remove($entity);
+ $em->flush();
+
+ return new Response(json_encode(array('result'=>true)));
+ }
+
+ /**
+ * Deletes an EventType entity.
+ *
+ * @Route("/{id}/deleteType", name="eventType_delete" ) //requirements={"id" = "\d+"}
+ * @Method("POST")
+ * @Template()
+ */
+ public function deleteTypeAction($id) {
+ $em = $this->getDoctrine()->getManager();
+ $entity = $em->getRepository('CTRVEventBundle:EventType')->find($id);
+
+ $em->remove($entity);
+ $em->flush();
+
+ return new Response(json_encode(array('result'=>true)));
+ }
+
+}
diff --git a/CTRV/EventBundle/DependencyInjection/CTRVEventExtension.php b/CTRV/EventBundle/DependencyInjection/CTRVEventExtension.php
new file mode 100644
index 0000000..ada3e51
--- /dev/null
+++ b/CTRV/EventBundle/DependencyInjection/CTRVEventExtension.php
@@ -0,0 +1,28 @@
+processConfiguration($configuration, $configs);
+
+ $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
+ $loader->load('services.yml');
+ }
+}
diff --git a/CTRV/EventBundle/DependencyInjection/Configuration.php b/CTRV/EventBundle/DependencyInjection/Configuration.php
new file mode 100644
index 0000000..156aad1
--- /dev/null
+++ b/CTRV/EventBundle/DependencyInjection/Configuration.php
@@ -0,0 +1,29 @@
+root('ctrv_event');
+
+ // Here you should define the parameters that are allowed to
+ // configure your bundle. See the documentation linked above for
+ // more information on that topic.
+
+ return $treeBuilder;
+ }
+}
diff --git a/CTRV/EventBundle/Entity/Event.php b/CTRV/EventBundle/Entity/Event.php
new file mode 100644
index 0000000..5bc2364
--- /dev/null
+++ b/CTRV/EventBundle/Entity/Event.php
@@ -0,0 +1,723 @@
+title;
+ }
+
+ /**
+ * @ORM\PrePersist
+ */
+ public function setAddedDateValue () {
+ $this->addedDate = new \DateTime();
+ }
+
+ /**
+ * @var integer $cityId
+ * @ORM\ManyToOne(targetEntity="\CTRV\CommonBundle\Entity\City")
+ * @JoinColumn(name="city_id",referencedColumnName="id", onDelete="CASCADE")
+ */
+ private $city;
+
+ /**
+ * @var integer $eventTypeId
+ * @ORM\ManyToOne(targetEntity="EventType")
+ * @JoinColumn(name="event_type_id",referencedColumnName="id", onDelete="CASCADE")
+ */
+ private $eventType;
+
+ /**
+ * @ORM\ManyToOne(targetEntity="\CTRV\CommonBundle\Entity\User",inversedBy="events")
+ * @JoinColumn(name="userid",referencedColumnName="userid", onDelete="CASCADE")
+ */
+ private $auteur;
+
+ /**
+ * @ORM\OneToMany(targetEntity="Event",mappedBy="event")
+ * @var unknown_type
+ */
+ private $eventUpdates;
+
+
+ /**
+ * Get id
+ *
+ * @return integer
+ */
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * Set latitude
+ *
+ * @param string $latitude
+ * @return Event
+ */
+ public function setLatitude($latitude)
+ {
+ $this->latitude = $latitude;
+
+ return $this;
+ }
+
+ /**
+ * Get latitude
+ *
+ * @return string
+ */
+ public function getLatitude()
+ {
+ return $this->latitude;
+ }
+
+ /**
+ * Set longitude
+ *
+ * @param string $longitude
+ * @return Event
+ */
+ public function setLongitude($longitude)
+ {
+ $this->longitude = $longitude;
+
+ return $this;
+ }
+
+ /**
+ * Get longitude
+ *
+ * @return string
+ */
+ public function getLongitude()
+ {
+ return $this->longitude;
+ }
+
+ /**
+ * Set duration
+ *
+ * @param integer $duration
+ * @return Event
+ */
+ public function setDuration($duration)
+ {
+ $this->duration = $duration;
+
+ return $this;
+ }
+
+ /**
+ * Get duration
+ *
+ * @return integer
+ */
+ public function getDuration()
+ {
+ return $this->duration;
+ }
+
+ /**
+ * Set addedDate
+ *
+ * @param \DateTime $addedDate
+ * @return Event
+ */
+ public function setAddedDate($addedDate)
+ {
+ $this->addedDate = $addedDate;
+
+ return $this;
+ }
+
+ /**
+ * Get addedDate
+ *
+ * @return \DateTime
+ */
+ public function getAddedDate()
+ {
+ return $this->addedDate;
+ }
+
+ /**
+ * Set description
+ *
+ * @param string $description
+ * @return Event
+ */
+ public function setDescription($description)
+ {
+ $this->description = $description;
+
+ return $this;
+ }
+
+ /**
+ * Get description
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->description;
+ }
+
+ /**
+ * Set title
+ *
+ * @param string $title
+ * @return Event
+ */
+ public function setTitle($title)
+ {
+ $this->title = $title;
+
+ return $this;
+ }
+
+ /**
+ * Get title
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->title;
+ }
+
+ /**
+ * Set street
+ *
+ * @param string $street
+ * @return Event
+ */
+ public function setStreet($street)
+ {
+ $this->street = $street;
+
+ return $this;
+ }
+
+ /**
+ * Get street
+ *
+ * @return string
+ */
+ public function getStreet()
+ {
+ return $this->street;
+ }
+
+ /**
+ * Set mark
+ *
+ * @param integer $mark
+ * @return Event
+ */
+ public function setMark($mark)
+ {
+ $this->mark = $mark;
+
+ return $this;
+ }
+
+ /**
+ * Get mark
+ *
+ * @return integer
+ */
+ public function getMark()
+ {
+ return $this->mark;
+ }
+
+ /**
+ * Set numberMark
+ *
+ * @param integer $numberMark
+ * @return Event
+ */
+ public function setNumberMark($numberMark)
+ {
+ $this->numberMark = $numberMark;
+
+ return $this;
+ }
+
+ /**
+ * Get numberMark
+ *
+ * @return integer
+ */
+ public function getNumberMark()
+ {
+ return $this->numberMark;
+ }
+
+ /**
+ * Set city
+ *
+ * @param CTRV\CommonBundle\Entity\City $city
+ * @return Event
+ */
+ public function setCity(\CTRV\CommonBundle\Entity\City $city = null)
+ {
+ $this->city = $city;
+
+ return $this;
+ }
+
+ /**
+ * Get city
+ *
+ * @return CTRV\CommonBundle\Entity\City
+ */
+ public function getCity()
+ {
+ return $this->city;
+ }
+
+ /**
+ * Set eventType
+ *
+ * @param CTRV\CommonBundle\Entity\EventType $eventType
+ * @return Event
+ */
+ public function setEventType(EventType $eventType = null)
+ {
+ $this->eventType = $eventType;
+
+ return $this;
+ }
+
+ /**
+ * Get eventType
+ *
+ * @return CTRV\CommonBundle\Entity\EventType
+ */
+ public function getEventType()
+ {
+ return $this->eventType;
+ }
+
+ /**
+ * Set auteur
+ *
+ * @param CTRV\CommonBundle\Entity\User $auteur
+ * @return Event
+ */
+ public function setAuteur(\CTRV\CommonBundle\Entity\User $auteur = null)
+ {
+ $this->auteur = $auteur;
+
+ return $this;
+ }
+
+ /**
+ * Get auteur
+ *
+ * @return CTRV\CommonBundle\Entity\User
+ */
+ public function getAuteur()
+ {
+ return $this->auteur;
+ }
+
+
+ /**
+ * Set isPrivate
+ *
+ * @param boolean $isPrivate
+ * @return Event
+ */
+ public function setIsPrivate($isPrivate)
+ {
+ $this->isPrivate = $isPrivate;
+ }
+
+ /**
+ * Get isPrivate
+ *
+ * @return boolean
+ */
+ public function getIsPrivate()
+ {
+ return $this->isPrivate;
+ }
+
+ /**
+ * Set visibility
+ *
+ * @param string $visibility
+ * @return Event
+ */
+ public function setVisibility($visibility)
+ {
+ $this->visibility = $visibility;
+
+ return $this;
+ }
+
+ /**
+ * Get visibility
+ *
+ * @return string
+ */
+ public function getVisibility()
+ {
+ return $this->visibility;
+ }
+
+ /**
+ * Set accessRight
+ *
+ * @param string $accessRight
+ * @return Event
+ */
+ public function setAccessRight($accessRight)
+ {
+ $this->accessRight = $accessRight;
+
+ return $this;
+ }
+
+ /**
+ * Get accessRight
+ *
+ * @return string
+ */
+ public function getAccessRight()
+ {
+ return $this->accessRight;
+ }
+
+ /**
+ * Set startDate
+ *
+ * @param \DateTime $startDate
+ * @return Event
+ */
+ public function setStartDate($startDate)
+ {
+ $this->startDate = $startDate;
+
+ return $this;
+ }
+
+ /**
+ * Get startDate
+ *
+ * @return \DateTime
+ */
+ public function getStartDate()
+ {
+ return $this->startDate;
+ }
+
+ /**
+ * Set endDate
+ *
+ * @param \DateTime $endDate
+ * @return Event
+ */
+ public function setEndDate($endDate)
+ {
+ $this->endDate = $endDate;
+
+ return $this;
+ }
+
+ /**
+ * Get endDate
+ *
+ * @return \DateTime
+ */
+ public function getEndDate()
+ {
+ return $this->endDate;
+ }
+
+ /**
+ * Set startTime
+ *
+ * @param string $startTime
+ * @return Event
+ */
+ public function setStartTime($startTime)
+ {
+ $this->startTime = $startTime;
+
+ return $this;
+ }
+
+ /**
+ * Get startTime
+ *
+ * @return string
+ */
+ public function getStartTime()
+ {
+ return $this->startTime;
+ }
+
+ /**
+ * Set endTime
+ *
+ * @param string $endTime
+ * @return Event
+ */
+ public function setEndTime($endTime)
+ {
+ $this->endTime = $endTime;
+
+ return $this;
+ }
+
+ /**
+ * Get endTime
+ *
+ * @return string
+ */
+ public function getEndTime()
+ {
+ return $this->endTime;
+ }
+
+ /**
+ * Set isRealtime
+ *
+ * @param boolean $isRealtime
+ * @return Event
+ */
+ public function setIsRealtime($isRealtime)
+ {
+ $this->isRealtime = $isRealtime;
+
+ return $this;
+ }
+
+ /**
+ * Get isRealtime
+ *
+ * @return boolean
+ */
+ public function getIsRealtime()
+ {
+ return $this->isRealtime;
+ }
+ /**
+ * Constructor
+ */
+ public function __construct()
+ {
+ $this->eventUpdates = new \Doctrine\Common\Collections\ArrayCollection();
+ }
+
+ /**
+ * Set lastUpdateDate
+ *
+ * @param \DateTime $lastUpdateDate
+ * @return Event
+ */
+ public function setLastUpdateDate($lastUpdateDate)
+ {
+ $this->lastUpdateDate = $lastUpdateDate;
+
+ return $this;
+ }
+
+ /**
+ * Get lastUpdateDate
+ *
+ * @return \DateTime
+ */
+ public function getLastUpdateDate()
+ {
+ return $this->lastUpdateDate;
+ }
+
+ /**
+ * Add eventUpdates
+ *
+ * @param CTRV\EventBundle\Entity\Event $eventUpdates
+ * @return Event
+ */
+ public function addEventUpdate(\CTRV\EventBundle\Entity\Event $eventUpdates)
+ {
+ $this->eventUpdates[] = $eventUpdates;
+
+ return $this;
+ }
+
+ /**
+ * Remove eventUpdates
+ *
+ * @param CTRV\EventBundle\Entity\Event $eventUpdates
+ */
+ public function removeEventUpdate(\CTRV\EventBundle\Entity\Event $eventUpdates)
+ {
+ $this->eventUpdates->removeElement($eventUpdates);
+ }
+
+ /**
+ * Get eventUpdates
+ *
+ * @return Doctrine\Common\Collections\Collection
+ */
+ public function getEventUpdates()
+ {
+ return $this->eventUpdates;
+ }
+}
\ No newline at end of file
diff --git a/CTRV/EventBundle/Entity/EventFollower.php b/CTRV/EventBundle/Entity/EventFollower.php
new file mode 100644
index 0000000..0f299cb
--- /dev/null
+++ b/CTRV/EventBundle/Entity/EventFollower.php
@@ -0,0 +1,214 @@
+id;
+ }
+
+ /**
+ * Set type
+ *
+ * @param string $type
+ * @return EventFollower
+ */
+ public function setType($type)
+ {
+ $this->type = $type;
+
+ return $this;
+ }
+
+ /**
+ * Get type
+ *
+ * @return string
+ */
+ public function getType()
+ {
+ return $this->type;
+ }
+
+ /**
+ * Set participate
+ *
+ * @param boolean $participate
+ * @return EventFollower
+ */
+ public function setParticipate($participate)
+ {
+ $this->participate = $participate;
+
+ return $this;
+ }
+
+ /**
+ * Get participate
+ *
+ * @return boolean
+ */
+ public function getParticipate()
+ {
+ return $this->participate;
+ }
+
+ /**
+ * Set wasThere
+ *
+ * @param boolean $wasThere
+ * @return EventFollower
+ */
+ public function setWasThere($wasThere)
+ {
+ $this->wasThere = $wasThere;
+
+ return $this;
+ }
+
+ /**
+ * Get wasThere
+ *
+ * @return boolean
+ */
+ public function getWasThere()
+ {
+ return $this->wasThere;
+ }
+
+ /**
+ * Set user
+ *
+ * @param CTRV\CommonBundle\Entity\User $user
+ * @return EventFollower
+ */
+ public function setUser(\CTRV\CommonBundle\Entity\User $user = null)
+ {
+ $this->user = $user;
+
+ return $this;
+ }
+
+ /**
+ * Get user
+ *
+ * @return CTRV\CommonBundle\Entity\User
+ */
+ public function getUser()
+ {
+ return $this->user;
+ }
+
+ /**
+ * Set id_event_agenda_place
+ *
+ * @param integer $idEventAgendaPlace
+ * @return EventFollower
+ */
+ public function setIdEventAgendaPlace($idEventAgendaPlace)
+ {
+ $this->id_event_agenda_place = $idEventAgendaPlace;
+
+ return $this;
+ }
+
+ /**
+ * Get id_event_agenda_place
+ *
+ * @return integer
+ */
+ public function getIdEventAgendaPlace()
+ {
+ return $this->id_event_agenda_place;
+ }
+
+ /**
+ * Set isAccepted
+ *
+ * @param boolean $isAccepted
+ * @return EventFollower
+ */
+ public function setIsAccepted($isAccepted)
+ {
+ $this->isAccepted = $isAccepted;
+
+ return $this;
+ }
+
+ /**
+ * Get isAccepted
+ *
+ * @return boolean
+ */
+ public function getIsAccepted()
+ {
+ return $this->isAccepted;
+ }
+}
\ No newline at end of file
diff --git a/CTRV/EventBundle/Entity/EventFollowerRepository.php b/CTRV/EventBundle/Entity/EventFollowerRepository.php
new file mode 100644
index 0000000..56a254d
--- /dev/null
+++ b/CTRV/EventBundle/Entity/EventFollowerRepository.php
@@ -0,0 +1,15 @@
+createQueryBuilder("e")
+ ->where("e.auteur is not null")
+ ->andWhere("e.city=?1")
+ ->andWhere("e.isPrivate=?2")
+ ->andWhere("e.duration > 0")
+ ->andWhere("e.isRealtime=?3")
+ ->orderBy('e.addedDate', 'DESC')
+ ->setParameter(1, $city)
+ ->setParameter(2, false)
+ ->setParameter(3, true)
+ ->setFirstResult($first)
+ ->setMaxResults($last)
+ ;
+ return $qb->getQuery()->getResult();
+ }
+
+ /**
+ * retourne le nombre d'événements en cours de la ville courante
+ */
+ public function getEventNumber($city) {
+ $qb = $this->createQueryBuilder("e")
+ ->select("count(e)")
+ ->where("e.auteur is not null")
+ ->andWhere("e.duration > 0")
+ ->andWhere("e.city=?1")
+ ->andWhere("e.isPrivate=?2")
+ ->andWhere("e.isRealtime=?3")
+ ->orderBy('e.addedDate', 'DESC')
+ ->setParameter(1, $city)
+ ->setParameter(2, false)
+ ->setParameter(3, true)
+ ;
+ return $qb->getQuery()->getSingleScalarResult();
+ }
+
+
+ /**
+ * retourne la liste des événements ayant des mis à jour proposés de la ville courante
+ */
+ public function getEventUpdatedByCity($city, $first, $last) {
+ $qb = $this->createQueryBuilder("e")
+ ->from('CTRV\EventBundle\Entity\UpdatedEvent','u')
+ ->where("e.id=u.event")
+ ->andWhere("e.auteur is not null")
+ ->andWhere("e.city=?1")
+ ->andWhere("e.isPrivate=?2")
+ ->andWhere("e.duration > 0")
+ ->andWhere("e.isRealtime=?3")
+ ->orderBy('e.addedDate', 'DESC')
+ ->setParameter(1, $city)
+ ->setParameter(2, false)
+ ->setParameter(3, true)
+ ->setFirstResult($first)
+ ->setMaxResults($last)
+ ;
+ return $qb->getQuery()->getResult();
+ }
+ /**
+ * retourne la liste des événements ayant des mis à jour proposés de la ville courante
+ */
+ public function getEventWithUpdateProposedByCity($city) {
+ $qb = $this->createQueryBuilder("e")
+ ->from('CTRV\EventBundle\Entity\UpdatedEvent','u')
+ ->where("e.id=u.event")
+ ->andWhere("e.auteur is not null")
+ ->andWhere("e.city=?1")
+ ->andWhere("e.isPrivate=?2")
+ ->andWhere("e.duration > 0")
+ ->andWhere("e.isRealtime=?3")
+ ->orderBy('e.addedDate', 'DESC')
+ ->setParameter(1, $city)
+ ->setParameter(2, false)
+ ->setParameter(3, true)
+ ;
+ return $qb->getQuery()->getResult();
+ }
+
+ /**
+ * retourne un événement ayant des mis à jour proposés de la ville courante
+ */
+ public function getcurrentEventWithUpdateProposed($id, $city, $first, $last) {
+ $qb = $this->createQueryBuilder("e")
+ ->from('CTRV\EventBundle\Entity\UpdatedEvent','u')
+ ->where("e.id=u.event")
+ ->andWhere("e.auteur is not null")
+ ->andWhere("e.id=?1")
+ ->andWhere("e.city=?2")
+ ->andWhere("e.isPrivate=?3")
+ ->andWhere("e.duration > 0")
+ ->andWhere("e.isRealtime=?4")
+ ->orderBy('e.addedDate', 'DESC')
+ ->setParameter(1, $id)
+ ->setParameter(2, $city)
+ ->setParameter(3, false)
+ ->setParameter(4, true)
+ ->setFirstResult($first)
+ ->setMaxResults($last)
+ ;
+ return $qb->getQuery()->getResult();
+ }
+
+
+ /**
+ * retourne le nombre d'événements ayant des mis à jour proposés de la ville courante
+ */
+ public function getEventUpdatedByCityNumber($city) {
+ $qb = $this->createQueryBuilder("e")
+ ->select("count(DISTINCT u.event)")
+ ->from('CTRV\EventBundle\Entity\UpdatedEvent','u')
+ ->where("e.id=u.event")
+ ->andWhere("e.auteur is not null")
+ ->andWhere("e.city=?1")
+ ->andWhere("e.isPrivate=?2")
+ ->andWhere("e.duration > 0")
+ ->andWhere("e.isRealtime=?3")
+ ->orderBy('e.addedDate', 'DESC')
+ ->setParameter(1, $city)
+ ->setParameter(2, false)
+ ->setParameter(3, true)
+ ;
+ return $qb->getQuery()->getSingleScalarResult();
+ }
+
+
+ /**
+ * retourne la liste des événements passés de la ville courante
+ */
+ public function getEventPassed($city, $first, $last) {
+ $qb = $this->createQueryBuilder("p")
+ ->where("p.auteur is not null")
+ ->andWhere("p.city=?1")
+ ->andWhere("p.isPrivate=?2")
+ ->andWhere("p.duration <= 0")
+ ->andWhere("p.isRealtime=?3")
+ ->orderBy('p.addedDate', 'DESC')
+ ->setParameter(1, $city)
+ ->setParameter(2, false)
+ ->setParameter(3, true)
+ ->setFirstResult($first)
+ ->setMaxResults($last)
+ ;
+ return $qb->getQuery()->getResult();
+ }
+
+ /**
+ * retourne le nombre d'événements passés de la ville courante
+ */
+ public function getEventPassedNumber($city) {
+ $qb = $this->createQueryBuilder("p")
+ ->select("count(p)")
+ ->where("p.auteur is not null")
+ ->andWhere("p.duration <= 0")
+ ->andWhere("p.city=?1")
+ ->andWhere("p.isPrivate=?2")
+ ->andWhere("p.isRealtime=?3")
+ ->orderBy('p.addedDate', 'DESC')
+ ->setParameter(1, $city)
+ ->setParameter(2, false)
+ ->setParameter(3, true)
+ ;
+ return $qb->getQuery()->getSingleScalarResult();
+ }
+
+
+ /**
+ * retourne la liste des agendas passés de la ville courante
+ */
+ public function getPassedAgenda ($city, $first, $last, $date) {
+ $qb = $this->createQueryBuilder("p")
+ ->where("p.auteur is not null")
+ ->andWhere("p.city=?1")
+ ->andWhere("p.isPrivate=?2")
+ ->andWhere("p.isRealtime=?3")
+ ->andWhere("p.startDate is not null ")
+ ->andWhere("p.startDate4")
+ ->orderBy('p.addedDate', 'DESC')
+ ->setParameter(1, $city)
+ ->setParameter(2, false)
+ ->setParameter(3, false)
+ ->setParameter(4, $date)
+ ->setFirstResult($first)
+ ->setMaxResults($last)
+ ;
+ return $qb->getQuery()->getResult();
+ }
+
+ /**
+ * retourne le nombre d'agendas en cours de la ville courante
+ */
+ public function getPassedAgendaNumber($city, $date) {
+ $qb = $this->createQueryBuilder("p")
+ ->select("count(p)")
+ ->where("p.auteur is not null")
+ ->andWhere("p.city=?1")
+ ->andWhere("p.isPrivate=?2")
+ ->andWhere("p.isRealtime=?3")
+ ->andWhere("p.startDate is not null ")
+ ->andWhere("p.startDate4")
+ ->orderBy('p.addedDate', 'DESC')
+ ->setParameter(1, $city)
+ ->setParameter(2, false)
+ ->setParameter(3, false)
+ ->setParameter(4, $date)
+ ;
+ return $qb->getQuery()->getSingleScalarResult();
+ }
+
+ /**
+ * retourne la liste des agendas en cours de la ville courante
+ */
+ public function getCurrentAgenda ($city, $first, $last, $date) {
+ $qb = $this->createQueryBuilder("p")
+ ->where("p.auteur is not null")
+ ->andWhere("p.city=?1")
+ ->andWhere("p.isPrivate=?2")
+ ->andWhere("p.isRealtime=?3")
+ ->andWhere("p.startDate is not null ")
+ ->andWhere("p.startDate >=?4")
+ ->orderBy('p.addedDate', 'DESC')
+ ->setParameter(1, $city)
+ ->setParameter(2, false)
+ ->setParameter(3, false)
+ ->setParameter(4, $date)
+ ->setFirstResult($first)
+ ->setMaxResults($last)
+ ;
+ return $qb->getQuery()->getResult();
+ }
+
+ /**
+ * retourne le nombre d'agendas en cours de la ville courante
+ */
+ public function getCurrentAgendaNumber($city, $date) {
+ $qb = $this->createQueryBuilder("p")
+ ->select("count(p)")
+ ->where("p.auteur is not null")
+ ->andWhere("p.city=?1")
+ ->andWhere("p.isPrivate=?2")
+ ->andWhere("p.isRealtime=?3")
+ ->andWhere("p.startDate is not null ")
+ ->andWhere("p.startDate >=?4")
+ ->orderBy('p.addedDate', 'DESC')
+ ->setParameter(1, $city)
+ ->setParameter(2, false)
+ ->setParameter(3, false)
+ ->setParameter(4, $date)
+ ;
+ return $qb->getQuery()->getSingleScalarResult();
+ }
+
+ /**
+ * retourne la liste des mis à jour proposés pour l'événement spécifié
+ */
+ public function getUpdatePerEvent ($id, $city, $first, $last) {
+ $qb = $this->createQueryBuilder("e")
+ ->select('e')
+ ->from('CTRV\EventBundle\Entity\UpdatedEvent','u')
+ ->where("e.id=?1")
+ ->andWhere("e.id=u.event")
+ ->andWhere("e.city=?2")
+ ->orderBy('e.addedDate', 'DESC')
+ ->setParameter(1,$id)
+ ->setParameter(2,$city)
+ ->setFirstResult($first)
+ ->setMaxResults($last)
+ ;
+ return $qb->getQuery()->getSingleScalarResult();
+ }
+
+
+ /**
+ * retourne le nombre de mis à jour proposés pour l'événement spécifié
+ */
+ public function getUpdatePerEventNumber ($id) {
+ $qb = $this->createQueryBuilder("e")
+ ->select("count(e)")
+ ->from('CTRV\EventBundle\Entity\UpdatedEvent','u')
+ ->where("e.id=?1")
+ ->andWhere("e.id=u.event")
+ ->orderBy('e.addedDate', 'DESC')
+ ->setParameter(1,$id)
+ ;
+ return $qb->getQuery()->getSingleScalarResult();
+ }
+
+}
\ No newline at end of file
diff --git a/CTRV/EventBundle/Entity/EventType.php b/CTRV/EventBundle/Entity/EventType.php
new file mode 100644
index 0000000..d605de1
--- /dev/null
+++ b/CTRV/EventBundle/Entity/EventType.php
@@ -0,0 +1,158 @@
+id;
+ }
+
+ /**
+ * Set label
+ *
+ * @param string $label
+ * @return EventType
+ */
+ public function setLabel($label)
+ {
+ $this->label = $label;
+
+ return $this;
+ }
+
+ /**
+ * Get label
+ *
+ * @return string
+ */
+ public function getLabel()
+ {
+ return $this->label;
+ }
+ public function __toString() {
+ return $this->label;
+ }
+
+
+ /**
+ * Set code
+ *
+ * @param string $code
+ * @return EventType
+ */
+ public function setCode($code)
+ {
+ $this->code = $code;
+
+ return $this;
+ }
+
+ /**
+ * Get code
+ *
+ * @return string
+ */
+ public function getCode()
+ {
+ return $this->code;
+ }
+
+ /**
+ * Set language
+ *
+ * @param string $language
+ * @return EventType
+ */
+ public function setLanguage($language)
+ {
+ $this->language = $language;
+
+ return $this;
+ }
+
+ /**
+ * Get language
+ *
+ * @return string
+ */
+ public function getLanguage()
+ {
+ return $this->language;
+ }
+
+ /**
+ * Set img_url
+ *
+ * @param string $imgUrl
+ * @return EventType
+ */
+ public function setImgUrl($imgUrl)
+ {
+ $this->img_url = $imgUrl;
+
+ return $this;
+ }
+
+ /**
+ * Get img_url
+ *
+ * @return string
+ */
+ public function getImgUrl()
+ {
+ return $this->img_url;
+ }
+}
\ No newline at end of file
diff --git a/CTRV/EventBundle/Entity/EventTypeRepository.php b/CTRV/EventBundle/Entity/EventTypeRepository.php
new file mode 100644
index 0000000..80d41b7
--- /dev/null
+++ b/CTRV/EventBundle/Entity/EventTypeRepository.php
@@ -0,0 +1,35 @@
+createQueryBuilder("p")
+ ->orderBy('p.code','ASC')
+ ->setFirstResult($first)
+ ->setMaxResults($last)
+ ;
+ return $qb->getQuery()->getResult();
+ }
+
+ /**
+ * retourne le nombre de types d'évenements
+ */
+ public function getTypeEventsNumber(){
+ $qb= $this->createQueryBuilder("p")
+ ->select("count(p)")
+ ->orderBy('p.code','ASC')
+ ;
+ return $qb->getQuery()->getSingleScalarResult();
+ }
+
+}
\ No newline at end of file
diff --git a/CTRV/EventBundle/Entity/UpdatedEvent.php b/CTRV/EventBundle/Entity/UpdatedEvent.php
new file mode 100644
index 0000000..3ec4361
--- /dev/null
+++ b/CTRV/EventBundle/Entity/UpdatedEvent.php
@@ -0,0 +1,433 @@
+addedDate = new \DateTime();
+ }
+
+ /**
+ * Get id
+ *
+ * @return integer
+ */
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * Set latitude
+ *
+ * @param string $latitude
+ * @return UpdatedEvent
+ */
+ public function setLatitude($latitude)
+ {
+ $this->latitude = $latitude;
+
+ return $this;
+ }
+
+ /**
+ * Get latitude
+ *
+ * @return string
+ */
+ public function getLatitude()
+ {
+ return $this->latitude;
+ }
+
+ /**
+ * Set longitude
+ *
+ * @param string $longitude
+ * @return UpdatedEvent
+ */
+ public function setLongitude($longitude)
+ {
+ $this->longitude = $longitude;
+
+ return $this;
+ }
+
+ /**
+ * Get longitude
+ *
+ * @return string
+ */
+ public function getLongitude()
+ {
+ return $this->longitude;
+ }
+
+ /**
+ * Set duration
+ *
+ * @param integer $duration
+ * @return UpdatedEvent
+ */
+ public function setDuration($duration)
+ {
+ $this->duration = $duration;
+
+ return $this;
+ }
+
+ /**
+ * Get duration
+ *
+ * @return integer
+ */
+ public function getDuration()
+ {
+ return $this->duration;
+ }
+
+ /**
+ * Set addedDate
+ *
+ * @param \DateTime $addedDate
+ * @return UpdatedEvent
+ */
+ public function setAddedDate($addedDate)
+ {
+ $this->addedDate = $addedDate;
+
+ return $this;
+ }
+
+ /**
+ * Get addedDate
+ *
+ * @return \DateTime
+ */
+ public function getAddedDate()
+ {
+ return $this->addedDate;
+ }
+
+ /**
+ * Set description
+ *
+ * @param string $description
+ * @return UpdatedEvent
+ */
+ public function setDescription($description)
+ {
+ $this->description = $description;
+
+ return $this;
+ }
+
+ /**
+ * Get description
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->description;
+ }
+
+ /**
+ * Set title
+ *
+ * @param string $title
+ * @return UpdatedEvent
+ */
+ public function setTitle($title)
+ {
+ $this->title = $title;
+
+ return $this;
+ }
+
+ /**
+ * Get title
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->title;
+ }
+
+ /**
+ * Set street
+ *
+ * @param string $street
+ * @return UpdatedEvent
+ */
+ public function setStreet($street)
+ {
+ $this->street = $street;
+
+ return $this;
+ }
+
+ /**
+ * Get street
+ *
+ * @return string
+ */
+ public function getStreet()
+ {
+ return $this->street;
+ }
+
+ /**
+ * Set startDate
+ *
+ * @param \DateTime $startDate
+ * @return UpdatedEvent
+ */
+ public function setStartDate($startDate)
+ {
+ $this->startDate = $startDate;
+
+ return $this;
+ }
+
+ /**
+ * Get startDate
+ *
+ * @return \DateTime
+ */
+ public function getStartDate()
+ {
+ return $this->startDate;
+ }
+
+ /**
+ * Set endDate
+ *
+ * @param \DateTime $endDate
+ * @return UpdatedEvent
+ */
+ public function setEndDate($endDate)
+ {
+ $this->endDate = $endDate;
+
+ return $this;
+ }
+
+ /**
+ * Get endDate
+ *
+ * @return \DateTime
+ */
+ public function getEndDate()
+ {
+ return $this->endDate;
+ }
+
+ /**
+ * Set startTime
+ *
+ * @param string $startTime
+ * @return UpdatedEvent
+ */
+ public function setStartTime($startTime)
+ {
+ $this->startTime = $startTime;
+
+ return $this;
+ }
+
+ /**
+ * Get startTime
+ *
+ * @return string
+ */
+ public function getStartTime()
+ {
+ return $this->startTime;
+ }
+
+ /**
+ * Set endTime
+ *
+ * @param string $endTime
+ * @return UpdatedEvent
+ */
+ public function setEndTime($endTime)
+ {
+ $this->endTime = $endTime;
+
+ return $this;
+ }
+
+ /**
+ * Get endTime
+ *
+ * @return string
+ */
+ public function getEndTime()
+ {
+ return $this->endTime;
+ }
+
+ /**
+ * Set event
+ *
+ * @param CTRV\EventBundle\Entity\Event $event
+ * @return UpdatedEvent
+ */
+ public function setEvent(\CTRV\EventBundle\Entity\Event $event = null)
+ {
+ $this->event = $event;
+
+ return $this;
+ }
+
+ /**
+ * Get event
+ *
+ * @return CTRV\EventBundle\Entity\Event
+ */
+ public function getEvent()
+ {
+ return $this->event;
+ }
+
+ /**
+ * Set auteur
+ *
+ * @param CTRV\CommonBundle\Entity\User $auteur
+ * @return UpdatedEvent
+ */
+ public function setAuteur(\CTRV\CommonBundle\Entity\User $auteur = null)
+ {
+ $this->auteur = $auteur;
+
+ return $this;
+ }
+
+ /**
+ * Get auteur
+ *
+ * @return CTRV\CommonBundle\Entity\User
+ */
+ public function getAuteur()
+ {
+ return $this->auteur;
+ }
+}
\ No newline at end of file
diff --git a/CTRV/EventBundle/Entity/UpdatedEventRepository.php b/CTRV/EventBundle/Entity/UpdatedEventRepository.php
new file mode 100644
index 0000000..efdb863
--- /dev/null
+++ b/CTRV/EventBundle/Entity/UpdatedEventRepository.php
@@ -0,0 +1,55 @@
+createQueryBuilder("e")
+ ->from('CTRV\EventBundle\Entity\Event','ev')
+ ->where("e.auteur is not null")
+ ->andWhere("ev.id=e.event")
+ ->andWhere("e.event=?1")
+ ->andWhere("ev.city=?2")
+ ->andWhere("e.duration > 0")
+ ->orderBy('e.addedDate', 'DESC')
+ ->setParameter(1, $id)
+ ->setParameter(2,$city)
+ ->setFirstResult($first)
+ ->setMaxResults($last)
+ ;
+ return $qb->getQuery()->getResult();
+ }
+
+ /**
+ * Retourne le nombre de mis à jour proposés pour un événement spécifié
+ */
+ public function getUpdatePerEventNumber($id, $city) {
+ $qb = $this->createQueryBuilder("e")
+ ->select("count(e)")
+ ->from('CTRV\EventBundle\Entity\Event','ev')
+ ->where("e.auteur is not null")
+ ->andWhere("ev.id=e.event")
+ ->andWhere("e.event=?1")
+ ->andWhere("ev.city=?2")
+ ->andWhere("e.duration > 0")
+ ->orderBy('e.addedDate', 'DESC')
+ ->setParameter(1, $id)
+ ->setParameter(2,$city)
+ ;
+ return $qb->getQuery()->getSingleScalarResult();
+ }
+
+}
diff --git a/CTRV/EventBundle/Form/EventTypeType.php b/CTRV/EventBundle/Form/EventTypeType.php
new file mode 100644
index 0000000..e70dc57
--- /dev/null
+++ b/CTRV/EventBundle/Form/EventTypeType.php
@@ -0,0 +1,38 @@
+add('label','text',array('label'=>'event.ajouterForm.libelle'))
+ ->add('code','text',array('label'=>'event.ajouterForm.code'))
+ ->add('language','choice',array('label'=>'event.ajouterForm.langue','choices'=>array(
+ 'FRENCH' => 'event.ajouterForm.fr',
+ 'ENGLISH' => 'event.ajouterForm.en',
+ 'SPANISH' => 'event.ajouterForm.es',
+ ),
+ ))
+ ->add('img_url','file',array('label'=>'event.ajouterForm.select_file', 'required'=>false))
+ ;
+ }
+
+ public function setDefaultOptions(OptionsResolverInterface $resolver)
+ {
+ $resolver->setDefaults(array(
+ 'data_class' => 'CTRV\EventBundle\Entity\EventType'
+ ));
+ }
+
+ public function getName()
+ {
+ return 'ctrv_eventbundle_eventtypetype';
+ }
+}
diff --git a/CTRV/EventBundle/Form/UpdatedEventType.php b/CTRV/EventBundle/Form/UpdatedEventType.php
new file mode 100644
index 0000000..ac32465
--- /dev/null
+++ b/CTRV/EventBundle/Form/UpdatedEventType.php
@@ -0,0 +1,41 @@
+add('latitude')
+ ->add('longitude')
+ ->add('duration')
+ ->add('addedDate')
+ ->add('description')
+ ->add('title')
+ ->add('street')
+ ->add('startDate')
+ ->add('endDate')
+ ->add('startTime')
+ ->add('endTime')
+ ->add('event')
+ ->add('auteur')
+ ;
+ }
+
+ public function setDefaultOptions(OptionsResolverInterface $resolver)
+ {
+ $resolver->setDefaults(array(
+ 'data_class' => 'CTRV\EventBundle\Entity\UpdatedEvent'
+ ));
+ }
+
+ public function getName()
+ {
+ return 'ctrv_eventbundle_updatedeventtype';
+ }
+}
diff --git a/CTRV/EventBundle/Resources/config/services.yml b/CTRV/EventBundle/Resources/config/services.yml
new file mode 100644
index 0000000..3d6e822
--- /dev/null
+++ b/CTRV/EventBundle/Resources/config/services.yml
@@ -0,0 +1,14 @@
+services:
+ event_service:
+ class: CTRV\EventBundle\Service\EventService
+ arguments: [@mailer,@doctrine,@service_container,@templating,@translator]
+ agenda_service:
+ class: CTRV\EventBundle\Service\AgendaService
+ arguments: [@mailer,@doctrine,@service_container,@templating,@translator]
+ agendaComment_service:
+ class: CTRV\EventBundle\Service\AgendaCommentService
+ arguments: [@mailer,@doctrine,@service_container,@templating,@translator]
+ eventComment_service:
+ class: CTRV\EventBundle\Service\EventCommentService
+ arguments: [@mailer,@doctrine,@service_container,@templating,@translator]
+
\ No newline at end of file
diff --git a/CTRV/EventBundle/Resources/doc/index.rst b/CTRV/EventBundle/Resources/doc/index.rst
new file mode 100644
index 0000000..e69de29
diff --git a/CTRV/EventBundle/Resources/public/js/agenda.js b/CTRV/EventBundle/Resources/public/js/agenda.js
new file mode 100644
index 0000000..14ca76b
--- /dev/null
+++ b/CTRV/EventBundle/Resources/public/js/agenda.js
@@ -0,0 +1,32 @@
+/**
+ * Retourne la liste des agendas selon la page spécifié
+ */
+function loadAgenda (urlAction,ppage,container) {
+ container.html('');
+
+ $.post(urlAction,
+ {
+ page:ppage
+ },
+ function (data) {
+ container.html(data);
+ },
+ 'html'
+ );
+}
+
+/**
+ * Supprime un agenda
+ */
+function deleteAgenda (urlAction, tr_elem) {
+ $.post(urlAction,
+ {
+ },
+ function (data) {
+ if(data.result){
+ tr_elem.remove();
+ }
+ },
+ 'json'
+ );
+}
\ No newline at end of file
diff --git a/CTRV/EventBundle/Resources/public/js/event.js b/CTRV/EventBundle/Resources/public/js/event.js
new file mode 100644
index 0000000..be079bf
--- /dev/null
+++ b/CTRV/EventBundle/Resources/public/js/event.js
@@ -0,0 +1,48 @@
+/**
+ * Retourne la liste des événements selon le type et la page spécifié
+ */
+function loadEvent (urlAction,ppage,container) {
+ container.html('');
+
+ $.post(urlAction,
+ {
+ page:ppage
+ },
+ function (data) {
+ container.html(data);
+ },
+ 'html'
+ );
+}
+
+/**
+ * Supprime un évenements
+ */
+function deleteEvent (urlAction, tr_elem) {
+ $.post(urlAction,
+ {
+ },
+ function (data) {
+ if(data.result){
+ tr_elem.remove();
+ }
+ },
+ 'json'
+ );
+}
+
+/**
+ * Supprime un type d'évenements
+ */
+function deleteEventType (urlAction, tr_elem) {
+ $.post(urlAction,
+ {
+ },
+ function (data) {
+ if(data.result){
+ tr_elem.remove();
+ }
+ },
+ 'json'
+ );
+}
\ No newline at end of file
diff --git a/CTRV/EventBundle/Resources/translations/messages.fr.yml b/CTRV/EventBundle/Resources/translations/messages.fr.yml
new file mode 100644
index 0000000..4ad42a6
--- /dev/null
+++ b/CTRV/EventBundle/Resources/translations/messages.fr.yml
@@ -0,0 +1,102 @@
+agenda:
+ menu:
+ currentAgenda: Liste des agendas en cours
+ passedAgenda : Liste des agendas passés
+ list:
+ title: Liste des évènements publics futur ajoutés
+ titlePassed: Liste des évènements publics futur dépassés
+ titleAllAgendaAt : Nombre total d'événements publics futurs à
+ titleAllAgendaPassedAt : Nombre d'événements passés à
+ table:
+ title: Titre
+ description: Description
+ adresse: Adresse
+ author: Auteur
+ start_date : Date de début
+ addedDate: Date d'ajout
+ action: Actions
+ delete_action: Supprimer
+ no_result: Aucun agenda trouvé
+
+event:
+ menu:
+ currentEvent: Liste des événements en cours
+ passedEvent : Liste des événements passés
+ eventUpdated : Liste des événements mis à jour
+ add : Ajouter
+ type : Types d'évenements
+ list:
+ titlePublicEvent: Liste des événements publics temps rééls ajoutés
+ titlePublicEventUpdated : Liste des événements avec mis à jour
+ titlePublicEventPassed: Liste des événements publics passés
+ titleTypeEvent: Liste des types d'évenements
+ titleAllEventAt : Nombre total d'événements à
+ titleAllEventPassedAt : Nombre d'événements passés à
+ titleEventUpdatedAt : Nombre d'événements mis à jour à
+ titleUpdatePerEvent: Liste des mis à jours de l'événement
+ LastValues : Anciennes valeurs
+ titleAllUpdate : Nombre total de mis à jour
+ table:
+ title: Titre
+ description: Description
+ adresse: Adresse
+ author: Auteur
+ duration : Durée
+ update_number : Nombre de mis à jour
+ addedDate: Date d'ajout
+ action: Actions
+ delete_action: Supprimer
+ update_action: Modifier
+ view_action : Afficher
+ validate_action : Valider
+ back_action : Retour
+ code: Code
+ label: Libellé
+ language: Langue
+ img_url: Icône
+ no_result: Aucun événement trouvé
+ ajouterForm:
+ titleAddEventType : Ajouter un type d'évenement
+ titleUpdateEventType: Modifier un type d'évenement
+ select_file : Selectionner un fichier
+ libelle: Libellé
+ code : Code
+ langue: Langue
+ fr : French
+ en : English
+ es : Spanish
+ save : Sauvegarder
+ rechercheForm:
+ title : Liste des évenements correspondant à votre recherche
+ rechercher: Entrer le nom d'un évenement
+
+agendaComment:
+ menu:
+ afficher: Commentaires des agendas
+
+ list:
+ title: Liste des commentaires des évènements publics futur
+ table:
+ author: Auteur
+ content: Contenu
+ typeEntity: Type
+ addedDate: Date d'ajout
+ event: Evènement
+ action: Actions
+ delete_action: Supprimer
+ no_result: Aucun commentaire trouvé
+
+eventComment:
+ menu:
+ afficher: Commentaires des évènements
+ list:
+ title: Liste des commentaires des évènements publics temps rééls
+ table:
+ author: Auteur
+ content: Contenu
+ typeEntity: Type
+ addedDate: Date d'ajout
+ event: Evènement
+ action: Actions
+ delete_action: Supprimer
+ no_result: Aucun commentaire trouvé
\ No newline at end of file
diff --git a/CTRV/EventBundle/Resources/views/Event/addEventType.html.twig b/CTRV/EventBundle/Resources/views/Event/addEventType.html.twig
new file mode 100644
index 0000000..8bd1883
--- /dev/null
+++ b/CTRV/EventBundle/Resources/views/Event/addEventType.html.twig
@@ -0,0 +1,25 @@
+{% extends "::base.html.twig" %}
+{% import '::macro.html.twig' as forms %}
+
+{% block body %}
+
+
+
+
+ {% include "CTRVEventBundle::menuEvent.html.twig" %}
+
+
+
+
{% trans %}event.ajouterForm.titleAddEventType{% endtrans %}
+
+
+
+
+
+
+
+
+{% endblock body %}
\ No newline at end of file
diff --git a/CTRV/EventBundle/Resources/views/Event/loadAgenda.html.twig b/CTRV/EventBundle/Resources/views/Event/loadAgenda.html.twig
new file mode 100644
index 0000000..d210f10
--- /dev/null
+++ b/CTRV/EventBundle/Resources/views/Event/loadAgenda.html.twig
@@ -0,0 +1,66 @@
+{% extends "::base.html.twig" %}
+{% import '::macro.html.twig' as forms %}
+
+{% block body %}
+
+
+
+
+ {% include "CTRVEventBundle::menuAgenda.html.twig" %}
+
+
{% trans %}agenda.list.table.no_result{% endtrans %}
+ {% endif %}
+
+
+
+
+
+
+{% endblock body %}
\ No newline at end of file
diff --git a/CTRV/EventBundle/Resources/views/Event/loadEvent.html.twig b/CTRV/EventBundle/Resources/views/Event/loadEvent.html.twig
new file mode 100644
index 0000000..ad5c19b
--- /dev/null
+++ b/CTRV/EventBundle/Resources/views/Event/loadEvent.html.twig
@@ -0,0 +1,70 @@
+{% extends "::base.html.twig" %}
+{% import '::macro.html.twig' as forms %}
+
+{% block body %}
+
+
+
+
+ {% include "CTRVEventBundle::menuEvent.html.twig" %}
+
+
+
+
{% trans %}event.list.titlePublicEvent{% endtrans %}
{% trans %}event.list.table.no_result{% endtrans %}
+ {% endif %}
+
+
+
+
+
+
+
+{% endblock body %}
\ No newline at end of file
diff --git a/CTRV/EventBundle/Resources/views/Event/loadPassedAgenda.html.twig b/CTRV/EventBundle/Resources/views/Event/loadPassedAgenda.html.twig
new file mode 100644
index 0000000..5d25660
--- /dev/null
+++ b/CTRV/EventBundle/Resources/views/Event/loadPassedAgenda.html.twig
@@ -0,0 +1,64 @@
+{% extends "::base.html.twig" %}
+{% import '::macro.html.twig' as forms %}
+
+{% block body %}
+
+
+
+
+ {% include "CTRVEventBundle::menuAgenda.html.twig" %}
+
+
{% trans %}agenda.list.table.no_result{% endtrans %}
+ {% endif %}
+
+
+
+
+
+
+{% endblock body %}
\ No newline at end of file
diff --git a/CTRV/EventBundle/Resources/views/Event/loadTypeEvents.html.twig b/CTRV/EventBundle/Resources/views/Event/loadTypeEvents.html.twig
new file mode 100644
index 0000000..5e58194
--- /dev/null
+++ b/CTRV/EventBundle/Resources/views/Event/loadTypeEvents.html.twig
@@ -0,0 +1,67 @@
+{% extends "::base.html.twig" %}
+{% import '::macro.html.twig' as forms %}
+
+{% block body %}
+
+
+
+
+ {% include "CTRVEventBundle::menuEvent.html.twig" %}
+
+
+
+
{% trans %}event.list.titleTypeEvent{% endtrans %}
{% trans %}event.list.table.no_result{% endtrans %}
+ {% endif %}
+
+
+
+
+
+
+
+{% endblock body %}
\ No newline at end of file
diff --git a/CTRV/EventBundle/Resources/views/Event/loadUpdatePerEvent.html.twig b/CTRV/EventBundle/Resources/views/Event/loadUpdatePerEvent.html.twig
new file mode 100644
index 0000000..adacfc0
--- /dev/null
+++ b/CTRV/EventBundle/Resources/views/Event/loadUpdatePerEvent.html.twig
@@ -0,0 +1,89 @@
+{% extends "::base.html.twig" %}
+{% import '::macro.html.twig' as forms %}
+
+{% block body %}
+
+
+
+
+ {% include "CTRVEventBundle::menuEvent.html.twig" %}
+
+
+ {% if events is not empty %}
+ {% for entity in events %}
+
{% trans %}event.list.table.no_result{% endtrans %}
+ {% endif %}
+
+
+
+
+
+
+
+{% endblock body %}
\ No newline at end of file
diff --git a/CTRV/EventBundle/Resources/views/Event/updateEventType.html.twig b/CTRV/EventBundle/Resources/views/Event/updateEventType.html.twig
new file mode 100644
index 0000000..5399f11
--- /dev/null
+++ b/CTRV/EventBundle/Resources/views/Event/updateEventType.html.twig
@@ -0,0 +1,25 @@
+{% extends "::base.html.twig" %}
+{% import '::macro.html.twig' as forms %}
+
+{% block body %}
+
+
+
+
+ {% include "CTRVEventBundle::menuEvent.html.twig" %}
+
+
+
+
{% trans %}event.ajouterForm.titleUpdateEventType{% endtrans %}
+
+
+
+
+
+
+
+
+{% endblock body %}
\ No newline at end of file
diff --git a/CTRV/EventBundle/Resources/views/EventComment/eventCommentAbuse.html.twig b/CTRV/EventBundle/Resources/views/EventComment/eventCommentAbuse.html.twig
new file mode 100644
index 0000000..e176017
--- /dev/null
+++ b/CTRV/EventBundle/Resources/views/EventComment/eventCommentAbuse.html.twig
@@ -0,0 +1,53 @@
+{% extends "::base.html.twig" %}
+{% import '::macro.html.twig' as forms %}
+
+{% block body %}
+
+
+
+
+ {% include "CTRVCommonBundle::menuEvent.html.twig" %}
+
+
{% trans %}eventComment.list.table.no_result{% endtrans %}
+ {% endif %}
+
+
+
+
+
+
+
+{% endblock body %}
\ No newline at end of file
diff --git a/CTRV/EventBundle/Resources/views/menuAgenda.html.twig b/CTRV/EventBundle/Resources/views/menuAgenda.html.twig
new file mode 100644
index 0000000..9041f7d
--- /dev/null
+++ b/CTRV/EventBundle/Resources/views/menuAgenda.html.twig
@@ -0,0 +1,8 @@
+
+
\ No newline at end of file
diff --git a/CTRV/EventBundle/Resources/views/menuEvent.html.twig b/CTRV/EventBundle/Resources/views/menuEvent.html.twig
new file mode 100644
index 0000000..c68055e
--- /dev/null
+++ b/CTRV/EventBundle/Resources/views/menuEvent.html.twig
@@ -0,0 +1,10 @@
+
+
{% trans %}abus.list.table.no_result{% endtrans %}
+ {% endif %}
+
+
+
+
+
+
+{% endblock body %}
\ No newline at end of file
diff --git a/CTRV/FlowBundle/Resources/views/menu.html.twig b/CTRV/FlowBundle/Resources/views/menu.html.twig
new file mode 100644
index 0000000..1508746
--- /dev/null
+++ b/CTRV/FlowBundle/Resources/views/menu.html.twig
@@ -0,0 +1,9 @@
+
+
\ No newline at end of file
diff --git a/CTRV/FlowBundle/Service/GroupeService.php b/CTRV/FlowBundle/Service/GroupeService.php
new file mode 100644
index 0000000..5153215
--- /dev/null
+++ b/CTRV/FlowBundle/Service/GroupeService.php
@@ -0,0 +1,52 @@
+mailer = $mailer;
+ $this->doctrine = $doctrine;
+ $this->em = $doctrine->getEntityManager();
+ $this->service_container = $service_container;
+ $this->templating = $templating;
+ $this->translator = $translator;
+ }
+/**
+ * retourne la liste de tous les groupes
+ */
+ public function getGroup() {
+ $entities = $this->em->getRepository('CTRVFlowBundle:GroupUser')->getGroup();
+ return $entities;
+ }
+ /**
+ * retourne la liste des groupes de la ville courante
+ */
+ public function getGroupByCity($currentCity) {
+ $entities = $this->em->getRepository('CTRVFlowBundle:GroupUser')
+ ->getGroupByCity($this->em->getRepository('CTRVCommonBundle:City')->find($currentCity->getId()));
+ return $entities;
+ }
+/**
+ * retourne la liste des membres du groupe spécifié
+ */
+ public function getGroupMember($group_user) {
+ $entities = $this->em->getRepository('CTRVFlowBundle:GroupMember')->findByGroupUser($group_user);
+ return $entities;
+ }
+}
diff --git a/CTRV/FlowBundle/Service/PublicMessageService.php b/CTRV/FlowBundle/Service/PublicMessageService.php
new file mode 100644
index 0000000..9b95016
--- /dev/null
+++ b/CTRV/FlowBundle/Service/PublicMessageService.php
@@ -0,0 +1,58 @@
+mailer = $mailer;
+ $this->doctrine = $doctrine;
+ $this->em = $doctrine->getEntityManager();
+ $this->service_container = $service_container;
+ $this->templating = $templating;
+ $this->translator = $translator;
+ }
+/**
+ * retoune la liste des messages publics de la ville courante
+ */
+ public function getPublicMessage($currentCity) {
+ $entities = $this->em->getRepository('CTRVFlowBundle:PublicMessage')
+ ->getPublicMessage($this->em->getRepository('CTRVCommonBundle:City')->find($currentCity->getId()));
+ return $entities;
+ }
+ /**
+ * Retourne la liste des types de mails
+ * @return unknown
+ */
+ public function getTypeMails() {
+ $entities = $this->em->getRepository('CTRVMailBundle:MailType')->getTypeMails();
+ return $entities;
+
+ }
+ /**
+ * retourne la liste des messages publics signalés de la ville courante
+ * @return unknown
+ */
+ public function getMessagePublicAbuse($currentCity) {
+ $entities = $this->em->getRepository('CTRVFlowBundle:PublicMessage')
+ ->getMessagePublicAbuse($this->em->getRepository('CTRVCommonBundle:City')->find($currentCity->getId()));
+ return $entities;
+ }
+}
diff --git a/CTRV/MailBundle/CTRVMailBundle.php b/CTRV/MailBundle/CTRVMailBundle.php
new file mode 100644
index 0000000..13d6ae5
--- /dev/null
+++ b/CTRV/MailBundle/CTRVMailBundle.php
@@ -0,0 +1,9 @@
+getDoctrine()->getEntityManager()->getRepository("CTRVMailBundle:MailTemplate")->findAll();
+ return array("entities"=>$entities);
+ }
+
+ /**
+ * @Route("/send",name="send_mail")
+ * @Template()
+ */
+ public function sendMailAction() {
+
+ $form = $this->createForm(new MailTemplateType());
+ $form1 = $this->createForm(new SendMailType());
+ if( $this->get('request')->getMethod() == 'POST' ) {
+ $form1->bind($this->get('request'));
+ $form->bind($this->get('request'));
+
+ if ( $form->isValid() ) {
+
+ $mailTemplate = $form->getData();
+ $this->getDoctrine()->getEntityManager()->persist($mailTemplate);
+ $this->getDoctrine()->getEntityManager()->flush();
+
+ return $this->redirect($this->generateUrl("mail"));
+ }
+ $message = \Swift_Message::newInstance();
+
+ if ($form1->isValid()){
+
+ $message->setSubject("Objet");
+ $message->setFrom('cndiaye@iota-it.com');
+ $message->setTo('ahmedtijane@gmail.com');
+ $message->setBody('Hello world');
+ $this->get('mailer')->send($message);
+
+ return $this->redirect($this->generateUrl("send_mail"));
+ }
+ }
+ return array(
+ 'form'=>$form->createView(),
+ 'form1'=>$form1->createView()
+ );
+ }
+
+
+ /**
+ * Ajouter, sauvegarder un mail template
+ * @Route("/mailTemplate/add",name="add_mail")
+ * @Template()
+ */
+ public function addMailTemplateAction() {
+
+ $form = $this->createForm(new MailTemplateType());
+
+ if( $this->get('request')->getMethod() == 'POST' ) {
+
+ $form->bind($this->get('request'));
+
+ if ( $form->isValid() ) {
+
+ $mailTemplate = $form->getData();
+ $this->getDoctrine()->getEntityManager()->persist($mailTemplate);
+ $this->getDoctrine()->getEntityManager()->flush();
+
+ return $this->redirect($this->generateUrl("mail"));
+ }
+ }
+ return array('form'=>$form->createView());
+ }
+
+ /**
+ * Editer puis sauvegarder un mail template
+ * @Route("/mailTemplate/edit/{id}",name="edit_mail")
+ * @Template()
+ */
+ public function editMailTemplateAction (MailTemplate $mailTemplate) {
+
+ $form = $this->createForm(new MailTemplateType,$mailTemplate);
+
+ if( $this->get('request')->getMethod() == 'POST' ) {
+
+ $form->bind($this->get('request'));
+
+ if ( $form->isValid() ) {
+
+ $data = $form->getData();
+
+ $mailTemplate->setContent($data->getContent());
+ $mailTemplate->setSubject($data->getSubject());
+ $mailTemplate->setMailType($data->getMailType());
+
+ $this->getDoctrine()->getEntityManager()->persist($mailTemplate);
+ $this->getDoctrine()->getEntityManager()->flush();
+
+ return $this->redirect($this->generateUrl("mail"));
+ }
+ }
+
+ return array('form'=>$form->createView());
+ }
+
+ /**
+ * Charger les type de mail
+ * @Route("/loadTypeMails", name="loadTypeMails")
+ * @Template()
+ */
+ public function loadTypeMailsAction () {
+
+ $em = $this->getDoctrine()->getEntityManager();
+ $currentCity = $this->get('session_service')->getCity();
+
+ if ($currentCity == null) {
+ $this->get('session')->getFlashBag()->add('error', $this->get('translator')->trans('session.city.not_found'));
+ $this->redirect($this->generateUrl("home"));
+ }
+
+ $page = $this->getRequest()->get("page",1);
+ $entities = $this->get("mail_service")->getTypeMails();
+
+ //pagination
+ $nb_entities = count($entities);
+ $nb_entities_page = Constants::mailstype_number_per_page;
+ $nb_pages = ceil($nb_entities/$nb_entities_page);
+ $offset = ($page-1) * $nb_entities_page;
+
+ $entities = array_slice($entities, $offset,$nb_entities_page);
+
+ return array (
+ 'entities' => $entities,
+ 'nb_pages' => $nb_pages,
+ 'page' => $page,
+ 'nb_entities' => $nb_entities
+ );
+ }
+
+ /**
+ * ajouter un nouveau type de mail
+ * @Route("/addTypeMail",name="addType_mail")
+ * @Template()
+ */
+ public function addTypeMailAction () {
+ $em = $this->getDoctrine()->getEntityManager();
+ $form = $this->createForm(new MailTypeType(),new MailType());
+ // On vérifie qu'elle est de type POST
+ if ($this->getRequest()->getMethod() == 'POST') {
+ // On fait le lien Requête <-> Formulaire
+ $form->bind($this->getRequest());
+ // On vérifie que les valeurs rentrées sont correctes
+ if ($form->isValid()) {
+ // On enregistre notre objet $mailType dans la base de données
+ $mailType = $form->getData();
+ $em->persist($mailType);
+ $em->flush();
+ // on redirige vers la liste des types de mails
+ return $this->redirect($this->generateUrl("loadTypeMails"));
+ }
+ }
+
+
+ return array('form'=>$form->createView());
+
+ }
+
+
+
+
+/**
+ * modifier un type de mail
+ * @Route("/edit/{id}",name="editType_mail")
+ * @Template()
+ */
+ public function editTypeMailAction (MailType $mailType) {
+ $form = $this->createForm(new MailTypeType, $mailType);
+ $request=$this->getRequest();
+ // On vérifie qu'elle est de type POST
+ if ($this->getRequest()->getMethod() == 'POST') {
+ // On fait le lien Requête <-> Formulaire
+ $form->bind($this->getRequest());
+ // On vérifie que les valeurs rentrées sont correctes
+ if ($form->isValid()) {
+ // On enregistre notre objet $mailType dans la base de données
+ $em = $this->getDoctrine()->getEntityManager();
+ $em->persist($mailType);
+ $em->flush();
+ // on redirige vers les types de place
+ return $this->redirect($this->generateUrl("loadTypeMails"));
+ }
+
+ }
+
+
+ return array(
+ 'mailType'=> $mailType,
+ 'form'=>$form->createView());
+
+}
+/**
+ * Deletes a MailType entity.
+ *
+ * @Route("/{id}/deleteType", name="mailType_delete" ) //requirements={"id" = "\d+"}
+ * @Method("POST")
+ * @Template()
+ */
+public function deleteMailTypeAction($id) {
+
+ $em = $this->getDoctrine()->getManager();
+ $entity = $em->getRepository('CTRVMailBundle:MailType')->find($id);
+
+ $em->remove($entity);
+ $em->flush();
+
+ return new Response(json_encode(array('result'=>true)));
+}
+}
diff --git a/CTRV/MailBundle/DependencyInjection/CTRVMailExtension.php b/CTRV/MailBundle/DependencyInjection/CTRVMailExtension.php
new file mode 100644
index 0000000..68d38e6
--- /dev/null
+++ b/CTRV/MailBundle/DependencyInjection/CTRVMailExtension.php
@@ -0,0 +1,28 @@
+processConfiguration($configuration, $configs);
+
+ $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
+ $loader->load('services.yml');
+ }
+}
diff --git a/CTRV/MailBundle/DependencyInjection/Configuration.php b/CTRV/MailBundle/DependencyInjection/Configuration.php
new file mode 100644
index 0000000..6ce1aff
--- /dev/null
+++ b/CTRV/MailBundle/DependencyInjection/Configuration.php
@@ -0,0 +1,29 @@
+root('ctrv_mail');
+
+ // Here you should define the parameters that are allowed to
+ // configure your bundle. See the documentation linked above for
+ // more information on that topic.
+
+ return $treeBuilder;
+ }
+}
diff --git a/CTRV/MailBundle/Entity/MailTemplate.php b/CTRV/MailBundle/Entity/MailTemplate.php
new file mode 100644
index 0000000..bc5cc68
--- /dev/null
+++ b/CTRV/MailBundle/Entity/MailTemplate.php
@@ -0,0 +1,181 @@
+id;
+ }
+
+ /**
+ * Set sender
+ *
+ * @param string $sender
+ * @return MailTemplate
+ */
+ public function setSender($sender)
+ {
+ $this->sender = $sender;
+
+ return $this;
+ }
+
+ /**
+ * Get sender
+ *
+ * @return string
+ */
+ public function getSender()
+ {
+ return $this->sender;
+ }
+
+ /**
+ * Set receiver
+ *
+ * @param string $receiver
+ * @return MailTemplate
+ */
+ public function setReceiver($receiver)
+ {
+ $this->receiver = $receiver;
+
+ return $this;
+ }
+
+ /**
+ * Get receiver
+ *
+ * @return string
+ */
+ public function getReceiver()
+ {
+ return $this->receiver;
+ }
+
+ /**
+ * Set subject
+ *
+ * @param string $subject
+ * @return MailTemplate
+ */
+ public function setSubject($subject)
+ {
+ $this->subject = $subject;
+
+ return $this;
+ }
+
+ /**
+ * Get subject
+ *
+ * @return string
+ */
+ public function getSubject()
+ {
+ return $this->subject;
+ }
+
+ /**
+ * Set content
+ *
+ * @param string $content
+ * @return MailTemplate
+ */
+ public function setContent($content)
+ {
+ $this->content = $content;
+
+ return $this;
+ }
+
+ /**
+ * Get content
+ *
+ * @return string
+ */
+ public function getContent()
+ {
+ return $this->content;
+ }
+
+ /**
+ * Set mailType
+ *
+ * @param CTRV\MailBundle\Entity\MailType $mailType
+ * @return MailTemplate
+ */
+ public function setMailType(\CTRV\MailBundle\Entity\MailType $mailType = null)
+ {
+ $this->mailType = $mailType;
+
+ return $this;
+ }
+
+ /**
+ * Get mailType
+ *
+ * @return CTRV\MailBundle\Entity\MailType
+ */
+ public function getMailType()
+ {
+ return $this->mailType;
+ }
+}
\ No newline at end of file
diff --git a/CTRV/MailBundle/Entity/MailTemplateRepository.php b/CTRV/MailBundle/Entity/MailTemplateRepository.php
new file mode 100644
index 0000000..927a43d
--- /dev/null
+++ b/CTRV/MailBundle/Entity/MailTemplateRepository.php
@@ -0,0 +1,15 @@
+id;
+ }
+
+ /**
+ * Set code
+ *
+ * @param string $code
+ * @return MailType
+ */
+ public function setCode($code)
+ {
+ $this->code = $code;
+
+ return $this;
+ }
+
+ /**
+ * Get code
+ *
+ * @return string
+ */
+ public function getCode()
+ {
+ return $this->code;
+ }
+
+ public function __toString() {
+ return $this->code;
+ }
+}
\ No newline at end of file
diff --git a/CTRV/MailBundle/Entity/MailTypeRepository.php b/CTRV/MailBundle/Entity/MailTypeRepository.php
new file mode 100644
index 0000000..ef015cd
--- /dev/null
+++ b/CTRV/MailBundle/Entity/MailTypeRepository.php
@@ -0,0 +1,25 @@
+createQueryBuilder("p")
+ ->orderBy('p.code','ASC')
+ ;
+ return $qb->getQuery()->getResult();
+ }
+}
diff --git a/CTRV/MailBundle/Form/MailTemplateType.php b/CTRV/MailBundle/Form/MailTemplateType.php
new file mode 100644
index 0000000..bdcc56a
--- /dev/null
+++ b/CTRV/MailBundle/Form/MailTemplateType.php
@@ -0,0 +1,31 @@
+add('mailType',null,array('label'=>'mail.form.type'))
+ ->add('subject',null,array('label'=>'mail.form.subject'))
+ ->add('content',null,array('label'=>'mail.form.content'))
+ ;
+ }
+
+ public function setDefaultOptions(OptionsResolverInterface $resolver)
+ {
+ $resolver->setDefaults(array(
+ 'data_class' => 'CTRV\MailBundle\Entity\MailTemplate'
+ ));
+ }
+
+ public function getName()
+ {
+ return 'ctrv_mailbundle_mailtemplatetype';
+ }
+}
diff --git a/CTRV/MailBundle/Form/MailTypeType.php b/CTRV/MailBundle/Form/MailTypeType.php
new file mode 100644
index 0000000..845864b
--- /dev/null
+++ b/CTRV/MailBundle/Form/MailTypeType.php
@@ -0,0 +1,30 @@
+add('code','text',array('label'=>'mail.form.code'))
+ ;
+ }
+
+ public function setDefaultOptions(OptionsResolverInterface $resolver)
+ {
+ $resolver->setDefaults(array(
+ 'data_class' => 'CTRV\MailBundle\Entity\MailType'
+ ));
+ }
+
+ public function getName()
+ {
+ return 'ctrv_mailbundle_mailtypetype';
+ }
+}
diff --git a/CTRV/MailBundle/Form/SendMailType.php b/CTRV/MailBundle/Form/SendMailType.php
new file mode 100644
index 0000000..59718c3
--- /dev/null
+++ b/CTRV/MailBundle/Form/SendMailType.php
@@ -0,0 +1,27 @@
+add('mailType',null,array('label'=>'mail.form.type'))
+ ->add('subject',null,array('label'=>'mail.form.subject'))
+ ->add('content',null,array('label'=>'mail.form.content'))
+ ->add('destChoice','checkbox',array('label'=>'mail.sendMailform.destChoice1'))
+ ->add('destField','textarea',array ('label'=>'mail.sendMailform.destPersonalised'))
+ ;
+ }
+
+ public function getName()
+ {
+ return 'ctrv_mailbundle_sendMailtemplatetype';
+ }
+}
diff --git a/CTRV/MailBundle/Resources/config/services.yml b/CTRV/MailBundle/Resources/config/services.yml
new file mode 100644
index 0000000..ac3157c
--- /dev/null
+++ b/CTRV/MailBundle/Resources/config/services.yml
@@ -0,0 +1,4 @@
+services:
+ mail_service:
+ class: CTRV\FlowBundle\Service\PublicMessageService
+ arguments: [@mailer,@doctrine,@service_container,@templating,@translator]
\ No newline at end of file
diff --git a/CTRV/MailBundle/Resources/doc/index.rst b/CTRV/MailBundle/Resources/doc/index.rst
new file mode 100644
index 0000000..e69de29
diff --git a/CTRV/MailBundle/Resources/public/js/mail.js b/CTRV/MailBundle/Resources/public/js/mail.js
new file mode 100644
index 0000000..5d39b78
--- /dev/null
+++ b/CTRV/MailBundle/Resources/public/js/mail.js
@@ -0,0 +1,47 @@
+/**
+ * Retourne la liste des mails
+ *
+ */
+function loadMails (urlAction,ppage,container) {
+ container.html('');
+
+ $.post(urlAction,
+ {
+ page:ppage
+ },
+ function (data) {
+ container.html(data);
+ },
+ 'html'
+ );
+}
+/**
+ * Supprime un mail
+ */
+function deleteMail (urlAction, tr_elem) {
+ $.post(urlAction,
+ {
+ },
+ function (data) {
+ if(data.result){
+ tr_elem.remove();
+ }
+ },
+ 'json'
+ );
+}
+/**
+ * Supprime un type de mail
+ */
+function deleteMailType (urlAction, tr_elem) {
+ $.post(urlAction,
+ {
+ },
+ function (data) {
+ if(data.result){
+ tr_elem.remove();
+ }
+ },
+ 'json'
+ );
+}
\ No newline at end of file
diff --git a/CTRV/MailBundle/Resources/translations/messages.fr.yml b/CTRV/MailBundle/Resources/translations/messages.fr.yml
new file mode 100644
index 0000000..4a15564
--- /dev/null
+++ b/CTRV/MailBundle/Resources/translations/messages.fr.yml
@@ -0,0 +1,46 @@
+mail:
+ menu:
+ template: Templates de mail
+ send: Envoyer un email
+ add: Ajouter un template
+ type: Types de mail
+ addType: Ajouter
+ form:
+ titleUpdateTypeMail: Modifier un type de mail
+ titleAddTypeMail : Ajouter un type de mail
+ subject: Sujet
+ content: Contenu
+ type: Type de mail
+ code : Code
+ submit: Sauvegarder
+ list:
+ title: Liste des mails template
+ titleTypeMail: Liste des types de mail
+ table:
+ action: Action
+ subject: Sujet
+ content: Contenu
+ type: Type
+ code : Code
+ delete_action: Supprimer
+ edit_action: Modifier
+ no_result : Aucun template de mail trouvé
+ no_type_result: Aucun type de mail trouvé
+ addMailTemplate:
+ title: Ajouter un mail template
+ editMailTemplate:
+ title: Modifier un mail template
+ sendMailTemplate:
+ title: Envoi de mails
+ MultipleChoiceTitle : Choix destinataires multiples
+ suggestion : Parametre d'email disponible
+ sendMailform :
+ type: Type de Mail
+ subject : Sujet
+ content : Contenu
+ destChoice1 : Tous les utilisateurs
+ destChoice2 : Tous les utilisateurs de la ville courante
+ destChoice3 : Tous les professionnels de la ville courante
+ destPersonalised : Destinataires personnalisés (séparés par des ";")
+ send : Envoyer
+ submit : Sauvegarder comme modéle
\ No newline at end of file
diff --git a/CTRV/MailBundle/Resources/translations/validators.fr.yml b/CTRV/MailBundle/Resources/translations/validators.fr.yml
new file mode 100644
index 0000000..2fb84d0
--- /dev/null
+++ b/CTRV/MailBundle/Resources/translations/validators.fr.yml
@@ -0,0 +1,6 @@
+mailTemplate:
+ addEdit:
+ form:
+ mail_type_already_exist: Ce type de mail existe déjà
+
+
diff --git a/CTRV/MailBundle/Resources/views/Mail/addMailTemplate.html.twig b/CTRV/MailBundle/Resources/views/Mail/addMailTemplate.html.twig
new file mode 100644
index 0000000..35d7b03
--- /dev/null
+++ b/CTRV/MailBundle/Resources/views/Mail/addMailTemplate.html.twig
@@ -0,0 +1,23 @@
+{% extends "::base.html.twig" %}
+{% import '::macro.html.twig' as forms %}
+
+{% block body %}
+
+
+
+ {% include "CTRVMailBundle::menu.html.twig" %}
+
+
+
+
{% trans %}mail.addMailTemplate.title{% endtrans %}
+
+
+
+
+
+
+
+{% endblock body %}
diff --git a/CTRV/MailBundle/Resources/views/Mail/addTypeMail.html.twig b/CTRV/MailBundle/Resources/views/Mail/addTypeMail.html.twig
new file mode 100644
index 0000000..e2cba06
--- /dev/null
+++ b/CTRV/MailBundle/Resources/views/Mail/addTypeMail.html.twig
@@ -0,0 +1,24 @@
+{% extends "::base.html.twig" %}
+{% import '::macro.html.twig' as forms %}
+
+{% block body %}
+
+
+
+
+ {% include "CTRVMailBundle::menu.html.twig" %}
+
+
+
+
{% trans %}mail.form.titleAddTypeMail{% endtrans %}
+
+
+
+
+
+
+
+{% endblock body %}
\ No newline at end of file
diff --git a/CTRV/MailBundle/Resources/views/Mail/editMailTemplate.html.twig b/CTRV/MailBundle/Resources/views/Mail/editMailTemplate.html.twig
new file mode 100644
index 0000000..5c78f74
--- /dev/null
+++ b/CTRV/MailBundle/Resources/views/Mail/editMailTemplate.html.twig
@@ -0,0 +1,26 @@
+{% extends "::base.html.twig" %}
+{% import '::macro.html.twig' as forms %}
+
+{% block body %}
+
+
+
+ {% include "CTRVMailBundle::menu.html.twig" %}
+
+
+
{% trans %}mail.editMailTemplate.title{% endtrans %}
+
+
+
+
+
+
+{% endblock body %}
diff --git a/CTRV/MailBundle/Resources/views/Mail/editTypeMail.html.twig b/CTRV/MailBundle/Resources/views/Mail/editTypeMail.html.twig
new file mode 100644
index 0000000..d34c74b
--- /dev/null
+++ b/CTRV/MailBundle/Resources/views/Mail/editTypeMail.html.twig
@@ -0,0 +1,24 @@
+{% extends "::base.html.twig" %}
+{% import '::macro.html.twig' as forms %}
+
+{% block body %}
+
+
+
+
+ {% include "CTRVMailBundle::menu.html.twig" %}
+
+
+
+
{% trans %}mail.form.titleUpdateTypeMail{% endtrans %}
+
+
+
+
+
+
+
+{% endblock body %}
\ No newline at end of file
diff --git a/CTRV/MailBundle/Resources/views/Mail/index.html.twig b/CTRV/MailBundle/Resources/views/Mail/index.html.twig
new file mode 100644
index 0000000..b1af6bf
--- /dev/null
+++ b/CTRV/MailBundle/Resources/views/Mail/index.html.twig
@@ -0,0 +1,58 @@
+{% extends "::base.html.twig" %}
+{% import '::macro.html.twig' as forms %}
+
+
+
+{% block body %}
+
+
+
+
+ {% include "CTRVMailBundle::menu.html.twig" %}
+
+
\ No newline at end of file
diff --git a/CTRV/MailBundle/Service/MailService.php b/CTRV/MailBundle/Service/MailService.php
new file mode 100644
index 0000000..53474aa
--- /dev/null
+++ b/CTRV/MailBundle/Service/MailService.php
@@ -0,0 +1,42 @@
+mailer = $mailer;
+ $this->doctrine = $doctrine;
+ $this->em = $doctrine->getEntityManager();
+ $this->service_container = $service_container;
+ $this->templating = $templating;
+ $this->translator = $translator;
+ }
+ /**
+ * Retourne la liste des types de mails
+ * @return unknown
+ */
+ public function getTypeMails() {
+ $entities = $this->em->getRepository('CTRVMailBundle:MailType')->getTypeMails();
+ return $entities;
+
+ }
+
+}
diff --git a/CTRV/PlaceBundle/CTRVPlaceBundle.php b/CTRV/PlaceBundle/CTRVPlaceBundle.php
new file mode 100644
index 0000000..ccee80c
--- /dev/null
+++ b/CTRV/PlaceBundle/CTRVPlaceBundle.php
@@ -0,0 +1,9 @@
+get("session_service")->getCity();
+ $city = $this->getDoctrine()->getEntityManager()->getRepository('CTRVCommonBundle:City')->find($currentCity->getId());
+
+ if ($currentCity == null) {
+ $this->get('session')->getFlashBag()->add('error', $this->get('translator')->trans('session.city.not_found'));
+ $this->redirect($this->generateUrl("home"));
+ }
+
+ $page = intval ($this->getRequest()->get("page",1));
+
+ //pagination
+ $nb_entities = $placeComments = $this->getDoctrine()->getRepository('CTRVCommonBundle:Comment')->getPlaceCommentNumber($city);
+ $nb_entities_page = Constants::agendasComment_number_per_page;
+ $nb_pages = ceil($nb_entities/$nb_entities_page);
+ $offset = ($page-1) * $nb_entities_page;
+
+ $placeComments = $this->getDoctrine()->getRepository('CTRVCommonBundle:Comment')->getPlaceComment($city, $offset, $nb_entities_page);
+
+ return array (
+ 'entities' => $placeComments,
+ 'nb_pages' => $nb_pages,
+ 'page' => $page,
+ 'nb_entities' => $nb_entities
+ );
+ }
+
+
+}
diff --git a/CTRV/PlaceBundle/Controller/PlaceController.php b/CTRV/PlaceBundle/Controller/PlaceController.php
new file mode 100644
index 0000000..ddb722d
--- /dev/null
+++ b/CTRV/PlaceBundle/Controller/PlaceController.php
@@ -0,0 +1,597 @@
+get('session_service')->getCity() == null) {
+ $city = $this->getDoctrine()->getEntityManager()->getRepository('CTRVCommonBundle:City')->findOneBy(array());
+ $this->get('session_service')->setCity($city);
+ } else {
+ $city = $this->getDoctrine()->getEntityManager()->getRepository('CTRVCommonBundle:City')->find($this->get('session_service')->getCity()->getId());
+ }
+
+ return array("entities"=>$this->get("place_service")->deleteDoublePlaces($city));
+ }
+
+ /**
+ * Formulaire de recherche d'une place
+ * @Route("/rechercher",name="rechercher_place")
+ * @Template()
+ */
+ public function rechercherPlaceAction () {
+
+ $currentCity = $this->get("session_service")->getCity();
+ $city = $this->getDoctrine()->getEntityManager()->getRepository('CTRVCommonBundle:City')->find($currentCity->getId());
+
+ $localizedPlaceNumber = $this->getDoctrine()->getRepository('CTRVPlaceBundle:Place')->getLocalizedPlacesByCityNumber($city);
+ $form = $this->createForm(new PlaceRechercheType());
+
+ return array('form'=>$form->createView(),
+ 'localizedPlaceNumber'=>$localizedPlaceNumber
+ );
+ }
+ /**
+ * ajouter une nouvelle place
+ * @Route("/addNewPlace",name="addNew_place")
+ * @Template()
+ */
+ public function addNewPlaceAction () {
+ $em = $this->getDoctrine()->getEntityManager();
+ $form = $this->createForm(new PlaceForm(),new Place());
+ // On vérifie qu'elle est de type POST
+ if ($this->getRequest()->getMethod() == 'POST') {
+ // On fait le lien Requête <-> Formulaire
+ $form->bind($this->getRequest());
+ // On vérifie que les valeurs rentrées sont correctes
+ if ($form->isValid()) {
+ // On enregistre notre objet $placeType dans la base de données
+ $place = $form->getData();
+ $em->persist($place);
+ $em->flush();
+ // on redirige vers l'ajout des types de place
+ return $this->redirect($this->generateUrl("place"));
+ }
+ }
+
+
+ return array('form'=>$form->createView());
+
+ }
+ /**
+ * ajouter un nouveau type de place
+ * @Route("/ajouter",name="ajouter_place")
+ * @Template()
+ */
+ public function ajouterTypeAction () {
+ $em = $this->getDoctrine()->getEntityManager();
+ $form = $this->createForm(new PlaceTypeType(),new PlaceType());
+ // On vérifie qu'elle est de type POST
+ if ($this->getRequest()->getMethod() == 'POST') {
+ // On fait le lien Requête <-> Formulaire
+ $form->bind($this->getRequest());
+ // On vérifie que les valeurs rentrées sont correctes
+ if ($form->isValid()) {
+ // On enregistre notre objet $placeType dans la base de données
+ $placeType = $form->getData();
+ $em->persist($placeType);
+ $em->flush();
+ // on redirige vers la liste des types de place
+ return $this->redirect($this->generateUrl("loadTypePlaces")); }
+ }
+
+
+ return array('form'=>$form->createView());
+
+ }
+ /**
+ * modifier un type de place
+ * @Route("/modifier/{id}",name="modifier_place")
+ * @Template()
+ */
+ public function modifierTypeAction(PlaceType $placeType) {
+ $form = $this->createForm(new PlaceTypeType, $placeType);
+ $request=$this->getRequest();
+ // On vérifie qu'elle est de type POST
+ if ($this->getRequest()->getMethod() == 'POST') {
+ // On fait le lien Requête <-> Formulaire
+ $form->bind($this->getRequest());
+ // On vérifie que les valeurs rentrées sont correctes
+ if ($form->isValid()) {
+ // On enregistre notre objet $placeType dans la base de données
+ $em = $this->getDoctrine()->getEntityManager();
+ $em->persist($placeType);
+ $em->flush();
+ // on redirige vers les types de place
+ return $this->redirect($this->generateUrl("loadTypePlaces"));
+ }
+
+ }
+
+
+ return array(
+ 'placeType'=> $placeType,
+ 'form'=>$form->createView());
+
+ }
+ /**
+ * modifier une place
+ * @Route("/updatePlace/{id}",name="update_place")
+ * @Template()
+ */
+ public function updatePlaceAction(Place $place) {
+ $form = $this->createForm(new PlaceForm(), $place);
+ $request=$this->getRequest();
+ // On vérifie qu'elle est de type POST
+ if ($this->getRequest()->getMethod() == 'POST') {
+ // On fait le lien Requête <-> Formulaire
+ $form->bind($this->getRequest());
+ // On vérifie que les valeurs rentrées sont correctes
+ if ($form->isValid()) {
+ // On enregistre notre objet $place dans la base de données
+ $em = $this->getDoctrine()->getEntityManager();
+ $em->persist($place);
+ $em->flush();
+ // on redirige vers la liste des places existantes
+ return $this->redirect($this->generateUrl("place"));
+ }
+
+ }
+
+
+ return array(
+ 'place'=> $place,
+ 'form'=>$form->createView());
+
+ }
+ /**
+ * saisir latitude et longitude
+ * @Route("/saisir/{id}",name="saisir_lat_long")
+ * @Template()
+ */
+ public function saisirLatLongAction(Place $place) {
+ $form = $this->createForm(new PlaceLatLongForm(), $place);
+ $request=$this->getRequest();
+ // On vérifie qu'elle est de type POST
+ if ($this->getRequest()->getMethod() == 'POST') {
+ // On fait le lien Requête <-> Formulaire
+ $form->bind($this->getRequest());
+ // On vérifie que les valeurs rentrées sont correctes
+ if ($form->isValid()) {
+ // On enregistre notre objet $place dans la base de données
+ $em = $this->getDoctrine()->getEntityManager();
+ $em->persist($place);
+ $em->flush();
+ // on redirige vers la liste des places existantes
+ return $this->redirect($this->generateUrl("placeWithoutLatLong"));
+ }
+
+ }
+
+
+ return array(
+ 'place'=> $place,
+ 'form'=>$form->createView());
+
+ }
+ /**
+ * saisir Description
+ * @Route("/saisirDescrition/{id}",name="saisir_description")
+ * @Template()
+ */
+ public function saisirDescriptionAction(Place $place) {
+ $form = $this->createForm(new PlaceDescriptionForm(), $place);
+ $request=$this->getRequest();
+ // On vérifie qu'elle est de type POST
+ if ($this->getRequest()->getMethod() == 'POST') {
+ // On fait le lien Requête <-> Formulaire
+ $form->bind($this->getRequest());
+ // On vérifie que les valeurs rentrées sont correctes
+ if ($form->isValid()) {
+ // On enregistre notre objet $place dans la base de données
+ $em = $this->getDoctrine()->getEntityManager();
+ $em->persist($place);
+ $em->flush();
+ // on redirige vers la liste des places existantes
+ return $this->redirect($this->generateUrl("placeWithoutDescription"));
+ }
+
+ }
+
+
+ return array(
+ 'place'=> $place,
+ 'form'=>$form->createView());
+
+ }
+
+ /**
+ * Afficher le resultat de la recherche sur les places
+ * @Route("/rechercherResult",name="rechercher_place_result")
+ * @Template()
+ */
+ public function rechercherPlaceResultAction () {
+
+ $searchText = $this->getRequest()->get("searchText","");
+
+ $currentCity = $this->get("session_service")->getCity();
+ $city = $this->getDoctrine()->getEntityManager()->getRepository('CTRVCommonBundle:City')->find($currentCity->getId());
+
+ $page = intval($this->getRequest()->get("page",1));
+ //pagination
+ $nb_entities = $places = $this->getDoctrine()->getRepository('CTRVPlaceBundle:Place')->getPlaceByStreetNumber($searchText, $city);
+ $nb_entities_page = Constants::places_search_number_per_page;
+ $nb_pages = ceil($nb_entities/$nb_entities_page);
+ $offset = ($page-1) * $nb_entities_page;
+
+ $places = $this->getDoctrine()->getRepository('CTRVPlaceBundle:Place')->getPlaceByStreet($searchText, $city, $offset, $nb_entities_page);
+
+ return array (
+ 'entities' => $places,
+ 'nb_pages' => $nb_pages,
+ 'page' => $page,
+ 'nb_entities' => $nb_entities
+ );
+ }
+
+
+ /**
+ * Importer un fichier de données de place
+ * @Route("/import",name="import_place")
+ * @Template()
+ */
+ public function importAction () {
+
+ $form = $this->createForm(new ImportPlaceType(), new ImportPlace());
+
+ if( $this->get('request')->getMethod() == 'POST' ) {
+
+ $form->bind($this->get('request'));
+
+ if ( $form->isValid() ) {
+
+ $city = $this->get('session')->get("city");
+
+ $importPlace = $form->getData();
+ $fileName = uniqid($city->getName().$importPlace->placeType).'.'.$importPlace->file->guessExtension();
+ $importPlace->file->move($importPlace->getUploadRootDir(), $fileName);
+ $importPlace->file = null;
+
+ $res = $this->get("place_service")->savePlaceDataFromFile ($importPlace->getUploadRootDir().'/'.$fileName, $city, $importPlace->placeType);
+
+ $this->get('session')->getFlashBag()->add('success', $this->get('translator')
+ ->trans('place.import.success',array("%imported%"=>$res['added'],"%already%"=>$res["already"],"%traited%"=>$res['latLngFound'],"%total%"=>$res['all'])));
+
+ }
+ }
+
+ $notLocalizedPlaceNumber = $this->getDoctrine()->getEntityManager()->getRepository("CTRVPlaceBundle:Place")->getNotLocalizedPlaceNumber();
+ $allPlaceNumber = $this->getDoctrine()->getEntityManager()->getRepository("CTRVPlaceBundle:Place")->getAllPlaceNumber();
+ //$localized = $allPlaceNumber - $notLocalizedPlaceNumber;
+
+ return array('form'=>$form->createView(),'notLocalizedPlacesNumber'=>$notLocalizedPlaceNumber,'allPlaceNumber'=>$allPlaceNumber);
+ }
+
+ /**
+ * Lance le calcul de la latitude et longitude des places dont les coordonnées n'ont encore été trouvées
+ * @Route("/calculate_Lat_Lng", name="calculate_Lat_Lng")
+ * @Template("CTRVPlaceBundle:Place:import.html.twig")
+ */
+ public function calculateLatLngAction () {
+
+ $form = $this->createForm(new ImportPlaceType(), new ImportPlace());
+
+ $city = $this->get('session')->get("city");
+ $res = $this->get("place_service")->calculateLatLng($city);
+ $traitedPlaceNumber = $res[0];
+ $totalPlaceNumber = $res[1];
+
+ $this->get('session')->getFlashBag()->add('success', $this->get('translator')
+ ->trans('place.import.relaunch_success',array("%traited%"=>$traitedPlaceNumber,"%total%"=>$totalPlaceNumber)));
+
+ $notLocalizedPlaceNumber = $this->getDoctrine()->getEntityManager()->getRepository("CTRVPlaceBundle:Place")->getNotLocalizedPlaceNumber();
+ $allPlaceNumber = $this->getDoctrine()->getEntityManager()->getRepository("CTRVPlaceBundle:Place")->getAllPlaceNumber();
+ //$localized = $allPlaceNumber - $notLocalizedPlaceNumber;
+
+ return array('form'=>$form->createView(),'notLocalizedPlacesNumber'=>$notLocalizedPlaceNumber,'allPlaceNumber'=>$allPlaceNumber);
+ }
+
+
+ /**
+ * Affiche le formulaire de choix de type de place
+ * @Route("/list", name="place")
+ * @Template()
+ */
+ public function indexAction () {
+
+ $form = $this->createForm(new ChoosePlaceTypeType());
+ return array (
+ 'form' => $form->createView(),
+ );
+ }
+
+ /**
+ * Charge les donnees du type de place spécifié en AJAX (places ajoutées par des utilisateurs sous forme de tableau paginé)
+ * @Route("/loadPlacesByType", name="loadPlacesByType")
+ * @Template()
+ */
+ public function loadPlacesByTypeAction () {
+
+ $currentCity = $this->get("session_service")->getCity();
+ if ($currentCity == null) {
+ $this->get('session')->getFlashBag()->add('error', $this->get('translator')->trans('session.city.not_found'));
+ $this->redirect($this->generateUrl("home"));
+ }
+ $city = $this->getDoctrine()->getEntityManager()->getRepository('CTRVCommonBundle:City')->find($currentCity->getId());
+
+ $page = intval($this->getRequest()->get("page",1));
+ $placeTypeId = $this->getRequest()->get("placeTypeId");
+
+ //pagination
+ $nb_entities = $places = $this->getDoctrine()->getRepository('CTRVPlaceBundle:Place')->getPlaceAddedByUsersNumber($placeTypeId, $currentCity);
+ $nb_entities_page = Constants::places_number_per_page;
+ $nb_pages = ceil($nb_entities/$nb_entities_page);
+ $offset = ($page-1) * $nb_entities_page;
+
+ $places = $this->getDoctrine()->getRepository('CTRVPlaceBundle:Place')->getPlaceAddedByUsers ($placeTypeId, $currentCity, $offset, $nb_entities_page);
+
+ return array (
+ 'entities' => $places,
+ 'nb_pages' => $nb_pages,
+ 'page' => $page,
+ 'nb_entities' => $nb_entities
+ );
+ }
+
+ /**
+ * Charge les donnees des places avec le type spécifié ou non (toutes les places de l'application)
+ * @Route("/loadAllPlacesByTypeOrNot", name="loadAllPlacesByTypeOrNot")
+ * @Template()
+ */
+ public function loadAllPlacesByTypeOrNotAction () {
+
+ $currentCity = $this->get("session_service")->getCity();
+ if ($currentCity == null) {
+ $this->get('session')->getFlashBag()->add('error', $this->get('translator')->trans('session.city.not_found'));
+ $this->redirect($this->generateUrl("home"));
+ }
+ $city = $this->getDoctrine()->getEntityManager()->getRepository('CTRVCommonBundle:City')->find($currentCity->getId());
+ $form = $this->createForm(new ChoosePlaceTypeType());
+ $page = intval($this->getRequest()->get("page",1));
+ $placeTypeId = $this->getRequest()->get("placeTypeId");
+
+ //pagination
+ $nb_entities = $places = $this->getDoctrine()->getRepository('CTRVPlaceBundle:Place')->getPlacesByTypeNumber($placeTypeId, $currentCity);
+ $nb_entities_page = Constants::places_number_per_page;
+ $nb_pages = ceil($nb_entities/$nb_entities_page);
+ $offset = ($page-1) * $nb_entities_page;
+
+ $places = $this->getDoctrine()->getRepository('CTRVPlaceBundle:Place')->getPlacesByType ($placeTypeId, $currentCity, $offset, $nb_entities_page);
+
+ return array (
+ 'entities' => $places,
+ 'nb_pages' => $nb_pages,
+ 'page' => $page,
+ 'nb_entities' => $nb_entities,
+ 'form' => $form->createView()
+ );
+ }
+
+ /**
+ * Charge les données des places de la ville courante sans Latitude ou Longitude
+ * @Route("/placeWithoutLatLong", name="placeWithoutLatLong")
+ * @Template()
+ */
+ public function placeWithoutLatLongAction () {
+
+ $currentCity = $this->get('session_service')->getCity();
+ if ($currentCity == null) {
+ $this->get('session')->getFlashBag()->add('error', $this->get('translator')->trans('session.city.not_found'));
+ $this->redirect($this->generateUrl("home"));
+ }
+
+ $page = $this->getRequest()->get("page",1);
+
+ //pagination
+ $nb_entities = $this->getDoctrine()->getEntityManager()->getRepository("CTRVPlaceBundle:Place")->getPlacesWithoutLatLongNumber($currentCity);
+ $nb_entities_page = Constants::places_without_lat_lng_number_per_page;
+ $nb_pages = ceil($nb_entities/$nb_entities_page);
+ $offset = ($page-1) * $nb_entities_page;
+
+ $entities = $this->get("place_service")->getPlacesWithoutLatLong($currentCity,$offset,$nb_entities_page);
+
+ return array (
+ 'entities' => $entities,
+ 'nb_pages' => $nb_pages,
+ 'page' => $page,
+ 'nb_entities' => $nb_entities
+ );
+ }
+
+ /**
+ * Charge les données des places de la ville courante sans Description
+ * @Route("/placeWithoutDescription", name="placeWithoutDescription")
+ * @Template()
+ */
+ public function placeWithoutDescriptionAction () {
+
+ $currentCity = $this->get('session_service')->getCity();
+ if ($currentCity == null) {
+ $this->get('session')->getFlashBag()->add('error', $this->get('translator')->trans('session.city.not_found'));
+ $this->redirect($this->generateUrl("home"));
+ }
+
+ $page = $this->getRequest()->get("page",1);
+
+ //pagination
+ $nb_entities = $this->getDoctrine()->getEntityManager()->getRepository("CTRVPlaceBundle:Place")->getPlacesWithoutDescriptionNumber($currentCity);
+ $nb_entities_page = Constants::places_without_description_number_per_page;
+ $nb_pages = ceil($nb_entities/$nb_entities_page);
+ $offset = ($page-1) * $nb_entities_page;
+
+ $entities = $this->get("place_service")->getPlacesWithoutDescription($currentCity,$offset,$nb_entities_page);
+
+ return array (
+ 'entities' => $entities,
+ 'nb_pages' => $nb_pages,
+ 'page' => $page,
+ 'nb_entities' => $nb_entities
+ );
+ }
+ /**
+ * Charge tous les type de place
+ * @Route("/loadTypePlaces", name="loadTypePlaces")
+ * @Template()
+ */
+ public function loadTypePlacesAction () {
+
+ $currentCity = $this->get("session_service")->getCity();
+ if ($currentCity == null) {
+ $this->get('session')->getFlashBag()->add('error', $this->get('translator')->trans('session.city.not_found'));
+ $this->redirect($this->generateUrl("home"));
+ }
+
+ $page = intval($this->getRequest()->get("page",1));
+
+ //pagination
+ $nb_entities = $places = $this->getDoctrine()->getRepository('CTRVPlaceBundle:PlaceType')->getTypePlacesNumber();
+ $nb_entities_page = Constants::places_type_number_per_page;
+ $nb_pages = ceil($nb_entities/$nb_entities_page);
+ $offset = ($page-1) * $nb_entities_page;
+
+ $places = $this->getDoctrine()->getRepository('CTRVPlaceBundle:PlaceType')->getTypePlaces($offset, $nb_entities_page);
+
+ return array (
+ 'entities' => $places,
+ 'nb_pages' => $nb_pages,
+ 'page' => $page,
+ 'nb_entities' => $nb_entities
+ );
+ }
+
+
+ /**
+ * Deletes a Place entity.
+ *
+ * @Route("/{id}/delete", name="place_delete" ) //requirements={"id" = "\d+"}
+ * @Method("POST")
+ * @Template()
+ */
+ public function deleteAction($id) {
+
+ $em = $this->getDoctrine()->getManager();
+ $entity = $em->getRepository('CTRVPlaceBundle:Place')->find(intval($id));
+ $em->remove($entity);
+ $em->flush();
+
+ return new Response(json_encode(array('result'=>true)));
+ }
+
+
+ /**
+ * Deletes a lit of Place entity.
+ *
+ * @Route("/deleteList", name="place_list_delete" )
+ * @Template()
+ */
+ public function deleteListAction() {
+
+ $selectedIds = json_decode($this->getRequest()->get("selectedIds"));
+ $em = $this->getDoctrine()->getManager();
+
+ if ($selectedIds != null)
+ foreach ($selectedIds as $id ) {
+ $entity = $em->getRepository('CTRVPlaceBundle:Place')->find($id);
+ $em->remove($entity);
+ $em->flush();
+ }
+
+ return new Response(json_encode(array('result'=>true)));
+ }
+
+ /**
+ * @Route("/placeWithSameAddress", name="placeWithSameAddress")
+ * @Template()
+ */
+ public function placeWithSameAddressAction () {
+
+ $currentCity = $this->get('session_service')->getCity();
+
+ if ($currentCity == null) {
+ $this->get('session')->getFlashBag()->add('error', $this->get('translator')->trans('session.city.not_found'));
+ $this->redirect($this->generateUrl("home"));
+ }
+
+ $page = $this->getRequest()->get("page",1);
+
+ //pagination
+ $nb_entities = $this->getDoctrine()->getEntityManager()->getRepository("CTRVPlaceBundle:Place")->getPlacesHavinAddressInDoubleByCityNumber($currentCity->getId());
+ $nb_entities_page = Constants::places_with_same_address_number_per_page;
+ $nb_pages = ceil($nb_entities/$nb_entities_page);
+ $offset = ($page-1) * $nb_entities_page;
+
+ $places = $this->getDoctrine()->getEntityManager()->getRepository("CTRVPlaceBundle:Place")->getPlacesHavinAddressInDoubleByCity($currentCity->getId(), $offset, $nb_entities_page);
+
+
+// var_dump($places);exit;
+ return array (
+ 'entities' => $places,
+ 'nb_pages' => $nb_pages,
+ 'page' => $page,
+ 'nb_entities' => $nb_entities
+ );
+ }
+
+ /**
+ * Deletes a PlaceType entity.
+ *
+ * @Route("/{id}/deleteType", name="placeType_delete" ) //requirements={"id" = "\d+"}
+ * @Method("POST")
+ * @Template()
+ */
+ public function deletePlaceTypeAction($id) {
+
+ $em = $this->getDoctrine()->getManager();
+ $entity = $em->getRepository('CTRVPlaceBundle:PlaceType')->find($id);
+
+ $em->remove($entity);
+ $em->flush();
+
+ return new Response(json_encode(array('result'=>true)));
+ }
+
+}
diff --git a/CTRV/PlaceBundle/DependencyInjection/CTRVPlaceExtension.php b/CTRV/PlaceBundle/DependencyInjection/CTRVPlaceExtension.php
new file mode 100644
index 0000000..069c572
--- /dev/null
+++ b/CTRV/PlaceBundle/DependencyInjection/CTRVPlaceExtension.php
@@ -0,0 +1,28 @@
+processConfiguration($configuration, $configs);
+
+ $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
+ $loader->load('services.yml');
+ }
+}
diff --git a/CTRV/PlaceBundle/DependencyInjection/Configuration.php b/CTRV/PlaceBundle/DependencyInjection/Configuration.php
new file mode 100644
index 0000000..4738548
--- /dev/null
+++ b/CTRV/PlaceBundle/DependencyInjection/Configuration.php
@@ -0,0 +1,29 @@
+root('ctrv_place');
+
+ // Here you should define the parameters that are allowed to
+ // configure your bundle. See the documentation linked above for
+ // more information on that topic.
+
+ return $treeBuilder;
+ }
+}
diff --git a/CTRV/PlaceBundle/Entity/ImportPlace.php b/CTRV/PlaceBundle/Entity/ImportPlace.php
new file mode 100644
index 0000000..6508e8e
--- /dev/null
+++ b/CTRV/PlaceBundle/Entity/ImportPlace.php
@@ -0,0 +1,40 @@
+city;
+ }
+
+ public function getUploadRootDir()
+ {
+ return __DIR__.'/../../../../web/'.$this->getUploadDir();
+ }
+
+ public function getUploadDir()
+ {
+ return Constants::IMPORT_FILE_PATH;
+ }
+
+
+}
diff --git a/CTRV/PlaceBundle/Entity/Place.php b/CTRV/PlaceBundle/Entity/Place.php
new file mode 100644
index 0000000..f6433c0
--- /dev/null
+++ b/CTRV/PlaceBundle/Entity/Place.php
@@ -0,0 +1,671 @@
+addedDate = new \DateTime();
+ }
+
+ /**
+ * Get id
+ *
+ * @return integer
+ */
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * Set activity
+ *
+ * @param string $activity
+ * @return Place
+ */
+ public function setActivity($activity)
+ {
+ $this->activity = $activity;
+
+ return $this;
+ }
+
+ /**
+ * Get activity
+ *
+ * @return string
+ */
+ public function getActivity()
+ {
+ return $this->activity;
+ }
+
+ /**
+ * Set latitude
+ *
+ * @param string $latitude
+ * @return Place
+ */
+ public function setLatitude($latitude)
+ {
+ $this->latitude = $latitude;
+
+ return $this;
+ }
+
+ /**
+ * Get latitude
+ *
+ * @return string
+ */
+ public function getLatitude()
+ {
+ return $this->latitude;
+ }
+
+ /**
+ * Set longitude
+ *
+ * @param string $longitude
+ * @return Place
+ */
+ public function setLongitude($longitude)
+ {
+ $this->longitude = $longitude;
+
+ return $this;
+ }
+
+ /**
+ * Get longitude
+ *
+ * @return string
+ */
+ public function getLongitude()
+ {
+ return $this->longitude;
+ }
+
+ /**
+ * Set isApproximateAddress
+ *
+ * @param boolean $isApproximateAddress
+ * @return Place
+ */
+ public function setIsApproximateAddress($isApproximateAddress)
+ {
+ $this->isApproximateAddress = $isApproximateAddress;
+
+ return $this;
+ }
+
+ /**
+ * Get isApproximateAddress
+ *
+ * @return boolean
+ */
+ public function getIsApproximateAddress()
+ {
+ return $this->isApproximateAddress;
+ }
+
+ /**
+ * Set description
+ *
+ * @param string $description
+ * @return Place
+ */
+ public function setDescription($description)
+ {
+ $this->description = $description;
+
+ return $this;
+ }
+
+ /**
+ * Get description
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->description;
+ }
+
+ /**
+ * Set title
+ *
+ * @param string $title
+ * @return Place
+ */
+ public function setTitle($title)
+ {
+ $this->title = $title;
+
+ return $this;
+ }
+
+ /**
+ * Get title
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->title;
+ }
+
+ /**
+ * Set siteUrl
+ *
+ * @param string $siteUrl
+ * @return Place
+ */
+ public function setSiteUrl($siteUrl)
+ {
+ $this->siteUrl = $siteUrl;
+
+ return $this;
+ }
+
+ /**
+ * Get siteUrl
+ *
+ * @return string
+ */
+ public function getSiteUrl()
+ {
+ return $this->siteUrl;
+ }
+
+ /**
+ * Set town
+ *
+ * @param string $town
+ * @return Place
+ */
+ public function setTown($town)
+ {
+ $this->town = $town;
+
+ return $this;
+ }
+
+ /**
+ * Get town
+ *
+ * @return string
+ */
+ public function getTown()
+ {
+ return $this->town;
+ }
+
+ /**
+ * Set street
+ *
+ * @param string $street
+ * @return Place
+ */
+ public function setStreet($street)
+ {
+ $this->street = $street;
+
+ return $this;
+ }
+
+ /**
+ * Get street
+ *
+ * @return string
+ */
+ public function getStreet()
+ {
+ return $this->street;
+ }
+
+ /**
+ * Set mark
+ *
+ * @param integer $mark
+ * @return Place
+ */
+ public function setMark($mark)
+ {
+ $this->mark = $mark;
+
+ return $this;
+ }
+
+ /**
+ * Get mark
+ *
+ * @return integer
+ */
+ public function getMark()
+ {
+ return $this->mark;
+ }
+
+ /**
+ * Set numberMark
+ *
+ * @param integer $numberMark
+ * @return Place
+ */
+ public function setNumberMark($numberMark)
+ {
+ $this->numberMark = $numberMark;
+
+ return $this;
+ }
+
+ /**
+ * Get numberMark
+ *
+ * @return integer
+ */
+ public function getNumberMark()
+ {
+ return $this->numberMark;
+ }
+
+ /**
+ * Set addedDate
+ *
+ * @param \DateTime $addedDate
+ * @return Place
+ */
+ public function setAddedDate($addedDate)
+ {
+ $this->addedDate = $addedDate;
+
+ return $this;
+ }
+
+ /**
+ * Get addedDate
+ *
+ * @return \DateTime
+ */
+ public function getAddedDate()
+ {
+ return $this->addedDate;
+ }
+
+ /**
+ * Set placeType
+ *
+ * @param CTRV\PlaceBundle\Entity\PlaceType $placeType
+ * @return Place
+ */
+ public function setPlaceType(\CTRV\PlaceBundle\Entity\PlaceType $placeType = null)
+ {
+ $this->placeType = $placeType;
+
+ return $this;
+ }
+
+ /**
+ * Get placeType
+ *
+ * @return CTRV\PlaceBundle\Entity\PlaceType
+ */
+ public function getPlaceType()
+ {
+ return $this->placeType;
+ }
+
+ /**
+ * Set auteur
+ *
+ * @param CTRV\CommonBundle\Entity\User $auteur
+ * @return Place
+ */
+ public function setAuteur(\CTRV\CommonBundle\Entity\User $auteur = null)
+ {
+ $this->auteur = $auteur;
+
+ return $this;
+ }
+
+ /**
+ * Get auteur
+ *
+ * @return CTRV\CommonBundle\Entity\User
+ */
+ public function getAuteur()
+ {
+ return $this->auteur;
+ }
+
+ /**
+ * Set city
+ *
+ * @param CTRV\CommonBundle\Entity\City $city
+ * @return Place
+ */
+ public function setCity(\CTRV\CommonBundle\Entity\City $city = null)
+ {
+ $this->city = $city;
+
+ return $this;
+ }
+
+ /**
+ * Get city
+ *
+ * @return CTRV\CommonBundle\Entity\City
+ */
+ public function getCity()
+ {
+ return $this->city;
+ }
+
+ /**
+ * Set tel
+ *
+ * @param string $tel
+ * @return Place
+ */
+ public function setTel($tel)
+ {
+ $this->tel = $tel;
+
+ return $this;
+ }
+
+ /**
+ * Get tel
+ *
+ * @return string
+ */
+ public function getTel()
+ {
+ return $this->tel;
+ }
+
+ /**
+ * Set owner
+ *
+ * @param CTRV\CommonBundle\Entity\User $owner
+ * @return Place
+ */
+ public function setOwner(\CTRV\CommonBundle\Entity\User $owner = null)
+ {
+ $this->owner = $owner;
+
+ return $this;
+ }
+
+ /**
+ * Get owner
+ *
+ * @return CTRV\CommonBundle\Entity\User
+ */
+ public function getOwner()
+ {
+ return $this->owner;
+ }
+
+ /**
+ * Set tel2
+ *
+ * @param string $tel2
+ * @return Place
+ */
+ public function setTel2($tel2)
+ {
+ $this->tel2 = $tel2;
+
+ return $this;
+ }
+
+ /**
+ * Get tel2
+ *
+ * @return string
+ */
+ public function getTel2()
+ {
+ return $this->tel2;
+ }
+
+ /**
+ * Set codePostal
+ *
+ * @param string $codePostal
+ * @return Place
+ */
+ public function setCodePostal($codePostal)
+ {
+ $this->codePostal = $codePostal;
+
+ return $this;
+ }
+
+ /**
+ * Get codePostal
+ *
+ * @return string
+ */
+ public function getCodePostal()
+ {
+ return $this->codePostal;
+ }
+
+ /**
+ * Set fax
+ *
+ * @param string $fax
+ * @return Place
+ */
+ public function setFax($fax)
+ {
+ $this->fax = $fax;
+
+ return $this;
+ }
+
+ /**
+ * Get fax
+ *
+ * @return string
+ */
+ public function getFax()
+ {
+ return $this->fax;
+ }
+
+ /**
+ * Set mobile
+ *
+ * @param string $mobile
+ * @return Place
+ */
+ public function setMobile($mobile)
+ {
+ $this->mobile = $mobile;
+
+ return $this;
+ }
+
+ /**
+ * Get mobile
+ *
+ * @return string
+ */
+ public function getMobile()
+ {
+ return $this->mobile;
+ }
+}
\ No newline at end of file
diff --git a/CTRV/PlaceBundle/Entity/PlaceRepository.php b/CTRV/PlaceBundle/Entity/PlaceRepository.php
new file mode 100644
index 0000000..59dc1d5
--- /dev/null
+++ b/CTRV/PlaceBundle/Entity/PlaceRepository.php
@@ -0,0 +1,287 @@
+createQueryBuilder("p")
+ ->select("p.street")
+ ->where("p.city=?1")
+ ->groupBy("p.street")
+ ->having("count(p.id) >?2")
+ ->setParameter(1, $city_id)
+ ->setParameter(2, 1)
+ ;
+
+ $list_address = $qbtemp->getQuery()->getResult();
+
+ $addresses = array();
+ foreach ($list_address as $item) {
+ array_push($addresses, $item);
+ }
+
+ return $addresses;
+ }
+
+ /**
+ * Retourne la liste de tous les place dont les addresses existent en double.
+ * @param unknown_type $placeType
+ * @param unknown_type $city
+ */
+ public function getPlacesHavinAddressInDoubleByCity ($city_id,$first, $last) {
+
+ $addresses = $this->getAddressInDouble($city_id);
+
+ $qb = $this->createQueryBuilder("p")
+ ->where("p.city=?1")
+ ->andWhere("p.street IN (?2)")
+ ->orderBy('p.street', 'ASC')
+ ->setParameter(1, $city_id)
+ ->setParameter(2, $addresses)
+ ->setFirstResult($first)
+ ->setMaxResults($last)
+ ;
+
+ return $qb->getQuery()->getResult();
+ }
+
+
+ /**
+ * Retourne le nombre de places dont les addresses existent en double.
+ * @param unknown_type $placeType
+ * @param unknown_type $city
+ */
+ public function getPlacesHavinAddressInDoubleByCityNumber ($city_id) {
+
+ $addresses = $this->getAddressInDouble($city_id);
+
+ $qb = $this->createQueryBuilder("p")
+ ->select("count(p)")
+ ->where("p.city=?1")
+ ->andWhere("p.street IN (?2)")
+ ->orderBy('p.street', 'ASC')
+ ->setParameter(1, $city_id)
+ ->setParameter(2, $addresses)
+ ;
+
+ return $qb->getQuery()->getSingleScalarResult();
+ }
+
+
+
+
+ /**
+ * Retourne la liste des places par types ajoutées par les utilisateurs
+ * @param unknown_type $placeType
+ * @param unknown_type $city
+ */
+ public function getPlaceAddedByUsers ($placeType, $city, $first, $last) {
+ $qb = $this->createQueryBuilder("p")
+ ->where("p.auteur is not null")
+ ->andWhere("p.placeType=?1")
+ ->andWhere("p.city=?2")
+ ->orderBy('p.addedDate', 'DESC')
+ ->setParameter(1, $placeType)
+ ->setParameter(2, $city)
+ ->setFirstResult($first)
+ ->setMaxResults($last)
+ ;
+ return $qb->getQuery()->getResult();
+ }
+
+ /**
+ * Retourne le nombre de places par types ajoutées par les utilisateurs
+ * @param unknown_type $placeType
+ * @param unknown_type $city
+ */
+ public function getPlaceAddedByUsersNumber ($placeType, $city) {
+ $qb = $this->createQueryBuilder("p")
+ ->select('count(p)')
+ ->where("p.auteur is not null")
+ ->andWhere("p.placeType=?1")
+ ->andWhere("p.city=?2")
+ ->orderBy('p.addedDate', 'DESC')
+ ->setParameter(1, $placeType)
+ ->setParameter(2, $city)
+ ;
+ return $qb->getQuery()->getSingleScalarResult();
+ }
+
+
+ /**
+ * Retourne la liste des places par types
+ * @param unknown_type $placeType
+ * @param unknown_type $city
+ */
+ public function getPlacesByType ($placeType, $city, $first, $last) {
+ $qb = $this->createQueryBuilder("p")
+ ->where("p.latitude is null OR p.longitude is null")
+ ->andWhere("p.placeType=?1")
+ ->andWhere("p.city=?2")
+ ->orderBy('p.addedDate', 'DESC')
+ ->setParameter(1, $placeType)
+ ->setParameter(2, $city)
+ ->setFirstResult($first)
+ ->setMaxResults($last)
+ ;
+ return $qb->getQuery()->getResult();
+ }
+
+ /**
+ * Retourne le nombre de places par types
+ * @param unknown_type $placeType
+ * @param unknown_type $city
+ */
+ public function getPlacesByTypeNumber ($placeType, $city) {
+ $qb = $this->createQueryBuilder("p")
+ ->select('count(p)')
+ ->where("p.latitude is null OR p.longitude is null")
+ ->andWhere("p.placeType=?1")
+ ->andWhere("p.city=?2")
+ ->orderBy('p.addedDate', 'DESC')
+ ->setParameter(1, $placeType)
+ ->setParameter(2, $city)
+ ;
+ return $qb->getQuery()->getSingleScalarResult();
+ }
+
+
+ /**
+ * Retourne la liste des places sans latitude ou longitude de la ville courante
+ * @param unknown_type $city
+ */
+ public function getPlacesWithoutLatLong ($city, $first, $last) {
+ $qb = $this->createQueryBuilder("p")
+ ->where("p.latitude is null OR p.longitude is null")
+ ->andWhere("p.city=?1")
+ ->orderBy('p.title', 'ASC')
+ ->setParameter(1, $city)
+ ->setFirstResult($first)
+ ->setMaxResults($last)
+ ;
+ return $qb->getQuery()->getResult();
+ }
+
+ /**
+ * Retourne le nombre de place sans latitude longitude de la ville courante
+ * @param unknown_type $city
+ */
+ public function getPlacesWithoutLatLongNumber ($city) {
+ $qb = $this->createQueryBuilder("p")
+ ->select('count(p)')
+ ->where("p.latitude is null OR p.longitude is null")
+ ->andWhere("p.city=?1")
+ ->setParameter(1, $city->getId())
+ ->getQuery()->getSingleScalarResult()
+ ;
+ return $qb;
+ }
+
+ public function getLocalizedPlacesByCityNumber ($city) {
+ $qb = $this->createQueryBuilder("p")
+ ->select('count(p)')
+// ->where("p.latitude is not null")
+ ->where("p.city=?1")
+ ->setParameter(1, $city)
+ ->getQuery()->getSingleScalarResult()
+ ;
+ return $qb;
+ }
+
+ /**
+ * Retourne la liste des places sans description de la ville courante
+ * @param unknown_type $city
+ */
+ public function getPlacesWithoutDescription ($city, $first, $last) {
+ $qb = $this->createQueryBuilder("p")
+ ->where("p.description is null")
+ ->andWhere("p.city=?1")
+ ->orderBy('p.title', 'ASC')
+ ->setParameter(1, $city)
+ ->setFirstResult($first)
+ ->setMaxResults($last)
+
+ ;
+ return $qb->getQuery()->getResult();
+ }
+
+ /**
+ * Retourne le nombre de place sans description de la ville courante
+ * @param unknown_type $city
+ */
+ public function getPlacesWithoutDescriptionNumber ($city) {
+ $qb = $this->createQueryBuilder("p")
+ ->select('count(p)')
+ ->where("p.description is null")
+ ->andWhere("p.city=?1")
+ ->orderBy('p.addedDate', 'DESC')
+ ->setParameter(1, $city->getId())
+ ;
+ return $qb->getQuery()->getSingleScalarResult();
+ }
+
+ /**
+ * Retourne la liste des places de la rue spécifiée dans la ville courante
+ * @param unknown_type $searchText
+ */
+ public function getPlaceByStreet ($searchText, $city, $first, $last) {
+ $qb = $this->createQueryBuilder("p")
+ ->where("p.street like ?1")
+ ->andWhere("p.city=?2")
+ ->setParameter(1, "%".$searchText."%")
+ ->setParameter(2, $city)
+ ->setFirstResult($first)
+ ->setMaxResults($last)
+ ;
+ return $qb->getQuery()->getResult();
+ }
+
+ /**
+ *
+ * @param unknown_type $searchText
+ * @param unknown_type $city
+ */
+ public function getPlaceByStreetNumber ($searchText, $city) {
+ $qb = $this->createQueryBuilder("p")
+ ->select('count(p)')
+ ->where("p.street like ?1")
+ ->andWhere("p.city=?2")
+ ->setParameter(1, "%".$searchText."%")
+ ->setParameter(2, $city->getId())
+ ;
+ return $qb->getQuery()->getSingleScalarResult();
+ }
+
+ /**
+ * Retourne le nombre de place localisée
+ */
+ public function getNotLocalizedPlaceNumber () {
+
+ $qb = $this->createQueryBuilder("p")
+ ->select("count(p)")
+ ->where("p.latitude is null")
+ ->orWhere("p.longitude is null")
+ ;
+ return $qb->getQuery()->getSingleScalarResult();
+ }
+ /**
+ * Retourne le nombre total de place
+ */
+ public function getAllPlaceNumber () {
+
+ $qb = $this->createQueryBuilder("p")
+ ->select("count(p)")
+ ;
+ return $qb->getQuery()->getSingleScalarResult();
+ }
+}
\ No newline at end of file
diff --git a/CTRV/PlaceBundle/Entity/PlaceType.php b/CTRV/PlaceBundle/Entity/PlaceType.php
new file mode 100644
index 0000000..786b181
--- /dev/null
+++ b/CTRV/PlaceBundle/Entity/PlaceType.php
@@ -0,0 +1,156 @@
+id;
+ }
+
+ /**
+ * Set label
+ *
+ * @param string $label
+ * @return PlaceType
+ */
+ public function setLabel($label)
+ {
+ $this->label = $label;
+
+ return $this;
+ }
+
+ /**
+ * Get label
+ *
+ * @return string
+ */
+ public function getLabel()
+ {
+ return $this->label;
+ }
+
+ public function __toString() {
+ return $this->label;
+ }
+
+ /**
+ * Set code
+ *
+ * @param string $code
+ * @return PlaceType
+ */
+ public function setCode($code)
+ {
+ $this->code = $code;
+
+ return $this;
+ }
+
+ /**
+ * Get code
+ *
+ * @return string
+ */
+ public function getCode()
+ {
+ return $this->code;
+ }
+
+ /**
+ * Set language
+ *
+ * @param string $language
+ * @return PlaceType
+ */
+ public function setLanguage($language)
+ {
+ $this->language = $language;
+
+ return $this;
+ }
+
+ /**
+ * Get language
+ *
+ * @return string
+ */
+ public function getLanguage()
+ {
+ return $this->language;
+ }
+
+ /**
+ * Set img_url
+ *
+ * @param string $imgUrl
+ * @return PlaceType
+ */
+ public function setImgUrl($imgUrl)
+ {
+ $this->img_url = $imgUrl;
+
+ return $this;
+ }
+
+ /**
+ * Get img_url
+ *
+ * @return string
+ */
+ public function getImgUrl()
+ {
+ return $this->img_url;
+ }
+}
\ No newline at end of file
diff --git a/CTRV/PlaceBundle/Entity/PlaceTypeRepository.php b/CTRV/PlaceBundle/Entity/PlaceTypeRepository.php
new file mode 100644
index 0000000..b813824
--- /dev/null
+++ b/CTRV/PlaceBundle/Entity/PlaceTypeRepository.php
@@ -0,0 +1,35 @@
+createQueryBuilder("p")
+ ->orderBy('p.code','ASC')
+ ->setFirstResult($first)
+ ->setMaxResults($last)
+ ;
+ return $qb->getQuery()->getResult();
+
+ }
+
+ /**
+ * retourne le nombre total de types de places
+ */
+ public function getTypePlacesNumber(){
+ $qb= $this->createQueryBuilder("p")
+ ->select('count(p)')
+ ;
+ return $qb->getQuery()->getSingleScalarResult();
+
+ }
+
+}
\ No newline at end of file
diff --git a/CTRV/PlaceBundle/Entity/TraitedPlace.php b/CTRV/PlaceBundle/Entity/TraitedPlace.php
new file mode 100644
index 0000000..28bd983
--- /dev/null
+++ b/CTRV/PlaceBundle/Entity/TraitedPlace.php
@@ -0,0 +1,63 @@
+id;
+ }
+
+ /**
+ * Set idPlace
+ *
+ * @param integer $idPlace
+ * @return TraitedPlace
+ */
+ public function setIdPlace($idPlace)
+ {
+ $this->idPlace = $idPlace;
+
+ return $this;
+ }
+
+ /**
+ * Get idPlace
+ *
+ * @return integer
+ */
+ public function getIdPlace()
+ {
+ return $this->idPlace;
+ }
+}
\ No newline at end of file
diff --git a/CTRV/PlaceBundle/Entity/TraitedPlaceRepository.php b/CTRV/PlaceBundle/Entity/TraitedPlaceRepository.php
new file mode 100644
index 0000000..9e52f3a
--- /dev/null
+++ b/CTRV/PlaceBundle/Entity/TraitedPlaceRepository.php
@@ -0,0 +1,15 @@
+add('placeType', 'entity', array (
+ 'class' => 'CTRVPlaceBundle:PlaceType',
+ 'query_builder' => function(EntityRepository $er) {
+ return $er->createQueryBuilder('u')
+ ->orderBy('u.label', 'ASC');
+ },
+ 'label'=>'place.ajouterForm.placeType',
+ 'attr'=> array('class'=>'input-xlarge')
+ ))
+ ;
+ }
+
+
+ public function getName()
+ {
+ return 'choose_place_type';
+ }
+}
diff --git a/CTRV/PlaceBundle/Form/ImportPlaceType.php b/CTRV/PlaceBundle/Form/ImportPlaceType.php
new file mode 100644
index 0000000..ca76b66
--- /dev/null
+++ b/CTRV/PlaceBundle/Form/ImportPlaceType.php
@@ -0,0 +1,39 @@
+add('placeType','entity', array(
+ 'class' => 'CTRVPlaceBundle:PlaceType',
+ 'query_builder' => function(EntityRepository $er) {
+ return $er->createQueryBuilder('u')
+ ->orderBy('u.label', 'ASC');
+ },
+ 'label'=>'place.import.form.placetype',
+ 'attr' =>array('class'=>'input-xlarge')
+ ))
+ ->add('file','file',array('label'=>'place.import.form.file'))
+ ;
+ }
+
+ public function setDefaultOptions(OptionsResolverInterface $resolver)
+ {
+ $resolver->setDefaults(array(
+ 'data_class' => 'CTRV\PlaceBundle\Entity\ImportPlace'
+ ));
+ }
+
+ public function getName()
+ {
+ return 'ctrv_placebundle_placetype_import_place';
+ }
+}
diff --git a/CTRV/PlaceBundle/Form/PlaceDescriptionForm.php b/CTRV/PlaceBundle/Form/PlaceDescriptionForm.php
new file mode 100644
index 0000000..c767eac
--- /dev/null
+++ b/CTRV/PlaceBundle/Form/PlaceDescriptionForm.php
@@ -0,0 +1,60 @@
+add('activity','textarea',array('label'=>'place.ajouterForm.activity','read_only' => true,'required'=>false))
+ ->add('latitude','text',array('label'=>'place.ajouterForm.latitude','required'=>false,'read_only' => true))
+ ->add('longitude','text',array('label'=>'place.ajouterForm.longitude','required'=>false,'read_only' => true))
+ ->add('isApproximateAddress','checkbox',array('label'=>'place.ajouterForm.isApproxAdress','read_only' => true,'required'=>false))
+ ->add('description','textarea',array('label'=>'place.ajouterForm.description','required'=>false))
+ ->add('title','text',array('label'=>'place.ajouterForm.TitlePlace','read_only' => true,'required'=>false))
+ ->add('siteUrl','text',array('label'=>'place.ajouterForm.siteUrl','read_only' => true,'required'=>false))
+ ->add('town','text',array('label'=>'place.ajouterForm.town','read_only' => true,'required'=>false))
+ ->add('street','textarea',array('label'=>'place.ajouterForm.street','read_only' => true,'required'=>false))
+ ->add('mark','text',array('label'=>'place.ajouterForm.mark','read_only' => true,'required'=>false))
+ ->add('tel','text',array('label'=>'place.ajouterForm.tel','read_only' => true,'required'=>false))
+ ->add('numberMark','text',array('label'=>'place.ajouterForm.numberMark','read_only' => true,'required'=>false))
+ ->add('addedDate','date',array('label'=>'place.ajouterForm.date','read_only' => true,'required'=>false))
+ ->add('placeType', 'entity', array ('read_only' => true,
+ 'class' => 'CTRVPlaceBundle:PlaceType',
+ 'query_builder' => function(EntityRepository $er) {
+ return $er->createQueryBuilder('u')
+ ->orderBy('u.label', 'ASC');
+ },
+ 'label'=>'place.moderate.form.placeType'
+ ))
+ //->add('auteur')
+ //->add('owner')
+ ->add('city', 'entity', array ('read_only' => true,
+ 'class' => 'CTRVCommonBundle:City',
+ 'query_builder' => function(EntityRepository $er) {
+ return $er->createQueryBuilder('c')
+ ->orderBy('c.name', 'ASC');
+ },
+ 'label'=>'place.ajouterForm.city'
+ ))
+ ;
+ }
+
+ public function setDefaultOptions(OptionsResolverInterface $resolver)
+ {
+ $resolver->setDefaults(array(
+ 'data_class' => 'CTRV\PlaceBundle\Entity\Place'
+ ));
+ }
+
+ public function getName()
+ {
+ return 'ctrv_placebundle_placeLatLongform';
+ }
+}
diff --git a/CTRV/PlaceBundle/Form/PlaceForm.php b/CTRV/PlaceBundle/Form/PlaceForm.php
new file mode 100644
index 0000000..713d871
--- /dev/null
+++ b/CTRV/PlaceBundle/Form/PlaceForm.php
@@ -0,0 +1,60 @@
+add('activity','textarea',array('label'=>'place.ajouterForm.activity','required'=>false))
+ ->add('latitude','text',array('label'=>'place.ajouterForm.latitude','required'=>false))
+ ->add('longitude','text',array('label'=>'place.ajouterForm.longitude','required'=>false))
+ ->add('isApproximateAddress','checkbox',array('label'=>'place.ajouterForm.isApproxAdress','required'=>false))
+ ->add('description','textarea',array('label'=>'place.ajouterForm.description','required'=>false))
+ ->add('title','text',array('label'=>'place.ajouterForm.TitlePlace'))
+ ->add('siteUrl','text',array('label'=>'place.ajouterForm.siteUrl','required'=>false))
+ ->add('town','text',array('label'=>'place.ajouterForm.town','required'=>false))
+ ->add('street','textarea',array('label'=>'place.ajouterForm.street'))
+ ->add('mark','text',array('label'=>'place.ajouterForm.mark','required'=>false))
+ ->add('tel','text',array('label'=>'place.ajouterForm.tel','required'=>false))
+ ->add('numberMark','text',array('label'=>'place.ajouterForm.numberMark','required'=>false))
+ ->add('addedDate','date',array('label'=>'place.ajouterForm.date','required'=>false))
+ ->add('placeType', 'entity', array (
+ 'class' => 'CTRVPlaceBundle:PlaceType',
+ 'query_builder' => function(EntityRepository $er) {
+ return $er->createQueryBuilder('u')
+ ->orderBy('u.label', 'ASC');
+ },
+ 'label'=>'place.moderate.form.placeType',
+ ))
+ //->add('auteur')
+ //->add('owner')
+ ->add('city', 'entity', array (
+ 'class' => 'CTRVCommonBundle:City',
+ 'query_builder' => function(EntityRepository $er) {
+ return $er->createQueryBuilder('c')
+ ->orderBy('c.name', 'ASC');
+ },
+ 'label'=>'place.ajouterForm.city',
+ ))
+ ;
+ }
+
+ public function setDefaultOptions(OptionsResolverInterface $resolver)
+ {
+ $resolver->setDefaults(array(
+ 'data_class' => 'CTRV\PlaceBundle\Entity\Place'
+ ));
+ }
+
+ public function getName()
+ {
+ return 'ctrv_placebundle_placeform';
+ }
+}
diff --git a/CTRV/PlaceBundle/Form/PlaceLatLongForm.php b/CTRV/PlaceBundle/Form/PlaceLatLongForm.php
new file mode 100644
index 0000000..eac0f86
--- /dev/null
+++ b/CTRV/PlaceBundle/Form/PlaceLatLongForm.php
@@ -0,0 +1,60 @@
+add('activity','textarea',array('label'=>'place.ajouterForm.activity','read_only' => true,'required'=>false))
+ ->add('latitude','text',array('label'=>'place.ajouterForm.latitude','required'=>false))
+ ->add('longitude','text',array('label'=>'place.ajouterForm.longitude','required'=>false))
+ ->add('isApproximateAddress','checkbox',array('label'=>'place.ajouterForm.isApproxAdress','read_only' => true,'required'=>false))
+ ->add('description','textarea',array('label'=>'place.ajouterForm.description','read_only' => true,'required'=>false))
+ ->add('title','text',array('label'=>'place.ajouterForm.TitlePlace','read_only' => true,'required'=>false))
+ ->add('siteUrl','text',array('label'=>'place.ajouterForm.siteUrl','read_only' => true,'required'=>false))
+ ->add('town','text',array('label'=>'place.ajouterForm.town','read_only' => true,'required'=>false))
+ ->add('street','textarea',array('label'=>'place.ajouterForm.street','read_only' => false,'required'=>false))
+ ->add('mark','text',array('label'=>'place.ajouterForm.mark','read_only' => true,'required'=>false))
+ ->add('tel','text',array('label'=>'place.ajouterForm.tel','read_only' => true,'required'=>false))
+ ->add('numberMark','text',array('label'=>'place.ajouterForm.numberMark','read_only' => true,'required'=>false))
+ ->add('addedDate','date',array('label'=>'place.ajouterForm.date','read_only' => true,'required'=>false))
+ ->add('placeType', 'entity', array (
+ 'class' => 'CTRVPlaceBundle:PlaceType',
+ 'query_builder' => function(EntityRepository $er) {
+ return $er->createQueryBuilder('u')
+ ->orderBy('u.label', 'ASC');
+ },
+ 'label'=>'place.moderate.form.placeType','read_only' => true,'required'=>false
+ ))
+ //->add('auteur')
+ //->add('owner')
+ ->add('city', 'entity', array (
+ 'class' => 'CTRVCommonBundle:City',
+ 'query_builder' => function(EntityRepository $er) {
+ return $er->createQueryBuilder('c')
+ ->orderBy('c.name', 'ASC');
+ },
+ 'label'=>'place.ajouterForm.city','read_only' => true,'required'=>false
+ ))
+ ;
+ }
+
+ public function setDefaultOptions(OptionsResolverInterface $resolver)
+ {
+ $resolver->setDefaults(array(
+ 'data_class' => 'CTRV\PlaceBundle\Entity\Place'
+ ));
+ }
+
+ public function getName()
+ {
+ return 'ctrv_placebundle_placeLatLongform';
+ }
+}
diff --git a/CTRV/PlaceBundle/Form/PlaceRechercheType.php b/CTRV/PlaceBundle/Form/PlaceRechercheType.php
new file mode 100644
index 0000000..f5edf5f
--- /dev/null
+++ b/CTRV/PlaceBundle/Form/PlaceRechercheType.php
@@ -0,0 +1,22 @@
+add('motcle','text', array('label' => 'place.rechercheForm.rechercher','required'=>false))
+ ;
+}
+
+public function getName() {
+ return 'placerecherche';
+}
+
+}
diff --git a/CTRV/PlaceBundle/Form/PlaceType.php b/CTRV/PlaceBundle/Form/PlaceType.php
new file mode 100644
index 0000000..8d60b1e
--- /dev/null
+++ b/CTRV/PlaceBundle/Form/PlaceType.php
@@ -0,0 +1,41 @@
+add('activity')
+ ->add('latitude')
+ ->add('longitude')
+ ->add('isApproximateAddress')
+ ->add('description')
+ ->add('title')
+ ->add('siteUrl')
+ ->add('town')
+ ->add('street')
+ ->add('mark')
+ ->add('numberMark')
+ ->add('placeType')
+ ;
+
+ }
+
+ public function setDefaultOptions(OptionsResolverInterface $resolver)
+ {
+ $resolver->setDefaults(array(
+ 'data_class' => 'CTRV\PlaceBundle\Entity\Place'
+ ));
+ }
+
+ public function getName()
+ {
+ return 'ctrv_placebundle_placetype';
+ }
+}
diff --git a/CTRV/PlaceBundle/Form/PlaceTypeType.php b/CTRV/PlaceBundle/Form/PlaceTypeType.php
new file mode 100644
index 0000000..82a3fcb
--- /dev/null
+++ b/CTRV/PlaceBundle/Form/PlaceTypeType.php
@@ -0,0 +1,38 @@
+add('label','text',array('label'=>'place.ajouterForm.libelle'))
+ ->add('code','text',array('label'=>'place.ajouterForm.code'))
+ ->add('language','choice',array('label'=>'place.ajouterForm.langue','choices'=>array(
+ 'FRENCH' => 'place.ajouterForm.fr',
+ 'ENGLISH' => 'place.ajouterForm.en',
+ 'SPANISH' => 'place.ajouterForm.es',
+ ),
+ ))
+ ->add('img_url','file',array('label'=>'place.ajouterForm.select_file','required'=>false))
+ ;
+ }
+
+ public function setDefaultOptions(OptionsResolverInterface $resolver)
+ {
+ $resolver->setDefaults(array(
+ 'data_class' => 'CTRV\PlaceBundle\Entity\PlaceType'
+ ));
+ }
+
+ public function getName()
+ {
+ return 'ctrv_placebundle_placetypetype';
+ }
+}
diff --git a/CTRV/PlaceBundle/Resources/config/services.yml b/CTRV/PlaceBundle/Resources/config/services.yml
new file mode 100644
index 0000000..fa3ea10
--- /dev/null
+++ b/CTRV/PlaceBundle/Resources/config/services.yml
@@ -0,0 +1,4 @@
+services:
+ place_service:
+ class: CTRV\PlaceBundle\Service\PlaceService
+ arguments: [@mailer,@doctrine,@service_container,@templating,@translator]
\ No newline at end of file
diff --git a/CTRV/PlaceBundle/Resources/doc/index.rst b/CTRV/PlaceBundle/Resources/doc/index.rst
new file mode 100644
index 0000000..2a4dad4
--- /dev/null
+++ b/CTRV/PlaceBundle/Resources/doc/index.rst
@@ -0,0 +1,3 @@
+\CTRV\CommonBundle\Entity\
+
+generate:doctrine:entities CTRVPlaceBundle
\ No newline at end of file
diff --git a/CTRV/PlaceBundle/Resources/public/js/place.js b/CTRV/PlaceBundle/Resources/public/js/place.js
new file mode 100644
index 0000000..d8568db
--- /dev/null
+++ b/CTRV/PlaceBundle/Resources/public/js/place.js
@@ -0,0 +1,103 @@
+/**
+ * Retourne la liste de place selon la rue spécifiée
+ */
+function loadSearchedPlaces (urlAction, p_searchText, ppage, container_id ) {
+ $('#'+container_id).html('');
+
+ $.post(urlAction,
+ {
+ searchText:p_searchText,
+ page:ppage
+
+ },
+ function (data) {
+ $('#'+container_id).html(data);
+ },
+ 'html'
+ );
+}
+
+
+
+
+/**
+ * Retourne la liste des place selon le type et la page spécifiée
+ */
+function loadPlacesByType (urlAction,pplaceTypeId,ppage,container) {
+ container.html('');
+
+ $.post(urlAction,
+ {
+ placeTypeId:pplaceTypeId,
+ page:ppage
+ },
+ function (data) {
+ container.html(data);
+ },
+ 'html'
+ );
+}
+
+
+/**
+ * Retourne la liste des places
+ */
+function loadPlaces (urlAction,ppage,container) {
+ container.html('');
+
+ $.post(urlAction,
+ {
+ page:ppage
+ },
+ function (data) {
+ container.html(data);
+ },
+ 'html'
+ );
+}
+/**
+ * Supprime une place
+ */
+function deletePlace (urlAction, tr_elem) {
+ $.post(urlAction,
+ {
+ },
+ function (data) {
+ if(data.result){
+ tr_elem.remove();
+ }
+ },
+ 'json'
+ );
+}
+
+
+function deleteListPlace (urlAction, pselectedIds) {
+ $.post(urlAction,
+ {
+ selectedIds: JSON.stringify(pselectedIds)
+ },
+ function (data) {
+ if(data.result){
+ location.reload();
+ }
+ },
+ 'json'
+ );
+}
+
+/**
+ * Supprime un type de place
+ */
+function deletePlaceType (urlAction, tr_elem) {
+ $.post(urlAction,
+ {
+ },
+ function (data) {
+ if(data.result){
+ tr_elem.remove();
+ }
+ },
+ 'json'
+ );
+}
\ No newline at end of file
diff --git a/CTRV/PlaceBundle/Resources/translations/messages.fr.yml b/CTRV/PlaceBundle/Resources/translations/messages.fr.yml
new file mode 100644
index 0000000..9c640a2
--- /dev/null
+++ b/CTRV/PlaceBundle/Resources/translations/messages.fr.yml
@@ -0,0 +1,127 @@
+place:
+ menu:
+ moderate: Places ajoutées par les utilisateurs
+ moderateAll : Toutes les places
+ import: Importer des données
+ setLatLng: Saisir la latitude et la longitude
+ setPlaceDescription: Saisir description de places
+ placeWithSameAddress: Nettoyer les doublons (manuel)
+ search: Rechercher par rue
+ type: Types de places
+ add: Ajouter
+ show_delete_double: Nettoyer et afficher les doublons
+ import:
+ title: Importation de données de places
+ help: Uploader un fichier xls contenant des données sur un type d'endroit d'une ville donnée.
+ success: Importation des données terminées (%traited%/%total% coordonnées de place trouvées) : %imported% nouvelle(s) place(s) ajoutée(s) - %already% place(s) existe(nt) déjà
+ relaunch_success: Importation des données terminées - %traited%/%total% coordonnées de place trouvées
+ calculate_coordinate: Recalculer les coordonnées
+ delete_double: Supprimer les doublons de la ville
+ form:
+ city: Ville
+ placetype: Type de place
+ file: Sélectionner fichier xls de données
+ submit: Importer
+ list:
+ title: Liste des places ajoutées par les utilisateurs
+ titleAll : Liste de toutes les places
+ titlePlaceWithoutLatLong: Liste des places ajoutées sans Latitude ou longitude
+ titlePlaceWithoutDescription: Liste des places ajoutées sans Description
+ titleTypePlace: Liste des types de Places
+ table:
+ title: Titre
+ type : Type
+ description: Description
+ latitude: Latitude
+ longitude: Longitude
+ adresse: Adresse
+ town: Ville
+ siteUrl: Url du Site
+ author: Auteur
+ addedDate: Date d'ajout
+ action: Actions
+ delete_action: Supprimer
+ update_action: Modifier
+ code: Code
+ label: Libellé
+ language: Langue
+ img_url: Icône
+ no_result: Aucune place trouvée
+ moderate:
+ form:
+ placeType: Type de place
+ ajouterForm:
+ titleAddTypePlace : Ajouter un type de place
+ titleUpdateTypePlace : Modifier un type de place
+ titleAddPlace : Ajouter une nouvelle Place
+ titleUpdatePlace : Modifier une Place
+ titleLatLong : Saisir Latitude et Longitude
+ titleDescription : Saisir la Description
+ select_file : Selectionner un fichier
+ libelle: Libellé
+ code : Code
+ activity: Activité
+ longitude: Longitude
+ latitude: Latitude
+ isApproxAdress: Adresse Approximative
+ description: Description
+ TitlePlace: Titre
+ siteUrl: Url du Site
+ town: Ville
+ street: Adresse
+ mark: Marque
+ tel: Téléphone
+ numberMark: Numéro de marques
+ date: Date
+ placeType: Type de place
+ auteur: Auteur
+ city: Cité
+ owner: Propriétaire
+ langue: Langue
+ fr : French
+ en : English
+ es : Spanish
+ save : Sauvegarder
+ rechercheForm:
+ title : Liste des places correspondant à votre recherche
+ rechercher: Entrer le nom d'une rue
+
+ list:
+ number: Il y a %number% places localisées dans cette ville
+ title: Liste des places de la ville
+ table:
+ title: Titre
+ type : Type de place
+ address: Adresse
+ action : Action
+ delete_action: Supprimer
+ no_result: Aucune place trouvée
+ placeWithSameAddress:
+ list:
+ title: Liste des places se trouvant à la même addresse
+ table:
+ title: Titre
+ type : Type
+ description: Description
+ adresse: Adresse
+ town: Ville
+ latitude: Latitude
+ longitude: Longitude
+ placeDeleteDouble:
+ title: Liste des groupes de places qui ont été considérées comme doublon
+
+placeComment:
+ menu:
+ afficher: Commentaires des Places
+
+ list:
+ title: Liste des Commentaires
+ table:
+ author: Auteur
+ content: Contenu
+ typeEntity: Type
+ addedDate: Date d'ajout
+ place: Place
+ action: Actions
+ delete_action: Supprimer
+ no_result: Aucun commentaire trouvé
\ No newline at end of file
diff --git a/CTRV/PlaceBundle/Resources/translations/validators.fr.yml b/CTRV/PlaceBundle/Resources/translations/validators.fr.yml
new file mode 100644
index 0000000..53a4185
--- /dev/null
+++ b/CTRV/PlaceBundle/Resources/translations/validators.fr.yml
@@ -0,0 +1,4 @@
+place:
+ import:
+ form:
+ file_format: Le format du fichier est incorrect. Le format attendu est xls
diff --git a/CTRV/PlaceBundle/Resources/views/Place/addNewPlace.html.twig b/CTRV/PlaceBundle/Resources/views/Place/addNewPlace.html.twig
new file mode 100644
index 0000000..ebeab44
--- /dev/null
+++ b/CTRV/PlaceBundle/Resources/views/Place/addNewPlace.html.twig
@@ -0,0 +1,25 @@
+{% extends "::base.html.twig" %}
+{% import '::macro.html.twig' as forms %}
+
+{% block body %}
+
+
+
+
+ {% include "CTRVPlaceBundle::menuPlace.html.twig" %}
+
+
+
+
{% trans %}place.ajouterForm.titleAddPlace{% endtrans %}
+
+
+
+
+
+
+
+
+{% endblock body %}
\ No newline at end of file
diff --git a/CTRV/PlaceBundle/Resources/views/Place/ajouterType.html.twig b/CTRV/PlaceBundle/Resources/views/Place/ajouterType.html.twig
new file mode 100644
index 0000000..0c791e6
--- /dev/null
+++ b/CTRV/PlaceBundle/Resources/views/Place/ajouterType.html.twig
@@ -0,0 +1,25 @@
+{% extends "::base.html.twig" %}
+{% import '::macro.html.twig' as forms %}
+
+{% block body %}
+
+
+
+
+ {% include "CTRVPlaceBundle::menuPlace.html.twig" %}
+
+
+
+
{% trans %}place.ajouterForm.titleAddTypePlace{% endtrans %}
+
+
+
+
+
+
+
+
+{% endblock body %}
\ No newline at end of file
diff --git a/CTRV/PlaceBundle/Resources/views/Place/autoDeleteDouble.html.twig b/CTRV/PlaceBundle/Resources/views/Place/autoDeleteDouble.html.twig
new file mode 100644
index 0000000..b98dc15
--- /dev/null
+++ b/CTRV/PlaceBundle/Resources/views/Place/autoDeleteDouble.html.twig
@@ -0,0 +1,41 @@
+{% extends "::base.html.twig" %}
+
+{% block body %}
+
+{% trans %}place.placeDeleteDouble.title{% endtrans %}
+
+ {% for entitys in entities %}
+
+
+
+
+
Id
+
{% trans %}place.placeWithSameAddress.list.table.type{% endtrans %}
+
{% trans %}place.placeWithSameAddress.list.table.title{% endtrans %}
+
{% trans %}place.placeWithSameAddress.list.table.adresse{% endtrans %}
+
{% trans %}place.placeWithSameAddress.list.table.town{% endtrans %}
+
{% trans %}place.placeWithSameAddress.list.table.latitude{% endtrans %}
+
{% trans %}place.placeWithSameAddress.list.table.longitude{% endtrans %}
+
+
+
+
+ {% for entity in entitys %}
+
+
{{ entity.id}}
+
{{ entity.placeType }}
+
{{ entity.title }}
+
{{ entity.street}}
+
{{ entity.town |upper}}
+
{{ entity.latitude}}
+
{{ entity.longitude}}
+
+ {% endfor %}
+
+
+
+{% endfor %}
+
+
+
+{% endblock body %}
\ No newline at end of file
diff --git a/CTRV/PlaceBundle/Resources/views/Place/import.html.twig b/CTRV/PlaceBundle/Resources/views/Place/import.html.twig
new file mode 100644
index 0000000..04b4718
--- /dev/null
+++ b/CTRV/PlaceBundle/Resources/views/Place/import.html.twig
@@ -0,0 +1,35 @@
+{% extends "::base.html.twig" %}
+{% import '::macro.html.twig' as forms %}
+
+{% block body %}
+
+
+
+
+ {% include "CTRVPlaceBundle::menuPlace.html.twig" %}
+
+
+
+{% endblock body %}
\ No newline at end of file
diff --git a/CTRV/PlaceBundle/Resources/views/Place/index.html.twig b/CTRV/PlaceBundle/Resources/views/Place/index.html.twig
new file mode 100644
index 0000000..bc597ce
--- /dev/null
+++ b/CTRV/PlaceBundle/Resources/views/Place/index.html.twig
@@ -0,0 +1,51 @@
+{% extends "::base.html.twig" %}
+{% import '::macro.html.twig' as forms %}
+
+{% block body %}
+
+
+
+
+ {% include "CTRVPlaceBundle::menuPlace.html.twig" %}
+
+
{% trans %}place.list.table.no_result{% endtrans %}
+{% endif %}
+
+
+
+
+
+
+
+
+
+{% endblock body %}
\ No newline at end of file
diff --git a/CTRV/PlaceBundle/Resources/views/Place/loadPlacesByType.html.twig b/CTRV/PlaceBundle/Resources/views/Place/loadPlacesByType.html.twig
new file mode 100644
index 0000000..4cc50aa
--- /dev/null
+++ b/CTRV/PlaceBundle/Resources/views/Place/loadPlacesByType.html.twig
@@ -0,0 +1,62 @@
+{% if entities is not empty %}
+
+
+
+
{% trans %}place.list.table.title{% endtrans %}
+
{% trans %}place.list.table.description{% endtrans %}
+
{% trans %}place.list.table.adresse{% endtrans %}
+
{% trans %}place.list.table.addedDate{% endtrans %}
+
{% trans %}place.list.table.action{% endtrans %}
+
+
+
+ {% for entity in entities %}
+
+
{{ entity.title }}
+
{{ entity.description }}
+
{{ entity.street }}
+ {% set format = constant('CTRV\\CommonBundle\\DependencyInjection\\Constants::DATE_FORMAT') %}
+
{% trans %}place.list.table.no_result{% endtrans %}
+{% endif %}
+
+
+
+
+
+
+
+{% endblock body %}
\ No newline at end of file
diff --git a/CTRV/PlaceBundle/Resources/views/Place/modifierType.html.twig b/CTRV/PlaceBundle/Resources/views/Place/modifierType.html.twig
new file mode 100644
index 0000000..424ad51
--- /dev/null
+++ b/CTRV/PlaceBundle/Resources/views/Place/modifierType.html.twig
@@ -0,0 +1,24 @@
+{% extends "::base.html.twig" %}
+{% import '::macro.html.twig' as forms %}
+
+{% block body %}
+
+
+
+
+ {% include "CTRVPlaceBundle::menuPlace.html.twig" %}
+
+
+
+
{% trans %}place.ajouterForm.titleUpdateTypePlace{% endtrans %}
+
+
+
+
+
+
+
+{% endblock body %}
\ No newline at end of file
diff --git a/CTRV/PlaceBundle/Resources/views/Place/placeWithSameAddress.html.twig b/CTRV/PlaceBundle/Resources/views/Place/placeWithSameAddress.html.twig
new file mode 100644
index 0000000..a46fe17
--- /dev/null
+++ b/CTRV/PlaceBundle/Resources/views/Place/placeWithSameAddress.html.twig
@@ -0,0 +1,93 @@
+{% extends "::base.html.twig" %}
+{% import '::macro.html.twig' as forms %}
+
+{% block body %}
+
+
+
+
+ {% include "CTRVPlaceBundle::menuPlace.html.twig" %}
+
+
+
+
{% trans %}place.placeWithSameAddress.list.title{% endtrans %}
+
+
+ {% if entities is not empty %}
+
+
+
+
+
{% trans %}place.placeWithSameAddress.list.table.type{% endtrans %}
+
{% trans %}place.placeWithSameAddress.list.table.title{% endtrans %}
+
{% trans %}place.placeWithSameAddress.list.table.adresse{% endtrans %}
+
{% trans %}place.placeWithSameAddress.list.table.town{% endtrans %}
+
{% trans %}place.placeWithSameAddress.list.table.latitude{% endtrans %}
+
{% trans %}place.placeWithSameAddress.list.table.longitude{% endtrans %}
+
+
+
+
+ {% set oldStreet = "" %}
+
+ {% for entity in entities %}
+
+ {% if oldStreet != entity.street %}
+
{% trans %}place.list.table.no_result{% endtrans %}
+{% endif %}
+
+
+
+
+
+{% endblock body %}
\ No newline at end of file
diff --git a/CTRV/PlaceBundle/Resources/views/Place/placeWithoutLatLong.html.twig b/CTRV/PlaceBundle/Resources/views/Place/placeWithoutLatLong.html.twig
new file mode 100644
index 0000000..e3250f8
--- /dev/null
+++ b/CTRV/PlaceBundle/Resources/views/Place/placeWithoutLatLong.html.twig
@@ -0,0 +1,62 @@
+{% extends "::base.html.twig" %}
+{% import '::macro.html.twig' as forms %}
+
+{% block body %}
+
+
+
+
+ {% include "CTRVPlaceBundle::menuPlace.html.twig" %}
+
+
+
+
{% trans %}place.list.titlePlaceWithoutLatLong{% endtrans %}
{% trans %}place.list.table.no_result{% endtrans %}
+ {% endif %}
+
+
+
+
+
+{% endblock body %}
\ No newline at end of file
diff --git a/CTRV/PlaceBundle/Resources/views/Place/rechercherPlace.html.twig b/CTRV/PlaceBundle/Resources/views/Place/rechercherPlace.html.twig
new file mode 100644
index 0000000..53568f6
--- /dev/null
+++ b/CTRV/PlaceBundle/Resources/views/Place/rechercherPlace.html.twig
@@ -0,0 +1,56 @@
+{% extends "::base.html.twig" %}
+{% import '::macro.html.twig' as forms %}
+
+{% block body %}
+
+
+
+
+ {% include "CTRVPlaceBundle::menuPlace.html.twig" %}
+
+
+
+
{% trans %}place.rechercheForm.list.title{% endtrans %}
+
+
+ {% trans with {'%number%':localizedPlaceNumber } %}place.rechercheForm.list.number{% endtrans %}
+
+
+
+
+
+
+
+
+
+{% endblock body %}
\ No newline at end of file
diff --git a/CTRV/PlaceBundle/Resources/views/Place/rechercherPlaceResult.html.twig b/CTRV/PlaceBundle/Resources/views/Place/rechercherPlaceResult.html.twig
new file mode 100644
index 0000000..4763df9
--- /dev/null
+++ b/CTRV/PlaceBundle/Resources/views/Place/rechercherPlaceResult.html.twig
@@ -0,0 +1,65 @@
+
+{% if entities is not empty %}
+
+
+
+
{% trans %}place.rechercheForm.list.table.type {% endtrans %}
+
{% trans %}place.rechercheForm.list.table.title {% endtrans %}
+
{% trans %}place.rechercheForm.list.table.address {% endtrans %}
+
{% trans %}place.rechercheForm.list.table.action {% endtrans %}
{% trans %}place.rechercheForm.list.table.no_result{% endtrans %}
+{% endif %}
+
+
+
+
\ No newline at end of file
diff --git a/CTRV/PlaceBundle/Resources/views/Place/saisirDescription.html.twig b/CTRV/PlaceBundle/Resources/views/Place/saisirDescription.html.twig
new file mode 100644
index 0000000..8f91058
--- /dev/null
+++ b/CTRV/PlaceBundle/Resources/views/Place/saisirDescription.html.twig
@@ -0,0 +1,24 @@
+{% extends "::base.html.twig" %}
+{% import '::macro.html.twig' as forms %}
+
+{% block body %}
+
+
+
+
+ {% include "CTRVPlaceBundle::menuPlace.html.twig" %}
+
+
+
+
{% trans %}place.ajouterForm.titleDescription{% endtrans %}
+
+
+
+
+
+
+
+{% endblock body %}
\ No newline at end of file
diff --git a/CTRV/PlaceBundle/Resources/views/Place/saisirLatLong.html.twig b/CTRV/PlaceBundle/Resources/views/Place/saisirLatLong.html.twig
new file mode 100644
index 0000000..9718897
--- /dev/null
+++ b/CTRV/PlaceBundle/Resources/views/Place/saisirLatLong.html.twig
@@ -0,0 +1,24 @@
+{% extends "::base.html.twig" %}
+{% import '::macro.html.twig' as forms %}
+
+{% block body %}
+
+
+
+
+ {% include "CTRVPlaceBundle::menuPlace.html.twig" %}
+
+
+
+
{% trans %}place.ajouterForm.titleLatLong{% endtrans %}
+
+
+
+
+
+
+
+{% endblock body %}
\ No newline at end of file
diff --git a/CTRV/PlaceBundle/Resources/views/Place/updatePlace.html.twig b/CTRV/PlaceBundle/Resources/views/Place/updatePlace.html.twig
new file mode 100644
index 0000000..46218fa
--- /dev/null
+++ b/CTRV/PlaceBundle/Resources/views/Place/updatePlace.html.twig
@@ -0,0 +1,24 @@
+{% extends "::base.html.twig" %}
+{% import '::macro.html.twig' as forms %}
+
+{% block body %}
+
+
+
+
+ {% include "CTRVPlaceBundle::menuPlace.html.twig" %}
+
+
+
+
{% trans %}place.ajouterForm.titleUpdatePlace{% endtrans %}
+
+
+
+
+
+
+
+{% endblock body %}
\ No newline at end of file
diff --git a/CTRV/PlaceBundle/Resources/views/PlaceComment/loadPlaceComment.html.twig b/CTRV/PlaceBundle/Resources/views/PlaceComment/loadPlaceComment.html.twig
new file mode 100644
index 0000000..d736fd4
--- /dev/null
+++ b/CTRV/PlaceBundle/Resources/views/PlaceComment/loadPlaceComment.html.twig
@@ -0,0 +1,70 @@
+{% extends "::base.html.twig" %}
+{% import '::macro.html.twig' as forms %}
+
+{% block body %}
+
+
+
+ {% include "CTRVPlaceBundle::menuPlace.html.twig" %}
+
+
+
+
{% trans %}placeComment.list.title{% endtrans %}
+
+ {% if entities is not empty %}
+
+
+
+
{% trans %}placeComment.list.table.author{% endtrans %}
+
{% trans %}placeComment.list.table.content{% endtrans %}
+
{% trans %}placeComment.list.table.addedDate{% endtrans %}
+
{% trans %}placeComment.list.table.place{% endtrans %}
+
{% trans %}placeComment.list.table.action{% endtrans %}
{% trans %}placeComment.list.table.no_result{% endtrans %}
+ {% endif %}
+
+
+
+
+
+
+{% endblock body %}
\ No newline at end of file
diff --git a/CTRV/PlaceBundle/Resources/views/menuPlace.html.twig b/CTRV/PlaceBundle/Resources/views/menuPlace.html.twig
new file mode 100644
index 0000000..87f79dc
--- /dev/null
+++ b/CTRV/PlaceBundle/Resources/views/menuPlace.html.twig
@@ -0,0 +1,15 @@
+
+
+ {% if app.session is not empty %}
+ {% set targetUrl = app.session.get('_security.' ~ app.security.token.providerKey ~ '.target_path') %}
+ {% if targetUrl is not empty %}