-
Notifications
You must be signed in to change notification settings - Fork 6
/
EGmap3Map.php
42 lines (39 loc) · 1.02 KB
/
EGmap3Map.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/**
* EGmap3 Yii extension
*
* Object oriented PHP interface to GMAP3 Javascript library for
* Google Maps.
*
* @copyright © Digitick <www.digitick.net> 2011
* @license GNU Lesser General Public License v3.0
* @author Ianaré Sévi
*
*/
/**
* The map init action.
*/
class EGmap3Map extends EGmap3ActionBase
{
protected $action = 'init';
/**
* @var EGmap3MapOptions
*/
protected $options;
/**
* Capture the map's zoom level to a field
*
* @param CModel $model Model containing the attribute
* @param string $attribute Name of the model's attribute
* @param boolean $generate Whether to generate the field
* @param array $htmlOptions HTML options for the field
*/
public function captureZoom(CModel $model, $attribute, $generate=true, array $htmlOptions=array())
{
if ($generate) {
echo CHtml::activeHiddenField($model, $attribute, $htmlOptions);
}
$attId = CHtml::activeId($model, $attribute);
$this->addEvent('zoom_changed', "function(map){\$('#{$attId}').val(map.getZoom());}");
}
}