| 1 |
lars |
1 |
<?php
|
|
|
2 |
session_start();
|
|
|
3 |
require_once "connect2.php";
|
|
|
4 |
|
|
|
5 |
// $charset laden um die jeweiligen ISO-Zeichensätzte zu laden.
|
|
|
6 |
require_once "charset.php";
|
|
|
7 |
$path = "includes/artikel_zusatzinfo/";
|
|
|
8 |
|
|
|
9 |
require_once $path."system.php";
|
|
|
10 |
|
|
|
11 |
if (!$ini = parse_ini_file($path.$webs[ID].".ini",true)){
|
|
|
12 |
}
|
|
|
13 |
|
|
|
14 |
|
|
|
15 |
$html = "";
|
|
|
16 |
|
|
|
17 |
$expName = $_REQUEST['expName']?$_REQUEST['expName']:array_keys($_SESSION['ini']['generateXML']);
|
|
|
18 |
|
|
|
19 |
//die Auswahl der verschiedenen immodienste anzeigen
|
|
|
20 |
if(!$_REQUEST['mode']){
|
|
|
21 |
if(($_REQUEST['action'] != "edit")and($_REQUEST['action']!="update")){
|
|
|
22 |
$html .= buildImmoSelect();
|
|
|
23 |
}
|
|
|
24 |
} else {
|
|
|
25 |
$html .= createXML();
|
|
|
26 |
}
|
|
|
27 |
|
|
|
28 |
$_SESSION['ini'] = $ini;
|
|
|
29 |
|
|
|
30 |
|
|
|
31 |
|
|
|
32 |
//echo $html;
|
|
|
33 |
|
|
|
34 |
function buildImmoSelect() {
|
|
|
35 |
global $webs;
|
|
|
36 |
global $ini;
|
|
|
37 |
$html = "";
|
|
|
38 |
$html .= "<div style=\"padding:20px;\">\n";
|
|
|
39 |
$html .= "Bitte klicken Sie auf den Immobilien-Anbieter, für den die XML-Dateien generiert werden sollen:";
|
|
|
40 |
$html .= "\n\n<form name=\"\" action=\"".$_SERVER['PHP_SELF']."\" method=\"post\">\n";
|
|
|
41 |
|
|
|
42 |
foreach($_SESSION['ini']['generateXML'] as $key => $val) {
|
|
|
43 |
if($val==1){
|
|
|
44 |
$html .= "<a href=\"".$_SERVER['PHP_SELF']."?mode=all&expName=".$key."\">".$ini[$key]['rs_link_text']."</a> \n";
|
|
|
45 |
// erstmal hier den ftp_upload anbieten. später dann über webrechte gesteuert.
|
|
|
46 |
if($ini[$key]){
|
|
|
47 |
if($ini[$key]['xml_upload']){
|
|
|
48 |
|
|
|
49 |
//$html .= "<a href=\"/content-management/cronjobs/xml_ftpupload.php?expName=".$key."&img_upload=".$ini[$key]['img_upload']."&xml_upload=".$ini[$key]['xml_upload']."&webId=".$webs['ID']."\">zum XML Upload</a>";
|
|
|
50 |
}
|
|
|
51 |
}
|
|
|
52 |
|
|
|
53 |
}
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
$html .= "</form>\n";
|
|
|
57 |
$html .= "</div>\n";
|
|
|
58 |
|
|
|
59 |
return $html;
|
|
|
60 |
}
|
|
|
61 |
|
|
|
62 |
//create_XML();
|
|
|
63 |
|
|
|
64 |
function createXML() {
|
|
|
65 |
global $data; // artikel_zusatzinfo für einen bestimmten Artikel
|
|
|
66 |
global $expName;
|
|
|
67 |
|
|
|
68 |
if(($_REQUEST['artikelId']) and ($_REQUEST['mode']=="single")){
|
|
|
69 |
if(is_array($expName)){
|
|
|
70 |
foreach($expName as $key => $val){
|
|
|
71 |
if($val == "is24"){
|
|
|
72 |
|
|
|
73 |
// einzel-XML-erstellung erstmal auskommentiert
|
|
|
74 |
is24_single_XML($data,$val);
|
|
|
75 |
}else{
|
|
|
76 |
// TODO: die funktion für die anderen anbieter..
|
|
|
77 |
//...
|
|
|
78 |
}
|
|
|
79 |
}
|
|
|
80 |
}else{
|
|
|
81 |
if($expName=="is24"){
|
|
|
82 |
|
|
|
83 |
is24_single_XML($data,$expName);
|
|
|
84 |
}else{
|
|
|
85 |
// TODO: die funktion für die anderen anbieter..
|
|
|
86 |
//...
|
|
|
87 |
}
|
|
|
88 |
}
|
|
|
89 |
}
|
|
|
90 |
if($_REQUEST['mode']=="all"){
|
|
|
91 |
if(is_array($expName)){
|
|
|
92 |
foreach($expName as $key => $val){
|
|
|
93 |
if($val == "is24"){
|
|
|
94 |
is24_all_XML($val);
|
|
|
95 |
}else{
|
|
|
96 |
// TODO: die funktion für die anderen anbieter..
|
|
|
97 |
//...
|
|
|
98 |
}
|
|
|
99 |
}
|
|
|
100 |
}else{
|
|
|
101 |
if($expName=="is24"){
|
|
|
102 |
is24_all_XML($expName);
|
|
|
103 |
}else{
|
|
|
104 |
// TODO: die funktion für die anderen anbieter..
|
|
|
105 |
//...
|
|
|
106 |
}
|
|
|
107 |
}
|
|
|
108 |
}
|
|
|
109 |
}
|
|
|
110 |
|
|
|
111 |
function is24_single_XML($data,$expName) {
|
|
|
112 |
global $ini;
|
|
|
113 |
|
|
|
114 |
unset($data['Formular']);
|
|
|
115 |
unset($data['Rubrik']);
|
|
|
116 |
|
|
|
117 |
$add_data['StatusHP'] = "aktiv";
|
|
|
118 |
$add_data['StatusIS24'] = "aktiv";
|
|
|
119 |
$add_data['StatusVBM'] = "aktiv";
|
|
|
120 |
$add_data['Importmodus'] = "importieren";
|
|
|
121 |
$add_data['Waehrung'] = "EUR";
|
|
|
122 |
|
|
|
123 |
$imgData = $_SESSION['imgData'];
|
|
|
124 |
|
|
|
125 |
$xw = New xmlWriter(); // Neues xmlWriter Objekt
|
|
|
126 |
$xw->openMemory(); // Oeffnen eines XML-Dokuments im Speicher
|
|
|
127 |
$xw->setIndent(TRUE);
|
|
|
128 |
$xw->startDocument(); // start document
|
|
|
129 |
|
|
|
130 |
// start Rootelement
|
|
|
131 |
$xw->startElement("IS24ImmobilienTransfer"); // start <IS24ImmobilienTransfer>
|
|
|
132 |
$xw->writeAttribute("xmlns", "http://www.immobilienscout24.de/immobilientransfer");
|
|
|
133 |
$xw->writeAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
|
|
|
134 |
$xw->writeAttribute("xsi:schemaLocation", "http://www.immobilienscout24.de/immobilientransfer is24immotransfer.xsd");
|
|
|
135 |
$xw->writeAttribute("ErstellerSoftware", "is24_xml_gen");
|
|
|
136 |
$xw->writeAttribute("ErstellerSoftwareVersion","Webagentur Niewerth, Gladbeck");
|
|
|
137 |
$xw->writeAttribute("EmailBeiFehler", $ini[$expName]['email_on_error']);
|
|
|
138 |
|
|
|
139 |
// start Anbieter
|
|
|
140 |
$xw->startElement("Anbieter"); // start <Anbieter>
|
|
|
141 |
$xw->writeAttribute("ScoutKundenID", $ini[$expName]['kundenID']);
|
|
|
142 |
|
|
|
143 |
// start Artikel Properties
|
|
|
144 |
// Elemente zur Objektbeschreibung Anfang
|
|
|
145 |
$orig_data = $data;
|
|
|
146 |
|
|
|
147 |
|
|
|
148 |
if(is_array($data)){
|
|
|
149 |
|
|
|
150 |
|
|
|
151 |
$arrKeys = array_keys($data);
|
|
|
152 |
|
|
|
153 |
$data[$arrKeys[0]][$arrKeys[0]]['AnbieterObjektID'] = $_REQUEST['artikelId']."_".$data[$arrKeys[0]][$arrKeys[0]]['AnbieterObjektID'];
|
|
|
154 |
//folgende Punkte werden erstmal gelöscht, weil sie am ende nach den multimediaanhängen
|
|
|
155 |
//angefügt werden müssen.
|
|
|
156 |
unset($data[$arrKeys[0]]['Kaufpreise']);
|
|
|
157 |
unset($data[$arrKeys[0]]['Mietpreise']);
|
|
|
158 |
unset($data[$arrKeys[0]]['BefeuerungsArt']);
|
|
|
159 |
unset($data[$arrKeys[0]]['Energieausweis']);
|
|
|
160 |
|
|
|
161 |
$xw->startElement($arrKeys[0]);
|
|
|
162 |
}
|
|
|
163 |
|
|
|
164 |
foreach($data as $key => $val) {
|
|
|
165 |
|
|
|
166 |
if(is_array($val)) {
|
|
|
167 |
foreach($val as $k => $v){
|
|
|
168 |
if($k==$arrKeys[0]){
|
|
|
169 |
foreach($v as $key_ => $val_){
|
|
|
170 |
if(($key_!="Rubrik")and($key_!="Region")){
|
|
|
171 |
|
|
|
172 |
// arrays werden komma-getrennt übergeben
|
|
|
173 |
/// wie z.B. bei Multiselect-Boxen
|
|
|
174 |
if(is_array($val_)){
|
|
|
175 |
if(strlen($val_)){
|
|
|
176 |
$val_ = implode(",",$val_);
|
|
|
177 |
}
|
|
|
178 |
}
|
|
|
179 |
if($val_=="on")$val_ = "true";
|
|
|
180 |
|
|
|
181 |
if(strlen($val_)>0){
|
|
|
182 |
$xw->writeAttribute($key_,trim(utf8_encode(strip_tags($val_))));
|
|
|
183 |
}
|
|
|
184 |
}
|
|
|
185 |
}
|
|
|
186 |
|
|
|
187 |
if(is_array($add_data)){
|
|
|
188 |
foreach($add_data as $addk => $addv){
|
|
|
189 |
$xw->writeAttribute($addk,utf8_encode(strip_tags($addv)));
|
|
|
190 |
}
|
|
|
191 |
}
|
|
|
192 |
}else{
|
|
|
193 |
$xw->startElement($k); // start Objekttyp
|
|
|
194 |
|
|
|
195 |
|
|
|
196 |
foreach($v as $key_ => $val_){
|
|
|
197 |
if(($key_!="Rubrik")and($key_!="Region")){
|
|
|
198 |
|
|
|
199 |
// arrays werden komma-getrennt übergeben
|
|
|
200 |
/// wie z.B. bei Multiselect-Boxen
|
|
|
201 |
if(is_array($val_)){
|
|
|
202 |
if(strlen($val_)){
|
|
|
203 |
$val_ = implode(",",$val_);
|
|
|
204 |
}
|
|
|
205 |
}
|
|
|
206 |
if($val_=="on")$val_ = "true";
|
|
|
207 |
if(strlen($val_)>0){
|
|
|
208 |
if(($key_=="Objektbeschreibung")or
|
|
|
209 |
($key_=="Lage")or
|
|
|
210 |
($key_=="Ausstattung")or
|
|
|
211 |
($key_=="SonstigeAngaben")) {
|
|
|
212 |
$xw->text(trim(utf8_encode(strip_tags($val_))));
|
|
|
213 |
}else{
|
|
|
214 |
$xw->writeAttribute($key_,trim(utf8_encode(strip_tags($val_))));
|
|
|
215 |
}
|
|
|
216 |
|
|
|
217 |
}
|
|
|
218 |
}
|
|
|
219 |
}
|
|
|
220 |
$xw->endElement(); // end Objekttyp
|
|
|
221 |
}
|
|
|
222 |
|
|
|
223 |
}
|
|
|
224 |
// die bilder müssen noch angefügt werden
|
|
|
225 |
if(is_array($imgData)){
|
|
|
226 |
foreach($imgData as $key1 => $val1){
|
|
|
227 |
|
|
|
228 |
$xw->startElement('MultimediaAnhang');
|
|
|
229 |
foreach($imgData[$key1] as $k1 => $v1){
|
|
|
230 |
$xw->writeAttribute($k1,utf8_encode(strip_tags($v1)));
|
|
|
231 |
}
|
|
|
232 |
$xw->endElement(); // close node
|
|
|
233 |
}
|
|
|
234 |
|
|
|
235 |
}
|
|
|
236 |
|
|
|
237 |
}
|
|
|
238 |
}
|
|
|
239 |
|
|
|
240 |
if(is_array($orig_data)){
|
|
|
241 |
$arrKeys = array_keys($orig_data);
|
|
|
242 |
}
|
|
|
243 |
foreach($orig_data[$arrKeys[0]] as $key => $val) {
|
|
|
244 |
|
|
|
245 |
if(is_array($val)){
|
|
|
246 |
$build = 0;
|
|
|
247 |
if(($key == "Kaufpreise")or($key == "Mietpreise")){
|
|
|
248 |
foreach($val as $k => $v){
|
|
|
249 |
if($k){
|
|
|
250 |
if($v){
|
|
|
251 |
$build=1;
|
|
|
252 |
}
|
|
|
253 |
}
|
|
|
254 |
}
|
|
|
255 |
if($build==1){
|
|
|
256 |
$xw->startElement($key);
|
|
|
257 |
foreach($val as $k => $v){
|
|
|
258 |
if($v){
|
|
|
259 |
if($v == "on")$v = "true";
|
|
|
260 |
$xw->writeAttribute($k,trim(utf8_encode(strip_tags($v))));
|
|
|
261 |
}
|
|
|
262 |
}
|
|
|
263 |
}
|
|
|
264 |
$xw->endElement(); // close node $arrKeys[0]
|
|
|
265 |
}
|
|
|
266 |
|
|
|
267 |
if($key == "BefeuerungsArt"){
|
|
|
268 |
$build = 0;
|
|
|
269 |
foreach($val as $k => $v){
|
|
|
270 |
if($k){
|
|
|
271 |
if($v){
|
|
|
272 |
$build=1;
|
|
|
273 |
}
|
|
|
274 |
}
|
|
|
275 |
}
|
|
|
276 |
if($build==1){
|
|
|
277 |
$xw->startElement($key);
|
|
|
278 |
foreach($val as $k => $v){
|
|
|
279 |
if($k){
|
|
|
280 |
if($v){
|
|
|
281 |
foreach($v as $k_ => $v_){
|
|
|
282 |
$xw->startElement($v_);
|
|
|
283 |
$xw->endElement();
|
|
|
284 |
|
|
|
285 |
}
|
|
|
286 |
}
|
|
|
287 |
}
|
|
|
288 |
}
|
|
|
289 |
}
|
|
|
290 |
$xw->endElement(); // close node $arrKeys[0]
|
|
|
291 |
}
|
|
|
292 |
if($key == "Energieausweis"){
|
|
|
293 |
$build = 0;
|
|
|
294 |
foreach($val as $k => $v){
|
|
|
295 |
if($k){
|
|
|
296 |
if($v){
|
|
|
297 |
$build=1;
|
|
|
298 |
}
|
|
|
299 |
}
|
|
|
300 |
}
|
|
|
301 |
if($build==1){
|
|
|
302 |
$xw->startElement($key);
|
|
|
303 |
foreach($val as $k => $v){
|
|
|
304 |
if($k){
|
|
|
305 |
if($v){
|
|
|
306 |
if($v == "on")$v = "true";
|
|
|
307 |
$xw->writeAttribute($k,trim(utf8_encode(strip_tags($v))));
|
|
|
308 |
}
|
|
|
309 |
}
|
|
|
310 |
}
|
|
|
311 |
}
|
|
|
312 |
$xw->endElement(); // close node $arrKeys[0]
|
|
|
313 |
}
|
|
|
314 |
}
|
|
|
315 |
}
|
|
|
316 |
|
|
|
317 |
|
|
|
318 |
$xw->endElement(); // close node $arrKeys[0]
|
|
|
319 |
|
|
|
320 |
$xw->endElement(); // close node <Anbieter>
|
|
|
321 |
|
|
|
322 |
// close Rootelement
|
|
|
323 |
$xw->endElement(); // close node <IS24ImmobilienTransfer>
|
|
|
324 |
|
|
|
325 |
// end document
|
|
|
326 |
$xw->endDocument();
|
|
|
327 |
|
|
|
328 |
//speichern in XML datei
|
|
|
329 |
// IhrDateiname_st_ZJH_imt.xml
|
|
|
330 |
$filepath = "/web/apache/content-management/xml/".$expName."/".$ini['web']['xmlFolder']."/";
|
|
|
331 |
$filename = $_POST['artikelId']."_".$ini['web']['xmlPrefix'].$expName."_st_ZJH_imt.xml";
|
|
|
332 |
if($fp = fopen($filepath.$filename,"w")) {
|
|
|
333 |
|
|
|
334 |
fputs($fp,$xw->outputMemory());
|
|
|
335 |
fclose($fp);
|
|
|
336 |
build_log($_POST['artikelId'],"xml_export","/xml/".$expName."/".$ini['web']['xmlFolder']."/".$filename);
|
|
|
337 |
}
|
|
|
338 |
echo $xw->outputMemory(); // Ausgabe des erzeugten XML
|
|
|
339 |
|
|
|
340 |
}
|
|
|
341 |
|
|
|
342 |
|
|
|
343 |
function is24_all_XML($expName) {
|
|
|
344 |
global $ini;
|
|
|
345 |
echo buildImmoSelect();
|
|
|
346 |
|
|
|
347 |
$sql = "select a.artikel_zusatzinfo as data,a.ID as artikelId
|
|
|
348 |
from artikel a,directory d
|
|
|
349 |
|
|
|
350 |
where a.Father in
|
|
|
351 |
|
|
|
352 |
(select directory.ID as dirId from directory where d.sichtbar=1 and a.Father = d.Id)
|
|
|
353 |
|
|
|
354 |
and immo_export_".$ini[$expName]['immoExportId']."=1
|
|
|
355 |
|
|
|
356 |
order by a.ID";
|
|
|
357 |
|
|
|
358 |
$add_data['StatusHP'] = "aktiv";
|
|
|
359 |
$add_data['StatusIS24'] = "aktiv";
|
|
|
360 |
$add_data['StatusVBM'] = "aktiv";
|
|
|
361 |
$add_data['Importmodus'] = "importieren";
|
|
|
362 |
$add_data['Waehrung'] = "EUR";
|
|
|
363 |
|
|
|
364 |
if($q=mysql_query($sql)) {
|
|
|
365 |
while($r=mysql_fetch_assoc($q)){
|
|
|
366 |
if($r['data']){
|
|
|
367 |
$data = unserialize($r['data']);
|
|
|
368 |
|
|
|
369 |
}
|
|
|
370 |
|
|
|
371 |
$imgData = is24_getImgData($ini,$expName,$r['artikelId']);
|
|
|
372 |
unset($data['Formular']);
|
|
|
373 |
unset($data['Rubrik']);
|
|
|
374 |
$xw = New xmlWriter(); // Neues xmlWriter Objekt
|
|
|
375 |
$xw->openMemory(); // Oeffnen eines XML-Dokuments im Speicher
|
|
|
376 |
$xw->setIndent(TRUE);
|
|
|
377 |
$xw->startDocument(); // start document
|
|
|
378 |
|
|
|
379 |
// start Rootelement
|
|
|
380 |
$xw->startElement("IS24ImmobilienTransfer"); // start <IS24ImmobilienTransfer>
|
|
|
381 |
$xw->writeAttribute("xmlns", "http://www.immobilienscout24.de/immobilientransfer");
|
|
|
382 |
$xw->writeAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
|
|
|
383 |
$xw->writeAttribute("xsi:schemaLocation", "http://www.immobilienscout24.de/immobilientransfer is24immotransfer.xsd");
|
|
|
384 |
$xw->writeAttribute("ErstellerSoftware", "is24_xml_gen");
|
|
|
385 |
$xw->writeAttribute("ErstellerSoftwareVersion","Webagentur Niewerth, Gladbeck");
|
|
|
386 |
$xw->writeAttribute("EmailBeiFehler", $ini[$expName]['email_on_error']);
|
|
|
387 |
|
|
|
388 |
// start Anbieter
|
|
|
389 |
$xw->startElement("Anbieter"); // start <Anbieter>
|
|
|
390 |
$xw->writeAttribute("ScoutKundenID", $ini[$expName]['kundenID']);
|
|
|
391 |
|
|
|
392 |
// start Artikel Properties
|
|
|
393 |
// Elemente zur Objektbeschreibung Anfang
|
|
|
394 |
$orig_data = $data;
|
|
|
395 |
|
|
|
396 |
|
|
|
397 |
if(is_array($data)){
|
|
|
398 |
$arrKeys = array_keys($data);
|
|
|
399 |
$data[$arrKeys[0]][$arrKeys[0]]['AnbieterObjektID'] = $r['artikelId']."_".$data[$arrKeys[0]][$arrKeys[0]]['AnbieterObjektID'];
|
|
|
400 |
//folgende Punkte werden erstmal gelöscht, weil sie am ende nach den multimediaanhängen
|
|
|
401 |
//angefügt werden müssen.
|
|
|
402 |
|
|
|
403 |
unset($data[$arrKeys[0]]['Kaufpreise']);
|
|
|
404 |
unset($data[$arrKeys[0]]['Provision']);
|
|
|
405 |
unset($data[$arrKeys[0]]['Mietpreise']);
|
|
|
406 |
unset($data[$arrKeys[0]]['BefeuerungsArt']);
|
|
|
407 |
unset($data[$arrKeys[0]]['Energieausweis']);
|
|
|
408 |
|
|
|
409 |
$xw->startElement($arrKeys[0]);
|
|
|
410 |
}
|
|
|
411 |
|
|
|
412 |
foreach($data as $key => $val) {
|
|
|
413 |
|
|
|
414 |
if(is_array($val)) {
|
|
|
415 |
foreach($val as $k => $v){
|
|
|
416 |
if($k==$arrKeys[0]){
|
|
|
417 |
foreach($v as $key_ => $val_){
|
|
|
418 |
if(($key_!="Rubrik")and($key_!="Region")){
|
|
|
419 |
|
|
|
420 |
// arrays werden komma-getrennt übergeben
|
|
|
421 |
/// wie z.B. bei Multiselect-Boxen
|
|
|
422 |
if(is_array($val_)){
|
|
|
423 |
if(strlen($val_)){
|
|
|
424 |
$val_ = implode(",",$val_);
|
|
|
425 |
}
|
|
|
426 |
}
|
|
|
427 |
if($val_=="on")$val_ = "true";
|
|
|
428 |
|
|
|
429 |
if(strlen($val_)>0){
|
|
|
430 |
$xw->writeAttribute($key_,trim(utf8_encode(strip_tags($val_))));
|
|
|
431 |
}
|
|
|
432 |
}
|
|
|
433 |
}
|
|
|
434 |
|
|
|
435 |
if(is_array($add_data)){
|
|
|
436 |
foreach($add_data as $addk => $addv){
|
|
|
437 |
$xw->writeAttribute($addk,utf8_encode(strip_tags($addv)));
|
|
|
438 |
}
|
|
|
439 |
}
|
|
|
440 |
}else{
|
|
|
441 |
$xw->startElement($k); // start Objekttyp
|
|
|
442 |
|
|
|
443 |
|
|
|
444 |
foreach($v as $key_ => $val_){
|
|
|
445 |
if(($key_!="Rubrik")and($key_!="Region")){
|
|
|
446 |
|
|
|
447 |
// arrays werden komma-getrennt übergeben
|
|
|
448 |
/// wie z.B. bei Multiselect-Boxen
|
|
|
449 |
if(is_array($val_)){
|
|
|
450 |
if(strlen($val_)){
|
|
|
451 |
$val_ = implode(",",$val_);
|
|
|
452 |
}
|
|
|
453 |
}
|
|
|
454 |
if($val_=="on")$val_ = "true";
|
|
|
455 |
if(strlen($val_)>0){
|
|
|
456 |
if(($key_=="Objektbeschreibung")or
|
|
|
457 |
($key_=="Lage")or
|
|
|
458 |
($key_=="Ausstattung")or
|
|
|
459 |
($key_=="SonstigeAngaben")){
|
|
|
460 |
$xw->text(trim(utf8_encode(strip_tags($val_))));
|
|
|
461 |
}else{
|
|
|
462 |
$xw->writeAttribute($key_,trim(utf8_encode(strip_tags($val_))));
|
|
|
463 |
}
|
|
|
464 |
|
|
|
465 |
}
|
|
|
466 |
}
|
|
|
467 |
}
|
|
|
468 |
$xw->endElement(); // end Objekttyp
|
|
|
469 |
}
|
|
|
470 |
|
|
|
471 |
}
|
|
|
472 |
// die bilder müssen noch angefügt werden
|
|
|
473 |
if(is_array($imgData)){
|
|
|
474 |
foreach($imgData as $key1 => $val1){
|
|
|
475 |
|
|
|
476 |
$xw->startElement('MultimediaAnhang');
|
|
|
477 |
foreach($imgData[$key1] as $k1 => $v1){
|
|
|
478 |
$xw->writeAttribute($k1,utf8_encode(strip_tags($v1)));
|
|
|
479 |
}
|
|
|
480 |
$xw->endElement(); // close node
|
|
|
481 |
}
|
|
|
482 |
|
|
|
483 |
}
|
|
|
484 |
|
|
|
485 |
}
|
|
|
486 |
}
|
|
|
487 |
|
|
|
488 |
if(is_array($orig_data)){
|
|
|
489 |
$arrKeys = array_keys($orig_data);
|
|
|
490 |
}
|
|
|
491 |
foreach($orig_data[$arrKeys[0]] as $key => $val) {
|
|
|
492 |
|
|
|
493 |
if(is_array($val)){
|
|
|
494 |
$build = 0;
|
|
|
495 |
if(($key == "Kaufpreise")or($key == "Mietpreise")or($key=="Provision")){
|
|
|
496 |
foreach($val as $k => $v){
|
|
|
497 |
if($k){
|
|
|
498 |
if($v){
|
|
|
499 |
$build=1;
|
|
|
500 |
}
|
|
|
501 |
}
|
|
|
502 |
}
|
|
|
503 |
if($build==1){
|
|
|
504 |
$xw->startElement($key);
|
|
|
505 |
foreach($val as $k => $v){
|
|
|
506 |
if($v){
|
|
|
507 |
if($v == "on")$v = "true";
|
|
|
508 |
$xw->writeAttribute($k,trim(utf8_encode(strip_tags($v))));
|
|
|
509 |
}
|
|
|
510 |
}
|
|
|
511 |
}
|
|
|
512 |
$xw->endElement(); // close node $arrKeys[0]
|
|
|
513 |
}
|
|
|
514 |
|
|
|
515 |
if($key == "BefeuerungsArt"){
|
|
|
516 |
$build = 0;
|
|
|
517 |
foreach($val as $k => $v){
|
|
|
518 |
if($k){
|
|
|
519 |
if($v){
|
|
|
520 |
$build=1;
|
|
|
521 |
}
|
|
|
522 |
}
|
|
|
523 |
}
|
|
|
524 |
if($build==1){
|
|
|
525 |
$xw->startElement($key);
|
|
|
526 |
foreach($val as $k => $v){
|
|
|
527 |
if($k){
|
|
|
528 |
if($v){
|
|
|
529 |
foreach($v as $k_ => $v_){
|
|
|
530 |
$xw->startElement($v_);
|
|
|
531 |
$xw->endElement();
|
|
|
532 |
|
|
|
533 |
}
|
|
|
534 |
}
|
|
|
535 |
}
|
|
|
536 |
}
|
|
|
537 |
}
|
|
|
538 |
$xw->endElement(); // close node $arrKeys[0]
|
|
|
539 |
}
|
|
|
540 |
if($key == "Energieausweis"){
|
|
|
541 |
$build = 0;
|
|
|
542 |
foreach($val as $k => $v){
|
|
|
543 |
if($k){
|
|
|
544 |
if($v){
|
|
|
545 |
$build=1;
|
|
|
546 |
}
|
|
|
547 |
}
|
|
|
548 |
}
|
|
|
549 |
if($build==1){
|
|
|
550 |
$xw->startElement($key);
|
|
|
551 |
foreach($val as $k => $v){
|
|
|
552 |
if($k){
|
|
|
553 |
if($v){
|
|
|
554 |
if($v == "on")$v = "true";
|
|
|
555 |
$xw->writeAttribute($k,trim(utf8_encode(strip_tags($v))));
|
|
|
556 |
}
|
|
|
557 |
}
|
|
|
558 |
}
|
|
|
559 |
}
|
|
|
560 |
$xw->endElement(); // close node $arrKeys[0]
|
|
|
561 |
}
|
|
|
562 |
}
|
|
|
563 |
}
|
|
|
564 |
|
|
|
565 |
|
|
|
566 |
$xw->endElement(); // close node $arrKeys[0]
|
|
|
567 |
|
|
|
568 |
$xw->endElement(); // close node <Anbieter>
|
|
|
569 |
|
|
|
570 |
// close Rootelement
|
|
|
571 |
$xw->endElement(); // close node <IS24ImmobilienTransfer>
|
|
|
572 |
|
|
|
573 |
// end document
|
|
|
574 |
$xw->endDocument();
|
|
|
575 |
|
|
|
576 |
//speichern in XML datei
|
|
|
577 |
// IhrDateiname_st_ZJH_imt.xml
|
|
|
578 |
$filepath = "/web/apache/content-management/xml/".$expName."/".$ini['web']['xmlFolder']."/";
|
|
|
579 |
$filename = $r['artikelId']."_".$ini['web']['xmlPrefix'].$expName."_st_ZJH_imt.xml";
|
|
|
580 |
|
|
|
581 |
if($fp = fopen($filepath.$filename,"w")) {
|
|
|
582 |
fputs($fp,$xw->outputMemory());
|
|
|
583 |
fclose($fp);
|
|
|
584 |
echo "<div style=\"padding-left:20px;\">Datei '<a href=\"/xml/".$expName."/".$ini['web']['xmlFolder']."/".$filename."\">".$filename."</a>' wurde erstellt.</div>\n";
|
|
|
585 |
build_log($r['artikelId'],"xml_export","/xml/".$expName."/".$ini['web']['xmlFolder']."/".$filename);
|
|
|
586 |
}
|
|
|
587 |
|
|
|
588 |
//echo $xw->outputMemory(); // Ausgabe des erzeugten XML
|
|
|
589 |
}//end while
|
|
|
590 |
} //end if
|
|
|
591 |
}
|
|
|
592 |
|
|
|
593 |
|
|
|
594 |
|
|
|
595 |
?>
|