...
 
Commits (5)
......@@ -220,13 +220,15 @@ class RealEstate
$returnValue = (string)$value;
} else {
$value = (array)$value;
foreach ($value['@attributes'] as $key => $val) {
if ($val) {
$returnValue = $key;
if ($arguments[0] === true) {
$returnValue = $val;
if ($value['@attributes']) {
foreach ($value['@attributes'] as $key => $val) {
if ($val) {
$returnValue = $key;
if ($arguments[0] === true) {
$returnValue = $val;
}
break;
}
break;
}
}
}
......
......@@ -31,6 +31,7 @@ class OpenImmoImportService
foreach ($zipFiles as $zipFile) {
try {
$this->importFile($zipFile);
$this->clearCache();
} catch (\RuntimeException $e) {
$this->output('Error: ' . $e);
}
......@@ -59,11 +60,18 @@ class OpenImmoImportService
$zip = new \ZipArchive();
$res = $zip->open($zipFile);
if ($res === true) {
$xmlFile = pathinfo($zipFile, PATHINFO_FILENAME) . '.xml';
$xmlFile = $this->findXmlFileNameInZip($zip);
$xml = @simplexml_load_string($zip->getFromName($xmlFile));
$objects = $xml->xpath('//immobilie');
foreach ($objects as $key => $object) {
$action = (string)$object->xpath('//aktion/@aktionart')[$key];
$objectId = (string)$object->xpath('//openimmo_obid')[$key];
if (file_exists($objectId)) {
$this->rrmdir($objectId);
}
if ($action === 'DELETE') {
break;
}
if ($objectId) {
// create folder for object
if (!@mkdir($objectId) && !is_dir($objectId)) {
......@@ -74,8 +82,12 @@ class OpenImmoImportService
// extract depending files into dir
$attachments = (array)$object->xpath('//anhaenge')[$key];
$files = [];
foreach ($attachments['anhang'] as $attachment) {
$files[] = (string)$attachment->daten->pfad;
if (is_array($attachments['anhang'])) {
foreach ($attachments['anhang'] as $attachment) {
$files[] = (string)$attachment->daten->pfad;
}
} elseif ($attachments['anhang'] instanceof \SimpleXMLElement) {
$files[] = (string)$attachments['anhang']->daten->pfad;
}
if ($files) {
$zip->extractTo($objectId, $files);
......@@ -93,6 +105,52 @@ class OpenImmoImportService
}
}
/**
* @param \ZipArchive $zip
* @return string
*/
protected function findXmlFileNameInZip(\ZipArchive $zip)
{
for ($i=0; $i < $zip->numFiles; $i++) {
$statName = $zip->statIndex($i);
if ($statName !== false && pathinfo($statName['name'], PATHINFO_EXTENSION) === 'xml') {
return $statName['name'];
}
}
return '';
}
/**
* @param string $src
* @return void
*/
protected function rrmdir(string $src)
{
$dir = opendir($src);
while (false !== ($file = readdir($dir))) {
if (($file !== '.') && ($file !== '..')) {
$full = $src . '/' . $file;
if (is_dir($full)) {
$this->rrmdir($full);
} else {
unlink($full);
}
}
}
closedir($dir);
rmdir($src);
}
/**
* @return void
*/
protected function clearCache()
{
$cacheManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Cache\CacheManager::class);
$cacheManager->flushCaches();
}
/**
* @param $message
* @return void
......
......@@ -15,6 +15,9 @@
<trans-unit id="epart_VERBRAUCH" xml:space="preserve">
<source>Energieverbrauchkennwert</source>
</trans-unit>
<trans-unit id="befeuerung_LUFTWP" xml:space="preserve">
<source>Luftwärmepumpe</source>
</trans-unit>
</body>
</file>
</xliff>
......@@ -2,7 +2,9 @@
<th scope="row">Endenergiebedarf</th>
<td>{re.endenergiebedarf -> f:format.number(decimals:'2',decimalSeparator:',',thousandsSeparator:'.')} kWh / m<sup>2</sup>a</td>
</tr>
<tr>
<th scope="row">Effizienzklasse</th>
<td>{re.energyPassClass}</td>
</tr>
<f:if condition="{re.energyPassClass}">
<tr>
<th scope="row">Effizienzklasse</th>
<td>{re.energyPassClass}</td>
</tr>
</f:if>
<tr>
<th scope="row">Endenergiebedarf</th>
<td>{re.energieverbrauchkennwert -> f:format.number(decimals:'2',decimalSeparator:',',thousandsSeparator:'.')} kWh / m<sup>2</sup>a</td>
</tr>
<f:if condition="{re.energyPassClass}">
<tr>
<th scope="row">Effizienzklasse</th>
<td>{re.energyPassClass}</td>
</tr>
</f:if>
<f:if condition="{re.mitwarmwasser}">
<tr>
<th scope="row">Warmwasser</th>
<td>inklusive</td>
</tr>
</f:if>
......@@ -30,6 +30,8 @@
</f:if>
<tr>
<th scope="row">Heizungsart und Befeuerung</th>
<td>{re.befeuerung}</td>
<td>
<f:translate key="befeuerung_{re.befeuerung}">{re.befeuerung -> f:format.case(mode:'lower') -> f:format.case(mode:'capital')}</f:translate>
</td>
</tr>
</html>
......@@ -30,6 +30,8 @@
</f:if>
<tr>
<th scope="row">Heizungsart und Befeuerung</th>
<td>{re.befeuerung}</td>
<td>
<f:translate key="befeuerung_{re.befeuerung}">{re.befeuerung -> f:format.case(mode:'lower') -> f:format.case(mode:'capital')}</f:translate>
</td>
</tr>
</html>
......@@ -30,6 +30,8 @@
</f:if>
<tr>
<th scope="row">Heizungsart und Befeuerung</th>
<td>{re.befeuerung}</td>
<td>
<f:translate key="befeuerung_{re.befeuerung}">{re.befeuerung -> f:format.case(mode:'lower') -> f:format.case(mode:'capital')}</f:translate>
</td>
</tr>
</html>
......@@ -30,6 +30,6 @@
</f:if>
<tr>
<th scope="row">Heizungsart und Befeuerung</th>
<td>{re.befeuerung}</td>
<td><f:translate key="befeuerung_{re.befeuerung}">{re.befeuerung -> f:format.case(mode:'lower') -> f:format.case(mode:'capital')}</f:translate></td>
</tr>
</html>
......@@ -7,7 +7,7 @@
<f:link.action class="property-teaser__link" pageUid="{settings.detailPage}" action="show" arguments="{id: re.openimmoObid}">
<div class="property-teaser__media-wrap">
<div class="property-teaser__media">
<img src="{re.pathToFiles}{re.mainImage.daten.pfad}" alt="{re.objekttitel}">
<f:image src="/{re.pathToFiles}{re.mainImage.daten.pfad}" width="400" alt="{re.objekttitel}" />
<ul class="property-teaser__detail">
<f:render partial="General/PropertyTeaserPrice/{re.vermarktungsart}" arguments="{re: re}" />
</ul>
......@@ -37,6 +37,29 @@
{re.anzahlZimmer} <em>Zimmer</em>
</li>
</f:if>
<f:if condition="{re.anzahlBadezimmer} > 1">
<li>
<svg role="img" class="icon icon-house" width="24" height="24" focusable="false">
<use xlink:href="/typo3conf/ext/dhimmo_package/Resources/Public/Images/all.svg#bathtub"></use>
</svg>
{re.anzahlBadezimmer} <em>Bäder</em>
</li>
</f:if>
<f:if condition="{re.stellplatzart}">
<li>
<svg role="img" class="icon icon-house" width="24" height="24" focusable="false">
<use xlink:href="/typo3conf/ext/dhimmo_package/Resources/Public/Images/all.svg#house-2"></use>
</svg>
<em>{re.stellplatzart -> f:format.case(mode:'lower') -> f:format.case(mode:'capital')}</em>
</li>
</f:if>
<f:if condition="{re.epart}">
<li title="Energiepass vorhanden">
<svg role="img" class="icon icon-house" width="24" height="24" focusable="false">
<use xlink:href="/typo3conf/ext/dhimmo_package/Resources/Public/Images/all.svg#house-5"></use>
</svg>
</li>
</f:if>
</ul>
</div>
</f:link.action>
......
......@@ -16,7 +16,7 @@
<figure class="swiper-wrapper">
<f:for each="{re.allImagesForSlider}" as="image">
<div class="swiper-slide">
<img class="swiper-lazy" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAQAAAAe/WZNAAAADklEQVR42mNkgAJGDAYAAFEABCaLYqoAAAAASUVORK5CYII=" data-src="{re.pathToFiles}{image.daten.pfad}" alt="{image.anhangtitel}" title="{image.anhangtitel}" width="800" height="533">
<img class="swiper-lazy" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAQAAAAe/WZNAAAADklEQVR42mNkgAJGDAYAAFEABCaLYqoAAAAASUVORK5CYII=" data-src="/{re.pathToFiles}{image.daten.pfad}" alt="{image.anhangtitel}" title="{image.anhangtitel}" width="800" height="533">
<div class="swiper-lazy-preloader"></div>
</div>
</f:for>
......
......@@ -19,7 +19,7 @@ $EM_CONF[$_EXTKEY] = [
'version' => '0.1.0',
'state' => 'beta',
'uploadfolder' => 1,
'createDirs' => 'uploads/tx_justimmoimport/',
'createDirs' => 'uploads/tx_justopenimmo/',
'clearcacheonload' => 1,
'author' => 'Thomas Löffler',
'author_email' => 'loeffler@spooner-web.de',
......