2017 © Pedro Peláez
 

yii2-extension yii2-yandex-maps

Yii 2 yandex map module

image

katzz0/yii2-yandex-maps

Yii 2 yandex map module

  • Thursday, July 2, 2015
  • by katzz0
  • Repository
  • 2 Watchers
  • 3 Stars
  • 637 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 28 Forks
  • 0 Open issues
  • 1 Versions
  • 1 % Grown

The README.md

Yii2 Yandex Maps Components


This repo is the fork of the yii2-yandex-maps by Mirocow, (*1)


Components

katzz0\yandexmaps\Api

Application components which register scripts., (*2)

Usage, (*3)

Attach component to application (e.g. edit config/main.php):, (*4)

'components' => [
    'yandexMapsApi' => [
        'class' => 'mirocow\yandexmaps\Api',
    ]
 ],

katzz0\yandexmaps\Map

Map instance., (*5)

Usage, (*6)

use katzz0\yandexmaps\Map;

$map = new Map('yandex_map', [
        'center' => [55.7372, 37.6066],
        'zoom' => 10,
        // Enable zoom with mouse scroll
        'behaviors' => array('default', 'scrollZoom'),
        'type' => "yandex#map",
    ],
    [
        // Permit zoom only fro 9 to 11
        'minZoom' => 9,
        'maxZoom' => 11,
        'controls' => [
          "new ymaps.control.SmallZoomControl()",
          "new ymaps.control.TypeSelector(['yandex#map', 'yandex#satellite'])",
        ],
    ]
);

katzz0\yandexmaps\Canvas

This is widget which render html tag for your map., (*7)

Usage, (*8)

Simple add widget to view:, (*9)

use katzz0\yandexmaps\Canvas as YandexMaps;

= YandexMaps::widget([
    'htmlOptions' => [
        'style' => 'height: 600px;',
    ],
    'map' => new Map('yandex_map', [
        'center' => [55.7372, 37.6066],
        'zoom' => 17,
        'controls' => [Map::CONTROL_ZOOM],
        'behaviors' => [Map::BEHAVIOR_DRAG],
        'type' => "yandex#map",
    ],
    [
        'objects' => [new Placemark(new Point(55.7372, 37.6066), [], [
            'draggable' => true,
            'preset' => 'islands#dotIcon',
            'iconColor' => '#2E9BB9',
            'events' => [
                'dragend' => 'js:function (e) {
                    console.log(e.get(\'target\').geometry.getCoordinates());
                }'
            ]
        ])]
    ])
]) ?>

You can use also direct place label:, (*10)

= YandexMaps::widget([
    'htmlOptions' => [
        'style' => 'height: 600px;',
    ],
    'map' => new Map(null, [
        'center' => 'London',
        'zoom' => 17,
        'controls' => [Map::CONTROL_ZOOM],
        'behaviors' => [Map::BEHAVIOR_DRAG],
        'type' => "yandex#map",
    ],
    [
        'objects' => [new Placemark(null, [], [
            'draggable' => true,
            'preset' => 'islands#dotIcon',
            'iconColor' => '#2E9BB9',
            'events' => [
                'dragend' => 'js:function (e) {
                    console.log(e.get(\'target\').geometry.getCoordinates());
                    }'
            ]
        ])]
    ])
]) ?>

The Versions

02/07 2015

dev-master

9999999-dev

Yii 2 yandex map module

  Sources   Download

MIT

The Requires

 

yii2 yii map yandex