Blame view

frontend/views/spots/_one_spot.php 2.6 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
  <?php
  use yii\helpers\Html;
  ?>
  <div class="kites-where-education-text-img">
      <div class="kites-where-education-title">
          <?=  Html::a("Cпот $model->name",['spots/view', 'translit' =>$model->translit ])  ?>
          <br>
          <?=  Html::a(" $model->address",['spots/view', 'translit' =>$model->translit ])  ?>
      </div>
      <div class="kites-master-wr-all">
          <div class="kites-master-wr">
              <div class="kites-master-left"><img src="/images/ico-kitler.jpg" width="24" height="23" alt=""><p>уровень сложности</p></div>
              <div class="kites-master-right">
                  <img src="/images/<?= $model->difficulty_level?>.jpg" alt=""><p><?= $model->difficulty_level?></p>
              </div>
          </div>
      </div>
      <div class="kites-map-educ">
          <div id="google-map_<?=$model->id?>" style="width: 280px;height: 178px"></div>
      </div>
  </div>
  <script>
      function map_initialize_<?= $model['id'] ?>( map_element_id )
      {
  
          var image = '/images/icon_map.png';
  
          var myOptions_<?= $model['id'] ?> = {
              zoom: 10,
              center: new google.maps.LatLng(<?= $model->coordinates_x?>,<?= $model->coordinates_y?>),
              mapTypeId: google.maps.MapTypeId.ROADMAP,
              mapTypeControl: true,
              mapTypeControlOptions: {
                  style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
              },
              scrollwheel: false
          };
  
  
          var map_<?= $model['id'] ?> = new google.maps.Map(document.getElementById( map_element_id ),myOptions_<?= $model['id'] ?>);
  
  
          var mapLat_<?= $model['id'] ?> = <?= $model->coordinates_x?>;
          var mapLng_<?= $model['id']?> = <?= $model->coordinates_y?>;
  
  
  
  
          var latlng_<?= $model['id']?> = new google.maps.LatLng(mapLat_<?= $model['id']?>,mapLng_<?= $model['id']?>);
  
  
          var marker_<?= $model['id']?> = new google.maps.Marker({
              position: latlng_<?= $model['id']?>,
              map: map_<?= $model['id'] ?>,
              icon: image
          });
  
  
          var contentString_<?= $model['id']?> = '';
  
  
  
  
          var infowindow_<?= $model['id']?> = new google.maps.InfoWindow({
              content: contentString_<?= $model['id']?>
          });
  
  
          google.maps.event.addListener(marker_<?= $model['id']?>, 'click', function() {
              infowindow_<?= $model['id']?>.open(map_<?= $model['id'] ?>,marker_<?= $model['id']?>);
          });
  
  
  
      }
  
      $(function () {
          if( document.getElementById('google-map_<?=$model->id?>') )
          {
              map_initialize_<?= $model['id'] ?>( 'google-map_<?=$model->id?>' );
          }
      });
  
  
  
  </script>