Commit 9c76b19c authored by Thomas Löffler's avatar Thomas Löffler

Updates usage of new object structure

parent 3415e6e6
......@@ -52,7 +52,7 @@ class RealEstate
*/
public function getPathToFiles()
{
return str_replace(PATH_site , '', \SpoonerWeb\JustOpenimmo\Service\ConfigurationService::getDataFolder() . $this->getOpenimmoAnid() . '/');
return str_replace(PATH_site , '', \SpoonerWeb\JustOpenimmo\Service\ConfigurationService::getDataFolder() . $this->getOpenimmoObid() . '/');
}
/**
......@@ -113,6 +113,7 @@ class RealEstate
'type' => $this->beautifyString(key($objektart)),
'label' => $this->beautifyString($this->{'get' . ucfirst(key($objektart))}()),
'subType' => $this->beautifyString($this->{'get' . ucfirst(key($objektart))}(true)),
'partial' => ucfirst(key($objektart))
];
return $objectType;
......@@ -126,6 +127,30 @@ class RealEstate
return $this->beautifyString($this->getZustand(true));
}
/**
* @return float
*/
public function getSquareFootage()
{
$type = $this->getObjectType()['type'];
switch (strtolower($type)) {
case 'grundstueck':
$squareFootage = $this->getGrundstuecksflaeche();
break;
case 'buero praxen':
$squareFootage = $this->getBueroflaeche();
break;
case 'wohnung':
case 'haus':
$squareFootage = $this->getWohnflaeche();
break;
default:
$squareFootage = $this->getGesamtflaeche();
}
return $squareFootage;
}
/**
* @return void
*/
......@@ -144,44 +169,47 @@ class RealEstate
$returnValue = '';
if (strpos($method, 'get') === 0) {
$fieldToGet = GeneralUtility::camelCaseToLowerCaseUnderscored(substr($method, 3));
$fieldType = $this->xsdService->getTypeOfField($fieldToGet);
switch ($fieldType) {
case 'string':
$value = $this->xml->xpath('//' . $fieldToGet)[0];
$returnValue = (string)$value;
break;
case 'decimal':
$value = $this->xml->xpath('//' . $fieldToGet)[0];
$returnValue = (float)$value;
break;
case 'int':
$value = $this->xml->xpath('//' . $fieldToGet)[0];
$returnValue = (int)$value;
break;
case 'date':
$value = $this->xml->xpath('//' . $fieldToGet)[0];
$returnValue = new \DateTime($value);
break;
case 'attributes':
$value = $this->xml->xpath('//' . $fieldToGet)[0];
if ($arguments[1] === true) {
try {
$fieldType = $this->xsdService->getTypeOfField($fieldToGet);
switch ($fieldType) {
case 'string':
$value = $this->xml->xpath('//' . $fieldToGet)[0];
$returnValue = (string)$value;
} else {
$value = (array)$value;
foreach ($value['@attributes'] as $key => $val) {
if ($val) {
$returnValue = $key;
if ($arguments[0] === true) {
$returnValue = $val;
break;
case 'decimal':
$value = $this->xml->xpath('//' . $fieldToGet)[0];
$returnValue = (float)$value;
break;
case 'int':
$value = $this->xml->xpath('//' . $fieldToGet)[0];
$returnValue = (int)$value;
break;
case 'date':
$value = $this->xml->xpath('//' . $fieldToGet)[0];
$returnValue = new \DateTime($value);
break;
case 'attributes':
$value = $this->xml->xpath('//' . $fieldToGet)[0];
if ($arguments[1] === true) {
$returnValue = (string)$value;
} else {
$value = (array)$value;
foreach ($value['@attributes'] as $key => $val) {
if ($val) {
$returnValue = $key;
if ($arguments[0] === true) {
$returnValue = $val;
}
break;
}
break;
}
}
}
break;
default:
$value = $this->xml->xpath('//' . $fieldToGet);
$returnValue = $value;
break;
default:
$value = $this->xml->xpath('//' . $fieldToGet);
$returnValue = $value;
}
} catch (\Exception $exception) {
}
}
......
......@@ -49,8 +49,9 @@ class OpenImmoXsdService
} else {
$type = 'attributes';
}
} elseif ($elementType instanceof \GoetasWebservices\XML\XSDReader\Schema\Type\ComplexTypeSimpleContent) {
$type = $elementType->getExtension()->getBase()->getName();
}
// \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($type);
return $type;
}
......
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<li class="property-teaser__area">
<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"></use>
</svg>
{re.wohnflaeche -> f:format.number(decimals:'2',decimalSeparator:',',thousandsSeparator:'.')} <em>m&sup2;</em>
</li>
<li class="property-teaser__rooms">
<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#duplex"></use>
</svg>
{re.anzahlZimmer} <em>Zimmer</em>
</li>
</html>
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<li class="property-teaser__area">
<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"></use>
</svg>
{re.bueroflaeche -> f:format.number(decimals:'2',decimalSeparator:',',thousandsSeparator:'.')} <em>m&sup2;</em>
</li>
<li class="property-teaser__rooms">
<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#duplex"></use>
</svg>
{re.anzahlZimmer} <em>Zimmer</em>
</li>
</html>
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<li class="property-teaser__area">
<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"></use>
</svg>
{re.wohnflaeche -> f:format.number(decimals:'2',decimalSeparator:',',thousandsSeparator:'.')} <em>m&sup2;</em>
</li>
<li class="property-teaser__rooms">
<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#duplex"></use>
</svg>
{re.anzahlZimmer} <em>Zimmer</em>
</li>
</html>
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<li class="property-teaser__area">
<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"></use>
</svg>
{re.wohnflaeche -> f:format.number(decimals:'2',decimalSeparator:',',thousandsSeparator:'.')} <em>m&sup2;</em>
</li>
<li class="property-teaser__rooms">
<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#duplex"></use>
</svg>
{re.anzahlZimmer} <em>Zimmer</em>
</li>
</html>
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<f:if condition="{re.anzahlZimmer}">
<tr>
<th scope="row">Zimmeranzahl</th>
<td>{re.anzahlZimmer}</td>
</tr>
</f:if>
<tr>
<th scope="row">Nebenkosten</th>
<td>{re.nebenkosten -> f:format.number(decimals:'2',decimalSeparator:',',thousandsSeparator:'.')} €</td>
</tr>
<tr>
<th scope="row">Nebenkosten inkl. Heizung</th>
<td>
<f:if condition="{re.heizkostenEnthalten}">
<f:then>ja</f:then>
<f:else>nein</f:else>
</f:if>
</td>
</tr>
<tr>
<th scope="row">Frei ab</th>
<td>{re.verfuegbarAb}</td>
</tr>
<f:if condition="{re.anzahlEtagen}">
<tr>
<th scope="row">Anzahl Etagen</th>
<td>{re.anzahlEtagen}</td>
</tr>
</f:if>
<tr>
<th scope="row">Heizungsart und Befeuerung</th>
<td>{re.befeuerung}</td>
</tr>
</html>
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<f:if condition="{re.anzahlZimmer}">
<tr>
<th scope="row">Zimmeranzahl</th>
<td>{re.anzahlZimmer}</td>
</tr>
</f:if>
<tr>
<th scope="row">Nebenkosten</th>
<td>{re.nebenkosten -> f:format.number(decimals:'2',decimalSeparator:',',thousandsSeparator:'.')} €</td>
</tr>
<tr>
<th scope="row">Nebenkosten inkl. Heizung</th>
<td>
<f:if condition="{re.heizkostenEnthalten}">
<f:then>ja</f:then>
<f:else>nein</f:else>
</f:if>
</td>
</tr>
<tr>
<th scope="row">Frei ab</th>
<td>{re.verfuegbarAb}</td>
</tr>
<f:if condition="{re.anzahlEtagen}">
<tr>
<th scope="row">Anzahl Etagen</th>
<td>{re.anzahlEtagen}</td>
</tr>
</f:if>
<tr>
<th scope="row">Heizungsart und Befeuerung</th>
<td>{re.befeuerung}</td>
</tr>
</html>
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
</html>
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<f:if condition="{re.anzahlZimmer}">
<tr>
<th scope="row">Zimmeranzahl</th>
<td>{re.anzahlZimmer}</td>
</tr>
</f:if>
<tr>
<th scope="row">Nebenkosten</th>
<td>{re.nebenkosten -> f:format.number(decimals:'2',decimalSeparator:',',thousandsSeparator:'.')} €</td>
</tr>
<tr>
<th scope="row">Nebenkosten inkl. Heizung</th>
<td>
<f:if condition="{re.heizkostenEnthalten}">
<f:then>ja</f:then>
<f:else>nein</f:else>
</f:if>
</td>
</tr>
<tr>
<th scope="row">Frei ab</th>
<td>{re.verfuegbarAb}</td>
</tr>
<f:if condition="{re.anzahlEtagen}">
<tr>
<th scope="row">Anzahl Etagen</th>
<td>{re.anzahlEtagen}</td>
</tr>
</f:if>
<tr>
<th scope="row">Heizungsart und Befeuerung</th>
<td>{re.befeuerung}</td>
</tr>
</html>
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<f:if condition="{re.anzahlZimmer}">
<tr>
<th scope="row">Zimmeranzahl</th>
<td>{re.anzahlZimmer}</td>
</tr>
</f:if>
<tr>
<th scope="row">Nebenkosten</th>
<td>{re.nebenkosten -> f:format.number(decimals:'2',decimalSeparator:',',thousandsSeparator:'.')} €</td>
</tr>
<tr>
<th scope="row">Nebenkosten inkl. Heizung</th>
<td>
<f:if condition="{re.heizkostenEnthalten}">
<f:then>ja</f:then>
<f:else>nein</f:else>
</f:if>
</td>
</tr>
<tr>
<th scope="row">Frei ab</th>
<td>{re.verfuegbarAb}</td>
</tr>
<f:if condition="{re.anzahlEtagen}">
<tr>
<th scope="row">Anzahl Etagen</th>
<td>{re.anzahlEtagen}</td>
</tr>
</f:if>
<tr>
<th scope="row">Heizungsart und Befeuerung</th>
<td>{re.befeuerung}</td>
</tr>
</html>
......@@ -4,7 +4,7 @@
<f:for each="{realEstates}" as="re">
<li class="property-list__item">
<div class="property-teaser">
<f:link.action class="property-teaser__link" pageUid="{settings.detailPage}" action="show" arguments="{id: re.openimmoAnid}">
<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}">
......@@ -23,7 +23,20 @@
{re.plz} {re.ort}
</p>
<ul class="property-teaser__detail">
<f:render partial="List/PropertyTeaserDetail/{re.nutzungsart}" arguments="{re: re}" />
<li class="property-teaser__area">
<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"></use>
</svg>
{re.squareFootage -> f:format.number(decimals:'2',decimalSeparator:',',thousandsSeparator:'.')} <em>m&sup2;</em>
</li>
<f:if condition="{re.anzahlZimmer}">
<li class="property-teaser__rooms">
<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#duplex"></use>
</svg>
{re.anzahlZimmer} <em>Zimmer</em>
</li>
</f:if>
</ul>
</div>
</f:link.action>
......
......@@ -42,7 +42,20 @@
<li>
<f:render partial="General/PropertyTeaserPrice/{re.vermarktungsart}" arguments="{re: re}" />
</li>
<f:render partial="Show/PropertyTeaserDetail/{re.nutzungsart}" arguments="{re: re}" />
<li class="property-teaser__area">
<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"></use>
</svg>
{re.squareFootage -> f:format.number(decimals:'2',decimalSeparator:',',thousandsSeparator:'.')} <em>m&sup2;</em>
</li>
<f:if condition="{re.anzahlZimmer}">
<li class="property-teaser__rooms">
<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#duplex"></use>
</svg>
{re.anzahlZimmer} <em>Zimmer</em>
</li>
</f:if>
</ul>
<h4>Details</h4>
......@@ -50,48 +63,31 @@
<table class="property-detail__table">
<caption>Überblick Objekt Nr. {re.objektnrExtern}</caption>
<tbody>
<tr>
<th scope="row">Zimmeranzahl</th>
<td>{re.anzahlZimmer}</td>
</tr>
<tr>
<th scope="row">Nebenkosten</th>
<td>{re.nebenkosten -> f:format.number(decimals:'2',decimalSeparator:',',thousandsSeparator:'.')} €</td>
</tr>
<tr>
<th scope="row">Nebenkosten inkl. Heizung</th>
<td><f:if condition="{re.heizkostenEnthalten}"><f:then>ja</f:then><f:else>nein</f:else></f:if></td>
</tr>
<tr>
<th scope="row">Kaution</th>
<td>{re.kaution -> f:format.number(decimals:'2',decimalSeparator:',',thousandsSeparator:'.')} €</td>
</tr>
<f:render partial="Show/PropertyTableRows/{re.objectType.partial}" arguments="{re: re}" />
<f:if condition="{re.kaution}">
<tr>
<th scope="row">Kaution</th>
<td>{re.kaution -> f:format.number(decimals:'2',decimalSeparator:',',thousandsSeparator:'.')} €</td>
</tr>
</f:if>
<f:if condition="{re.courtage}">
<tr>
<th scope="row">Provision / Courtage</th>
<td>{re.courtage}</td>
</tr>
</f:if>
<tr>
<th scope="row">Frei ab</th>
<td>{re.verfuegbarAb}</td>
</tr>
<tr>
<th scope="row">{re.objectType.label}</th>
<td>{re.objectType.subType}</td>
</tr>
<tr>
<th scope="row">Anzahl Etagen</th>
<td>{re.anzahlEtagen}</td>
</tr>
<tr>
<th scope="row">Heizungsart und Befeuerung</th>
<td>{re.befeuerung}</td>
</tr>
<tr>
<th scope="row">Zustand</th>
<td>{re.status}</td>
</tr>
<f:if condition="{re.objectType}">
<tr>
<th scope="row">Typ</th>
<td>{re.objectType.type}</td>
</tr>
</f:if>
<f:if condition="{re.status}">
<tr>
<th scope="row">Zustand</th>
<td>{re.status}</td>
</tr>
</f:if>
</tbody>
</table>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment