/** * Generate the module */ protected function compile() { //Categories selected in List-Module-Options $arrCategoriesToShow = deserialize($this->gloImmoConnectorTypeSelector); $filter = null; if (\Input::post('FORM_SUBMIT') == $this->_searchFormId) { $filter = array('objectType' => htmlspecialchars(\Input::post('objectType')), 'zipcode' => htmlspecialchars(\Input::post('zipcode')), 'city' => htmlspecialchars(\Input::post('city')), 'keyword' => htmlspecialchars(\Input::post('keyword'))); } //Get Expose Page if ($this->jumpTo && ($objTarget = $this->objModel->getRelated('jumpTo')) !== null) { $this->_objTarget = $objTarget; } $objImmoConnector = new ImmoConnector('is24', \Config::get('gloImmoConnectorKey'), \Config::get('gloImmoConnectorSecret')); //User auf null setzen bzw. Username auslesen $objUser = \IcAuthModel::findByPk($this->gloImmoConnectorUser); if (is_null($objUser)) { throw new \Exception("Missing or invalid User selected for API-Connection", 1); } $objRes = $objImmoConnector->getAllUserObjects($objUser, $filter); $arrRes = $this->orderObjects(simplexml_import_dom($objRes)); // Filtern auf die Kategorien der der Moduleinstellungen if (count($arrCategoriesToShow) > 0) { $arrRes = array_intersect_key($arrRes, array_flip($arrCategoriesToShow)); } unset($objXml); $arrTypes = array_keys($arrRes); //Rendern der Objekt-Daten $arrRendered = array(); foreach ($arrRes as $strType => $objList) { $arrRendered[$strType] = $this->renderObjectTypeGroup($strType, $objList); } unset($arrRes); $this->Template->realEstateObjects = $arrRendered; }
public function registerApplication() { $sCertifyURL = \Environment::get('uri'); // Komplette URL inkl. Parameter auf der das Script eingebunden wird $objTemplate = new \BackendTemplate('be_registrationForm'); $objImmoConnector = new ImmoConnector('is24', \Config::get('gloImmoConnectorKey'), \Config::get('gloImmoConnectorSecret')); $immocaster = $objImmoConnector->getImmocaster(); if (\Input::get('main_registration') != null || \Input::get('state') != null) { if (\Input::post('user') != null) { $sUser = \Input::post('user'); } if (\Input::get('user') != null) { $sUser = \Input::get('user'); } $aParameter = array('callback_url' => $sCertifyURL . '?user='******'verifyApplication' => true); // Benutzer neu zertifizieren if ($immocaster->getAccess($aParameter)) { $objTemplate->certificationSuccessful = 'Zertifizierung war erfolgreich.'; } else { // Test ob Benutzer schon zertifiziert ist if ($immocaster->getApplicationTokenAndSecret($sUser)) { $objTemplate->alreadyCertified = 'Dieser Benutzer ist bereits zertifiziert.'; } } } $objTemplate->sCertifyURL = $sCertifyURL; return $objTemplate->parse(); }
/** * Generate the module */ protected function compile() { global $objPage; //Prüfen ob eine numerische ExposeId angegeben wurde $exposeId = \Input::get("object"); if ($exposeId == '' || !preg_match('/^\\d+$/', $exposeId)) { $this->redirectToNotFound($objPage); } //Get Object request Page if ($this->jumpTo && ($objTarget = $this->objModel->getRelated('jumpTo')) !== null) { $this->_objTarget = $objTarget; } $objImmoConnector = new ImmoConnector('is24', \Config::get('gloImmoConnectorKey'), \Config::get('gloImmoConnectorSecret')); //User auf null setzen bzw. Username auslesen $objUser = \IcAuthModel::findByPk($this->gloImmoConnectorUser); if (is_null($objUser)) { throw new \Exception("Missing or invalid User selected for API-Connection", 1); } //Expose laden $objExpose = $objImmoConnector->getExpose($exposeId, $objUser); $objAttachment = $objImmoConnector->getAttachment($exposeId); $xmlExpose = simplexml_import_dom($objExpose); //Typ der Immobilie bestimmen $strType = $this->getObjectType($objExpose); $strId = $this->getObjectId($objExpose); //Template je nach Typ setzen $this->Template = new \FrontendTemplate($this->getTemplateName($strType)); //XML-Daten für Objekttyp aufbereiten //$arrData = $this->getDataForType($strType, $objExpose); //Objektdaten dem Template zuweisen $this->Template->gloImmoConnectorRemoveTitleText = $this->gloImmoConnectorRemoveTitleText; $this->Template->expose = $xmlExpose; $this->Template->attachment = $this->getAttachments($objAttachment); $this->Template->objectRequest = array('action' => $this->generateFrontendUrl($this->_objTarget->row()), 'exposeId' => $strId, 'exposeUrl' => \Environment::get('uri'), 'exposeTitle' => htmlspecialchars((string) $xmlExpose->title)); }
/** * Generate the module */ protected function compile() { global $objPage; $objImmoConnector = new ImmoConnector('is24', \Config::get('gloImmoConnectorKey'), \Config::get('gloImmoConnectorSecret')); //User auf null setzen bzw. Username auslesen $objUser = \IcAuthModel::findByPk($this->gloImmoConnectorUser); if (is_null($objUser)) { throw new \Exception("Missing or invalid User selected for API-Connection", 1); } //Get Expose Page if ($this->gloImmoConnectorjumpTo && ($objTarget = $this->objModel->getRelated('gloImmoConnectorjumpTo')) !== null) { $this->_objTarget = $objTarget; } $objRes = $objImmoConnector->getAllUserObjects($objUser); $xpath = new \DOMXPath($objRes); $objList = $xpath->query("//realEstateElement"); if ($objList->length > 0) { $index = rand(0, $objList->length - 1); //Zufalls-Item aus Liste laden $objRand = simplexml_import_dom($objList->item($index)); $this->Template->title = $this->gloImmoConnectorRemoveTitleText != '' ? str_replace($this->gloImmoConnectorRemoveTitleText, '', $objRand->title) : (string) $objRand->title; if ($objRand->titlePicture) { foreach ($objRand->titlePicture->urls->url as $url) { if ($url['scale'] == 'SCALE_AND_CROP') { $this->Template->picture = array('url' => str_replace("%WIDTH%x%HEIGHT%", self::PICTURE_SIZE_FULL, $url['href']), 'title' => (string) $objRand->titlePicture->title); } } } $this->Template->zipcode = (string) $objRand->address->postcode; $this->Template->city = (string) $objRand->address->city; $this->Template->exposeHref = $this->generateFrontendUrl($this->_objTarget->row(), '/object/' . $objRand['id']); $this->Template->objectType = $GLOBALS['TL_LANG']['immoConnector'][$this->getObjectType($objRand)]; $this->Template->priceValue = (double) $objRand->price->value; $this->Template->priceCurrency = (string) $objRand->price->currency; switch ($this->getObjectType($objRand)) { case "houseBuy": case "apartmentBuy": case "investment": case "livingBuySite": $this->Template->priceTitle = $GLOBALS['TL_LANG']['immoConnector']['buyPrice']; break; case "houseRent": case "apartmentRent": $this->Template->priceTitle = $GLOBALS['TL_LANG']['immoConnector']['rentPrice']; break; } } else { $this->Template->noObjectFound = $GLOBALS['TL_LANG']['immoConnector']['noObjectFound']; } }
protected function getObjectTypes() { $arrTypes = array('' => $GLOBALS['TL_LANG']['immoConnector']['all']); foreach (ImmoConnector::getRealEstateTypes() as $strType) { $arrTypes[$strType] = isset($GLOBALS['TL_LANG']['immoConnector'][$strType]) ? $GLOBALS['TL_LANG']['immoConnector'][$strType] : $strType; } return $arrTypes; }
public function getObjectTypes() { $this->loadLanguageFile('default'); $arrTypes = ImmoConnector::getRealestateTypes(); $arrOptions = array(); foreach ($arrTypes as $strType) { $arrOptions[$strType] = $GLOBALS['TL_LANG']['immoConnector'][$strType] ?: $strType; } return $arrOptions; }