Commit ccd72873 by Julien Jorry

Ajout geocoder, openstreetmap provider, gmap, cache bundles + Update Back office menu

parent 83248460
...@@ -8,9 +8,14 @@ ...@@ -8,9 +8,14 @@
"friendsofsymfony/ckeditor-bundle": "^2.0", "friendsofsymfony/ckeditor-bundle": "^2.0",
"friendsofsymfony/rest-bundle": "^2.4", "friendsofsymfony/rest-bundle": "^2.4",
"friendsofsymfony/user-bundle": "^2.1", "friendsofsymfony/user-bundle": "^2.1",
"geocoder-php/cache-provider": "^4.1",
"geocoder-php/google-maps-provider": "^4.3",
"geocoder-php/nominatim-provider": "^5.0",
"knplabs/knp-paginator-bundle": "^2.8", "knplabs/knp-paginator-bundle": "^2.8",
"liip/imagine-bundle": "^2.1", "liip/imagine-bundle": "^2.1",
"nelmio/api-doc-bundle": "^3.3", "nelmio/api-doc-bundle": "^3.3",
"php-http/guzzle6-adapter": "^2.0",
"php-http/message": "^1.7",
"pixassociates/sortable-behavior-bundle": "^1.5", "pixassociates/sortable-behavior-bundle": "^1.5",
"sensio/framework-extra-bundle": "^5.1", "sensio/framework-extra-bundle": "^5.1",
"sonata-project/admin-bundle": "^3.40", "sonata-project/admin-bundle": "^3.40",
...@@ -22,6 +27,7 @@ ...@@ -22,6 +27,7 @@
"stof/doctrine-extensions-bundle": "^1.3", "stof/doctrine-extensions-bundle": "^1.3",
"symfony/apache-pack": "^1.0", "symfony/apache-pack": "^1.0",
"symfony/asset": "4.2.*", "symfony/asset": "4.2.*",
"symfony/cache": "4.2.*",
"symfony/console": "4.2.*", "symfony/console": "4.2.*",
"symfony/expression-language": "4.2.*", "symfony/expression-language": "4.2.*",
"symfony/flex": "^1.1", "symfony/flex": "^1.1",
...@@ -39,7 +45,8 @@ ...@@ -39,7 +45,8 @@
"symfony/web-link": "4.2.*", "symfony/web-link": "4.2.*",
"symfony/webpack-encore-bundle": "^1.0", "symfony/webpack-encore-bundle": "^1.0",
"symfony/yaml": "4.2.*", "symfony/yaml": "4.2.*",
"vich/uploader-bundle": "^1.8" "vich/uploader-bundle": "^1.8",
"willdurand/geocoder-bundle": "^5.0"
}, },
"require-dev": { "require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.0", "doctrine/doctrine-fixtures-bundle": "^3.0",
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -39,4 +39,5 @@ return [ ...@@ -39,4 +39,5 @@ return [
Sonata\MediaBundle\SonataMediaBundle::class => ['all' => true], Sonata\MediaBundle\SonataMediaBundle::class => ['all' => true],
FOS\CKEditorBundle\FOSCKEditorBundle::class => ['all' => true], FOS\CKEditorBundle\FOSCKEditorBundle::class => ['all' => true],
App\Application\Sonata\MediaBundle\ApplicationSonataMediaBundle::class => ['all' => true], App\Application\Sonata\MediaBundle\ApplicationSonataMediaBundle::class => ['all' => true],
Bazinga\GeocoderBundle\BazingaGeocoderBundle::class => ['all' => true],
]; ];
# See the docs at https://github.com/geocoder-php/BazingaGeocoderBundle
bazinga_geocoder:
# The local IP (127.0.0.1) will be replaced by the fake_ip
# see https://github.com/geocoder-php/BazingaGeocoderBundle/blob/5.0.0/Resources/doc/index.md#fake-local-ip
fake_ip: 123.123.123.123
providers:
# cache:
# adapter: mlc_cache_adapter
# provider: factory
# bing_maps:
# api_key: ~ # Required
# locale: ~
# cache:
# adapter: ~ # Required
# provider: ~ # Required
# locale: ~
# lifetime: 86400
# ip_info_db:
# api_key: ~ # Required
# cloudmade:
# api_key: ~ # Required
google_maps:
factory: Bazinga\GeocoderBundle\ProviderFactory\GoogleMapsFactory
options:
# httplug_client: '@httplug.client' # When using HTTPlugBundle
region: 'France'
api_key: 'XXXXXXXXX'
locale: fr
# region: ~
# use_ssl: false
# google_maps_business:
# client_id: ~ # Required
# api_key: ~
# region: ~
# use_ssl: false
openstreetmap:
factory: Bazinga\GeocoderBundle\ProviderFactory\NominatimFactory
locale: fr
# cache: '@Symfony\Component\Cache\Simple\ApcuCache'
# cache_lifetime: 3600
# cache_precision: ~
# host_ip: []
# geoip: []
# free_geo_ip: []
# mapquest:
# api_key: ~ # Required
# oiorest: []
# geocoder_ca: []
# geocoder_us: []
# ign_openls:
# api_key: ~ # Required
# data_science_toolkit: []
# yandex:
# locale: ~
# toponym: ~
# geo_ips:
# api_key: ~
# geo_plugin: []
# maxmind:
# api_key: ~ # Required
# maxmind_binary:
# binary_file: ~ # Required
# open_flag: ~
# chain:
# providers: []
\ No newline at end of file
...@@ -76,6 +76,97 @@ sonata_admin: ...@@ -76,6 +76,97 @@ sonata_admin:
# filters: # filter values # filters: # filter values
# edited: { value: 1 } # filtre on admin (settings:code) # edited: { value: 1 } # filtre on admin (settings:code)
groups:
sonata.admin.group.users:
keep_open: false
label: Utilisateurs
label_catalogue: SonataAdminBundle
icon: '<i class="fa fa-users"></i>'
roles: [ ROLE_SUPER_ADMIN, ROLE_ADMIN_SIEGE ]
items:
- sonata.user.admin.user
- sonata.user.admin.group
sonata.admin.group.media:
keep_open: false
label: Média
label_catalogue: SonataAdminBundle
icon: '<i class="fa fa-image"></i>'
roles: [ ROLE_SUPER_ADMIN, ROLE_ADMIN_SIEGE ]
items:
- sonata.media.admin.media
- sonata.media.admin.gallery
sonata.admin.group.adherent:
keep_open: false
label: Adhérents
label_catalogue: SonataAdminBundle
icon: '<i class="fa fa-address-card"></i>'
roles: [ ROLE_SUPER_ADMIN, ROLE_ADMIN_SIEGE, ROLE_TRESORIER, ROLE_GESTION_GROUPE, ROLE_COMPTOIR, ROLE_CONTACT ]
items:
- admin.adherent.gerer
- admin.adherent.cotisations
sonata.admin.group.prestataire:
keep_open: false
label: Prestataires
label_catalogue: SonataAdminBundle
icon: '<i class="fa fa-user-circle-o"></i>'
roles: [ ROLE_SUPER_ADMIN, ROLE_ADMIN_SIEGE, ROLE_TRESORIER, ROLE_GESTION_GROUPE, ROLE_COMPTOIR, ROLE_CONTACT ]
items:
- admin.prestataire.gerer
- admin.prestataire.cotisations
- admin.groupepresta.gerer
sonata.admin.group.groupe:
on_top: true
label: Groupes locaux
label_catalogue: SonataAdminBundle
icon: '<i class="fa fa-bandcamp"></i>'
roles: [ ROLE_SUPER_ADMIN, ROLE_ADMIN_SIEGE ]
items:
- admin.groupe.gerer
sonata.admin.group.comptoir:
on_top: true
label: "Comptoirs"
label_catalogue: SonataAdminBundle
icon: '<i class="fa fa-home"></i>'
roles: [ ROLE_SUPER_ADMIN, ROLE_ADMIN_SIEGE ]
items:
- admin.comptoir.gerer
# sonata.admin.group.compta:
# keep_open: false
# on_top: true
# label: "Comptabilité"
# label_catalogue: SonataAdminBundle
# icon: '<i class="fa fa-list"></i>'
# roles: [ ROLE_SUPER_ADMIN, ROLE_ADMIN_SIEGE, ROLE_TRESORIER ]
# items:
# - admin.flux.gerer
sonata.admin.group.document:
keep_open: false
on_top: true
label: "Documents"
label_catalogue: SonataAdminBundle
icon: '<i class="fa fa-file-text"></i>'
roles: [ ROLE_SUPER_ADMIN, ROLE_ADMIN_SIEGE, ROLE_TRESORIER, ROLE_GESTION_GROUPE, ROLE_COMPTOIR, ROLE_CONTACT, ROLE_REDACTEUR ]
items:
- admin.document.gerer
sonata.admin.group.rubrique:
keep_open: false
on_top: true
label: "Rubriques"
label_catalogue: SonataAdminBundle
icon: '<i class="fa fa-list"></i>'
roles: [ ROLE_SUPER_ADMIN, ROLE_ADMIN_SIEGE, ROLE_TRESORIER, ROLE_GESTION_GROUPE, ROLE_COMPTOIR, ROLE_CONTACT, ROLE_REDACTEUR ]
items:
- admin.rubrique.gerer
sonata.admin.group.faq:
keep_open: false
on_top: true
label: "FAQ"
label_catalogue: SonataAdminBundle
icon: '<i class="fa fa-question"></i>'
roles: [ ROLE_SUPER_ADMIN, ROLE_ADMIN_SIEGE, ROLE_TRESORIER, ROLE_GESTION_GROUPE, ROLE_COMPTOIR, ROLE_CONTACT, ROLE_REDACTEUR ]
items:
- admin.faq.gerer
# Gérer l'affichage du menu de l'admin en fonction des roles # Gérer l'affichage du menu de l'admin en fonction des roles
# groups: # groups:
# app.admin.group.content: # app.admin.group.content:
......
...@@ -30,6 +30,10 @@ services: ...@@ -30,6 +30,10 @@ services:
# add more service definitions when explicit configuration is needed # add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones # please note that last definitions always *replace* previous ones
# cache doctrine for bazinga geocoder
mlc_cache_adapter:
class: Doctrine\Common\Cache\ApcCache
# add more service definitions when explicit configuration is needed # add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones # please note that last definitions always *replace* previous ones
redirect.after.login: redirect.after.login:
...@@ -100,8 +104,7 @@ services: ...@@ -100,8 +104,7 @@ services:
tags: tags:
- name: sonata.admin - name: sonata.admin
manager_type: orm manager_type: orm
group: "Groupe" label: "Groupes locaux"
label: "Gérer"
public: true public: true
admin.comptoir.gerer: admin.comptoir.gerer:
...@@ -110,8 +113,7 @@ services: ...@@ -110,8 +113,7 @@ services:
tags: tags:
- name: sonata.admin - name: sonata.admin
manager_type: orm manager_type: orm
group: "Comptoir" label: "Comptoirs"
label: "Gérer"
public: true public: true
admin.groupepresta.gerer: admin.groupepresta.gerer:
...@@ -121,7 +123,7 @@ services: ...@@ -121,7 +123,7 @@ services:
- name: sonata.admin - name: sonata.admin
manager_type: orm manager_type: orm
group: "Prestataire" group: "Prestataire"
label: "Groupes" label: "AMAP / Marchés"
public: true public: true
admin.document.gerer: admin.document.gerer:
...@@ -153,3 +155,13 @@ services: ...@@ -153,3 +155,13 @@ services:
group: "Contenu" group: "Contenu"
label: "FAQs" label: "FAQs"
public: true public: true
# admin.flux.gerer:
# class: App\Admin\FluxAdmin
# arguments: [~, App\Entity\Transaction, ~]
# tags:
# - name: sonata.admin
# manager_type: orm
# group: "Comptabilité"
# label: "Flux"
# public: true
...@@ -29,9 +29,17 @@ App\Entity\Comptoir: ...@@ -29,9 +29,17 @@ App\Entity\Comptoir:
App\Entity\Groupeprestataire: App\Entity\Groupeprestataire:
grppresta_1: grppresta_1:
name: 'AMAP' name: 'AMAP de test'
horaires: 'Tous les Jeudis<br/>de 12h à 14h'
grppresta_2: grppresta_2:
name: 'MARCHÉ' name: 'AMAP de test 2'
horaires: 'Tous les Mercredis<br/>de 12h à 14h'
grppresta_3:
name: 'Marché de test'
horaires: 'Tous les Dimanches<br/>de 8h à 12h'
grppresta_4:
name: 'Marché de test 2'
horaires: 'Tous les 1er Dimanches du mois<br/>de 8h à 12h<br/>et de 18h à 20h'
App\Entity\TypePrestataire: App\Entity\TypePrestataire:
typepresta_prestataire: typepresta_prestataire:
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace App\Admin; namespace App\Admin;
use FOS\CKEditorBundle\Form\Type\CKEditorType;
use Sonata\AdminBundle\Admin\AbstractAdmin; use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\DatagridMapper; use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper; use Sonata\AdminBundle\Datagrid\ListMapper;
...@@ -9,6 +10,7 @@ use Sonata\AdminBundle\Form\FormMapper; ...@@ -9,6 +10,7 @@ use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Show\ShowMapper; use Sonata\AdminBundle\Show\ShowMapper;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
class GroupeprestataireAdmin extends AbstractAdmin class GroupeprestataireAdmin extends AbstractAdmin
{ {
...@@ -37,6 +39,10 @@ class GroupeprestataireAdmin extends AbstractAdmin ...@@ -37,6 +39,10 @@ class GroupeprestataireAdmin extends AbstractAdmin
'label' => 'Nom du groupe :', 'label' => 'Nom du groupe :',
'required' => true 'required' => true
)) ))
->add('horaires', TextareaType::class, array(
'label' => 'Horaires :',
'required' => false
))
->add('enabled', CheckboxType::class, array( ->add('enabled', CheckboxType::class, array(
'label' => 'Activé ?', 'label' => 'Activé ?',
'required' => false, 'required' => false,
...@@ -45,16 +51,6 @@ class GroupeprestataireAdmin extends AbstractAdmin ...@@ -45,16 +51,6 @@ class GroupeprestataireAdmin extends AbstractAdmin
; ;
} }
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
// $datagridMapper
// ->add('phone')
// ->add('email', null, [
// 'show_filter' => true
// ])
// ;
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
...@@ -62,7 +58,14 @@ class GroupeprestataireAdmin extends AbstractAdmin ...@@ -62,7 +58,14 @@ class GroupeprestataireAdmin extends AbstractAdmin
{ {
unset($this->listModes['mosaic']); unset($this->listModes['mosaic']);
$listMapper $listMapper
->addIdentifier('name', null, array('label' => 'Nom du groupe')) ->addIdentifier('name', null, array(
'label' => 'Nom du groupe'
))
->addIdentifier('horaires', 'html', array(
'label' => 'Horaires',
'strip' => true,
'truncate' => 50
))
->add( ->add(
'getPrestatairesCount', 'getPrestatairesCount',
null, null,
...@@ -72,7 +75,11 @@ class GroupeprestataireAdmin extends AbstractAdmin ...@@ -72,7 +75,11 @@ class GroupeprestataireAdmin extends AbstractAdmin
'sort_parent_association_mappings' => [], 'sort_parent_association_mappings' => [],
] ]
) )
->addIdentifier('enabled', null, array('label' => 'Activé', 'datatype' => 'App.Groupeprestataire', 'template' => '@SonataAdmin/Boolean/editable_boolean.html.twig')) ->addIdentifier('enabled', null, array(
'label' => 'Activé',
'datatype' => 'App.Groupeprestataire',
'template' => '@SonataAdmin/Boolean/editable_boolean.html.twig'
))
; ;
} }
......
...@@ -4,6 +4,8 @@ namespace App\Controller; ...@@ -4,6 +4,8 @@ namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Geocoder\Query\GeocodeQuery;
use Geocoder\Provider\Nominatim\Nominatim;
class IndexController extends AbstractController class IndexController extends AbstractController
{ {
...@@ -21,6 +23,15 @@ class IndexController extends AbstractController ...@@ -21,6 +23,15 @@ class IndexController extends AbstractController
// // no need to include %count% here; Symfony does that for you // // no need to include %count% here; Symfony does that for you
// array('%name%' => $user->getName()) // array('%name%' => $user->getName())
// ); // );
// GEOCODING ADDRESS :
// $httpClient = new \Http\Adapter\Guzzle6\Client();
// $provider = Nominatim::withOpenStreetMapServer($httpClient, 'test');
// $geocoder = new \Geocoder\StatefulGeocoder($provider, 'fr');
// $result = $geocoder->geocodeQuery(GeocodeQuery::create("19300 Rosiers-d'Egletons"));
// dump($result);
// exit();
return $this->render('index.html.twig', [ return $this->render('index.html.twig', [
'news' => array(), 'news' => array(),
]); ]);
......
...@@ -25,6 +25,7 @@ class Groupeprestataire ...@@ -25,6 +25,7 @@ class Groupeprestataire
{ {
use NameSlugContentEntityTrait, use NameSlugContentEntityTrait,
TimestampableEntity, TimestampableEntity,
GeolocEntityTrait,
EnablableEntityTrait; EnablableEntityTrait;
/** /**
......
<?php declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20190114185423 extends AbstractMigration
{
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE groupeprestaire ADD geoloc_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE groupeprestaire ADD CONSTRAINT FK_FB9ABBCEEF390162 FOREIGN KEY (geoloc_id) REFERENCES geoloc (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_FB9ABBCEEF390162 ON groupeprestaire (geoloc_id)');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE groupeprestaire DROP FOREIGN KEY FK_FB9ABBCEEF390162');
$this->addSql('DROP INDEX UNIQ_FB9ABBCEEF390162 ON groupeprestaire');
$this->addSql('ALTER TABLE groupeprestaire DROP geoloc_id');
}
}
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
"behat/transliterator": { "behat/transliterator": {
"version": "v1.2.0" "version": "v1.2.0"
}, },
"clue/stream-filter": {
"version": "v1.4.0"
},
"cocur/slugify": { "cocur/slugify": {
"version": "v3.1" "version": "v3.1"
}, },
...@@ -134,6 +137,27 @@ ...@@ -134,6 +137,27 @@
"gedmo/doctrine-extensions": { "gedmo/doctrine-extensions": {
"version": "v2.4.36" "version": "v2.4.36"
}, },
"geocoder-php/cache-provider": {
"version": "4.1.0"
},
"geocoder-php/common-http": {
"version": "4.2.0"
},
"geocoder-php/google-maps-provider": {
"version": "4.3.0"
},
"geocoder-php/nominatim-provider": {
"version": "5.0.0"
},
"geocoder-php/plugin": {
"version": "1.1.0"
},
"guzzlehttp/guzzle": {
"version": "6.3.3"
},
"guzzlehttp/promises": {
"version": "v1.3.1"
},
"guzzlehttp/psr7": { "guzzlehttp/psr7": {
"version": "1.5.2" "version": "1.5.2"
}, },
...@@ -230,6 +254,24 @@ ...@@ -230,6 +254,24 @@
"ocramius/proxy-manager": { "ocramius/proxy-manager": {
"version": "2.1.1" "version": "2.1.1"
}, },
"php-http/discovery": {
"version": "1.5.2"
},
"php-http/guzzle6-adapter": {
"version": "v2.0.1"
},
"php-http/httplug": {
"version": "v2.0.0"
},
"php-http/message": {
"version": "1.7.2"
},
"php-http/message-factory": {
"version": "v1.0.2"
},
"php-http/promise": {
"version": "v1.0.0"
},
"phpcollection/phpcollection": { "phpcollection/phpcollection": {
"version": "0.5.0" "version": "0.5.0"
}, },
...@@ -254,6 +296,9 @@ ...@@ -254,6 +296,9 @@
"psr/container": { "psr/container": {
"version": "1.0.0" "version": "1.0.0"
}, },
"psr/http-client": {
"version": "1.0.0"
},
"psr/http-message": { "psr/http-message": {
"version": "1.0.1" "version": "1.0.1"
}, },
...@@ -689,6 +734,18 @@ ...@@ -689,6 +734,18 @@
"webmozart/assert": { "webmozart/assert": {
"version": "1.3.0" "version": "1.3.0"
}, },
"willdurand/geocoder": {
"version": "4.2.1"
},
"willdurand/geocoder-bundle": {
"version": "5.0",
"recipe": {
"repo": "github.com/symfony/recipes-contrib",
"branch": "master",
"version": "5.0",
"ref": "b272ad4fbfcd45a20e7cbfdc4ad1b0e27a62fd3b"
}
},
"willdurand/jsonp-callback-validator": { "willdurand/jsonp-callback-validator": {
"version": "v1.1.0" "version": "v1.1.0"
}, },
......
app.admin.group.adherent: Adherent app.admin.group.adherent: Adherent
app.admin.group.prestataire: Prestataire app.admin.group.prestataire: Prestataire
app.admin.group.groupe: Groupe app.admin.group.groupe: Groupe
groups: Roles
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment