templates/debug/hobit.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block body %}
  3. <div class="page">
  4. <div class="container">
  5. <div class="row animated fadeIn delay-0-2s">
  6. <div class="col-12 mb-3 mb-lg-5">
  7. <div class="">
  8. <h2>Magic hobit</h2>
  9. </div>
  10. <div class="">
  11. {% if debugAndFlush %}
  12. <p>Debug and flush : Yes</p>
  13. {% else %}
  14. <p>Debug and flush : No</p>
  15. {% endif %}
  16. </div>
  17. <hr></hr>
  18. </div>
  19. </div>
  20. </div>
  21. {% if tabHobit %}
  22. {% if debugAndFlush %}
  23. <div class="container">
  24. <div class="row">
  25. {% set i = 3 %}
  26. {% set number = 1 %}
  27. {% for hobit in tabHobit %}
  28. <div class="col-12 col-lg-4 mb-3 mb-lg-5">
  29. <div class="card animated fadeIn delay-0-{{ i }}s" style="width: 100%;">
  30. <div class="card-img-top animated fadeIn delay-0-8s" style='text-align:center;'><iframe
  31. width='100%'
  32. height='300'
  33. frameborder='0' style='border:0'
  34. src='https://www.google.com/maps/embed/v1/place?key=AIzaSyAmbx9RsGi01srCnH_-2TVdH26TpjwvFDs
  35. &q={{ hobit['data'].latitude }},{{ hobit['data'].longitude }}'
  36. allowfullscreen>
  37. </iframe>
  38. </div>
  39. <div class="card-body">
  40. <h5 class="card-title">Hobit {{ number }}</h5>
  41. <p class="card-text">Date start : {{ hobit['startDateTime']|date("d/m/Y H:i") }}</p>
  42. <p class="card-text">Date end : {{ hobit['endDateTime']|date("d/m/Y H:i") }}</p>
  43. <p class="card-text">Latitude : {{ hobit['data'].latitude }}</p>
  44. <p class="card-text">Longitude : {{ hobit['data'].longitude }}</p>
  45. <p class="card-text">Number : {{ hobit['number'] }}</p>
  46. </div>
  47. </div>
  48. </div>
  49. {% set i = i + 1 %}
  50. {% set number = number + 1 %}
  51. {% endfor %}
  52. </div>
  53. </div>
  54. {% else %}
  55. <div class="container">
  56. <div class="row">
  57. {% set number = 1 %}
  58. {% for hobit in tabHobit %}
  59. <div class="col-12 col-lg-6">
  60. <div class="accordion" id="accordionExample">
  61. <div class="accordion-item">
  62. <div class="title">
  63. {% if hobit['activityType'] == "still" %}
  64. <i class="fas fa-chair"></i>
  65. {% elseif hobit['activityType'] == "on_foot" %}
  66. <i class="fas fa-walking"></i>
  67. {% elseif hobit['activityType'] == "on_bicycle" %}
  68. <i class="fas fa-bicycle"></i>
  69. {% elseif hobit['activityType'] == "in_vehicle" %}
  70. <i class="fas fa-car"></i>
  71. {% endif %}
  72. {{ hobit['activityType'] }}
  73. </div>
  74. {% if hobit["data"] is defined and hobit["data"].latitude and hobit["data"].longitude %}
  75. <div>
  76. <iframe
  77. width='100%'
  78. height='300'
  79. frameborder='0' style='border:0'
  80. src='https://www.google.com/maps/embed/v1/place?key=AIzaSyAmbx9RsGi01srCnH_-2TVdH26TpjwvFDs
  81. &q={{ hobit["data"].latitude }},{{ hobit["data"].longitude }}'
  82. allowfullscreen>
  83. </iframe>
  84. </div>
  85. {% else %}
  86. <div data-positions='{{ hobit['positions']|json_encode()|raw }}' id="map-multi-{{ number }}" class="animated fadeIn delay-0-8s map-multi" style="width: 100%; height: 300px;"></div>
  87. {% endif %}
  88. <div>
  89. <button class="accordion-button button black mt-3 mb-3" type="button" data-bs-toggle="collapse" data-bs-target="#tab-{{ number }}-main" aria-expanded="true" aria-controls="collapseOne">Open</button>
  90. </div>
  91. <div id="tab-{{ number }}-main" class="accordion-collapse collapse" aria-labelledby="tab-{{ number }}-main-label" data-bs-parent="#accordionExample">
  92. <div class="accordion-body">
  93. <div class="line"><strong>Start date time : </strong><code>{{ hobit['startDateTime']|date("d/m/Y H:i", "Europe/Paris") }}</code></div>
  94. <div class="line"><strong>Start date time server : </strong><code>{{ hobit['startDateTimeServer']|date("d/m/Y H:i", "Europe/Paris") }}</code></div>
  95. <div class="line"><strong>End date time hobbit : </strong><code>{{ hobit['endDateTime']|date("d/m/Y H:i", "Europe/Paris") }}</code></div>
  96. <div class="line"><strong>Type activity : </strong><code>{{ dump(hobit['activityType']) }}</code></div>
  97. {% if hobit['id'] is defined %}
  98. <div class="line"><strong>Id : </strong><code>{{ dump(hobit['id']) }}</code></div>
  99. {% endif %}
  100. <div class="line"><strong>Data : </strong><code>{{ dump(hobit) }}</code></div>
  101. </div>
  102. </div>
  103. </div>
  104. {% set number = number + 1 %}
  105. </div>
  106. </div>
  107. {% endfor %}
  108. </div>
  109. </div>
  110. {% endif %}
  111. {% else %}
  112. <div class="text-center animated fadeIn delay-0-4s" style="font-size: 30px;">No data...</div>
  113. {% endif %}
  114. </div>
  115. {% endblock %}
  116. {% block javascripts %}
  117. {{ parent() }}
  118. <script>
  119. $(window).on('load', function() {
  120. $(".map-multi").each(function( index ) {
  121. console.log(JSON.parse($(this).attr("data-positions")));
  122. initMap($(this).attr("id"));
  123. });
  124. function initMap(idMap) {
  125. var positions = JSON.parse($("#" + idMap).attr("data-positions"));
  126. //var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
  127. var mapOptions = {
  128. zoom: 16,
  129. center: new google.maps.LatLng(positions[0]['dataGps']['latitude'],positions[0]['dataGps']['longitude'])
  130. }
  131. var map = new google.maps.Map(document.getElementById(idMap), mapOptions);
  132. var markers = [];
  133. positions.forEach(function(element) {
  134. markers.push(new google.maps.Marker({
  135. position: new google.maps.LatLng(element['dataGps']['latitude'], element['dataGps']['longitude']),
  136. //title: element[2] + " - " + element[0] + " - " + element[1]
  137. }));
  138. });
  139. // To add the marker to the map, call setMap();
  140. //markers[0].setMap(map);
  141. //marker2.setMap(map);
  142. markers.forEach(function(element) {
  143. element.setMap(map);
  144. });
  145. }
  146. });
  147. </script>
  148. {% endblock %}