diff --git a/config/services.yaml b/config/services.yaml index 8c8024f5..490a8f80 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -87,6 +87,10 @@ services: $password: "%env(REDIS_CLIENT_PASSWORD)%" $env_flag: "dev" + App\Service\GoogleMapManager: ~ + + App\Service\MapManagerInterface: "@App\\Service\\GoogleMapManager" + Catalyst\APIBundle\Security\APIKeyUserProvider: arguments: $em: "@doctrine.orm.entity_manager" diff --git a/src/Controller/GeofenceController.php b/src/Controller/GeofenceController.php index 48cc5e43..08808352 100644 --- a/src/Controller/GeofenceController.php +++ b/src/Controller/GeofenceController.php @@ -6,6 +6,7 @@ use App\Entity\SupportedArea; use App\Service\KMLFileImporter; use App\Service\FileUploader; +use App\Service\MapManagerInterface; use Doctrine\ORM\Query; use Doctrine\ORM\QueryBuilder; @@ -25,13 +26,14 @@ class GeofenceController extends Controller /** * @Menu(selected="geofence_list") */ - public function index() + public function index(MapManagerInterface $map_manager) { $this->denyAccessUnlessGranted('geofence.list', null, 'No access.'); $params['areas'] = $this->getDoctrine() ->getRepository(SupportedArea::class) - ->findAll();; + ->findAll(); + $params['map_manager'] = $map_manager->getMapManager(); return $this->render('geofence/list.html.twig', $params); } diff --git a/src/Service/BingMapManager.php b/src/Service/BingMapManager.php index 6b1145b3..6320a406 100644 --- a/src/Service/BingMapManager.php +++ b/src/Service/BingMapManager.php @@ -4,35 +4,10 @@ namespace App\Service; class BingMapManager implements MapManagerInterface { - public function jsGeofence() + const MANAGER = 'bing'; + + public function getMapManager() { - - echo "" . "\n"; - echo "". "\n"; - + return self::MANAGER; } } diff --git a/src/Service/GoogleMapManager.php b/src/Service/GoogleMapManager.php index 8b425654..55250dce 100644 --- a/src/Service/GoogleMapManager.php +++ b/src/Service/GoogleMapManager.php @@ -4,39 +4,10 @@ namespace App\Service; class GoogleMapManager implements MapManagerInterface { - public function jsGeofence() - { - echo "" . "\n"; - echo "" . "\n"; - echo "". "\n"; + public function getMapManager() + { + return self::MANAGER; } } diff --git a/src/Service/MapManagerInterface.php b/src/Service/MapManagerInterface.php index 10934d7a..c37eba9e 100644 --- a/src/Service/MapManagerInterface.php +++ b/src/Service/MapManagerInterface.php @@ -5,11 +5,7 @@ namespace App\Service; interface MapManagerInterface { - /* - * Return javascript text with map and polygons to show coverage areas - * - */ - public function jsGeofence(); + public function getMapManager(); //public function jsJobOrderDetails(); diff --git a/templates/geofence/bingmaps.js.twig b/templates/geofence/bingmaps.js.twig new file mode 100644 index 00000000..79ec6b8e --- /dev/null +++ b/templates/geofence/bingmaps.js.twig @@ -0,0 +1,35 @@ + + + + + -