@@ -152,7 +152,7 @@ public function get_event_location() {
152
152
</div>
153
153
<div class="member_check_wrap">
154
154
<div class="member_check">
155
- <a href="../view_control/attendance_check?eventId= <?= $ event_dto_id ?> &memberId= <?= $ _SESSION [ ' member_id ' ] ?> " class="attendance_check">
155
+ <a href="javascript:;" onclick="attendance_check() " class="attendance_check">
156
156
<div class="icon"><i class="fa-solid fa-user-check"></i></div>
157
157
<div class="attendance_check_txt"><p>출석 확인</p></div>
158
158
</a>
@@ -175,7 +175,7 @@ public function get_event_location() {
175
175
<div class="match_address_wrap">
176
176
<div class="match_address">
177
177
<div class="icon"><i class="fa-solid fa-map-pin"></i></div>
178
- <div class="match_address_txt"><?= $ event_dto_location?> </div>
178
+ <div id="match_address_txt" class="match_address_txt"><?= $ event_dto_location?> </div>
179
179
</div>
180
180
</div>
181
181
<div class="match_map_wrap">
@@ -206,6 +206,58 @@ public function get_event_location() {
206
206
function player_check_lity() {
207
207
lity('#player_check_lity');
208
208
}
209
+ function attendance_check() {
210
+ if ("geolocation" in navigator) {
211
+ navigator.geolocation.getCurrentPosition(function(position) {
212
+ var latitude = position.coords.latitude; // 위도
213
+ var longitude = position.coords.longitude; // 경도
214
+ $.ajax({
215
+ url: '../view_control/attendance_check',
216
+ method: 'POST',
217
+ data: { eventId: <?= $ event_dto_id?> , latitude: latitude, longitude: longitude },
218
+ success: function(response) {
219
+ alert(response);
220
+ }
221
+ });
222
+ });
223
+ } else {
224
+ alert("위치정보를 지원하지 않는 브라우저입니다.");
225
+ }
226
+ }
227
+ function matchLocation() {
228
+ var address = document.getElementById('match_address_txt').textContent;
229
+ var centerCoord = new naver.maps.LatLng(37.5666102, 126.9783881);
230
+ var map = new naver.maps.Map('map', {
231
+ center: centerCoord,
232
+ zoom: 15
233
+ });
234
+
235
+ naver.maps.Service.geocode({
236
+ address: address
237
+ }, function(status, response) {
238
+ if (status === naver.maps.Service.Status.OK) {
239
+ var result = response.result;
240
+ var firstItem = result.items[0];
241
+ var coords = new naver.maps.LatLng(firstItem.point.y, firstItem.point.x);
242
+
243
+ map.setCenter(coords);
244
+
245
+ var marker = new naver.maps.Marker({
246
+ position: coords,
247
+ map: map
248
+ });
249
+
250
+ naver.maps.Event.addListener(marker, 'click', function() {
251
+ var naverMapURL = 'https://map.naver.com/?dlevel=11&lat=' + coords._lat + '&lng=' + coords._lng;
252
+ window.open(naverMapURL, '_blank');
253
+ });
254
+ } else {
255
+ alert('주소를 찾을 수 없습니다.');
256
+ }
257
+ });
258
+ }
259
+ window.onload = matchLocation;
260
+ naver.maps.onJSContentLoaded = matchLocation;
209
261
</script>
210
262
<?php
211
263
}
0 commit comments