1 |
<?php |
---|
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 |
include_once(dirname(__FILE__)."/../Widget.php"); |
---|
32 |
include_once(dirname(__FILE__)."/../Button.php"); |
---|
33 |
include_once(dirname(__FILE__)."/../Popup.php"); |
---|
34 |
|
---|
35 |
|
---|
36 |
|
---|
37 |
|
---|
38 |
|
---|
39 |
|
---|
40 |
class ExtractWFSData extends CWCWidget |
---|
41 |
{ |
---|
42 |
var $moButton; |
---|
43 |
var $moPopup; |
---|
44 |
|
---|
45 |
|
---|
46 |
|
---|
47 |
|
---|
48 |
|
---|
49 |
|
---|
50 |
function ExtractWFSData() |
---|
51 |
{ |
---|
52 |
parent::CWCWidget(); |
---|
53 |
|
---|
54 |
$this->moButton = new CWCButton( $this ); |
---|
55 |
$this->moPopup = new CWCPopup( $this ); |
---|
56 |
$this->moPopup->mszLink = $_SESSION['gszCoreWebPath']. |
---|
57 |
"/widgets/ExtractWFSData/ExtractWFSData.phtml"; |
---|
58 |
|
---|
59 |
|
---|
60 |
$this->szWidgetDescription = <<<EOT |
---|
61 |
The Extract WFS Data widget allows the user to extract data based on the current |
---|
62 |
selected layer and ROI. Currently the following formats are supported: |
---|
63 |
GML |
---|
64 |
Shape |
---|
65 |
EOT; |
---|
66 |
$this->mnMaturityLevel = MATURITY_BETA; |
---|
67 |
|
---|
68 |
} |
---|
69 |
|
---|
70 |
function InitDefaults() |
---|
71 |
{ |
---|
72 |
parent::InitDefaults(); |
---|
73 |
|
---|
74 |
$this->maParams["TOOLSET"] = ""; |
---|
75 |
$this->moButton->InitDefaults(); |
---|
76 |
$this->moButton->SetOnClick('clickExtractWFSData'); |
---|
77 |
} |
---|
78 |
|
---|
79 |
|
---|
80 |
|
---|
81 |
|
---|
82 |
|
---|
83 |
|
---|
84 |
function SetMap($oMapSession) |
---|
85 |
{ |
---|
86 |
$this->moMapObject = $oMapSession; |
---|
87 |
} |
---|
88 |
|
---|
89 |
|
---|
90 |
function GetJavascriptInitFunctions() |
---|
91 |
{ |
---|
92 |
return $this->moButton->GetJavascriptInitFunctions(); |
---|
93 |
} |
---|
94 |
|
---|
95 |
function GetJavascriptVariables() |
---|
96 |
{ |
---|
97 |
return $this->moButton->GetJavascriptVariables(); |
---|
98 |
} |
---|
99 |
|
---|
100 |
function GetJavascriptOnLoadFunctions() |
---|
101 |
{ |
---|
102 |
return $this->moButton->GetJavascriptOnLoadFunctions(); |
---|
103 |
} |
---|
104 |
|
---|
105 |
function GetJavascriptIncludeFunctions() |
---|
106 |
{ |
---|
107 |
return $this->moButton->GetJavascriptIncludeFunctions(); |
---|
108 |
} |
---|
109 |
|
---|
110 |
|
---|
111 |
|
---|
112 |
|
---|
113 |
function GetHTMLHiddenVariables() |
---|
114 |
{ |
---|
115 |
|
---|
116 |
$aReturn = $this->moButton->GetHTMLHiddenVariables(); |
---|
117 |
|
---|
118 |
|
---|
119 |
return $aReturn; |
---|
120 |
} |
---|
121 |
|
---|
122 |
|
---|
123 |
|
---|
124 |
|
---|
125 |
|
---|
126 |
function ParseURL() |
---|
127 |
{ |
---|
128 |
|
---|
129 |
return true; |
---|
130 |
} |
---|
131 |
|
---|
132 |
|
---|
133 |
|
---|
134 |
|
---|
135 |
|
---|
136 |
|
---|
137 |
|
---|
138 |
function GetJavascriptFunctions() |
---|
139 |
{ |
---|
140 |
|
---|
141 |
if (isset($this->maszContents["COMPRESSIONFORMAT"])) |
---|
142 |
{ |
---|
143 |
$aszCompressionFormat = array(); |
---|
144 |
foreach ($this->maszContents["COMPRESSIONFORMAT"] as $aCompressionFormat) |
---|
145 |
{ |
---|
146 |
if (isset($aCompressionFormat["VALUE"])) |
---|
147 |
array_push($aszCompressionFormat, $aCompressionFormat["VALUE"]); |
---|
148 |
} |
---|
149 |
if (count($aszCompressionFormat) > 0) |
---|
150 |
{ |
---|
151 |
$this->moPopup->mszParam .= "&szCompressionFormat=". |
---|
152 |
urlencode(implode("|", $aszCompressionFormat)); |
---|
153 |
} |
---|
154 |
} |
---|
155 |
else |
---|
156 |
{ |
---|
157 |
$this->moPopup->mszParam .= "&szCompressionFormat=".urlencode("TGZ|ZIP"); |
---|
158 |
} |
---|
159 |
|
---|
160 |
|
---|
161 |
if (isset($this->maszContents["OUTPUTFORMAT"])) |
---|
162 |
{ |
---|
163 |
$aszOutputFormat = array(); |
---|
164 |
foreach ($this->maszContents["OUTPUTFORMAT"] as $aOutputFormat) |
---|
165 |
{ |
---|
166 |
if (isset($aOutputFormat["VALUE"])) |
---|
167 |
array_push($aszOutputFormat, $aOutputFormat["VALUE"]); |
---|
168 |
} |
---|
169 |
if (count($aszOutputFormat) > 0) |
---|
170 |
{ |
---|
171 |
$this->moPopup->mszParam .= "&szOutputFormat=". |
---|
172 |
urlencode(implode("|", $aszOutputFormat)); |
---|
173 |
} |
---|
174 |
} |
---|
175 |
else |
---|
176 |
{ |
---|
177 |
$this->moPopup->mszParam .= "&szOutputFormat=".urlencode("Shape|GML"); |
---|
178 |
} |
---|
179 |
|
---|
180 |
if (isset($this->maSharedResourceWidgets["CWCJSAPI"])) |
---|
181 |
$bCWCJSAPI = 1; |
---|
182 |
else |
---|
183 |
$bCWCJSAPI = 0; |
---|
184 |
|
---|
185 |
$aReturn = $this->moButton->GetJavascriptFunctions(); |
---|
186 |
$this->moPopup->mszLink = $_SESSION['gszCoreWebPath']."/widgets/ExtractWFSData/ExtractWFSData.phtml?". |
---|
187 |
"&chkCompress=1". |
---|
188 |
"&selectedlayers=' + szSelectedLayers + ' "; |
---|
189 |
$szJsFunctionName = "clickExtractWFSData"; |
---|
190 |
$szButtonJS = $this->moPopup->DrawPublish(); |
---|
191 |
$szFunction = <<<EOT |
---|
192 |
/** |
---|
193 |
* {$szJsFunctionName} |
---|
194 |
* popup a extract wfs data dialog |
---|
195 |
*/ |
---|
196 |
function {$szJsFunctionName}() |
---|
197 |
{ |
---|
198 |
var szSelectedLayers = ""; |
---|
199 |
// set the var |
---|
200 |
if ( {$this->mszHTMLForm}.SELECTED_LAYERS ) |
---|
201 |
{ |
---|
202 |
szSelectedLayers = {$this->mszHTMLForm}.SELECTED_LAYERS.value; |
---|
203 |
} |
---|
204 |
//alert( szSelectedLayers ); |
---|
205 |
{$szButtonJS} |
---|
206 |
return; |
---|
207 |
} |
---|
208 |
EOT; |
---|
209 |
$aReturn[$szJsFunctionName] = $szFunction; |
---|
210 |
|
---|
211 |
|
---|
212 |
return $aReturn; |
---|
213 |
} |
---|
214 |
|
---|
215 |
|
---|
216 |
|
---|
217 |
|
---|
218 |
|
---|
219 |
|
---|
220 |
|
---|
221 |
function DrawPublish() |
---|
222 |
{ |
---|
223 |
if (!$this->mbVisible) |
---|
224 |
return "<!-- ExtractWFSData popup widget hidden -->"; |
---|
225 |
|
---|
226 |
$szResult = $this->moButton->DrawPublish(); |
---|
227 |
return $szResult; |
---|
228 |
} |
---|
229 |
} |
---|
230 |
?> |
---|
231 |
|
---|