mapTypeIds: mapTypeIds } }); map.mapTypes.set("OSM", new google.maps.ImageMapType({ getTileUrl: function(coord, zoom) { return "http://tile.openstreetmap.org/" + zoom + "/" + coord.x + "/" + coord.y + ".png"; }, tileSize: new google.maps.Size(256, 256), name: "OpenStreetMap", maxZoom: 18 })); <?php if (in_array($box->project->blur, [Projects::BLUR_100, Projects::BLUR_500]) && $box->project->showBlur()) { ?> var cords = <?php echo WGS84::blurCoordinates($box->project->getBlurInMeters(), $box->cord_lat, $box->cord_lng, true); ?> ; map.setZoom(14); map.setCenter(cords); var rectangle = new google.maps.Rectangle({ strokeColor: 'red', strokeOpacity: 1, map: map, bounds: calcBounds(map.getCenter(), new google.maps.Size(<?php echo $box->project->getBlurInMeters(); ?> ,<?php echo $box->project->getBlurInMeters(); ?> ))
public function rules() { return [[['code', 'cord_lat', 'cord_lng', 'province'], 'required'], [['project_id', 'boxtype_id'], 'integer'], [['placement_date', 'removal_date', 'date_created', 'date_updated', 'cluster_id', 'deleteImage'], 'safe'], [['remarks', 'placement_height'], 'string'], [['deleted'], 'boolean'], [['code', 'location'], 'string', 'max' => 45], [['cord_lat', 'cord_lng'], 'string', 'max' => 50], ['province', 'string', 'max' => 20], [['direction'], 'string', 'max' => 2], [['picture'], 'string', 'max' => 100], ['placement_height', 'trim'], ['project_id', 'required', 'when' => function () { return $this->isNewRecord ? true : false; }], ['code', function ($attribute, $params) { if (isset($this->project)) { $uniqueQuery = Boxes::find()->where(['and', ['code' => $this->{$attribute}], ['project_id' => $this->project->id]]); if (!$this->isNewRecord) { $uniqueQuery->andWhere(['<>', 'id', $this->id]); } if ($uniqueQuery->exists()) { $this->addError($attribute, Yii::t('app', 'Kastcode bestaat al binnen dit project.')); } } }], ['placement_date', function ($attribute, $params) { if ($this->placement_date >= $this->removal_date && !empty($this->removal_date)) { $this->addError($attribute, Yii::t('app', 'Plaatsingsdatum mag niet na de verwijderdatum liggen.')); } }], ['removal_date', function ($attribute, $params) { if ($this->removal_date <= $this->placement_date && !empty($this->removal_date)) { $this->addError($attribute, Yii::t('app', 'Verwijderdatum mag niet voor de plaatsingsdatum liggen.')); } }], ['cord_lat', function ($attribute, $params) { if (!WGS84::inrange(-90, $this->cord_lat, 90)) { $this->addError($attribute, Yii::t('app', 'Latitude coördinaat is niet valide')); } }], ['cord_lng', function ($attribute, $params) { if (!WGS84::inrange(-180, $this->cord_lng, 180)) { $this->addError($attribute, Yii::t('app', 'Longitude coördinaat is niet valide')); } }], ['project_id', function ($attribute, $params) { if (!Projects::find()->andWhere(['projects.id' => $this->{$attribute}])->hasRights()->exists() && $this->isNewRecord) { return $this->addError($attribute, Yii::t('app', 'U heeft geen toegang tot het geselecteerde project')); } }]]; }
mapTypeIds: mapTypeIds } }); map.mapTypes.set("OSM", new google.maps.ImageMapType({ getTileUrl: function(coord, zoom) { return "http://tile.openstreetmap.org/" + zoom + "/" + coord.x + "/" + coord.y + ".png"; }, tileSize: new google.maps.Size(256, 256), name: "OpenStreetMap", maxZoom: 18 })); <?php if ($observation->visit->showBlur()) { ?> var cords = <?php echo WGS84::blurCoordinates($observation->visit->getBlurInMeters(), $observation->box->cord_lat, $observation->box->cord_lng, true); ?> ; map.setZoom(16); map.setCenter(cords); var rectangle = new google.maps.Rectangle({ strokeColor: 'red', strokeOpacity: 1, map: map, bounds: calcBounds(map.getCenter(), new google.maps.Size(<?php echo $observation->visit->getBlurInMeters(); ?> ,<?php echo $observation->visit->getBlurInMeters(); ?> ))