-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmaps.admin.view.php
176 lines (154 loc) · 5.71 KB
/
maps.admin.view.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
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<?php
/* Copyright (C) Kim, MinSoo <[email protected]> */
/**
* @file maps.admin.view.php
* @author MinSoo Kim ([email protected])
* @brief admin view class of the maps module
* @todo 상세 작업을 추가해서 마무리(?) 해야한다.
*/
class mapsAdminView extends maps
{
/**
* Initialization
* @return void
*/
public function init()
{
}
public function dispMapsAdminList()
{
// option to get a list
$args = new stdClass();
$args->page = intval(Context::get('page'));
$args->order_type = 'desc';// asc | desc
$oMapsAdminModel = getAdminModel('maps');
$maps_list = $oMapsAdminModel->getMapsAdminList($args);
if($maps_list->error)
{
Context::set('total_count', 0);
Context::set('maps_error', $maps_list->error);
Context::set('maps_message', $maps_list->message);
}
else
{
//Pre. page
if($maps_list->page_navigation->first_page <= $maps_list->page_navigation->cur_page - 1)
{
$maps_list->page_navigation->prev_page = $maps_list->page_navigation->cur_page - 1;
}
else
{
$maps_list->page_navigation->prev_page = $maps_list->page_navigation->cur_page;
}
Context::set('total_count', $maps_list->total_count);
Context::set('total_page', $maps_list->total_page);
Context::set('page', $maps_list->page);
Context::set('page_navigation', $maps_list->page_navigation);
Context::set('maps_list', $maps_list->data);
}
// Specify a template
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('maps_list');
}
public function dispMapsAdminWrite()
{
// 한국 지도가 기본값(언어에 따라 다른 위치 표시될 수도 있음(세계지도 표시가능한 경우만)
$maps_lat = 37.57;
$maps_lng = 126.98;
// API 종류 정하기 다음/네이버/구글
$oMapsModel = getModel('maps');
$maps_config = $oMapsModel->getMapsConfig();
$args = new stdClass();
$args->maps_srl = intval(Context::get('maps_srl'));
// 정수형이고, 값이 존재할 경우 실제 존재하는 지도인지 확인(업데이트 날짜가 존재하는지 확인)
if($args->maps_srl > 0)
{
$output = executeQuery('maps.getMapUpdate', $args);
}
// 존재하는 지도일 경우, 지도 데이터 가져옴
if($output->data->update)
{
$output = executeQuery('maps.getMapbySrl', $args);
$maps_content = unserialize(base64_decode($output->data->maps_content));
Context::set('map_title',$output->data->title);
Context::set('map_content',$output->data->content);
Context::set('map_center',$maps_content->map_center);
Context::set('map_markers',$maps_content->map_markers);
Context::set('map_zoom',$maps_content->map_zoom);
}
// 다음과 네이버는 국내 지도만 사용가능. 구글은 세계지도.
if($maps_config->maps_api_type == 'daum')
{
$map_comp_header_script = '<script src="https://apis.daum.net/maps/maps3.js?apikey='.$maps_config->map_api_key.'"></script>';
$map_comp_header_script .= '<script>'.
sprintf(
'var defaultlat="%s";'.
'var defaultlng="%s";'
,$maps_lat,$maps_lng).
'</script>';
Context::set('maps_langcode', 'ko');
}
elseif($maps_config->maps_api_type == 'naver')
{
$map_comp_header_script = '<script src="https://openapi.map.naver.com/openapi/naverMap.naver?ver=2.0&key='.$maps_config->map_api_key.'"></script>';
$map_comp_header_script .= '<script>'.
sprintf(
'var defaultlat="%s";'.
'var defaultlng="%s";'
,$maps_lat,$maps_lng).
'</script>';
Context::set('maps_langcode', 'ko');
}
elseif($maps_config->maps_api_type == 'microsoft')
{
// 언어 값 설정
$langtype = str_replace($this->xe_langtype, $this->ISO_3166_1_alpha_2, strtolower(Context::getLangType()));
// 세계지도 표시 가능한 경우는 외국이 표시될 수 있음
$maps_lat = $this->country_position[Context::getLangType()][0];
$maps_lng = $this->country_position[Context::getLangType()][1];
$map_comp_header_script = '<script type="text/javascript" src="https://www.bing.com/api/maps/mapcontrol?UR='.$langtype.'"></script>';
$map_comp_header_script .= '<script>'.
sprintf(
'var defaultlat="%s";'.
'var defaultlng="%s";'
,$maps_lat,$maps_lng).
'</script>';
Context::set('maps_langcode', $langtype);
}
else
{
// 언어 값 설정
$langtype = str_replace($this->xe_langtype, $this->google_langtype, strtolower(Context::getLangType()));
// 세계지도 표시 가능한 경우는 외국이 표시될 수 있음
$maps_lat = $this->country_position[Context::getLangType()][0];
$maps_lng = $this->country_position[Context::getLangType()][1];
$map_comp_header_script = '<script src="https://maps.googleapis.com/maps/api/js?key=' . $maps_config->map_api_key . '&language='.$langtype.'"></script>';
$map_comp_header_script .= '<script>'.
sprintf(
'var defaultlat="%s";'.
'var defaultlng="%s";'
,$maps_lat,$maps_lng).
'</script>';
Context::set('maps_langcode',$langtype);
}
Context::set('maps_api_type', $maps_config->maps_api_type);
Context::set('map_api_key', $maps_config->map_api_key);
Context::addHtmlHeader($map_comp_header_script);
// Specify a template
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('maps_write');
}
public function dispMapsAdminConfig()
{
$oMapsModel = getModel('maps');
$maps_config = $oMapsModel->getMapsConfig();
Context::set('map_api_key', $maps_config->map_api_key);
Context::set('daum_local_api_key', $maps_config->daum_local_api_key);
Context::set('map_api_type', $maps_config->map_api_type);
// Specify a template
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('maps_config');
}
}
/* End of file maps.admin.view.php */
/* Location: ./modules/maps/maps.admin.view.php */