Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
— |
schulesuchen_app.js [19.02.2018 19:49] (aktuell) whupfeld angelegt |
||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
+ | ====== app.js ====== | ||
+ | <code javascript> | ||
+ | var app = angular.module(' | ||
+ | app.filter(' | ||
+ | //Wandelt ein Object in ein Array, damit Filter anwendbar ist. | ||
+ | return function(items){ | ||
+ | var filtered = []; | ||
+ | angular.forEach(items, | ||
+ | filtered.push(item) | ||
+ | }); | ||
+ | return filtered; | ||
+ | }; | ||
+ | }) | ||
+ | |||
+ | app.controller(' | ||
+ | |||
+ | angular.extend($scope, | ||
+ | center: { | ||
+ | lat: 52.095, | ||
+ | lng: 6.823, | ||
+ | zoom: 16 | ||
+ | }, | ||
+ | markers: { | ||
+ | schule: { | ||
+ | lat: 52.095, | ||
+ | lng: 6.823, | ||
+ | message: "Name der Schule ", | ||
+ | focus: false, | ||
+ | draggable: false | ||
+ | } | ||
+ | }, | ||
+ | legend: { | ||
+ | position: ' | ||
+ | colors: [ '# | ||
+ | labels: [ ' | ||
+ | }, | ||
+ | defaults: { | ||
+ | scrollWheelZoom: | ||
+ | tileLayer: ' | ||
+ | }, | ||
+ | bounds:{ | ||
+ | northEast: { lat: 52.0, lng: 7.0 }, | ||
+ | southWest: { lat: 51.0, lng: 8.7 } | ||
+ | }, | ||
+ | iconRed : { | ||
+ | iconUrl: ' | ||
+ | shadowUrl: ' | ||
+ | iconSize: [25, 41], | ||
+ | iconAnchor: | ||
+ | popupAnchor: | ||
+ | shadowSize: | ||
+ | }, | ||
+ | iconBlue : { | ||
+ | iconUrl: ' | ||
+ | shadowUrl: ' | ||
+ | iconSize: [25, 41], | ||
+ | iconAnchor: | ||
+ | popupAnchor: | ||
+ | shadowSize: | ||
+ | }, | ||
+ | iconGreen : { | ||
+ | iconUrl: ' | ||
+ | shadowUrl: ' | ||
+ | iconSize: [25, 41], | ||
+ | iconAnchor: | ||
+ | popupAnchor: | ||
+ | shadowSize: | ||
+ | }, | ||
+ | iconViolet : { | ||
+ | iconUrl: ' | ||
+ | shadowUrl: ' | ||
+ | iconSize: [25, 41], | ||
+ | iconAnchor: | ||
+ | popupAnchor: | ||
+ | shadowSize: | ||
+ | }, | ||
+ | iconYellow : { | ||
+ | iconUrl: ' | ||
+ | shadowUrl: ' | ||
+ | iconSize: [25, 41], | ||
+ | iconAnchor: | ||
+ | popupAnchor: | ||
+ | shadowSize: | ||
+ | }, | ||
+ | iconGrey : { | ||
+ | iconUrl: ' | ||
+ | shadowUrl: ' | ||
+ | iconSize: [25, 41], | ||
+ | iconAnchor: | ||
+ | popupAnchor: | ||
+ | shadowSize: | ||
+ | }, | ||
+ | iconOrange : { | ||
+ | iconUrl: ' | ||
+ | shadowUrl: ' | ||
+ | iconSize: [25, 41], | ||
+ | iconAnchor: | ||
+ | popupAnchor: | ||
+ | shadowSize: | ||
+ | }, | ||
+ | iconBlack : { | ||
+ | iconUrl: ' | ||
+ | shadowUrl: ' | ||
+ | iconSize: [25, 41], | ||
+ | iconAnchor: | ||
+ | popupAnchor: | ||
+ | shadowSize: | ||
+ | }, | ||
+ | }); | ||
+ | |||
+ | |||
+ | $scope.search = function () { | ||
+ | if (!$scope.searchstr) {$scope.errortext = " | ||
+ | else { | ||
+ | $http.get(" | ||
+ | .then(function (response) { | ||
+ | $scope.start = false; | ||
+ | $scope.names = response.data.records; | ||
+ | delete $scope.schule; | ||
+ | delete $scope.gemeinden; | ||
+ | delete $scope.gem_schulen; | ||
+ | }); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | $scope.searchgm = function () { | ||
+ | if (!$scope.searchgmstr) {$scope.errortext = " | ||
+ | else { | ||
+ | $http.get(" | ||
+ | .then(function (response) { | ||
+ | $scope.start=false; | ||
+ | $scope.gemeinden = response.data.gemeinden; | ||
+ | delete $scope.schule; | ||
+ | delete $scope.names; | ||
+ | delete $scope.gem_schulen; | ||
+ | |||
+ | }); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | $scope.show = function (snr) { | ||
+ | // | ||
+ | $http.get(" | ||
+ | | ||
+ | $scope.schule = response.data; | ||
+ | $scope.fbilingual($scope.schule.Schulnummer); | ||
+ | |||
+ | $scope.center.lat=response.data.latitude; | ||
+ | $scope.center.lng=response.data.longitude; | ||
+ | $scope.center.zoom = 16; | ||
+ | $scope.markers = {}; | ||
+ | $scope.markers.schule = { | ||
+ | lat: response.data.latitude, | ||
+ | lng: response.data.longitude, | ||
+ | message: message=response.data.Schulbezeichnung_1+"< | ||
+ | focus: false, | ||
+ | draggable: false | ||
+ | } | ||
+ | }, | ||
+ | function errorCallback(response){ alert(response) }); | ||
+ | } | ||
+ | |||
+ | $scope.showgm = function(gemschluessel) { | ||
+ | $http.get(" | ||
+ | .then(function successCallback(response){ | ||
+ | $scope.gem_schulen = response.data; | ||
+ | |||
+ | $scope.center.lat=response.data[1].latitude; | ||
+ | $scope.center.lng=response.data[1].longitude; | ||
+ | $scope.center.zoom = 10; | ||
+ | num=Object.keys(response.data).length; | ||
+ | $scope.markers = {}; | ||
+ | $scope.bounds = {}; | ||
+ | // | ||
+ | minlat=100; | ||
+ | for (var i=1; i<=num; i++) { | ||
+ | var latitude = response.data[i].latitude; | ||
+ | var longitude = response.data[i].longitude; | ||
+ | var Schulnummer = response.data[i].Schulnummer; | ||
+ | var sf = response.data[i].sf; | ||
+ | maxlat=Math.max(latitude, | ||
+ | minlat=Math.min(latitude, | ||
+ | maxlng=Math.max(longitude, | ||
+ | minlng=Math.min(longitude, | ||
+ | switch (sf) { | ||
+ | case " | ||
+ | break; | ||
+ | case " | ||
+ | break; | ||
+ | case " | ||
+ | case " | ||
+ | break; | ||
+ | case " | ||
+ | case " | ||
+ | break; | ||
+ | case " | ||
+ | break; | ||
+ | case " | ||
+ | break; | ||
+ | | ||
+ | } | ||
+ | var html = response.data[i].Schulbezeichnung_1 | ||
+ | + '< | ||
+ | + '< | ||
+ | // + '< | ||
+ | $scope.markers[' | ||
+ | lat: latitude, | ||
+ | lng: longitude, | ||
+ | getMessageScope: | ||
+ | message: html, | ||
+ | compileMessage: | ||
+ | draggable: false, | ||
+ | icon: sficon | ||
+ | } | ||
+ | } | ||
+ | $scope.bounds ={ | ||
+ | northEast: {lat: maxlat, lng: minlng }, | ||
+ | southWest: {lat: minlat, lng: maxlng | ||
+ | } | ||
+ | } | ||
+ | |||
+ | console.log($scope.markers); | ||
+ | console.log($scope.bounds); | ||
+ | }) | ||
+ | } | ||
+ | |||
+ | $scope.statistik = function (gemeinde) { | ||
+ | $http.get(" | ||
+ | .then(function(response){ | ||
+ | $scope.anzSchulen = response.data.sfstatistik; | ||
+ | $scope.rechtsformen = response.data.rfstatistik; | ||
+ | }) | ||
+ | } | ||
+ | |||
+ | $scope.kursangebot = function (snr) { | ||
+ | $http.get(" | ||
+ | .then(function(response){ | ||
+ | $scope.gkef = response.data.gkef; | ||
+ | $scope.gkq1 = response.data.gkq1; | ||
+ | $scope.lkq1 = response.data.lkq1; | ||
+ | $scope.gkq2 = response.data.gkq2; | ||
+ | $scope.lkq2 = response.data.lkq2; | ||
+ | }) | ||
+ | } | ||
+ | |||
+ | $scope.fbilingual = function (snr) { | ||
+ | $http.get(" | ||
+ | .then(function(response){ | ||
+ | $scope.bilingual = response.data.bilingual; | ||
+ | }) | ||
+ | } | ||
+ | |||
+ | | ||
+ | }); | ||
+ | |||
+ | </ |