定制 ibrarturi/yii2-latlng-finder 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ibrarturi/yii2-latlng-finder

Composer 安装命令:

composer require ibrarturi/yii2-latlng-finder

包简介

Find Latitude and Longitude using google maps

README 文档

README

Find Latitude and Longitude using Google Maps

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist ibrarturi/yii2-latlng-finder "dev-master"

or add

"ibrarturi/yii2-latlng-finder": "dev-master"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code mentioned below. Click once on the map to the get the marker and coordinates then you can drag the marker around to the desired place on the map.

  • Default usage
<div class="form-group">
    <label class="control-label" for="lat">Latitude</label>
    <input class="form-control" type="text" name="lat" id="lat">
</div>
<div class="form-group">
    <label class="control-label" for="lng">Longitude</label>
    <input class="form-control" type="text" name="lng" id="lng">
</div>
<div class="form-group">
    <label class="control-label" for="zoom">Zoom</label>
    <input class="form-control" type="text" name="zoom" id="zoom">
</div>

<?= \ibrarturi\latlngfinder\LatLngFinder::widget(); ?>
  • Default usage without Zoom Field
<div class="form-group">
    <label class="control-label" for="lat">Latitude</label>
    <input class="form-control" type="text" name="lat" id="lat">
</div>
<div class="form-group">
    <label class="control-label" for="lng">Longitude</label>
    <input class="form-control" type="text" name="lng" id="lng">
</div>

<?= \ibrarturi\latlngfinder\LatLngFinder::widget([
	'enableZoom' => false 			// true, false
]); ?>
  • Default usage with optional parameters
<div class="form-group">
    <label class="control-label" for="lat">Latitude</label>
    <input class="form-control" type="text" name="lat" id="lat">
</div>
<div class="form-group">
    <label class="control-label" for="lng">Longitude</label>
    <input class="form-control" type="text" name="lng" id="lng">
</div>
<div class="form-group">
    <label class="control-label" for="zoom">Zoom</label>
    <input class="form-control" type="text" name="zoom" id="zoom">
</div>

<?= \ibrarturi\latlngfinder\LatLngFinder::widget([
	'latAttribute' => 'lat',		// Latitude text field id
	'lngAttribute' => 'lng',		// Longitude text field id
	'zoomAttribute' => 'zoom',		// Zoom text field id
	'mapCanvasId' => 'map',			// Map Canvas id
	'mapWidth' => 450,				// Map Canvas width
	'mapHeight' => 300,				// Map Canvas mapHeight
	'defaultLat' => -34.397,		// Default latitude for the map
	'defaultLng' =>150.644,			// Default Longitude for the map
	'defaultZoom' => 8, 			// Default zoom for the map
	'enableZoomField' => true,		// True: for assigning zoom values to the zoom field, False: Do not assign zoom value to the zoom field
]); ?>
  • Default usage with model
<?= $form->field($model, 'lat') ?>
<?= $form->field($model, 'lng') ?>
<?= $form->field($model, 'zoom') ?>

<?= \ibrarturi\latlngfinder\LatLngFinder::widget([
    'model' => $model,				// model object
]); ?>
  • Default usage with model without zoom field
<?= $form->field($model, 'lat') ?>
<?= $form->field($model, 'lng') ?>

<?= \ibrarturi\latlngfinder\LatLngFinder::widget([
    'model' => $model,				// model object
    'enableZoom' => false 			// true, false
]); ?>
  • Default usage with model and optional parameters
<?= $form->field($model, 'lat') ?>
<?= $form->field($model, 'lng') ?>
<?= $form->field($model, 'zoom') ?>

<?= \ibrarturi\latlngfinder\LatLngFinder::widget([
	'model' => $model,				// model object
	'latAttribute' => 'lat',		// Latitude attribute
	'lngAttribute' => 'lng',		// Longitude attribute
	'zoomAttribute' => 'zoom',		// Zoom text attribute
	'mapCanvasId' => 'map',			// Map Canvas id
	'mapWidth' => 450,				// Map Canvas width
	'mapHeight' => 300,				// Map Canvas mapHeight
	'defaultLat' => -34.397,		// Default latitude for the map
	'defaultLng' =>150.644,			// Default Longitude for the map
	'defaultZoom' => 8, 			// Default zoom for the map
	'enableZoomField' => true,		// True: for assigning zoom values to the zoom field, False: Do not assign zoom value to the zoom field
]); ?>

Resources

统计信息

  • 总下载量: 3.59k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 2
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-12-17