Blame view

frontend/views/spots/index.php 2.68 KB
c7f222e2   Artem   first
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
  <?php
  use yii\helpers\Html;
  use yii\bootstrap\ActiveForm;
  
  /* @var $this yii\web\View */
  /* @var $form yii\bootstrap\ActiveForm */
  /* @var $model \frontend\models\SignupForm */
  $this->registerCssFile('/css/school_one.css');
  $this->registerJsFile('/js/jquery.scrollbox.min.js');
  $this->title = 'Споты';
  $this->params['breadcrumbs'][] = $this->title;
  ?>
      <div class="kites-where-education-wr my_margin">
          <div id="google-map" style="width: 920px; height: 380px; margin-left: 39px"></div>
          <script src="http://maps.google.com/maps/api/js?sensor=false"></script>
          <script>
              function map_initialize( map_element_id )
              {
  
                  var image = '/images/icon_map.png';
  
                  var myOptions = {
                      zoom: 5,
                      center: new google.maps.LatLng(46.656422, 33.487768),
                      mapTypeId: google.maps.MapTypeId.ROADMAP,
                      mapTypeControl: true,
                      mapTypeControlOptions: {
                          style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
                      },
                      scrollwheel: false
                  };
  
  
                  var map = new google.maps.Map(document.getElementById( map_element_id ),myOptions);
  
                  <?php foreach($dataProvider->getModels() as $data): ?>
                  var mapLat_<?= $data['id'] ?> = <?= $data->coordinates_x?>;
                  var mapLng_<?= $data['id']?> = <?= $data->coordinates_y?>;
  
  
  
  
                  var latlng_<?= $data['id']?> = new google.maps.LatLng(mapLat_<?= $data['id']?>,mapLng_<?= $data['id']?>);
  
  
                  var marker_<?= $data['id']?> = new google.maps.Marker({
                      position: latlng_<?= $data['id']?>,
                      map: map,
                      icon: image
                  });
  
  
                  var contentString_<?= $data['id']?> = '';
  
  
  
  
                  var infowindow_<?= $data['id']?> = new google.maps.InfoWindow({
                      content: contentString_<?= $data['id']?>
                  });
  
  
                  google.maps.event.addListener(marker_<?= $data['id']?>, 'click', function() {
                      infowindow_<?= $data['id']?>.open(map,marker_<?= $data['id']?>);
                  });
                  <?php endforeach; ?>
  
  
              }
  
              window.onload = function()
              {
                  if( document.getElementById('google-map') )
                  {
                      map_initialize( 'google-map' );
                  }
              };
  
  
  
          </script>
          <?php
          echo \yii\widgets\ListView::widget( [
              'dataProvider' => $dataProvider,
              'itemView'=>'_one_spot',
              'summary'=>'',
          ] );
          ?>
      </div>